Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.pubsub.kotlin.LiteTopic.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.pubsub.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.pubsub.kotlin.outputs.LiteTopicPartitionConfig
import com.pulumi.gcp.pubsub.kotlin.outputs.LiteTopicReservationConfig
import com.pulumi.gcp.pubsub.kotlin.outputs.LiteTopicRetentionConfig
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.pubsub.kotlin.outputs.LiteTopicPartitionConfig.Companion.toKotlin as liteTopicPartitionConfigToKotlin
import com.pulumi.gcp.pubsub.kotlin.outputs.LiteTopicReservationConfig.Companion.toKotlin as liteTopicReservationConfigToKotlin
import com.pulumi.gcp.pubsub.kotlin.outputs.LiteTopicRetentionConfig.Companion.toKotlin as liteTopicRetentionConfigToKotlin
/**
* Builder for [LiteTopic].
*/
@PulumiTagMarker
public class LiteTopicResourceBuilder internal constructor() {
public var name: String? = null
public var args: LiteTopicArgs = LiteTopicArgs()
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 LiteTopicArgsBuilder.() -> Unit) {
val builder = LiteTopicArgsBuilder()
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(): LiteTopic {
val builtJavaResource = com.pulumi.gcp.pubsub.LiteTopic(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return LiteTopic(builtJavaResource)
}
}
/**
* 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/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.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}}
* ```
*/
public class LiteTopic internal constructor(
override val javaResource: com.pulumi.gcp.pubsub.LiteTopic,
) : KotlinCustomResource(javaResource, LiteTopicMapper) {
/**
* Name of the topic.
* - - -
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The settings for this topic's partitions.
* Structure is documented below.
*/
public val partitionConfig: Output?
get() = javaResource.partitionConfig().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> liteTopicPartitionConfigToKotlin(args0) })
}).orElse(null)
})
/**
* 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 })
/**
* The region of the pubsub lite topic.
*/
public val region: Output?
get() = javaResource.region().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The settings for this topic's Reservation usage.
* Structure is documented below.
*/
public val reservationConfig: Output?
get() = javaResource.reservationConfig().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> liteTopicReservationConfigToKotlin(args0) })
}).orElse(null)
})
/**
* The settings for a topic's message retention.
* Structure is documented below.
*/
public val retentionConfig: Output?
get() = javaResource.retentionConfig().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> liteTopicRetentionConfigToKotlin(args0) })
}).orElse(null)
})
/**
* The zone of the pubsub lite topic.
*/
public val zone: Output?
get() = javaResource.zone().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object LiteTopicMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.pubsub.LiteTopic::class == javaResource::class
override fun map(javaResource: Resource): LiteTopic = LiteTopic(
javaResource as
com.pulumi.gcp.pubsub.LiteTopic,
)
}
/**
* @see [LiteTopic].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [LiteTopic].
*/
public suspend fun liteTopic(name: String, block: suspend LiteTopicResourceBuilder.() -> Unit): LiteTopic {
val builder = LiteTopicResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [LiteTopic].
* @param name The _unique_ name of the resulting resource.
*/
public fun liteTopic(name: String): LiteTopic {
val builder = LiteTopicResourceBuilder()
builder.name(name)
return builder.build()
}