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

com.pulumi.gcp.bigquery.kotlin.Reservation.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.bigquery.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.bigquery.kotlin.outputs.ReservationAutoscale
import com.pulumi.gcp.bigquery.kotlin.outputs.ReservationAutoscale.Companion.toKotlin
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 [Reservation].
 */
@PulumiTagMarker
public class ReservationResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ReservationArgs = ReservationArgs()

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

/**
 * A reservation is a mechanism used to guarantee BigQuery slots to users.
 * To get more information about Reservation, see:
 * * [API documentation](https://cloud.google.com/bigquery/docs/reference/reservations/rest/v1/projects.locations.reservations/create)
 * * How-to Guides
 *     * [Introduction to Reservations](https://cloud.google.com/bigquery/docs/reservations-intro)
 * ## Example Usage
 * ### Bigquery Reservation Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const reservation = new gcp.bigquery.Reservation("reservation", {
 *     name: "my-reservation",
 *     location: "us-west2",
 *     slotCapacity: 0,
 *     edition: "STANDARD",
 *     ignoreIdleSlots: true,
 *     concurrency: 0,
 *     autoscale: {
 *         maxSlots: 100,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * reservation = gcp.bigquery.Reservation("reservation",
 *     name="my-reservation",
 *     location="us-west2",
 *     slot_capacity=0,
 *     edition="STANDARD",
 *     ignore_idle_slots=True,
 *     concurrency=0,
 *     autoscale=gcp.bigquery.ReservationAutoscaleArgs(
 *         max_slots=100,
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var reservation = new Gcp.BigQuery.Reservation("reservation", new()
 *     {
 *         Name = "my-reservation",
 *         Location = "us-west2",
 *         SlotCapacity = 0,
 *         Edition = "STANDARD",
 *         IgnoreIdleSlots = true,
 *         Concurrency = 0,
 *         Autoscale = new Gcp.BigQuery.Inputs.ReservationAutoscaleArgs
 *         {
 *             MaxSlots = 100,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := bigquery.NewReservation(ctx, "reservation", &bigquery.ReservationArgs{
 * 			Name:            pulumi.String("my-reservation"),
 * 			Location:        pulumi.String("us-west2"),
 * 			SlotCapacity:    pulumi.Int(0),
 * 			Edition:         pulumi.String("STANDARD"),
 * 			IgnoreIdleSlots: pulumi.Bool(true),
 * 			Concurrency:     pulumi.Int(0),
 * 			Autoscale: &bigquery.ReservationAutoscaleArgs{
 * 				MaxSlots: pulumi.Int(100),
 * 			},
 * 		})
 * 		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.bigquery.Reservation;
 * import com.pulumi.gcp.bigquery.ReservationArgs;
 * import com.pulumi.gcp.bigquery.inputs.ReservationAutoscaleArgs;
 * 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 reservation = new Reservation("reservation", ReservationArgs.builder()
 *             .name("my-reservation")
 *             .location("us-west2")
 *             .slotCapacity(0)
 *             .edition("STANDARD")
 *             .ignoreIdleSlots(true)
 *             .concurrency(0)
 *             .autoscale(ReservationAutoscaleArgs.builder()
 *                 .maxSlots(100)
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   reservation:
 *     type: gcp:bigquery:Reservation
 *     properties:
 *       name: my-reservation
 *       location: us-west2
 *       slotCapacity: 0
 *       edition: STANDARD
 *       ignoreIdleSlots: true
 *       concurrency: 0
 *       autoscale:
 *         maxSlots: 100
 * ```
 * 
 * ## Import
 * Reservation can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/reservations/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, Reservation can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:bigquery/reservation:Reservation default projects/{{project}}/locations/{{location}}/reservations/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:bigquery/reservation:Reservation default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:bigquery/reservation:Reservation default {{location}}/{{name}}
 * ```
 */
public class Reservation internal constructor(
    override val javaResource: com.pulumi.gcp.bigquery.Reservation,
) : KotlinCustomResource(javaResource, ReservationMapper) {
    /**
     * The configuration parameters for the auto scaling feature.
     * Structure is documented below.
     */
    public val autoscale: Output?
        get() = javaResource.autoscale().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Maximum number of queries that are allowed to run concurrently in this reservation. This is a soft limit due to asynchronous nature of the system and various optimizations for small queries. Default value is 0 which means that concurrency will be automatically set based on the reservation size.
     */
    public val concurrency: Output?
        get() = javaResource.concurrency().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The edition type. Valid values are STANDARD, ENTERPRISE, ENTERPRISE_PLUS
     */
    public val edition: Output
        get() = javaResource.edition().applyValue({ args0 -> args0 })

    /**
     * If false, any query using this reservation will use idle slots from other reservations within
     * the same admin project. If true, a query using this reservation will execute with the slot
     * capacity specified above at most.
     */
    public val ignoreIdleSlots: Output?
        get() = javaResource.ignoreIdleSlots().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The geographic location where the transfer config should reside.
     * Examples: US, EU, asia-northeast1. The default value is US.
     */
    public val location: Output?
        get() = javaResource.location().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Applicable only for reservations located within one of the BigQuery multi-regions (US or EU).
     * If set to true, this reservation is placed in the organization's secondary region which is designated for disaster recovery purposes. If false, this reservation is placed in the organization's default region.
     */
    public val multiRegionAuxiliary: Output?
        get() = javaResource.multiRegionAuxiliary().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the reservation. This field must only contain alphanumeric characters or dash.
     * - - -
     */
    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 })

    /**
     * Minimum slots available to this reservation. A slot is a unit of computational power in BigQuery, and serves as the
     * unit of parallelism. Queries using this reservation might use more slots during runtime if ignoreIdleSlots is set to false.
     */
    public val slotCapacity: Output
        get() = javaResource.slotCapacity().applyValue({ args0 -> args0 })
}

public object ReservationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.bigquery.Reservation::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy