com.pulumi.gcp.pubsub.kotlin.LiteSubscriptionArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.pubsub.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.pubsub.LiteSubscriptionArgs.builder
import com.pulumi.gcp.pubsub.kotlin.inputs.LiteSubscriptionDeliveryConfigArgs
import com.pulumi.gcp.pubsub.kotlin.inputs.LiteSubscriptionDeliveryConfigArgsBuilder
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 representing the stream of messages from a single,
* specific topic, to be delivered to the subscribing application.
* To get more information about Subscription, see:
* * [API documentation](https://cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions)
* * How-to Guides
* * [Managing Subscriptions](https://cloud.google.com/pubsub/lite/docs/subscriptions)
* ## Example Usage
* ### Pubsub Lite Subscription Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const project = gcp.organizations.getProject({});
* const example = 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",
* },
* });
* const exampleLiteSubscription = new gcp.pubsub.LiteSubscription("example", {
* name: "example-subscription",
* topic: example.name,
* deliveryConfig: {
* deliveryRequirement: "DELIVER_AFTER_STORED",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* project = gcp.organizations.get_project()
* example = gcp.pubsub.LiteTopic("example",
* name="example-topic",
* project=project.number,
* partition_config=gcp.pubsub.LiteTopicPartitionConfigArgs(
* count=1,
* capacity=gcp.pubsub.LiteTopicPartitionConfigCapacityArgs(
* publish_mib_per_sec=4,
* subscribe_mib_per_sec=8,
* ),
* ),
* retention_config=gcp.pubsub.LiteTopicRetentionConfigArgs(
* per_partition_bytes="32212254720",
* ))
* example_lite_subscription = gcp.pubsub.LiteSubscription("example",
* name="example-subscription",
* topic=example.name,
* delivery_config=gcp.pubsub.LiteSubscriptionDeliveryConfigArgs(
* delivery_requirement="DELIVER_AFTER_STORED",
* ))
* ```
* ```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.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",
* },
* });
* var exampleLiteSubscription = new Gcp.PubSub.LiteSubscription("example", new()
* {
* Name = "example-subscription",
* Topic = example.Name,
* DeliveryConfig = new Gcp.PubSub.Inputs.LiteSubscriptionDeliveryConfigArgs
* {
* DeliveryRequirement = "DELIVER_AFTER_STORED",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "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 {
* project, err := organizations.LookupProject(ctx, nil, nil)
* if err != nil {
* return err
* }
* example, 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"),
* },
* })
* if err != nil {
* return err
* }
* _, err = pubsub.NewLiteSubscription(ctx, "example", &pubsub.LiteSubscriptionArgs{
* Name: pulumi.String("example-subscription"),
* Topic: example.Name,
* DeliveryConfig: &pubsub.LiteSubscriptionDeliveryConfigArgs{
* DeliveryRequirement: pulumi.String("DELIVER_AFTER_STORED"),
* },
* })
* 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.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.LiteSubscription;
* import com.pulumi.gcp.pubsub.LiteSubscriptionArgs;
* import com.pulumi.gcp.pubsub.inputs.LiteSubscriptionDeliveryConfigArgs;
* 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 LiteTopic("example", 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())
* .build());
* var exampleLiteSubscription = new LiteSubscription("exampleLiteSubscription", LiteSubscriptionArgs.builder()
* .name("example-subscription")
* .topic(example.name())
* .deliveryConfig(LiteSubscriptionDeliveryConfigArgs.builder()
* .deliveryRequirement("DELIVER_AFTER_STORED")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: gcp:pubsub:LiteTopic
* properties:
* name: example-topic
* project: ${project.number}
* partitionConfig:
* count: 1
* capacity:
* publishMibPerSec: 4
* subscribeMibPerSec: 8
* retentionConfig:
* perPartitionBytes: 3.221225472e+10
* exampleLiteSubscription:
* type: gcp:pubsub:LiteSubscription
* name: example
* properties:
* name: example-subscription
* topic: ${example.name}
* deliveryConfig:
* deliveryRequirement: DELIVER_AFTER_STORED
* variables:
* project:
* fn::invoke:
* Function: gcp:organizations:getProject
* Arguments: {}
* ```
*
* ## Import
* Subscription can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{zone}}/subscriptions/{{name}}`
* * `{{project}}/{{zone}}/{{name}}`
* * `{{zone}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, Subscription can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default projects/{{project}}/locations/{{zone}}/subscriptions/{{name}}
* ```
* ```sh
* $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default {{project}}/{{zone}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default {{zone}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default {{name}}
* ```
* @property deliveryConfig The settings for this subscription's message delivery.
* Structure is documented below.
* @property name Name of the subscription.
* - - -
* @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 topic A reference to a Topic resource.
* @property zone The zone of the pubsub lite topic.
*/
public data class LiteSubscriptionArgs(
public val deliveryConfig: Output? = null,
public val name: Output? = null,
public val project: Output? = null,
public val region: Output? = null,
public val topic: Output? = null,
public val zone: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.pubsub.LiteSubscriptionArgs =
com.pulumi.gcp.pubsub.LiteSubscriptionArgs.builder()
.deliveryConfig(deliveryConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.name(name?.applyValue({ args0 -> args0 }))
.project(project?.applyValue({ args0 -> args0 }))
.region(region?.applyValue({ args0 -> args0 }))
.topic(topic?.applyValue({ args0 -> args0 }))
.zone(zone?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [LiteSubscriptionArgs].
*/
@PulumiTagMarker
public class LiteSubscriptionArgsBuilder internal constructor() {
private var deliveryConfig: Output? = null
private var name: Output? = null
private var project: Output? = null
private var region: Output? = null
private var topic: Output? = null
private var zone: Output? = null
/**
* @param value The settings for this subscription's message delivery.
* Structure is documented below.
*/
@JvmName("rqblanlffnuhdbce")
public suspend fun deliveryConfig(`value`: Output) {
this.deliveryConfig = value
}
/**
* @param value Name of the subscription.
* - - -
*/
@JvmName("rqxlogmoxrbwjgkl")
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("jrelhtpsniwlxppb")
public suspend fun project(`value`: Output) {
this.project = value
}
/**
* @param value The region of the pubsub lite topic.
*/
@JvmName("dcnroqeqbwjjplxo")
public suspend fun region(`value`: Output) {
this.region = value
}
/**
* @param value A reference to a Topic resource.
*/
@JvmName("cknohvkwpewgvoac")
public suspend fun topic(`value`: Output) {
this.topic = value
}
/**
* @param value The zone of the pubsub lite topic.
*/
@JvmName("qmgsgweggoamdotv")
public suspend fun zone(`value`: Output) {
this.zone = value
}
/**
* @param value The settings for this subscription's message delivery.
* Structure is documented below.
*/
@JvmName("xigbxnwlsknmgvid")
public suspend fun deliveryConfig(`value`: LiteSubscriptionDeliveryConfigArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.deliveryConfig = mapped
}
/**
* @param argument The settings for this subscription's message delivery.
* Structure is documented below.
*/
@JvmName("dcdirtkrcbwxftau")
public suspend fun deliveryConfig(argument: suspend LiteSubscriptionDeliveryConfigArgsBuilder.() -> Unit) {
val toBeMapped = LiteSubscriptionDeliveryConfigArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.deliveryConfig = mapped
}
/**
* @param value Name of the subscription.
* - - -
*/
@JvmName("hdcemyccnqmswxes")
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("wgyqnmxugsxqsyko")
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("rvwxxtsvyicbkeia")
public suspend fun region(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.region = mapped
}
/**
* @param value A reference to a Topic resource.
*/
@JvmName("irnbjyohkbtalmhd")
public suspend fun topic(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.topic = mapped
}
/**
* @param value The zone of the pubsub lite topic.
*/
@JvmName("wwikxemaimmexykn")
public suspend fun zone(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.zone = mapped
}
internal fun build(): LiteSubscriptionArgs = LiteSubscriptionArgs(
deliveryConfig = deliveryConfig,
name = name,
project = project,
region = region,
topic = topic,
zone = zone,
)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy