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

com.pulumi.gcp.cloudtasks.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.

There is a newer version: 8.13.1.0
Show newest version
@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.QueueHttpTarget
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.QueueHttpTarget.Companion.toKotlin as queueHttpTargetToKotlin
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/v8/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={
 *         "service": "worker",
 *         "version": "1.0",
 *         "instance": "test",
 *     },
 *     rate_limits={
 *         "max_concurrent_dispatches": 3,
 *         "max_dispatches_per_second": 2,
 *     },
 *     retry_config={
 *         "max_attempts": 5,
 *         "max_retry_duration": "4s",
 *         "max_backoff": "3s",
 *         "min_backoff": "2s",
 *         "max_doublings": 1,
 *     },
 *     stackdriver_logging_config={
 *         "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/v8/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
 * ```
 * 
 * ### Cloud Tasks Queue Http Target Oidc
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const oidcServiceAccount = new gcp.serviceaccount.Account("oidc_service_account", {
 *     accountId: "example-oidc",
 *     displayName: "Tasks Queue OIDC Service Account",
 * });
 * const httpTargetOidc = new gcp.cloudtasks.Queue("http_target_oidc", {
 *     name: "cloud-tasks-queue-http-target-oidc",
 *     location: "us-central1",
 *     httpTarget: {
 *         httpMethod: "POST",
 *         uriOverride: {
 *             scheme: "HTTPS",
 *             host: "oidc.example.com",
 *             port: "8443",
 *             pathOverride: {
 *                 path: "/users/1234",
 *             },
 *             queryOverride: {
 *                 queryParams: "qparam1=123&qparam2=456",
 *             },
 *             uriOverrideEnforceMode: "IF_NOT_EXISTS",
 *         },
 *         headerOverrides: [
 *             {
 *                 header: {
 *                     key: "AddSomethingElse",
 *                     value: "MyOtherValue",
 *                 },
 *             },
 *             {
 *                 header: {
 *                     key: "AddMe",
 *                     value: "MyValue",
 *                 },
 *             },
 *         ],
 *         oidcToken: {
 *             serviceAccountEmail: oidcServiceAccount.email,
 *             audience: "https://oidc.example.com",
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * oidc_service_account = gcp.serviceaccount.Account("oidc_service_account",
 *     account_id="example-oidc",
 *     display_name="Tasks Queue OIDC Service Account")
 * http_target_oidc = gcp.cloudtasks.Queue("http_target_oidc",
 *     name="cloud-tasks-queue-http-target-oidc",
 *     location="us-central1",
 *     http_target={
 *         "http_method": "POST",
 *         "uri_override": {
 *             "scheme": "HTTPS",
 *             "host": "oidc.example.com",
 *             "port": "8443",
 *             "path_override": {
 *                 "path": "/users/1234",
 *             },
 *             "query_override": {
 *                 "query_params": "qparam1=123&qparam2=456",
 *             },
 *             "uri_override_enforce_mode": "IF_NOT_EXISTS",
 *         },
 *         "header_overrides": [
 *             {
 *                 "header": {
 *                     "key": "AddSomethingElse",
 *                     "value": "MyOtherValue",
 *                 },
 *             },
 *             {
 *                 "header": {
 *                     "key": "AddMe",
 *                     "value": "MyValue",
 *                 },
 *             },
 *         ],
 *         "oidc_token": {
 *             "service_account_email": oidc_service_account.email,
 *             "audience": "https://oidc.example.com",
 *         },
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var oidcServiceAccount = new Gcp.ServiceAccount.Account("oidc_service_account", new()
 *     {
 *         AccountId = "example-oidc",
 *         DisplayName = "Tasks Queue OIDC Service Account",
 *     });
 *     var httpTargetOidc = new Gcp.CloudTasks.Queue("http_target_oidc", new()
 *     {
 *         Name = "cloud-tasks-queue-http-target-oidc",
 *         Location = "us-central1",
 *         HttpTarget = new Gcp.CloudTasks.Inputs.QueueHttpTargetArgs
 *         {
 *             HttpMethod = "POST",
 *             UriOverride = new Gcp.CloudTasks.Inputs.QueueHttpTargetUriOverrideArgs
 *             {
 *                 Scheme = "HTTPS",
 *                 Host = "oidc.example.com",
 *                 Port = "8443",
 *                 PathOverride = new Gcp.CloudTasks.Inputs.QueueHttpTargetUriOverridePathOverrideArgs
 *                 {
 *                     Path = "/users/1234",
 *                 },
 *                 QueryOverride = new Gcp.CloudTasks.Inputs.QueueHttpTargetUriOverrideQueryOverrideArgs
 *                 {
 *                     QueryParams = "qparam1=123&qparam2=456",
 *                 },
 *                 UriOverrideEnforceMode = "IF_NOT_EXISTS",
 *             },
 *             HeaderOverrides = new[]
 *             {
 *                 new Gcp.CloudTasks.Inputs.QueueHttpTargetHeaderOverrideArgs
 *                 {
 *                     Header = new Gcp.CloudTasks.Inputs.QueueHttpTargetHeaderOverrideHeaderArgs
 *                     {
 *                         Key = "AddSomethingElse",
 *                         Value = "MyOtherValue",
 *                     },
 *                 },
 *                 new Gcp.CloudTasks.Inputs.QueueHttpTargetHeaderOverrideArgs
 *                 {
 *                     Header = new Gcp.CloudTasks.Inputs.QueueHttpTargetHeaderOverrideHeaderArgs
 *                     {
 *                         Key = "AddMe",
 *                         Value = "MyValue",
 *                     },
 *                 },
 *             },
 *             OidcToken = new Gcp.CloudTasks.Inputs.QueueHttpTargetOidcTokenArgs
 *             {
 *                 ServiceAccountEmail = oidcServiceAccount.Email,
 *                 Audience = "https://oidc.example.com",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/cloudtasks"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/serviceaccount"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		oidcServiceAccount, err := serviceaccount.NewAccount(ctx, "oidc_service_account", &serviceaccount.AccountArgs{
 * 			AccountId:   pulumi.String("example-oidc"),
 * 			DisplayName: pulumi.String("Tasks Queue OIDC Service Account"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cloudtasks.NewQueue(ctx, "http_target_oidc", &cloudtasks.QueueArgs{
 * 			Name:     pulumi.String("cloud-tasks-queue-http-target-oidc"),
 * 			Location: pulumi.String("us-central1"),
 * 			HttpTarget: &cloudtasks.QueueHttpTargetArgs{
 * 				HttpMethod: pulumi.String("POST"),
 * 				UriOverride: &cloudtasks.QueueHttpTargetUriOverrideArgs{
 * 					Scheme: pulumi.String("HTTPS"),
 * 					Host:   pulumi.String("oidc.example.com"),
 * 					Port:   pulumi.String("8443"),
 * 					PathOverride: &cloudtasks.QueueHttpTargetUriOverridePathOverrideArgs{
 * 						Path: pulumi.String("/users/1234"),
 * 					},
 * 					QueryOverride: &cloudtasks.QueueHttpTargetUriOverrideQueryOverrideArgs{
 * 						QueryParams: pulumi.String("qparam1=123&qparam2=456"),
 * 					},
 * 					UriOverrideEnforceMode: pulumi.String("IF_NOT_EXISTS"),
 * 				},
 * 				HeaderOverrides: cloudtasks.QueueHttpTargetHeaderOverrideArray{
 * 					&cloudtasks.QueueHttpTargetHeaderOverrideArgs{
 * 						Header: &cloudtasks.QueueHttpTargetHeaderOverrideHeaderArgs{
 * 							Key:   pulumi.String("AddSomethingElse"),
 * 							Value: pulumi.String("MyOtherValue"),
 * 						},
 * 					},
 * 					&cloudtasks.QueueHttpTargetHeaderOverrideArgs{
 * 						Header: &cloudtasks.QueueHttpTargetHeaderOverrideHeaderArgs{
 * 							Key:   pulumi.String("AddMe"),
 * 							Value: pulumi.String("MyValue"),
 * 						},
 * 					},
 * 				},
 * 				OidcToken: &cloudtasks.QueueHttpTargetOidcTokenArgs{
 * 					ServiceAccountEmail: oidcServiceAccount.Email,
 * 					Audience:            pulumi.String("https://oidc.example.com"),
 * 				},
 * 			},
 * 		})
 * 		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.serviceaccount.Account;
 * import com.pulumi.gcp.serviceaccount.AccountArgs;
 * import com.pulumi.gcp.cloudtasks.Queue;
 * import com.pulumi.gcp.cloudtasks.QueueArgs;
 * import com.pulumi.gcp.cloudtasks.inputs.QueueHttpTargetArgs;
 * import com.pulumi.gcp.cloudtasks.inputs.QueueHttpTargetUriOverrideArgs;
 * import com.pulumi.gcp.cloudtasks.inputs.QueueHttpTargetUriOverridePathOverrideArgs;
 * import com.pulumi.gcp.cloudtasks.inputs.QueueHttpTargetUriOverrideQueryOverrideArgs;
 * import com.pulumi.gcp.cloudtasks.inputs.QueueHttpTargetOidcTokenArgs;
 * 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 oidcServiceAccount = new Account("oidcServiceAccount", AccountArgs.builder()
 *             .accountId("example-oidc")
 *             .displayName("Tasks Queue OIDC Service Account")
 *             .build());
 *         var httpTargetOidc = new Queue("httpTargetOidc", QueueArgs.builder()
 *             .name("cloud-tasks-queue-http-target-oidc")
 *             .location("us-central1")
 *             .httpTarget(QueueHttpTargetArgs.builder()
 *                 .httpMethod("POST")
 *                 .uriOverride(QueueHttpTargetUriOverrideArgs.builder()
 *                     .scheme("HTTPS")
 *                     .host("oidc.example.com")
 *                     .port(8443)
 *                     .pathOverride(QueueHttpTargetUriOverridePathOverrideArgs.builder()
 *                         .path("/users/1234")
 *                         .build())
 *                     .queryOverride(QueueHttpTargetUriOverrideQueryOverrideArgs.builder()
 *                         .queryParams("qparam1=123&qparam2=456")
 *                         .build())
 *                     .uriOverrideEnforceMode("IF_NOT_EXISTS")
 *                     .build())
 *                 .headerOverrides(
 *                     QueueHttpTargetHeaderOverrideArgs.builder()
 *                         .header(QueueHttpTargetHeaderOverrideHeaderArgs.builder()
 *                             .key("AddSomethingElse")
 *                             .value("MyOtherValue")
 *                             .build())
 *                         .build(),
 *                     QueueHttpTargetHeaderOverrideArgs.builder()
 *                         .header(QueueHttpTargetHeaderOverrideHeaderArgs.builder()
 *                             .key("AddMe")
 *                             .value("MyValue")
 *                             .build())
 *                         .build())
 *                 .oidcToken(QueueHttpTargetOidcTokenArgs.builder()
 *                     .serviceAccountEmail(oidcServiceAccount.email())
 *                     .audience("https://oidc.example.com")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   httpTargetOidc:
 *     type: gcp:cloudtasks:Queue
 *     name: http_target_oidc
 *     properties:
 *       name: cloud-tasks-queue-http-target-oidc
 *       location: us-central1
 *       httpTarget:
 *         httpMethod: POST
 *         uriOverride:
 *           scheme: HTTPS
 *           host: oidc.example.com
 *           port: 8443
 *           pathOverride:
 *             path: /users/1234
 *           queryOverride:
 *             queryParams: qparam1=123&qparam2=456
 *           uriOverrideEnforceMode: IF_NOT_EXISTS
 *         headerOverrides:
 *           - header:
 *               key: AddSomethingElse
 *               value: MyOtherValue
 *           - header:
 *               key: AddMe
 *               value: MyValue
 *         oidcToken:
 *           serviceAccountEmail: ${oidcServiceAccount.email}
 *           audience: https://oidc.example.com
 *   oidcServiceAccount:
 *     type: gcp:serviceaccount:Account
 *     name: oidc_service_account
 *     properties:
 *       accountId: example-oidc
 *       displayName: Tasks Queue OIDC Service Account
 * ```
 * 
 * ### Cloud Tasks Queue Http Target Oauth
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const oauthServiceAccount = new gcp.serviceaccount.Account("oauth_service_account", {
 *     accountId: "example-oauth",
 *     displayName: "Tasks Queue OAuth Service Account",
 * });
 * const httpTargetOauth = new gcp.cloudtasks.Queue("http_target_oauth", {
 *     name: "cloud-tasks-queue-http-target-oauth",
 *     location: "us-central1",
 *     httpTarget: {
 *         httpMethod: "POST",
 *         uriOverride: {
 *             scheme: "HTTPS",
 *             host: "oauth.example.com",
 *             port: "8443",
 *             pathOverride: {
 *                 path: "/users/1234",
 *             },
 *             queryOverride: {
 *                 queryParams: "qparam1=123&qparam2=456",
 *             },
 *             uriOverrideEnforceMode: "IF_NOT_EXISTS",
 *         },
 *         headerOverrides: [
 *             {
 *                 header: {
 *                     key: "AddSomethingElse",
 *                     value: "MyOtherValue",
 *                 },
 *             },
 *             {
 *                 header: {
 *                     key: "AddMe",
 *                     value: "MyValue",
 *                 },
 *             },
 *         ],
 *         oauthToken: {
 *             serviceAccountEmail: oauthServiceAccount.email,
 *             scope: "openid https://www.googleapis.com/auth/userinfo.email",
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * oauth_service_account = gcp.serviceaccount.Account("oauth_service_account",
 *     account_id="example-oauth",
 *     display_name="Tasks Queue OAuth Service Account")
 * http_target_oauth = gcp.cloudtasks.Queue("http_target_oauth",
 *     name="cloud-tasks-queue-http-target-oauth",
 *     location="us-central1",
 *     http_target={
 *         "http_method": "POST",
 *         "uri_override": {
 *             "scheme": "HTTPS",
 *             "host": "oauth.example.com",
 *             "port": "8443",
 *             "path_override": {
 *                 "path": "/users/1234",
 *             },
 *             "query_override": {
 *                 "query_params": "qparam1=123&qparam2=456",
 *             },
 *             "uri_override_enforce_mode": "IF_NOT_EXISTS",
 *         },
 *         "header_overrides": [
 *             {
 *                 "header": {
 *                     "key": "AddSomethingElse",
 *                     "value": "MyOtherValue",
 *                 },
 *             },
 *             {
 *                 "header": {
 *                     "key": "AddMe",
 *                     "value": "MyValue",
 *                 },
 *             },
 *         ],
 *         "oauth_token": {
 *             "service_account_email": oauth_service_account.email,
 *             "scope": "openid https://www.googleapis.com/auth/userinfo.email",
 *         },
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var oauthServiceAccount = new Gcp.ServiceAccount.Account("oauth_service_account", new()
 *     {
 *         AccountId = "example-oauth",
 *         DisplayName = "Tasks Queue OAuth Service Account",
 *     });
 *     var httpTargetOauth = new Gcp.CloudTasks.Queue("http_target_oauth", new()
 *     {
 *         Name = "cloud-tasks-queue-http-target-oauth",
 *         Location = "us-central1",
 *         HttpTarget = new Gcp.CloudTasks.Inputs.QueueHttpTargetArgs
 *         {
 *             HttpMethod = "POST",
 *             UriOverride = new Gcp.CloudTasks.Inputs.QueueHttpTargetUriOverrideArgs
 *             {
 *                 Scheme = "HTTPS",
 *                 Host = "oauth.example.com",
 *                 Port = "8443",
 *                 PathOverride = new Gcp.CloudTasks.Inputs.QueueHttpTargetUriOverridePathOverrideArgs
 *                 {
 *                     Path = "/users/1234",
 *                 },
 *                 QueryOverride = new Gcp.CloudTasks.Inputs.QueueHttpTargetUriOverrideQueryOverrideArgs
 *                 {
 *                     QueryParams = "qparam1=123&qparam2=456",
 *                 },
 *                 UriOverrideEnforceMode = "IF_NOT_EXISTS",
 *             },
 *             HeaderOverrides = new[]
 *             {
 *                 new Gcp.CloudTasks.Inputs.QueueHttpTargetHeaderOverrideArgs
 *                 {
 *                     Header = new Gcp.CloudTasks.Inputs.QueueHttpTargetHeaderOverrideHeaderArgs
 *                     {
 *                         Key = "AddSomethingElse",
 *                         Value = "MyOtherValue",
 *                     },
 *                 },
 *                 new Gcp.CloudTasks.Inputs.QueueHttpTargetHeaderOverrideArgs
 *                 {
 *                     Header = new Gcp.CloudTasks.Inputs.QueueHttpTargetHeaderOverrideHeaderArgs
 *                     {
 *                         Key = "AddMe",
 *                         Value = "MyValue",
 *                     },
 *                 },
 *             },
 *             OauthToken = new Gcp.CloudTasks.Inputs.QueueHttpTargetOauthTokenArgs
 *             {
 *                 ServiceAccountEmail = oauthServiceAccount.Email,
 *                 Scope = "openid https://www.googleapis.com/auth/userinfo.email",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/cloudtasks"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/serviceaccount"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		oauthServiceAccount, err := serviceaccount.NewAccount(ctx, "oauth_service_account", &serviceaccount.AccountArgs{
 * 			AccountId:   pulumi.String("example-oauth"),
 * 			DisplayName: pulumi.String("Tasks Queue OAuth Service Account"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cloudtasks.NewQueue(ctx, "http_target_oauth", &cloudtasks.QueueArgs{
 * 			Name:     pulumi.String("cloud-tasks-queue-http-target-oauth"),
 * 			Location: pulumi.String("us-central1"),
 * 			HttpTarget: &cloudtasks.QueueHttpTargetArgs{
 * 				HttpMethod: pulumi.String("POST"),
 * 				UriOverride: &cloudtasks.QueueHttpTargetUriOverrideArgs{
 * 					Scheme: pulumi.String("HTTPS"),
 * 					Host:   pulumi.String("oauth.example.com"),
 * 					Port:   pulumi.String("8443"),
 * 					PathOverride: &cloudtasks.QueueHttpTargetUriOverridePathOverrideArgs{
 * 						Path: pulumi.String("/users/1234"),
 * 					},
 * 					QueryOverride: &cloudtasks.QueueHttpTargetUriOverrideQueryOverrideArgs{
 * 						QueryParams: pulumi.String("qparam1=123&qparam2=456"),
 * 					},
 * 					UriOverrideEnforceMode: pulumi.String("IF_NOT_EXISTS"),
 * 				},
 * 				HeaderOverrides: cloudtasks.QueueHttpTargetHeaderOverrideArray{
 * 					&cloudtasks.QueueHttpTargetHeaderOverrideArgs{
 * 						Header: &cloudtasks.QueueHttpTargetHeaderOverrideHeaderArgs{
 * 							Key:   pulumi.String("AddSomethingElse"),
 * 							Value: pulumi.String("MyOtherValue"),
 * 						},
 * 					},
 * 					&cloudtasks.QueueHttpTargetHeaderOverrideArgs{
 * 						Header: &cloudtasks.QueueHttpTargetHeaderOverrideHeaderArgs{
 * 							Key:   pulumi.String("AddMe"),
 * 							Value: pulumi.String("MyValue"),
 * 						},
 * 					},
 * 				},
 * 				OauthToken: &cloudtasks.QueueHttpTargetOauthTokenArgs{
 * 					ServiceAccountEmail: oauthServiceAccount.Email,
 * 					Scope:               pulumi.String("openid https://www.googleapis.com/auth/userinfo.email"),
 * 				},
 * 			},
 * 		})
 * 		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.serviceaccount.Account;
 * import com.pulumi.gcp.serviceaccount.AccountArgs;
 * import com.pulumi.gcp.cloudtasks.Queue;
 * import com.pulumi.gcp.cloudtasks.QueueArgs;
 * import com.pulumi.gcp.cloudtasks.inputs.QueueHttpTargetArgs;
 * import com.pulumi.gcp.cloudtasks.inputs.QueueHttpTargetUriOverrideArgs;
 * import com.pulumi.gcp.cloudtasks.inputs.QueueHttpTargetUriOverridePathOverrideArgs;
 * import com.pulumi.gcp.cloudtasks.inputs.QueueHttpTargetUriOverrideQueryOverrideArgs;
 * import com.pulumi.gcp.cloudtasks.inputs.QueueHttpTargetOauthTokenArgs;
 * 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 oauthServiceAccount = new Account("oauthServiceAccount", AccountArgs.builder()
 *             .accountId("example-oauth")
 *             .displayName("Tasks Queue OAuth Service Account")
 *             .build());
 *         var httpTargetOauth = new Queue("httpTargetOauth", QueueArgs.builder()
 *             .name("cloud-tasks-queue-http-target-oauth")
 *             .location("us-central1")
 *             .httpTarget(QueueHttpTargetArgs.builder()
 *                 .httpMethod("POST")
 *                 .uriOverride(QueueHttpTargetUriOverrideArgs.builder()
 *                     .scheme("HTTPS")
 *                     .host("oauth.example.com")
 *                     .port(8443)
 *                     .pathOverride(QueueHttpTargetUriOverridePathOverrideArgs.builder()
 *                         .path("/users/1234")
 *                         .build())
 *                     .queryOverride(QueueHttpTargetUriOverrideQueryOverrideArgs.builder()
 *                         .queryParams("qparam1=123&qparam2=456")
 *                         .build())
 *                     .uriOverrideEnforceMode("IF_NOT_EXISTS")
 *                     .build())
 *                 .headerOverrides(
 *                     QueueHttpTargetHeaderOverrideArgs.builder()
 *                         .header(QueueHttpTargetHeaderOverrideHeaderArgs.builder()
 *                             .key("AddSomethingElse")
 *                             .value("MyOtherValue")
 *                             .build())
 *                         .build(),
 *                     QueueHttpTargetHeaderOverrideArgs.builder()
 *                         .header(QueueHttpTargetHeaderOverrideHeaderArgs.builder()
 *                             .key("AddMe")
 *                             .value("MyValue")
 *                             .build())
 *                         .build())
 *                 .oauthToken(QueueHttpTargetOauthTokenArgs.builder()
 *                     .serviceAccountEmail(oauthServiceAccount.email())
 *                     .scope("openid https://www.googleapis.com/auth/userinfo.email")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   httpTargetOauth:
 *     type: gcp:cloudtasks:Queue
 *     name: http_target_oauth
 *     properties:
 *       name: cloud-tasks-queue-http-target-oauth
 *       location: us-central1
 *       httpTarget:
 *         httpMethod: POST
 *         uriOverride:
 *           scheme: HTTPS
 *           host: oauth.example.com
 *           port: 8443
 *           pathOverride:
 *             path: /users/1234
 *           queryOverride:
 *             queryParams: qparam1=123&qparam2=456
 *           uriOverrideEnforceMode: IF_NOT_EXISTS
 *         headerOverrides:
 *           - header:
 *               key: AddSomethingElse
 *               value: MyOtherValue
 *           - header:
 *               key: AddMe
 *               value: MyValue
 *         oauthToken:
 *           serviceAccountEmail: ${oauthServiceAccount.email}
 *           scope: openid https://www.googleapis.com/auth/userinfo.email
 *   oauthServiceAccount:
 *     type: gcp:serviceaccount:Account
 *     name: oauth_service_account
 *     properties:
 *       accountId: example-oauth
 *       displayName: Tasks Queue OAuth Service Account
 * ```
 * 
 * ## 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)
        })

    /**
     * Modifies HTTP target for HTTP tasks.
     * Structure is documented below.
     */
    public val httpTarget: Output?
        get() = javaResource.httpTarget().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    queueHttpTargetToKotlin(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 - 2025 Weber Informatics LLC | Privacy Policy