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

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

package com.pulumi.gcp.cloudquota.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.cloudquota.kotlin.outputs.SQuotaPreferenceQuotaConfig
import com.pulumi.gcp.cloudquota.kotlin.outputs.SQuotaPreferenceQuotaConfig.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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map

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

    public var args: SQuotaPreferenceArgs = SQuotaPreferenceArgs()

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

/**
 * QuotaPreference represents the preferred quota configuration specified for a project, folder or organization. There is only one QuotaPreference resource for a quota value targeting a unique set of dimensions.
 * To get more information about QuotaPreference, see:
 * * [API documentation](https://cloud.google.com/docs/quotas/reference/rest/v1/projects.locations.quotaPreferences)
 * * How-to Guides
 *     * [Cloud Quotas Overview](https://cloud.google.com/docs/quotas/overview)
 * ## Example Usage
 * ### Cloudquotas Quota Preference Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const preference = new gcp.cloudquota.SQuotaPreference("preference", {
 *     parent: "projects/my-project-name",
 *     name: "compute_googleapis_com-CPUS-per-project_us-east1",
 *     dimensions: {
 *         region: "us-east1",
 *     },
 *     service: "compute.googleapis.com",
 *     quotaId: "CPUS-per-project-region",
 *     contactEmail: "[email protected]",
 *     quotaConfig: {
 *         preferredValue: "200",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * preference = gcp.cloudquota.SQuotaPreference("preference",
 *     parent="projects/my-project-name",
 *     name="compute_googleapis_com-CPUS-per-project_us-east1",
 *     dimensions={
 *         "region": "us-east1",
 *     },
 *     service="compute.googleapis.com",
 *     quota_id="CPUS-per-project-region",
 *     contact_email="[email protected]",
 *     quota_config=gcp.cloudquota.SQuotaPreferenceQuotaConfigArgs(
 *         preferred_value="200",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var preference = new Gcp.CloudQuota.SQuotaPreference("preference", new()
 *     {
 *         Parent = "projects/my-project-name",
 *         Name = "compute_googleapis_com-CPUS-per-project_us-east1",
 *         Dimensions =
 *         {
 *             { "region", "us-east1" },
 *         },
 *         Service = "compute.googleapis.com",
 *         QuotaId = "CPUS-per-project-region",
 *         ContactEmail = "[email protected]",
 *         QuotaConfig = new Gcp.CloudQuota.Inputs.SQuotaPreferenceQuotaConfigArgs
 *         {
 *             PreferredValue = "200",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudquota"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := cloudquota.NewSQuotaPreference(ctx, "preference", &cloudquota.SQuotaPreferenceArgs{
 * 			Parent: pulumi.String("projects/my-project-name"),
 * 			Name:   pulumi.String("compute_googleapis_com-CPUS-per-project_us-east1"),
 * 			Dimensions: pulumi.StringMap{
 * 				"region": pulumi.String("us-east1"),
 * 			},
 * 			Service:      pulumi.String("compute.googleapis.com"),
 * 			QuotaId:      pulumi.String("CPUS-per-project-region"),
 * 			ContactEmail: pulumi.String("[email protected]"),
 * 			QuotaConfig: &cloudquota.SQuotaPreferenceQuotaConfigArgs{
 * 				PreferredValue: pulumi.String("200"),
 * 			},
 * 		})
 * 		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.cloudquota.SQuotaPreference;
 * import com.pulumi.gcp.cloudquota.SQuotaPreferenceArgs;
 * import com.pulumi.gcp.cloudquota.inputs.SQuotaPreferenceQuotaConfigArgs;
 * 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 preference = new SQuotaPreference("preference", SQuotaPreferenceArgs.builder()
 *             .parent("projects/my-project-name")
 *             .name("compute_googleapis_com-CPUS-per-project_us-east1")
 *             .dimensions(Map.of("region", "us-east1"))
 *             .service("compute.googleapis.com")
 *             .quotaId("CPUS-per-project-region")
 *             .contactEmail("[email protected]")
 *             .quotaConfig(SQuotaPreferenceQuotaConfigArgs.builder()
 *                 .preferredValue(200)
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   preference:
 *     type: gcp:cloudquota:SQuotaPreference
 *     properties:
 *       parent: projects/my-project-name
 *       name: compute_googleapis_com-CPUS-per-project_us-east1
 *       dimensions:
 *         region: us-east1
 *       service: compute.googleapis.com
 *       quotaId: CPUS-per-project-region
 *       contactEmail: [email protected]
 *       quotaConfig:
 *         preferredValue: 200
 * ```
 * 
 * ## Import
 * QuotaPreference can be imported using any of these accepted formats:
 * * `{{parent}}/locations/global/quotaPreferences/{{name}}`
 * When using the `pulumi import` command, QuotaPreference can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:cloudquota/sQuotaPreference:SQuotaPreference default {{parent}}/locations/global/quotaPreferences/{{name}}
 * ```
 */
public class SQuotaPreference internal constructor(
    override val javaResource: com.pulumi.gcp.cloudquota.SQuotaPreference,
) : KotlinCustomResource(javaResource, SQuotaPreferenceMapper) {
    /**
     * An email address that can be used for quota related communication between the Google Cloud and the user in case the
     * Google Cloud needs further information to make a decision on whether the user preferred quota can be granted. The Google
     * account for the email address must have quota update permission for the project, folder or organization this quota
     * preference is for.
     */
    public val contactEmail: Output?
        get() = javaResource.contactEmail().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Create time stamp.
     * A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: `2014-10-02T15:01:23Z` and `2014-10-02T15:01:23.045123456Z`.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * The dimensions that this quota preference applies to. The key of the map entry is the name of a dimension, such as
     * "region", "zone", "network_id", and the value of the map entry is the dimension value. If a dimension is missing from
     * the map of dimensions, the quota preference applies to all the dimension values except for those that have other quota
     * preferences configured for the specific value. NOTE: QuotaPreferences can only be applied across all values of "user"
     * and "resource" dimension. Do not set values for "user" or "resource" in the dimension map. Example: '{"provider": "Foo
     * Inc"}' where "provider" is a service specific dimension.
     */
    public val dimensions: Output>
        get() = javaResource.dimensions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The current etag of the quota preference. If an etag is provided on update and does not match the current server's etag of the quota preference, the request will be blocked and an ABORTED error will be returned. See https://google.aip.dev/134#etags for more details on etags.
     */
    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * The list of quota safety checks to be ignored. Default value: "QUOTA_SAFETY_CHECK_UNSPECIFIED" Possible values:
     * ["QUOTA_SAFETY_CHECK_UNSPECIFIED", "QUOTA_DECREASE_BELOW_USAGE", "QUOTA_DECREASE_PERCENTAGE_TOO_HIGH"]
     */
    public val ignoreSafetyChecks: Output?
        get() = javaResource.ignoreSafetyChecks().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The reason / justification for this quota preference.
     */
    public val justification: Output?
        get() = javaResource.justification().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The resource name of the quota preference. Required except in the CREATE requests.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The parent of the quota preference. Allowed parents are "projects/[project-id / number]" or "folders/[folder-id / number]" or "organizations/[org-id / number]".
     */
    public val parent: Output
        get() = javaResource.parent().applyValue({ args0 -> args0 })

    /**
     * The preferred quota configuration.
     * Structure is documented below.
     */
    public val quotaConfig: Output
        get() = javaResource.quotaConfig().applyValue({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })

    /**
     * The id of the quota to which the quota preference is applied. A quota id is unique in the service.
     * Example: `CPUS-per-project-region`.
     */
    public val quotaId: Output
        get() = javaResource.quotaId().applyValue({ args0 -> args0 })

    /**
     * Is the quota preference pending Google Cloud approval and fulfillment.
     */
    public val reconciling: Output
        get() = javaResource.reconciling().applyValue({ args0 -> args0 })

    /**
     * The name of the service to which the quota preference is applied.
     */
    public val service: Output
        get() = javaResource.service().applyValue({ args0 -> args0 })

    /**
     * Update time stamp.
     * A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: `2014-10-02T15:01:23Z` and `2014-10-02T15:01:23.045123456Z`.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object SQuotaPreferenceMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.cloudquota.SQuotaPreference::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy