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

com.pulumi.aws.licensemanager.kotlin.LicenseConfiguration.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.licensemanager.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.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map

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

    public var args: LicenseConfigurationArgs = LicenseConfigurationArgs()

    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 LicenseConfigurationArgsBuilder.() -> Unit) {
        val builder = LicenseConfigurationArgsBuilder()
        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(): LicenseConfiguration {
        val builtJavaResource =
            com.pulumi.aws.licensemanager.LicenseConfiguration(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return LicenseConfiguration(builtJavaResource)
    }
}

/**
 * Provides a License Manager license configuration resource.
 * > **Note:** Removing the `license_count` attribute is not supported by the License Manager API.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.licensemanager.LicenseConfiguration("example", {
 *     name: "Example",
 *     description: "Example",
 *     licenseCount: 10,
 *     licenseCountHardLimit: true,
 *     licenseCountingType: "Socket",
 *     licenseRules: ["#minimumSockets=2"],
 *     tags: {
 *         foo: "barr",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.licensemanager.LicenseConfiguration("example",
 *     name="Example",
 *     description="Example",
 *     license_count=10,
 *     license_count_hard_limit=True,
 *     license_counting_type="Socket",
 *     license_rules=["#minimumSockets=2"],
 *     tags={
 *         "foo": "barr",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.LicenseManager.LicenseConfiguration("example", new()
 *     {
 *         Name = "Example",
 *         Description = "Example",
 *         LicenseCount = 10,
 *         LicenseCountHardLimit = true,
 *         LicenseCountingType = "Socket",
 *         LicenseRules = new[]
 *         {
 *             "#minimumSockets=2",
 *         },
 *         Tags =
 *         {
 *             { "foo", "barr" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/licensemanager"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := licensemanager.NewLicenseConfiguration(ctx, "example", &licensemanager.LicenseConfigurationArgs{
 * 			Name:                  pulumi.String("Example"),
 * 			Description:           pulumi.String("Example"),
 * 			LicenseCount:          pulumi.Int(10),
 * 			LicenseCountHardLimit: pulumi.Bool(true),
 * 			LicenseCountingType:   pulumi.String("Socket"),
 * 			LicenseRules: pulumi.StringArray{
 * 				pulumi.String("#minimumSockets=2"),
 * 			},
 * 			Tags: pulumi.StringMap{
 * 				"foo": pulumi.String("barr"),
 * 			},
 * 		})
 * 		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.aws.licensemanager.LicenseConfiguration;
 * import com.pulumi.aws.licensemanager.LicenseConfigurationArgs;
 * 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 example = new LicenseConfiguration("example", LicenseConfigurationArgs.builder()
 *             .name("Example")
 *             .description("Example")
 *             .licenseCount(10)
 *             .licenseCountHardLimit(true)
 *             .licenseCountingType("Socket")
 *             .licenseRules("#minimumSockets=2")
 *             .tags(Map.of("foo", "barr"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:licensemanager:LicenseConfiguration
 *     properties:
 *       name: Example
 *       description: Example
 *       licenseCount: 10
 *       licenseCountHardLimit: true
 *       licenseCountingType: Socket
 *       licenseRules:
 *         - '#minimumSockets=2'
 *       tags:
 *         foo: barr
 * ```
 * 
 * ## Rules
 * License rules should be in the format of `#RuleType=RuleValue`. Supported rule types:
 * * `minimumVcpus` - Resource must have minimum vCPU count in order to use the license. Default: 1
 * * `maximumVcpus` - Resource must have maximum vCPU count in order to use the license. Default: unbounded, limit: 10000
 * * `minimumCores` - Resource must have minimum core count in order to use the license. Default: 1
 * * `maximumCores` - Resource must have maximum core count in order to use the license. Default: unbounded, limit: 10000
 * * `minimumSockets` - Resource must have minimum socket count in order to use the license. Default: 1
 * * `maximumSockets` - Resource must have maximum socket count in order to use the license. Default: unbounded, limit: 10000
 * * `allowedTenancy` - Defines where the license can be used. If set, restricts license usage to selected tenancies. Specify a comma delimited list of `EC2-Default`, `EC2-DedicatedHost`, `EC2-DedicatedInstance`
 * ## Import
 * Using `pulumi import`, import license configurations using the `id`. For example:
 * ```sh
 * $ pulumi import aws:licensemanager/licenseConfiguration:LicenseConfiguration example arn:aws:license-manager:eu-west-1:123456789012:license-configuration:lic-0123456789abcdef0123456789abcdef
 * ```
 */
public class LicenseConfiguration internal constructor(
    override val javaResource: com.pulumi.aws.licensemanager.LicenseConfiguration,
) : KotlinCustomResource(javaResource, LicenseConfigurationMapper) {
    /**
     * The license configuration ARN.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * Description of the license configuration.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Number of licenses managed by the license configuration.
     */
    public val licenseCount: Output?
        get() = javaResource.licenseCount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Sets the number of available licenses as a hard limit.
     */
    public val licenseCountHardLimit: Output?
        get() = javaResource.licenseCountHardLimit().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Dimension to use to track license inventory. Specify either `vCPU`, `Instance`, `Core` or `Socket`.
     */
    public val licenseCountingType: Output
        get() = javaResource.licenseCountingType().applyValue({ args0 -> args0 })

    /**
     * Array of configured License Manager rules.
     */
    public val licenseRules: Output>?
        get() = javaResource.licenseRules().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * Name of the license configuration.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Account ID of the owner of the license configuration.
     */
    public val ownerAccountId: Output
        get() = javaResource.ownerAccountId().applyValue({ args0 -> args0 })

    /**
     * A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
     */
    @Deprecated(
        message = """
  Please use `tags` instead.
  """,
    )
    public val tagsAll: Output>
        get() = javaResource.tagsAll().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })
}

public object LicenseConfigurationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.licensemanager.LicenseConfiguration::class == javaResource::class

    override fun map(javaResource: Resource): LicenseConfiguration = LicenseConfiguration(
        javaResource
            as com.pulumi.aws.licensemanager.LicenseConfiguration,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy