com.pulumi.gcp.cloudtasks.kotlin.Queue.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.cloudtasks.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.cloudtasks.kotlin.outputs.QueueAppEngineRoutingOverride
import com.pulumi.gcp.cloudtasks.kotlin.outputs.QueueRateLimits
import com.pulumi.gcp.cloudtasks.kotlin.outputs.QueueRetryConfig
import com.pulumi.gcp.cloudtasks.kotlin.outputs.QueueStackdriverLoggingConfig
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.gcp.cloudtasks.kotlin.outputs.QueueAppEngineRoutingOverride.Companion.toKotlin as queueAppEngineRoutingOverrideToKotlin
import com.pulumi.gcp.cloudtasks.kotlin.outputs.QueueRateLimits.Companion.toKotlin as queueRateLimitsToKotlin
import com.pulumi.gcp.cloudtasks.kotlin.outputs.QueueRetryConfig.Companion.toKotlin as queueRetryConfigToKotlin
import com.pulumi.gcp.cloudtasks.kotlin.outputs.QueueStackdriverLoggingConfig.Companion.toKotlin as queueStackdriverLoggingConfigToKotlin
/**
* 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.gcp.cloudtasks.Queue(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Queue(builtJavaResource)
}
}
/**
* A named resource to which messages are sent by publishers.
* ## Example Usage
* ### Queue Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.cloudtasks.Queue("default", {
* name: "cloud-tasks-queue-test",
* location: "us-central1",
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.cloudtasks.Queue("default",
* name="cloud-tasks-queue-test",
* location="us-central1")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.CloudTasks.Queue("default", new()
* {
* Name = "cloud-tasks-queue-test",
* Location = "us-central1",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudtasks"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := cloudtasks.NewQueue(ctx, "default", &cloudtasks.QueueArgs{
* Name: pulumi.String("cloud-tasks-queue-test"),
* Location: pulumi.String("us-central1"),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.cloudtasks.Queue;
* import com.pulumi.gcp.cloudtasks.QueueArgs;
* 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) {
* var default_ = new Queue("default", QueueArgs.builder()
* .name("cloud-tasks-queue-test")
* .location("us-central1")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudtasks:Queue
* properties:
* name: cloud-tasks-queue-test
* location: us-central1
* ```
*
* ### Cloud Tasks Queue Advanced
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const advancedConfiguration = new gcp.cloudtasks.Queue("advanced_configuration", {
* name: "instance-name",
* location: "us-central1",
* appEngineRoutingOverride: {
* service: "worker",
* version: "1.0",
* instance: "test",
* },
* rateLimits: {
* maxConcurrentDispatches: 3,
* maxDispatchesPerSecond: 2,
* },
* retryConfig: {
* maxAttempts: 5,
* maxRetryDuration: "4s",
* maxBackoff: "3s",
* minBackoff: "2s",
* maxDoublings: 1,
* },
* stackdriverLoggingConfig: {
* samplingRatio: 0.9,
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* advanced_configuration = gcp.cloudtasks.Queue("advanced_configuration",
* name="instance-name",
* location="us-central1",
* app_engine_routing_override=gcp.cloudtasks.QueueAppEngineRoutingOverrideArgs(
* service="worker",
* version="1.0",
* instance="test",
* ),
* rate_limits=gcp.cloudtasks.QueueRateLimitsArgs(
* max_concurrent_dispatches=3,
* max_dispatches_per_second=2,
* ),
* retry_config=gcp.cloudtasks.QueueRetryConfigArgs(
* max_attempts=5,
* max_retry_duration="4s",
* max_backoff="3s",
* min_backoff="2s",
* max_doublings=1,
* ),
* stackdriver_logging_config=gcp.cloudtasks.QueueStackdriverLoggingConfigArgs(
* sampling_ratio=0.9,
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var advancedConfiguration = new Gcp.CloudTasks.Queue("advanced_configuration", new()
* {
* Name = "instance-name",
* Location = "us-central1",
* AppEngineRoutingOverride = new Gcp.CloudTasks.Inputs.QueueAppEngineRoutingOverrideArgs
* {
* Service = "worker",
* Version = "1.0",
* Instance = "test",
* },
* RateLimits = new Gcp.CloudTasks.Inputs.QueueRateLimitsArgs
* {
* MaxConcurrentDispatches = 3,
* MaxDispatchesPerSecond = 2,
* },
* RetryConfig = new Gcp.CloudTasks.Inputs.QueueRetryConfigArgs
* {
* MaxAttempts = 5,
* MaxRetryDuration = "4s",
* MaxBackoff = "3s",
* MinBackoff = "2s",
* MaxDoublings = 1,
* },
* StackdriverLoggingConfig = new Gcp.CloudTasks.Inputs.QueueStackdriverLoggingConfigArgs
* {
* SamplingRatio = 0.9,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudtasks"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := cloudtasks.NewQueue(ctx, "advanced_configuration", &cloudtasks.QueueArgs{
* Name: pulumi.String("instance-name"),
* Location: pulumi.String("us-central1"),
* AppEngineRoutingOverride: &cloudtasks.QueueAppEngineRoutingOverrideArgs{
* Service: pulumi.String("worker"),
* Version: pulumi.String("1.0"),
* Instance: pulumi.String("test"),
* },
* RateLimits: &cloudtasks.QueueRateLimitsArgs{
* MaxConcurrentDispatches: pulumi.Int(3),
* MaxDispatchesPerSecond: pulumi.Float64(2),
* },
* RetryConfig: &cloudtasks.QueueRetryConfigArgs{
* MaxAttempts: pulumi.Int(5),
* MaxRetryDuration: pulumi.String("4s"),
* MaxBackoff: pulumi.String("3s"),
* MinBackoff: pulumi.String("2s"),
* MaxDoublings: pulumi.Int(1),
* },
* StackdriverLoggingConfig: &cloudtasks.QueueStackdriverLoggingConfigArgs{
* SamplingRatio: pulumi.Float64(0.9),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.cloudtasks.Queue;
* import com.pulumi.gcp.cloudtasks.QueueArgs;
* import com.pulumi.gcp.cloudtasks.inputs.QueueAppEngineRoutingOverrideArgs;
* import com.pulumi.gcp.cloudtasks.inputs.QueueRateLimitsArgs;
* import com.pulumi.gcp.cloudtasks.inputs.QueueRetryConfigArgs;
* import com.pulumi.gcp.cloudtasks.inputs.QueueStackdriverLoggingConfigArgs;
* 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) {
* var advancedConfiguration = new Queue("advancedConfiguration", QueueArgs.builder()
* .name("instance-name")
* .location("us-central1")
* .appEngineRoutingOverride(QueueAppEngineRoutingOverrideArgs.builder()
* .service("worker")
* .version("1.0")
* .instance("test")
* .build())
* .rateLimits(QueueRateLimitsArgs.builder()
* .maxConcurrentDispatches(3)
* .maxDispatchesPerSecond(2)
* .build())
* .retryConfig(QueueRetryConfigArgs.builder()
* .maxAttempts(5)
* .maxRetryDuration("4s")
* .maxBackoff("3s")
* .minBackoff("2s")
* .maxDoublings(1)
* .build())
* .stackdriverLoggingConfig(QueueStackdriverLoggingConfigArgs.builder()
* .samplingRatio(0.9)
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* advancedConfiguration:
* type: gcp:cloudtasks:Queue
* name: advanced_configuration
* properties:
* name: instance-name
* location: us-central1
* appEngineRoutingOverride:
* service: worker
* version: '1.0'
* instance: test
* rateLimits:
* maxConcurrentDispatches: 3
* maxDispatchesPerSecond: 2
* retryConfig:
* maxAttempts: 5
* maxRetryDuration: 4s
* maxBackoff: 3s
* minBackoff: 2s
* maxDoublings: 1
* stackdriverLoggingConfig:
* samplingRatio: 0.9
* ```
*
* ## Import
* Queue can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{location}}/queues/{{name}}`
* * `{{project}}/{{location}}/{{name}}`
* * `{{location}}/{{name}}`
* When using the `pulumi import` command, Queue can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:cloudtasks/queue:Queue default projects/{{project}}/locations/{{location}}/queues/{{name}}
* ```
* ```sh
* $ pulumi import gcp:cloudtasks/queue:Queue default {{project}}/{{location}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:cloudtasks/queue:Queue default {{location}}/{{name}}
* ```
*/
public class Queue internal constructor(
override val javaResource: com.pulumi.gcp.cloudtasks.Queue,
) : KotlinCustomResource(javaResource, QueueMapper) {
/**
* Overrides for task-level appEngineRouting. These settings apply only
* to App Engine tasks in this queue
* Structure is documented below.
*/
public val appEngineRoutingOverride: Output?
get() = javaResource.appEngineRoutingOverride().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> queueAppEngineRoutingOverrideToKotlin(args0) })
}).orElse(null)
})
/**
* The location of the queue
* - - -
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* The queue name.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* Rate limits for task dispatches.
* The queue's actual dispatch rate is the result of:
* * Number of tasks in the queue
* * User-specified throttling: rateLimits, retryConfig, 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.
* Structure is documented below.
*/
public val rateLimits: Output
get() = javaResource.rateLimits().applyValue({ args0 ->
args0.let({ args0 ->
queueRateLimitsToKotlin(args0)
})
})
/**
* Settings that determine the retry behavior.
* Structure is documented below.
*/
public val retryConfig: Output
get() = javaResource.retryConfig().applyValue({ args0 ->
args0.let({ args0 ->
queueRetryConfigToKotlin(args0)
})
})
/**
* Configuration options for writing logs to Stackdriver Logging.
* Structure is documented below.
*/
public val stackdriverLoggingConfig: Output?
get() = javaResource.stackdriverLoggingConfig().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> queueStackdriverLoggingConfigToKotlin(args0) })
}).orElse(null)
})
}
public object QueueMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.cloudtasks.Queue::class == javaResource::class
override fun map(javaResource: Resource): Queue = Queue(
javaResource as
com.pulumi.gcp.cloudtasks.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 - 2024 Weber Informatics LLC | Privacy Policy