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

com.pulumi.googlenative.compute.alpha.kotlin.RegionCommitment.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.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.googlenative.compute.alpha.kotlin

import com.pulumi.core.Output
import com.pulumi.googlenative.compute.alpha.kotlin.outputs.LicenseResourceCommitmentResponse
import com.pulumi.googlenative.compute.alpha.kotlin.outputs.ReservationResponse
import com.pulumi.googlenative.compute.alpha.kotlin.outputs.ResourceCommitmentResponse
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 kotlin.collections.List
import com.pulumi.googlenative.compute.alpha.kotlin.outputs.LicenseResourceCommitmentResponse.Companion.toKotlin as licenseResourceCommitmentResponseToKotlin
import com.pulumi.googlenative.compute.alpha.kotlin.outputs.ReservationResponse.Companion.toKotlin as reservationResponseToKotlin
import com.pulumi.googlenative.compute.alpha.kotlin.outputs.ResourceCommitmentResponse.Companion.toKotlin as resourceCommitmentResponseToKotlin

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

    public var args: RegionCommitmentArgs = RegionCommitmentArgs()

    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 RegionCommitmentArgsBuilder.() -> Unit) {
        val builder = RegionCommitmentArgsBuilder()
        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(): RegionCommitment {
        val builtJavaResource =
            com.pulumi.googlenative.compute.alpha.RegionCommitment(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return RegionCommitment(builtJavaResource)
    }
}

/**
 * Creates a commitment in the specified project using the data included in the request.
 * Note - this resource's API doesn't support deletion. When deleted, the resource will persist
 * on Google Cloud even though it will be deleted from Pulumi state.
 */
public class RegionCommitment internal constructor(
    override val javaResource: com.pulumi.googlenative.compute.alpha.RegionCommitment,
) : KotlinCustomResource(javaResource, RegionCommitmentMapper) {
    /**
     * Specifies whether to enable automatic renewal for the commitment. The default value is false if not specified. The field can be updated until the day of the commitment expiration at 12:00am PST. If the field is set to true, the commitment will be automatically renewed for either one or three years according to the terms of the existing commitment.
     */
    public val autoRenew: Output
        get() = javaResource.autoRenew().applyValue({ args0 -> args0 })

    /**
     * The category of the commitment. Category MACHINE specifies commitments composed of machine resources such as VCPU or MEMORY, listed in resources. Category LICENSE specifies commitments composed of software licenses, listed in licenseResources. Note that only MACHINE commitments should have a Type specified.
     */
    public val category: Output
        get() = javaResource.category().applyValue({ args0 -> args0 })

    /**
     * Creation timestamp in RFC3339 text format.
     */
    public val creationTimestamp: Output
        get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })

    /**
     * An optional description of this resource. Provide this property when you create the resource.
     */
    public val description: Output
        get() = javaResource.description().applyValue({ args0 -> args0 })

    /**
     * Commitment end time in RFC3339 text format.
     */
    public val endTimestamp: Output
        get() = javaResource.endTimestamp().applyValue({ args0 -> args0 })

    /**
     * Type of the resource. Always compute#commitment for commitments.
     */
    public val kind: Output
        get() = javaResource.kind().applyValue({ args0 -> args0 })

    /**
     * The license specification required as part of a license commitment.
     */
    public val licenseResource: Output
        get() = javaResource.licenseResource().applyValue({ args0 ->
            args0.let({ args0 ->
                licenseResourceCommitmentResponseToKotlin(args0)
            })
        })

    /**
     * List of source commitments to be merged into a new commitment.
     */
    public val mergeSourceCommitments: Output>
        get() = javaResource.mergeSourceCommitments().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The plan for this commitment, which determines duration and discount rate. The currently supported plans are TWELVE_MONTH (1 year), and THIRTY_SIX_MONTH (3 years).
     */
    public val plan: Output
        get() = javaResource.plan().applyValue({ args0 -> args0 })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    public val region: Output
        get() = javaResource.region().applyValue({ args0 -> args0 })

    /**
     * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
     */
    public val requestId: Output?
        get() = javaResource.requestId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * List of reservations in this commitment.
     */
    public val reservations: Output>
        get() = javaResource.reservations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    reservationResponseToKotlin(args0)
                })
            })
        })

    /**
     * A list of commitment amounts for particular resources. Note that VCPU and MEMORY resource commitments must occur together.
     */
    public val resources: Output>
        get() = javaResource.resources().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    resourceCommitmentResponseToKotlin(args0)
                })
            })
        })

    /**
     * Server-defined URL for the resource.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })

    /**
     * Server-defined URL for this resource with the resource id.
     */
    public val selfLinkWithId: Output
        get() = javaResource.selfLinkWithId().applyValue({ args0 -> args0 })

    /**
     * Source commitment to be split into a new commitment.
     */
    public val splitSourceCommitment: Output
        get() = javaResource.splitSourceCommitment().applyValue({ args0 -> args0 })

    /**
     * Commitment start time in RFC3339 text format.
     */
    public val startTimestamp: Output
        get() = javaResource.startTimestamp().applyValue({ args0 -> args0 })

    /**
     * Status of the commitment with regards to eventual expiration (each commitment has an end date defined). One of the following values: NOT_YET_ACTIVE, ACTIVE, EXPIRED.
     */
    public val status: Output
        get() = javaResource.status().applyValue({ args0 -> args0 })

    /**
     * An optional, human-readable explanation of the status.
     */
    public val statusMessage: Output
        get() = javaResource.statusMessage().applyValue({ args0 -> args0 })

    /**
     * The type of commitment, which affects the discount rate and the eligible resources. Type MEMORY_OPTIMIZED specifies a commitment that will only apply to memory optimized machines. Type ACCELERATOR_OPTIMIZED specifies a commitment that will only apply to accelerator optimized machines.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object RegionCommitmentMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.googlenative.compute.alpha.RegionCommitment::class == javaResource::class

    override fun map(javaResource: Resource): RegionCommitment = RegionCommitment(
        javaResource as
            com.pulumi.googlenative.compute.alpha.RegionCommitment,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy