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

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

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

    public var args: ReservationAssignmentArgs = ReservationAssignmentArgs()

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

/**
 * The BigqueryReservation Assignment resource
 * ## Example Usage
 * ### Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const basic = new gcp.bigquery.Reservation("basic", {
 *     name: "tf-test-my-reservation",
 *     project: "my-project-name",
 *     location: "us-central1",
 *     slotCapacity: 0,
 *     ignoreIdleSlots: false,
 * });
 * const primary = new gcp.bigquery.ReservationAssignment("primary", {
 *     assignee: "projects/my-project-name",
 *     jobType: "PIPELINE",
 *     reservation: basic.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * basic = gcp.bigquery.Reservation("basic",
 *     name="tf-test-my-reservation",
 *     project="my-project-name",
 *     location="us-central1",
 *     slot_capacity=0,
 *     ignore_idle_slots=False)
 * primary = gcp.bigquery.ReservationAssignment("primary",
 *     assignee="projects/my-project-name",
 *     job_type="PIPELINE",
 *     reservation=basic.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var basic = new Gcp.BigQuery.Reservation("basic", new()
 *     {
 *         Name = "tf-test-my-reservation",
 *         Project = "my-project-name",
 *         Location = "us-central1",
 *         SlotCapacity = 0,
 *         IgnoreIdleSlots = false,
 *     });
 *     var primary = new Gcp.BigQuery.ReservationAssignment("primary", new()
 *     {
 *         Assignee = "projects/my-project-name",
 *         JobType = "PIPELINE",
 *         Reservation = basic.Id,
 *     });
 * });
 * ```
 * ```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 {
 * 		basic, err := bigquery.NewReservation(ctx, "basic", &bigquery.ReservationArgs{
 * 			Name:            pulumi.String("tf-test-my-reservation"),
 * 			Project:         pulumi.String("my-project-name"),
 * 			Location:        pulumi.String("us-central1"),
 * 			SlotCapacity:    pulumi.Int(0),
 * 			IgnoreIdleSlots: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = bigquery.NewReservationAssignment(ctx, "primary", &bigquery.ReservationAssignmentArgs{
 * 			Assignee:    pulumi.String("projects/my-project-name"),
 * 			JobType:     pulumi.String("PIPELINE"),
 * 			Reservation: basic.ID(),
 * 		})
 * 		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.ReservationAssignment;
 * import com.pulumi.gcp.bigquery.ReservationAssignmentArgs;
 * 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 basic = new Reservation("basic", ReservationArgs.builder()
 *             .name("tf-test-my-reservation")
 *             .project("my-project-name")
 *             .location("us-central1")
 *             .slotCapacity(0)
 *             .ignoreIdleSlots(false)
 *             .build());
 *         var primary = new ReservationAssignment("primary", ReservationAssignmentArgs.builder()
 *             .assignee("projects/my-project-name")
 *             .jobType("PIPELINE")
 *             .reservation(basic.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   basic:
 *     type: gcp:bigquery:Reservation
 *     properties:
 *       name: tf-test-my-reservation
 *       project: my-project-name
 *       location: us-central1
 *       slotCapacity: 0
 *       ignoreIdleSlots: false
 *   primary:
 *     type: gcp:bigquery:ReservationAssignment
 *     properties:
 *       assignee: projects/my-project-name
 *       jobType: PIPELINE
 *       reservation: ${basic.id}
 * ```
 * 
 * ## Import
 * Assignment can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/reservations/{{reservation}}/assignments/{{name}}`
 * * `{{project}}/{{location}}/{{reservation}}/{{name}}`
 * * `{{location}}/{{reservation}}/{{name}}`
 * When using the `pulumi import` command, Assignment can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:bigquery/reservationAssignment:ReservationAssignment default projects/{{project}}/locations/{{location}}/reservations/{{reservation}}/assignments/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:bigquery/reservationAssignment:ReservationAssignment default {{project}}/{{location}}/{{reservation}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:bigquery/reservationAssignment:ReservationAssignment default {{location}}/{{reservation}}/{{name}}
 * ```
 */
public class ReservationAssignment internal constructor(
    override val javaResource: com.pulumi.gcp.bigquery.ReservationAssignment,
) : KotlinCustomResource(javaResource, ReservationAssignmentMapper) {
    /**
     * The resource which will use the reservation. E.g. projects/myproject, folders/123, organizations/456.
     */
    public val assignee: Output
        get() = javaResource.assignee().applyValue({ args0 -> args0 })

    /**
     * Types of job, which could be specified when using the reservation. Possible values: JOB_TYPE_UNSPECIFIED, PIPELINE, QUERY
     */
    public val jobType: Output
        get() = javaResource.jobType().applyValue({ args0 -> args0 })

    /**
     * The location for the resource
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Output only. The resource name of the assignment.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The project for the resource
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The reservation for the resource
     * - - -
     */
    public val reservation: Output
        get() = javaResource.reservation().applyValue({ args0 -> args0 })

    /**
     * Assignment will remain in PENDING state if no active capacity commitment is present. It will become ACTIVE when some capacity commitment becomes active. Possible values: STATE_UNSPECIFIED, PENDING, ACTIVE
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy