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

com.pulumi.gcp.pubsub.kotlin.LiteTopicArgs.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.20.1.0
Show newest version
@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.LiteTopicArgs.builder
import com.pulumi.gcp.pubsub.kotlin.inputs.LiteTopicPartitionConfigArgs
import com.pulumi.gcp.pubsub.kotlin.inputs.LiteTopicPartitionConfigArgsBuilder
import com.pulumi.gcp.pubsub.kotlin.inputs.LiteTopicReservationConfigArgs
import com.pulumi.gcp.pubsub.kotlin.inputs.LiteTopicReservationConfigArgsBuilder
import com.pulumi.gcp.pubsub.kotlin.inputs.LiteTopicRetentionConfigArgs
import com.pulumi.gcp.pubsub.kotlin.inputs.LiteTopicRetentionConfigArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
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/lite/docs/reference/rest/v1/admin.projects.locations.topics)
 * * How-to Guides
 *     * [Managing Topics](https://cloud.google.com/pubsub/lite/docs/topics)
 * ## Example Usage
 * ### Pubsub Lite Topic Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = gcp.organizations.getProject({});
 * const example = new gcp.pubsub.LiteReservation("example", {
 *     name: "example-reservation",
 *     project: project.then(project => project.number),
 *     throughputCapacity: 2,
 * });
 * const exampleLiteTopic = new gcp.pubsub.LiteTopic("example", {
 *     name: "example-topic",
 *     project: project.then(project => project.number),
 *     partitionConfig: {
 *         count: 1,
 *         capacity: {
 *             publishMibPerSec: 4,
 *             subscribeMibPerSec: 8,
 *         },
 *     },
 *     retentionConfig: {
 *         perPartitionBytes: "32212254720",
 *     },
 *     reservationConfig: {
 *         throughputReservation: example.name,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.get_project()
 * example = gcp.pubsub.LiteReservation("example",
 *     name="example-reservation",
 *     project=project.number,
 *     throughput_capacity=2)
 * example_lite_topic = gcp.pubsub.LiteTopic("example",
 *     name="example-topic",
 *     project=project.number,
 *     partition_config={
 *         "count": 1,
 *         "capacity": {
 *             "publish_mib_per_sec": 4,
 *             "subscribe_mib_per_sec": 8,
 *         },
 *     },
 *     retention_config={
 *         "per_partition_bytes": "32212254720",
 *     },
 *     reservation_config={
 *         "throughput_reservation": example.name,
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var example = new Gcp.PubSub.LiteReservation("example", new()
 *     {
 *         Name = "example-reservation",
 *         Project = project.Apply(getProjectResult => getProjectResult.Number),
 *         ThroughputCapacity = 2,
 *     });
 *     var exampleLiteTopic = new Gcp.PubSub.LiteTopic("example", new()
 *     {
 *         Name = "example-topic",
 *         Project = project.Apply(getProjectResult => getProjectResult.Number),
 *         PartitionConfig = new Gcp.PubSub.Inputs.LiteTopicPartitionConfigArgs
 *         {
 *             Count = 1,
 *             Capacity = new Gcp.PubSub.Inputs.LiteTopicPartitionConfigCapacityArgs
 *             {
 *                 PublishMibPerSec = 4,
 *                 SubscribeMibPerSec = 8,
 *             },
 *         },
 *         RetentionConfig = new Gcp.PubSub.Inputs.LiteTopicRetentionConfigArgs
 *         {
 *             PerPartitionBytes = "32212254720",
 *         },
 *         ReservationConfig = new Gcp.PubSub.Inputs.LiteTopicReservationConfigArgs
 *         {
 *             ThroughputReservation = example.Name,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/pubsub"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example, err := pubsub.NewLiteReservation(ctx, "example", &pubsub.LiteReservationArgs{
 * 			Name:               pulumi.String("example-reservation"),
 * 			Project:            pulumi.String(project.Number),
 * 			ThroughputCapacity: pulumi.Int(2),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = pubsub.NewLiteTopic(ctx, "example", &pubsub.LiteTopicArgs{
 * 			Name:    pulumi.String("example-topic"),
 * 			Project: pulumi.String(project.Number),
 * 			PartitionConfig: &pubsub.LiteTopicPartitionConfigArgs{
 * 				Count: pulumi.Int(1),
 * 				Capacity: &pubsub.LiteTopicPartitionConfigCapacityArgs{
 * 					PublishMibPerSec:   pulumi.Int(4),
 * 					SubscribeMibPerSec: pulumi.Int(8),
 * 				},
 * 			},
 * 			RetentionConfig: &pubsub.LiteTopicRetentionConfigArgs{
 * 				PerPartitionBytes: pulumi.String("32212254720"),
 * 			},
 * 			ReservationConfig: &pubsub.LiteTopicReservationConfigArgs{
 * 				ThroughputReservation: example.Name,
 * 			},
 * 		})
 * 		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.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.pubsub.LiteReservation;
 * import com.pulumi.gcp.pubsub.LiteReservationArgs;
 * import com.pulumi.gcp.pubsub.LiteTopic;
 * import com.pulumi.gcp.pubsub.LiteTopicArgs;
 * import com.pulumi.gcp.pubsub.inputs.LiteTopicPartitionConfigArgs;
 * import com.pulumi.gcp.pubsub.inputs.LiteTopicPartitionConfigCapacityArgs;
 * import com.pulumi.gcp.pubsub.inputs.LiteTopicRetentionConfigArgs;
 * import com.pulumi.gcp.pubsub.inputs.LiteTopicReservationConfigArgs;
 * 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) {
 *         final var project = OrganizationsFunctions.getProject();
 *         var example = new LiteReservation("example", LiteReservationArgs.builder()
 *             .name("example-reservation")
 *             .project(project.applyValue(getProjectResult -> getProjectResult.number()))
 *             .throughputCapacity(2)
 *             .build());
 *         var exampleLiteTopic = new LiteTopic("exampleLiteTopic", LiteTopicArgs.builder()
 *             .name("example-topic")
 *             .project(project.applyValue(getProjectResult -> getProjectResult.number()))
 *             .partitionConfig(LiteTopicPartitionConfigArgs.builder()
 *                 .count(1)
 *                 .capacity(LiteTopicPartitionConfigCapacityArgs.builder()
 *                     .publishMibPerSec(4)
 *                     .subscribeMibPerSec(8)
 *                     .build())
 *                 .build())
 *             .retentionConfig(LiteTopicRetentionConfigArgs.builder()
 *                 .perPartitionBytes(32212254720)
 *                 .build())
 *             .reservationConfig(LiteTopicReservationConfigArgs.builder()
 *                 .throughputReservation(example.name())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:pubsub:LiteReservation
 *     properties:
 *       name: example-reservation
 *       project: ${project.number}
 *       throughputCapacity: 2
 *   exampleLiteTopic:
 *     type: gcp:pubsub:LiteTopic
 *     name: example
 *     properties:
 *       name: example-topic
 *       project: ${project.number}
 *       partitionConfig:
 *         count: 1
 *         capacity:
 *           publishMibPerSec: 4
 *           subscribeMibPerSec: 8
 *       retentionConfig:
 *         perPartitionBytes: 3.221225472e+10
 *       reservationConfig:
 *         throughputReservation: ${example.name}
 * variables:
 *   project:
 *     fn::invoke:
 *       function: gcp:organizations:getProject
 *       arguments: {}
 * ```
 * 
 * ## Import
 * Topic can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{zone}}/topics/{{name}}`
 * * `{{project}}/{{zone}}/{{name}}`
 * * `{{zone}}/{{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/liteTopic:LiteTopic default projects/{{project}}/locations/{{zone}}/topics/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:pubsub/liteTopic:LiteTopic default {{project}}/{{zone}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:pubsub/liteTopic:LiteTopic default {{zone}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:pubsub/liteTopic:LiteTopic default {{name}}
 * ```
 * @property name Name of the topic.
 * - - -
 * @property partitionConfig The settings for this topic's partitions.
 * Structure is documented below.
 * @property project The ID of the project in which the resource belongs.
 * If it is not provided, the provider project is used.
 * @property region The region of the pubsub lite topic.
 * @property reservationConfig The settings for this topic's Reservation usage.
 * Structure is documented below.
 * @property retentionConfig The settings for a topic's message retention.
 * Structure is documented below.
 * @property zone The zone of the pubsub lite topic.
 */
public data class LiteTopicArgs(
    public val name: Output? = null,
    public val partitionConfig: Output? = null,
    public val project: Output? = null,
    public val region: Output? = null,
    public val reservationConfig: Output? = null,
    public val retentionConfig: Output? = null,
    public val zone: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.pubsub.LiteTopicArgs =
        com.pulumi.gcp.pubsub.LiteTopicArgs.builder()
            .name(name?.applyValue({ args0 -> args0 }))
            .partitionConfig(partitionConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .project(project?.applyValue({ args0 -> args0 }))
            .region(region?.applyValue({ args0 -> args0 }))
            .reservationConfig(reservationConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .retentionConfig(retentionConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .zone(zone?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [LiteTopicArgs].
 */
@PulumiTagMarker
public class LiteTopicArgsBuilder internal constructor() {
    private var name: Output? = null

    private var partitionConfig: Output? = null

    private var project: Output? = null

    private var region: Output? = null

    private var reservationConfig: Output? = null

    private var retentionConfig: Output? = null

    private var zone: Output? = null

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

    /**
     * @param value The settings for this topic's partitions.
     * Structure is documented below.
     */
    @JvmName("dgxbtdxwcmdcucoa")
    public suspend fun partitionConfig(`value`: Output) {
        this.partitionConfig = value
    }

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

    /**
     * @param value The region of the pubsub lite topic.
     */
    @JvmName("pgwwakkstthubpin")
    public suspend fun region(`value`: Output) {
        this.region = value
    }

    /**
     * @param value The settings for this topic's Reservation usage.
     * Structure is documented below.
     */
    @JvmName("stnbinjkqncfafyn")
    public suspend fun reservationConfig(`value`: Output) {
        this.reservationConfig = value
    }

    /**
     * @param value The settings for a topic's message retention.
     * Structure is documented below.
     */
    @JvmName("wfyisnvscngreeyw")
    public suspend fun retentionConfig(`value`: Output) {
        this.retentionConfig = value
    }

    /**
     * @param value The zone of the pubsub lite topic.
     */
    @JvmName("npvswydyqlruxurs")
    public suspend fun zone(`value`: Output) {
        this.zone = value
    }

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

    /**
     * @param value The settings for this topic's partitions.
     * Structure is documented below.
     */
    @JvmName("kxvhxxwhhvvpsftl")
    public suspend fun partitionConfig(`value`: LiteTopicPartitionConfigArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.partitionConfig = mapped
    }

    /**
     * @param argument The settings for this topic's partitions.
     * Structure is documented below.
     */
    @JvmName("uemyhurgfgesrokw")
    public suspend fun partitionConfig(argument: suspend LiteTopicPartitionConfigArgsBuilder.() -> Unit) {
        val toBeMapped = LiteTopicPartitionConfigArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.partitionConfig = mapped
    }

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

    /**
     * @param value The region of the pubsub lite topic.
     */
    @JvmName("bhalbovkdlycbtyr")
    public suspend fun region(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.region = mapped
    }

    /**
     * @param value The settings for this topic's Reservation usage.
     * Structure is documented below.
     */
    @JvmName("adibviamtmmibmrb")
    public suspend fun reservationConfig(`value`: LiteTopicReservationConfigArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.reservationConfig = mapped
    }

    /**
     * @param argument The settings for this topic's Reservation usage.
     * Structure is documented below.
     */
    @JvmName("xbnryqwvpboqctta")
    public suspend fun reservationConfig(argument: suspend LiteTopicReservationConfigArgsBuilder.() -> Unit) {
        val toBeMapped = LiteTopicReservationConfigArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.reservationConfig = mapped
    }

    /**
     * @param value The settings for a topic's message retention.
     * Structure is documented below.
     */
    @JvmName("rqaxnhtpnxeiwqtc")
    public suspend fun retentionConfig(`value`: LiteTopicRetentionConfigArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.retentionConfig = mapped
    }

    /**
     * @param argument The settings for a topic's message retention.
     * Structure is documented below.
     */
    @JvmName("roojparccoyiabas")
    public suspend fun retentionConfig(argument: suspend LiteTopicRetentionConfigArgsBuilder.() -> Unit) {
        val toBeMapped = LiteTopicRetentionConfigArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.retentionConfig = mapped
    }

    /**
     * @param value The zone of the pubsub lite topic.
     */
    @JvmName("pavyutsbvgwrbiok")
    public suspend fun zone(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.zone = mapped
    }

    internal fun build(): LiteTopicArgs = LiteTopicArgs(
        name = name,
        partitionConfig = partitionConfig,
        project = project,
        region = region,
        reservationConfig = reservationConfig,
        retentionConfig = retentionConfig,
        zone = zone,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy