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

com.pulumi.azure.lighthouse.kotlin.Assignment.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.lighthouse.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 [Assignment].
 */
@PulumiTagMarker
public class AssignmentResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: AssignmentArgs = AssignmentArgs()

    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 AssignmentArgsBuilder.() -> Unit) {
        val builder = AssignmentArgsBuilder()
        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(): Assignment {
        val builtJavaResource = com.pulumi.azure.lighthouse.Assignment(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Assignment(builtJavaResource)
    }
}

/**
 * Manages a [Lighthouse](https://docs.microsoft.com/azure/lighthouse) Assignment to a subscription, or to a resource group.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const primary = azure.core.getSubscription({});
 * const example = new azure.lighthouse.Assignment("example", {
 *     scope: primary.then(primary => primary.id),
 *     lighthouseDefinitionId: "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ManagedServices/registrationDefinitions/00000000-0000-0000-0000-000000000000",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * primary = azure.core.get_subscription()
 * example = azure.lighthouse.Assignment("example",
 *     scope=primary.id,
 *     lighthouse_definition_id="/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ManagedServices/registrationDefinitions/00000000-0000-0000-0000-000000000000")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var primary = Azure.Core.GetSubscription.Invoke();
 *     var example = new Azure.Lighthouse.Assignment("example", new()
 *     {
 *         Scope = primary.Apply(getSubscriptionResult => getSubscriptionResult.Id),
 *         LighthouseDefinitionId = "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ManagedServices/registrationDefinitions/00000000-0000-0000-0000-000000000000",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/lighthouse"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		primary, err := core.LookupSubscription(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = lighthouse.NewAssignment(ctx, "example", &lighthouse.AssignmentArgs{
 * 			Scope:                  pulumi.String(primary.Id),
 * 			LighthouseDefinitionId: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ManagedServices/registrationDefinitions/00000000-0000-0000-0000-000000000000"),
 * 		})
 * 		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.azure.core.CoreFunctions;
 * import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
 * import com.pulumi.azure.lighthouse.Assignment;
 * import com.pulumi.azure.lighthouse.AssignmentArgs;
 * 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) {
 *         final var primary = CoreFunctions.getSubscription();
 *         var example = new Assignment("example", AssignmentArgs.builder()
 *             .scope(primary.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
 *             .lighthouseDefinitionId("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ManagedServices/registrationDefinitions/00000000-0000-0000-0000-000000000000")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:lighthouse:Assignment
 *     properties:
 *       scope: ${primary.id}
 *       lighthouseDefinitionId: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ManagedServices/registrationDefinitions/00000000-0000-0000-0000-000000000000
 * variables:
 *   primary:
 *     fn::invoke:
 *       Function: azure:core:getSubscription
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Lighthouse Assignments can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:lighthouse/assignment:Assignment example /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ManagedServices/registrationAssignments/00000000-0000-0000-0000-000000000000
 * ```
 */
public class Assignment internal constructor(
    override val javaResource: com.pulumi.azure.lighthouse.Assignment,
) : KotlinCustomResource(javaResource, AssignmentMapper) {
    /**
     * A Fully qualified path of the lighthouse definition, such as `/subscriptions/0afefe50-734e-4610-8c82-a144aff49dea/providers/Microsoft.ManagedServices/registrationDefinitions/26c128c2-fefa-4340-9bb1-8e081c90ada2`. Changing this forces a new resource to be created.
     */
    public val lighthouseDefinitionId: Output
        get() = javaResource.lighthouseDefinitionId().applyValue({ args0 -> args0 })

    /**
     * A unique UUID/GUID which identifies this lighthouse assignment- one will be generated if not specified. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The scope at which the Lighthouse Assignment applies too, such as `/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333` or `/subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup`. Changing this forces a new resource to be created.
     */
    public val scope: Output
        get() = javaResource.scope().applyValue({ args0 -> args0 })
}

public object AssignmentMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.lighthouse.Assignment::class == javaResource::class

    override fun map(javaResource: Resource): Assignment = Assignment(
        javaResource as
            com.pulumi.azure.lighthouse.Assignment,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy