com.pulumi.nomad.kotlin.QuoteSpecification.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-nomad-kotlin Show documentation
Show all versions of pulumi-nomad-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.nomad.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.nomad.kotlin.outputs.QuoteSpecificationLimit
import com.pulumi.nomad.kotlin.outputs.QuoteSpecificationLimit.Companion.toKotlin
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
/**
* Builder for [QuoteSpecification].
*/
@PulumiTagMarker
public class QuoteSpecificationResourceBuilder internal constructor() {
public var name: String? = null
public var args: QuoteSpecificationArgs = QuoteSpecificationArgs()
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 QuoteSpecificationArgsBuilder.() -> Unit) {
val builder = QuoteSpecificationArgsBuilder()
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(): QuoteSpecification {
val builtJavaResource = com.pulumi.nomad.QuoteSpecification(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return QuoteSpecification(builtJavaResource)
}
}
/**
* Manages a quota specification in a Nomad cluster.
* ## Example Usage
* Registering a quota specification:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as nomad from "@pulumi/nomad";
* const prodApi = new nomad.QuoteSpecification("prod_api", {
* name: "prod-api",
* description: "Production instances of backend API servers",
* limits: [{
* region: "global",
* regionLimit: {
* cpu: 2400,
* memoryMb: 1200,
* },
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_nomad as nomad
* prod_api = nomad.QuoteSpecification("prod_api",
* name="prod-api",
* description="Production instances of backend API servers",
* limits=[{
* "region": "global",
* "region_limit": {
* "cpu": 2400,
* "memory_mb": 1200,
* },
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Nomad = Pulumi.Nomad;
* return await Deployment.RunAsync(() =>
* {
* var prodApi = new Nomad.QuoteSpecification("prod_api", new()
* {
* Name = "prod-api",
* Description = "Production instances of backend API servers",
* Limits = new[]
* {
* new Nomad.Inputs.QuoteSpecificationLimitArgs
* {
* Region = "global",
* RegionLimit = new Nomad.Inputs.QuoteSpecificationLimitRegionLimitArgs
* {
* Cpu = 2400,
* MemoryMb = 1200,
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-nomad/sdk/v2/go/nomad"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := nomad.NewQuoteSpecification(ctx, "prod_api", &nomad.QuoteSpecificationArgs{
* Name: pulumi.String("prod-api"),
* Description: pulumi.String("Production instances of backend API servers"),
* Limits: nomad.QuoteSpecificationLimitArray{
* &nomad.QuoteSpecificationLimitArgs{
* Region: pulumi.String("global"),
* RegionLimit: &nomad.QuoteSpecificationLimitRegionLimitArgs{
* Cpu: pulumi.Int(2400),
* MemoryMb: pulumi.Int(1200),
* },
* },
* },
* })
* 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.nomad.QuoteSpecification;
* import com.pulumi.nomad.QuoteSpecificationArgs;
* import com.pulumi.nomad.inputs.QuoteSpecificationLimitArgs;
* import com.pulumi.nomad.inputs.QuoteSpecificationLimitRegionLimitArgs;
* 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 prodApi = new QuoteSpecification("prodApi", QuoteSpecificationArgs.builder()
* .name("prod-api")
* .description("Production instances of backend API servers")
* .limits(QuoteSpecificationLimitArgs.builder()
* .region("global")
* .regionLimit(QuoteSpecificationLimitRegionLimitArgs.builder()
* .cpu(2400)
* .memoryMb(1200)
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* prodApi:
* type: nomad:QuoteSpecification
* name: prod_api
* properties:
* name: prod-api
* description: Production instances of backend API servers
* limits:
* - region: global
* regionLimit:
* cpu: 2400
* memoryMb: 1200
* ```
*
*/
public class QuoteSpecification internal constructor(
override val javaResource: com.pulumi.nomad.QuoteSpecification,
) : KotlinCustomResource(javaResource, QuoteSpecificationMapper) {
/**
* `(string: "")` - A description of the quota specification.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* `(block: )` - A block of quota limits to enforce. Can
* be repeated. See below for the structure of this block.
*/
public val limits: Output>
get() = javaResource.limits().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
toKotlin(args0)
})
})
})
/**
* `(string: )` - A unique name for the quota specification.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
}
public object QuoteSpecificationMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.nomad.QuoteSpecification::class == javaResource::class
override fun map(javaResource: Resource): QuoteSpecification = QuoteSpecification(
javaResource as
com.pulumi.nomad.QuoteSpecification,
)
}
/**
* @see [QuoteSpecification].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [QuoteSpecification].
*/
public suspend fun quoteSpecification(
name: String,
block: suspend QuoteSpecificationResourceBuilder.() -> Unit,
): QuoteSpecification {
val builder = QuoteSpecificationResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [QuoteSpecification].
* @param name The _unique_ name of the resulting resource.
*/
public fun quoteSpecification(name: String): QuoteSpecification {
val builder = QuoteSpecificationResourceBuilder()
builder.name(name)
return builder.build()
}