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

com.pulumi.gcp.pubsub.kotlin.LiteReservation.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.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.pubsub.kotlin

import com.pulumi.core.Output
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

/**
 * Builder for [LiteReservation].
 */
@PulumiTagMarker
public class LiteReservationResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: LiteReservationArgs = LiteReservationArgs()

    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 LiteReservationArgsBuilder.() -> Unit) {
        val builder = LiteReservationArgsBuilder()
        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(): LiteReservation {
        val builtJavaResource = com.pulumi.gcp.pubsub.LiteReservation(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return LiteReservation(builtJavaResource)
    }
}

/**
 * A named resource representing a shared pool of capacity.
 * To get more information about Reservation, see:
 * * [API documentation](https://cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.reservations)
 * * How-to Guides
 *     * [Managing Reservations](https://cloud.google.com/pubsub/lite/docs/reservations)
 * ## Example Usage
 * ### Pubsub Lite Reservation 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,
 * });
 * ```
 * ```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)
 * ```
 * ```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,
 *     });
 * });
 * ```
 * ```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
 * 		}
 * 		_, 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
 * 		}
 * 		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 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());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: gcp:pubsub:LiteReservation
 *     properties:
 *       name: example-reservation
 *       project: ${project.number}
 *       throughputCapacity: 2
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Reservation can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{region}}/reservations/{{name}}`
 * * `{{project}}/{{region}}/{{name}}`
 * * `{{region}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Reservation can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:pubsub/liteReservation:LiteReservation default projects/{{project}}/locations/{{region}}/reservations/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:pubsub/liteReservation:LiteReservation default {{project}}/{{region}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:pubsub/liteReservation:LiteReservation default {{region}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:pubsub/liteReservation:LiteReservation default {{name}}
 * ```
 */
public class LiteReservation internal constructor(
    override val javaResource: com.pulumi.gcp.pubsub.LiteReservation,
) : KotlinCustomResource(javaResource, LiteReservationMapper) {
    /**
     * Name of the reservation.
     * - - -
     */
    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 })

    /**
     * The region of the pubsub lite reservation.
     */
    public val region: Output?
        get() = javaResource.region().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The reserved throughput capacity. Every unit of throughput capacity is
     * equivalent to 1 MiB/s of published messages or 2 MiB/s of subscribed
     * messages.
     */
    public val throughputCapacity: Output
        get() = javaResource.throughputCapacity().applyValue({ args0 -> args0 })
}

public object LiteReservationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.pubsub.LiteReservation::class == javaResource::class

    override fun map(javaResource: Resource): LiteReservation = LiteReservation(
        javaResource as
            com.pulumi.gcp.pubsub.LiteReservation,
    )
}

/**
 * @see [LiteReservation].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [LiteReservation].
 */
public suspend fun liteReservation(
    name: String,
    block: suspend LiteReservationResourceBuilder.() -> Unit,
): LiteReservation {
    val builder = LiteReservationResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [LiteReservation].
 * @param name The _unique_ name of the resulting resource.
 */
public fun liteReservation(name: String): LiteReservation {
    val builder = LiteReservationResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy