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

com.pulumi.gcp.pubsub.kotlin.TopicArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.pubsub.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.pubsub.TopicArgs.builder
import com.pulumi.gcp.pubsub.kotlin.inputs.TopicIngestionDataSourceSettingsArgs
import com.pulumi.gcp.pubsub.kotlin.inputs.TopicIngestionDataSourceSettingsArgsBuilder
import com.pulumi.gcp.pubsub.kotlin.inputs.TopicMessageStoragePolicyArgs
import com.pulumi.gcp.pubsub.kotlin.inputs.TopicMessageStoragePolicyArgsBuilder
import com.pulumi.gcp.pubsub.kotlin.inputs.TopicSchemaSettingsArgs
import com.pulumi.gcp.pubsub.kotlin.inputs.TopicSchemaSettingsArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * A named resource to which messages are sent by publishers.
 * To get more information about Topic, see:
 * * [API documentation](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics)
 * * How-to Guides
 *     * [Managing Topics](https://cloud.google.com/pubsub/docs/admin#managing_topics)
 * > **Note:** You can retrieve the email of the Google Managed Pub/Sub Service Account used for forwarding
 * by using the `gcp.projects.ServiceIdentity` resource.
 * ## Example Usage
 * ### Pubsub Topic Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example = new gcp.pubsub.Topic("example", {
 *     name: "example-topic",
 *     labels: {
 *         foo: "bar",
 *     },
 *     messageRetentionDuration: "86600s",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example = gcp.pubsub.Topic("example",
 *     name="example-topic",
 *     labels={
 *         "foo": "bar",
 *     },
 *     message_retention_duration="86600s")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Gcp.PubSub.Topic("example", new()
 *     {
 *         Name = "example-topic",
 *         Labels =
 *         {
 *             { "foo", "bar" },
 *         },
 *         MessageRetentionDuration = "86600s",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
 * 			Name: pulumi.String("example-topic"),
 * 			Labels: pulumi.StringMap{
 * 				"foo": pulumi.String("bar"),
 * 			},
 * 			MessageRetentionDuration: pulumi.String("86600s"),
 * 		})
 * 		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.pubsub.Topic;
 * import com.pulumi.gcp.pubsub.TopicArgs;
 * 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 example = new Topic("example", TopicArgs.builder()
 *             .name("example-topic")
 *             .labels(Map.of("foo", "bar"))
 *             .messageRetentionDuration("86600s")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:pubsub:Topic
 *     properties:
 *       name: example-topic
 *       labels:
 *         foo: bar
 *       messageRetentionDuration: 86600s
 * ```
 * 
 * ### Pubsub Topic Cmek
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const keyRing = new gcp.kms.KeyRing("key_ring", {
 *     name: "example-keyring",
 *     location: "global",
 * });
 * const cryptoKey = new gcp.kms.CryptoKey("crypto_key", {
 *     name: "example-key",
 *     keyRing: keyRing.id,
 * });
 * const example = new gcp.pubsub.Topic("example", {
 *     name: "example-topic",
 *     kmsKeyName: cryptoKey.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * key_ring = gcp.kms.KeyRing("key_ring",
 *     name="example-keyring",
 *     location="global")
 * crypto_key = gcp.kms.CryptoKey("crypto_key",
 *     name="example-key",
 *     key_ring=key_ring.id)
 * example = gcp.pubsub.Topic("example",
 *     name="example-topic",
 *     kms_key_name=crypto_key.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var keyRing = new Gcp.Kms.KeyRing("key_ring", new()
 *     {
 *         Name = "example-keyring",
 *         Location = "global",
 *     });
 *     var cryptoKey = new Gcp.Kms.CryptoKey("crypto_key", new()
 *     {
 *         Name = "example-key",
 *         KeyRing = keyRing.Id,
 *     });
 *     var example = new Gcp.PubSub.Topic("example", new()
 *     {
 *         Name = "example-topic",
 *         KmsKeyName = cryptoKey.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/kms"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		keyRing, err := kms.NewKeyRing(ctx, "key_ring", &kms.KeyRingArgs{
 * 			Name:     pulumi.String("example-keyring"),
 * 			Location: pulumi.String("global"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		cryptoKey, err := kms.NewCryptoKey(ctx, "crypto_key", &kms.CryptoKeyArgs{
 * 			Name:    pulumi.String("example-key"),
 * 			KeyRing: keyRing.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
 * 			Name:       pulumi.String("example-topic"),
 * 			KmsKeyName: cryptoKey.ID(),
 * 		})
 * 		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.kms.KeyRing;
 * import com.pulumi.gcp.kms.KeyRingArgs;
 * import com.pulumi.gcp.kms.CryptoKey;
 * import com.pulumi.gcp.kms.CryptoKeyArgs;
 * import com.pulumi.gcp.pubsub.Topic;
 * import com.pulumi.gcp.pubsub.TopicArgs;
 * 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 keyRing = new KeyRing("keyRing", KeyRingArgs.builder()
 *             .name("example-keyring")
 *             .location("global")
 *             .build());
 *         var cryptoKey = new CryptoKey("cryptoKey", CryptoKeyArgs.builder()
 *             .name("example-key")
 *             .keyRing(keyRing.id())
 *             .build());
 *         var example = new Topic("example", TopicArgs.builder()
 *             .name("example-topic")
 *             .kmsKeyName(cryptoKey.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:pubsub:Topic
 *     properties:
 *       name: example-topic
 *       kmsKeyName: ${cryptoKey.id}
 *   cryptoKey:
 *     type: gcp:kms:CryptoKey
 *     name: crypto_key
 *     properties:
 *       name: example-key
 *       keyRing: ${keyRing.id}
 *   keyRing:
 *     type: gcp:kms:KeyRing
 *     name: key_ring
 *     properties:
 *       name: example-keyring
 *       location: global
 * ```
 * 
 * ### Pubsub Topic Geo Restricted
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example = new gcp.pubsub.Topic("example", {
 *     name: "example-topic",
 *     messageStoragePolicy: {
 *         allowedPersistenceRegions: ["europe-west3"],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example = gcp.pubsub.Topic("example",
 *     name="example-topic",
 *     message_storage_policy={
 *         "allowed_persistence_regions": ["europe-west3"],
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Gcp.PubSub.Topic("example", new()
 *     {
 *         Name = "example-topic",
 *         MessageStoragePolicy = new Gcp.PubSub.Inputs.TopicMessageStoragePolicyArgs
 *         {
 *             AllowedPersistenceRegions = new[]
 *             {
 *                 "europe-west3",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
 * 			Name: pulumi.String("example-topic"),
 * 			MessageStoragePolicy: &pubsub.TopicMessageStoragePolicyArgs{
 * 				AllowedPersistenceRegions: pulumi.StringArray{
 * 					pulumi.String("europe-west3"),
 * 				},
 * 			},
 * 		})
 * 		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.pubsub.Topic;
 * import com.pulumi.gcp.pubsub.TopicArgs;
 * import com.pulumi.gcp.pubsub.inputs.TopicMessageStoragePolicyArgs;
 * 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 example = new Topic("example", TopicArgs.builder()
 *             .name("example-topic")
 *             .messageStoragePolicy(TopicMessageStoragePolicyArgs.builder()
 *                 .allowedPersistenceRegions("europe-west3")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:pubsub:Topic
 *     properties:
 *       name: example-topic
 *       messageStoragePolicy:
 *         allowedPersistenceRegions:
 *           - europe-west3
 * ```
 * 
 * ### Pubsub Topic Schema Settings
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example = new gcp.pubsub.Schema("example", {
 *     name: "example",
 *     type: "AVRO",
 *     definition: `{
 *   "type" : "record",
 *   "name" : "Avro",
 *   "fields" : [
 *     {
 *       "name" : "StringField",
 *       "type" : "string"
 *     },
 *     {
 *       "name" : "IntField",
 *       "type" : "int"
 *     }
 *   ]
 * }
 * `,
 * });
 * const exampleTopic = new gcp.pubsub.Topic("example", {
 *     name: "example-topic",
 *     schemaSettings: {
 *         schema: "projects/my-project-name/schemas/example",
 *         encoding: "JSON",
 *     },
 * }, {
 *     dependsOn: [example],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example = gcp.pubsub.Schema("example",
 *     name="example",
 *     type="AVRO",
 *     definition="""{
 *   "type" : "record",
 *   "name" : "Avro",
 *   "fields" : [
 *     {
 *       "name" : "StringField",
 *       "type" : "string"
 *     },
 *     {
 *       "name" : "IntField",
 *       "type" : "int"
 *     }
 *   ]
 * }
 * """)
 * example_topic = gcp.pubsub.Topic("example",
 *     name="example-topic",
 *     schema_settings={
 *         "schema": "projects/my-project-name/schemas/example",
 *         "encoding": "JSON",
 *     },
 *     opts = pulumi.ResourceOptions(depends_on=[example]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Gcp.PubSub.Schema("example", new()
 *     {
 *         Name = "example",
 *         Type = "AVRO",
 *         Definition = @"{
 *   ""type"" : ""record"",
 *   ""name"" : ""Avro"",
 *   ""fields"" : [
 *     {
 *       ""name"" : ""StringField"",
 *       ""type"" : ""string""
 *     },
 *     {
 *       ""name"" : ""IntField"",
 *       ""type"" : ""int""
 *     }
 *   ]
 * }
 * ",
 *     });
 *     var exampleTopic = new Gcp.PubSub.Topic("example", new()
 *     {
 *         Name = "example-topic",
 *         SchemaSettings = new Gcp.PubSub.Inputs.TopicSchemaSettingsArgs
 *         {
 *             Schema = "projects/my-project-name/schemas/example",
 *             Encoding = "JSON",
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             example,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := pubsub.NewSchema(ctx, "example", &pubsub.SchemaArgs{
 * 			Name: pulumi.String("example"),
 * 			Type: pulumi.String("AVRO"),
 * 			Definition: pulumi.String(`{
 *   "type" : "record",
 *   "name" : "Avro",
 *   "fields" : [
 *     {
 *       "name" : "StringField",
 *       "type" : "string"
 *     },
 *     {
 *       "name" : "IntField",
 *       "type" : "int"
 *     }
 *   ]
 * }
 * `),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
 * 			Name: pulumi.String("example-topic"),
 * 			SchemaSettings: &pubsub.TopicSchemaSettingsArgs{
 * 				Schema:   pulumi.String("projects/my-project-name/schemas/example"),
 * 				Encoding: pulumi.String("JSON"),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			example,
 * 		}))
 * 		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.pubsub.Schema;
 * import com.pulumi.gcp.pubsub.SchemaArgs;
 * import com.pulumi.gcp.pubsub.Topic;
 * import com.pulumi.gcp.pubsub.TopicArgs;
 * import com.pulumi.gcp.pubsub.inputs.TopicSchemaSettingsArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 example = new Schema("example", SchemaArgs.builder()
 *             .name("example")
 *             .type("AVRO")
 *             .definition("""
 * {
 *   "type" : "record",
 *   "name" : "Avro",
 *   "fields" : [
 *     {
 *       "name" : "StringField",
 *       "type" : "string"
 *     },
 *     {
 *       "name" : "IntField",
 *       "type" : "int"
 *     }
 *   ]
 * }
 *             """)
 *             .build());
 *         var exampleTopic = new Topic("exampleTopic", TopicArgs.builder()
 *             .name("example-topic")
 *             .schemaSettings(TopicSchemaSettingsArgs.builder()
 *                 .schema("projects/my-project-name/schemas/example")
 *                 .encoding("JSON")
 *                 .build())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(example)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:pubsub:Schema
 *     properties:
 *       name: example
 *       type: AVRO
 *       definition: |
 *         {
 *           "type" : "record",
 *           "name" : "Avro",
 *           "fields" : [
 *             {
 *               "name" : "StringField",
 *               "type" : "string"
 *             },
 *             {
 *               "name" : "IntField",
 *               "type" : "int"
 *             }
 *           ]
 *         }
 *   exampleTopic:
 *     type: gcp:pubsub:Topic
 *     name: example
 *     properties:
 *       name: example-topic
 *       schemaSettings:
 *         schema: projects/my-project-name/schemas/example
 *         encoding: JSON
 *     options:
 *       dependson:
 *         - ${example}
 * ```
 * 
 * ### Pubsub Topic Ingestion Kinesis
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const example = new gcp.pubsub.Topic("example", {
 *     name: "example-topic",
 *     ingestionDataSourceSettings: {
 *         awsKinesis: {
 *             streamArn: "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name",
 *             consumerArn: "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111",
 *             awsRoleArn: "arn:aws:iam::111111111111:role/fake-role-name",
 *             gcpServiceAccount: "[email protected]",
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * example = gcp.pubsub.Topic("example",
 *     name="example-topic",
 *     ingestion_data_source_settings={
 *         "aws_kinesis": {
 *             "stream_arn": "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name",
 *             "consumer_arn": "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111",
 *             "aws_role_arn": "arn:aws:iam::111111111111:role/fake-role-name",
 *             "gcp_service_account": "[email protected]",
 *         },
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Gcp.PubSub.Topic("example", new()
 *     {
 *         Name = "example-topic",
 *         IngestionDataSourceSettings = new Gcp.PubSub.Inputs.TopicIngestionDataSourceSettingsArgs
 *         {
 *             AwsKinesis = new Gcp.PubSub.Inputs.TopicIngestionDataSourceSettingsAwsKinesisArgs
 *             {
 *                 StreamArn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name",
 *                 ConsumerArn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111",
 *                 AwsRoleArn = "arn:aws:iam::111111111111:role/fake-role-name",
 *                 GcpServiceAccount = "[email protected]",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
 * 			Name: pulumi.String("example-topic"),
 * 			IngestionDataSourceSettings: &pubsub.TopicIngestionDataSourceSettingsArgs{
 * 				AwsKinesis: &pubsub.TopicIngestionDataSourceSettingsAwsKinesisArgs{
 * 					StreamArn:         pulumi.String("arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name"),
 * 					ConsumerArn:       pulumi.String("arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111"),
 * 					AwsRoleArn:        pulumi.String("arn:aws:iam::111111111111:role/fake-role-name"),
 * 					GcpServiceAccount: pulumi.String("[email protected]"),
 * 				},
 * 			},
 * 		})
 * 		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.pubsub.Topic;
 * import com.pulumi.gcp.pubsub.TopicArgs;
 * import com.pulumi.gcp.pubsub.inputs.TopicIngestionDataSourceSettingsArgs;
 * import com.pulumi.gcp.pubsub.inputs.TopicIngestionDataSourceSettingsAwsKinesisArgs;
 * 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 example = new Topic("example", TopicArgs.builder()
 *             .name("example-topic")
 *             .ingestionDataSourceSettings(TopicIngestionDataSourceSettingsArgs.builder()
 *                 .awsKinesis(TopicIngestionDataSourceSettingsAwsKinesisArgs.builder()
 *                     .streamArn("arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name")
 *                     .consumerArn("arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111")
 *                     .awsRoleArn("arn:aws:iam::111111111111:role/fake-role-name")
 *                     .gcpServiceAccount("[email protected]")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:pubsub:Topic
 *     properties:
 *       name: example-topic
 *       ingestionDataSourceSettings:
 *         awsKinesis:
 *           streamArn: arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name
 *           consumerArn: arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111
 *           awsRoleArn: arn:aws:iam::111111111111:role/fake-role-name
 *           gcpServiceAccount: [email protected]
 * ```
 * 
 * ## Import
 * Topic can be imported using any of these accepted formats:
 * * `projects/{{project}}/topics/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Topic can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:pubsub/topic:Topic default projects/{{project}}/topics/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:pubsub/topic:Topic default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:pubsub/topic:Topic default {{name}}
 * ```
 * @property ingestionDataSourceSettings Settings for ingestion from a data source into this topic.
 * Structure is documented below.
 * @property kmsKeyName The resource name of the Cloud KMS CryptoKey to be used to protect access
 * to messages published on this topic. Your project's PubSub service account
 * (`service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com`) must have
 * `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature.
 * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`
 * @property labels A set of key/value label pairs to assign to this Topic.
 * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
 * Please refer to the field `effective_labels` for all of the labels present on the resource.
 * @property messageRetentionDuration Indicates the minimum duration to retain a message after it is published
 * to the topic. If this field is set, messages published to the topic in
 * the last messageRetentionDuration are always available to subscribers.
 * For instance, it allows any attached subscription to seek to a timestamp
 * that is up to messageRetentionDuration in the past. If this field is not
 * set, message retention is controlled by settings on individual subscriptions.
 * The rotation period has the format of a decimal number, followed by the
 * letter `s` (seconds). Cannot be more than 31 days or less than 10 minutes.
 * @property messageStoragePolicy Policy constraining the set of Google Cloud Platform regions where
 * messages published to the topic may be stored. If not present, then no
 * constraints are in effect.
 * Structure is documented below.
 * @property name Name of the topic.
 * - - -
 * @property project The ID of the project in which the resource belongs.
 * If it is not provided, the provider project is used.
 * @property schemaSettings Settings for validating messages published against a schema.
 * Structure is documented below.
 * */*/*/*/
 */
public data class TopicArgs(
    public val ingestionDataSourceSettings: Output? = null,
    public val kmsKeyName: Output? = null,
    public val labels: Output>? = null,
    public val messageRetentionDuration: Output? = null,
    public val messageStoragePolicy: Output? = null,
    public val name: Output? = null,
    public val project: Output? = null,
    public val schemaSettings: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.pubsub.TopicArgs = com.pulumi.gcp.pubsub.TopicArgs.builder()
        .ingestionDataSourceSettings(
            ingestionDataSourceSettings?.applyValue({ args0 ->
                args0.let({ args0 ->
                    args0.toJava()
                })
            }),
        )
        .kmsKeyName(kmsKeyName?.applyValue({ args0 -> args0 }))
        .labels(labels?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
        .messageRetentionDuration(messageRetentionDuration?.applyValue({ args0 -> args0 }))
        .messageStoragePolicy(
            messageStoragePolicy?.applyValue({ args0 ->
                args0.let({ args0 ->
                    args0.toJava()
                })
            }),
        )
        .name(name?.applyValue({ args0 -> args0 }))
        .project(project?.applyValue({ args0 -> args0 }))
        .schemaSettings(
            schemaSettings?.applyValue({ args0 ->
                args0.let({ args0 ->
                    args0.toJava()
                })
            }),
        ).build()
}

/**
 * Builder for [TopicArgs].
 */
@PulumiTagMarker
public class TopicArgsBuilder internal constructor() {
    private var ingestionDataSourceSettings: Output? = null

    private var kmsKeyName: Output? = null

    private var labels: Output>? = null

    private var messageRetentionDuration: Output? = null

    private var messageStoragePolicy: Output? = null

    private var name: Output? = null

    private var project: Output? = null

    private var schemaSettings: Output? = null

    /**
     * @param value Settings for ingestion from a data source into this topic.
     * Structure is documented below.
     */
    @JvmName("fmopiaqwtjffmroo")
    public suspend fun ingestionDataSourceSettings(`value`: Output) {
        this.ingestionDataSourceSettings = value
    }

    /**
     * @param value The resource name of the Cloud KMS CryptoKey to be used to protect access
     * to messages published on this topic. Your project's PubSub service account
     * (`service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com`) must have
     * `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature.
     * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`
     * */*/*/*/
     */
    @JvmName("kjbwkfdxggepoeap")
    public suspend fun kmsKeyName(`value`: Output) {
        this.kmsKeyName = value
    }

    /**
     * @param value A set of key/value label pairs to assign to this Topic.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    @JvmName("yomxfckxpgewivbp")
    public suspend fun labels(`value`: Output>) {
        this.labels = value
    }

    /**
     * @param value Indicates the minimum duration to retain a message after it is published
     * to the topic. If this field is set, messages published to the topic in
     * the last messageRetentionDuration are always available to subscribers.
     * For instance, it allows any attached subscription to seek to a timestamp
     * that is up to messageRetentionDuration in the past. If this field is not
     * set, message retention is controlled by settings on individual subscriptions.
     * The rotation period has the format of a decimal number, followed by the
     * letter `s` (seconds). Cannot be more than 31 days or less than 10 minutes.
     */
    @JvmName("fokajnyxyyfvwcge")
    public suspend fun messageRetentionDuration(`value`: Output) {
        this.messageRetentionDuration = value
    }

    /**
     * @param value Policy constraining the set of Google Cloud Platform regions where
     * messages published to the topic may be stored. If not present, then no
     * constraints are in effect.
     * Structure is documented below.
     */
    @JvmName("kkdvbbckvmftpygq")
    public suspend fun messageStoragePolicy(`value`: Output) {
        this.messageStoragePolicy = value
    }

    /**
     * @param value Name of the topic.
     * - - -
     */
    @JvmName("ywioqtwjignmaicn")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("ailqpllnhtcjwjwb")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value Settings for validating messages published against a schema.
     * Structure is documented below.
     */
    @JvmName("qnqutgvdwcpbmyij")
    public suspend fun schemaSettings(`value`: Output) {
        this.schemaSettings = value
    }

    /**
     * @param value Settings for ingestion from a data source into this topic.
     * Structure is documented below.
     */
    @JvmName("xurfeoipqpjbkhfh")
    public suspend fun ingestionDataSourceSettings(`value`: TopicIngestionDataSourceSettingsArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.ingestionDataSourceSettings = mapped
    }

    /**
     * @param argument Settings for ingestion from a data source into this topic.
     * Structure is documented below.
     */
    @JvmName("mduwjsnjakcagafx")
    public suspend fun ingestionDataSourceSettings(argument: suspend TopicIngestionDataSourceSettingsArgsBuilder.() -> Unit) {
        val toBeMapped = TopicIngestionDataSourceSettingsArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.ingestionDataSourceSettings = mapped
    }

    /**
     * @param value The resource name of the Cloud KMS CryptoKey to be used to protect access
     * to messages published on this topic. Your project's PubSub service account
     * (`service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com`) must have
     * `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature.
     * The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`
     * */*/*/*/
     */
    @JvmName("eokujujlcxritjmp")
    public suspend fun kmsKeyName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.kmsKeyName = mapped
    }

    /**
     * @param value A set of key/value label pairs to assign to this Topic.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    @JvmName("nljcajdrodabvism")
    public suspend fun labels(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.labels = mapped
    }

    /**
     * @param values A set of key/value label pairs to assign to this Topic.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    @JvmName("tkhtuneutcvjdgsl")
    public fun labels(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.labels = mapped
    }

    /**
     * @param value Indicates the minimum duration to retain a message after it is published
     * to the topic. If this field is set, messages published to the topic in
     * the last messageRetentionDuration are always available to subscribers.
     * For instance, it allows any attached subscription to seek to a timestamp
     * that is up to messageRetentionDuration in the past. If this field is not
     * set, message retention is controlled by settings on individual subscriptions.
     * The rotation period has the format of a decimal number, followed by the
     * letter `s` (seconds). Cannot be more than 31 days or less than 10 minutes.
     */
    @JvmName("osouerefgfvgmdta")
    public suspend fun messageRetentionDuration(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.messageRetentionDuration = mapped
    }

    /**
     * @param value Policy constraining the set of Google Cloud Platform regions where
     * messages published to the topic may be stored. If not present, then no
     * constraints are in effect.
     * Structure is documented below.
     */
    @JvmName("uuirckitnwfpvxgb")
    public suspend fun messageStoragePolicy(`value`: TopicMessageStoragePolicyArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.messageStoragePolicy = mapped
    }

    /**
     * @param argument Policy constraining the set of Google Cloud Platform regions where
     * messages published to the topic may be stored. If not present, then no
     * constraints are in effect.
     * Structure is documented below.
     */
    @JvmName("lnpmwwtbiixvesqp")
    public suspend fun messageStoragePolicy(argument: suspend TopicMessageStoragePolicyArgsBuilder.() -> Unit) {
        val toBeMapped = TopicMessageStoragePolicyArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.messageStoragePolicy = mapped
    }

    /**
     * @param value Name of the topic.
     * - - -
     */
    @JvmName("vbuvjtweakpccoju")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("ihhsacianjbswfwi")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value Settings for validating messages published against a schema.
     * Structure is documented below.
     */
    @JvmName("nnorpktikxelckav")
    public suspend fun schemaSettings(`value`: TopicSchemaSettingsArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.schemaSettings = mapped
    }

    /**
     * @param argument Settings for validating messages published against a schema.
     * Structure is documented below.
     */
    @JvmName("bdrwxlkljanfbfgr")
    public suspend fun schemaSettings(argument: suspend TopicSchemaSettingsArgsBuilder.() -> Unit) {
        val toBeMapped = TopicSchemaSettingsArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.schemaSettings = mapped
    }

    internal fun build(): TopicArgs = TopicArgs(
        ingestionDataSourceSettings = ingestionDataSourceSettings,
        kmsKeyName = kmsKeyName,
        labels = labels,
        messageRetentionDuration = messageRetentionDuration,
        messageStoragePolicy = messageStoragePolicy,
        name = name,
        project = project,
        schemaSettings = schemaSettings,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy