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

com.pulumi.gcp.bigquery.kotlin.ReservationAssignment.kt Maven / Gradle / Ivy

@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.
 * To get more information about ReservationAssignment, see:
 * * [API documentation](https://cloud.google.com/bigquery/docs/reference/reservations/rest/v1/projects.locations.reservations.assignments)
 * * How-to Guides
 *     * [Work with reservation assignments](https://cloud.google.com/bigquery/docs/reservations-assignments)
 * ## Example Usage
 * ### Bigquery Reservation Assignment Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const basic = new gcp.bigquery.Reservation("basic", {
 *     name: "example-reservation",
 *     project: "my-project-name",
 *     location: "us-central1",
 *     slotCapacity: 0,
 *     ignoreIdleSlots: false,
 * });
 * const assignment = new gcp.bigquery.ReservationAssignment("assignment", {
 *     assignee: "projects/my-project-name",
 *     jobType: "PIPELINE",
 *     reservation: basic.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * basic = gcp.bigquery.Reservation("basic",
 *     name="example-reservation",
 *     project="my-project-name",
 *     location="us-central1",
 *     slot_capacity=0,
 *     ignore_idle_slots=False)
 * assignment = gcp.bigquery.ReservationAssignment("assignment",
 *     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 = "example-reservation",
 *         Project = "my-project-name",
 *         Location = "us-central1",
 *         SlotCapacity = 0,
 *         IgnoreIdleSlots = false,
 *     });
 *     var assignment = new Gcp.BigQuery.ReservationAssignment("assignment", 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("example-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, "assignment", &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("example-reservation")
 *             .project("my-project-name")
 *             .location("us-central1")
 *             .slotCapacity(0)
 *             .ignoreIdleSlots(false)
 *             .build());
 *         var assignment = new ReservationAssignment("assignment", ReservationAssignmentArgs.builder()
 *             .assignee("projects/my-project-name")
 *             .jobType("PIPELINE")
 *             .reservation(basic.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   basic:
 *     type: gcp:bigquery:Reservation
 *     properties:
 *       name: example-reservation
 *       project: my-project-name
 *       location: us-central1
 *       slotCapacity: 0
 *       ignoreIdleSlots: false
 *   assignment:
 *     type: gcp:bigquery:ReservationAssignment
 *     properties:
 *       assignee: projects/my-project-name
 *       jobType: PIPELINE
 *       reservation: ${basic.id}
 * ```
 * 
 * ## Import
 * ReservationAssignment 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, ReservationAssignment 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 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 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