Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.lighthouse.kotlin.Definition.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.lighthouse.kotlin
import com.pulumi.azure.lighthouse.kotlin.outputs.DefinitionAuthorization
import com.pulumi.azure.lighthouse.kotlin.outputs.DefinitionEligibleAuthorization
import com.pulumi.azure.lighthouse.kotlin.outputs.DefinitionPlan
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
import kotlin.collections.List
import com.pulumi.azure.lighthouse.kotlin.outputs.DefinitionAuthorization.Companion.toKotlin as definitionAuthorizationToKotlin
import com.pulumi.azure.lighthouse.kotlin.outputs.DefinitionEligibleAuthorization.Companion.toKotlin as definitionEligibleAuthorizationToKotlin
import com.pulumi.azure.lighthouse.kotlin.outputs.DefinitionPlan.Companion.toKotlin as definitionPlanToKotlin
/**
* Builder for [Definition].
*/
@PulumiTagMarker
public class DefinitionResourceBuilder internal constructor() {
public var name: String? = null
public var args: DefinitionArgs = DefinitionArgs()
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 DefinitionArgsBuilder.() -> Unit) {
val builder = DefinitionArgsBuilder()
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(): Definition {
val builtJavaResource = com.pulumi.azure.lighthouse.Definition(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Definition(builtJavaResource)
}
}
/**
* Manages a [Lighthouse](https://docs.microsoft.com/azure/lighthouse) Definition.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const contributor = azure.authorization.getRoleDefinition({
* roleDefinitionId: "b24988ac-6180-42a0-ab88-20f7382dd24c",
* });
* const example = new azure.lighthouse.Definition("example", {
* name: "Sample definition",
* description: "This is a lighthouse definition created IaC",
* managingTenantId: "00000000-0000-0000-0000-000000000000",
* scope: "/subscriptions/00000000-0000-0000-0000-000000000000",
* authorizations: [{
* principalId: "00000000-0000-0000-0000-000000000000",
* roleDefinitionId: contributor.then(contributor => contributor.roleDefinitionId),
* principalDisplayName: "Tier 1 Support",
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* contributor = azure.authorization.get_role_definition(role_definition_id="b24988ac-6180-42a0-ab88-20f7382dd24c")
* example = azure.lighthouse.Definition("example",
* name="Sample definition",
* description="This is a lighthouse definition created IaC",
* managing_tenant_id="00000000-0000-0000-0000-000000000000",
* scope="/subscriptions/00000000-0000-0000-0000-000000000000",
* authorizations=[{
* "principal_id": "00000000-0000-0000-0000-000000000000",
* "role_definition_id": contributor.role_definition_id,
* "principal_display_name": "Tier 1 Support",
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var contributor = Azure.Authorization.GetRoleDefinition.Invoke(new()
* {
* RoleDefinitionId = "b24988ac-6180-42a0-ab88-20f7382dd24c",
* });
* var example = new Azure.Lighthouse.Definition("example", new()
* {
* Name = "Sample definition",
* Description = "This is a lighthouse definition created IaC",
* ManagingTenantId = "00000000-0000-0000-0000-000000000000",
* Scope = "/subscriptions/00000000-0000-0000-0000-000000000000",
* Authorizations = new[]
* {
* new Azure.Lighthouse.Inputs.DefinitionAuthorizationArgs
* {
* PrincipalId = "00000000-0000-0000-0000-000000000000",
* RoleDefinitionId = contributor.Apply(getRoleDefinitionResult => getRoleDefinitionResult.RoleDefinitionId),
* PrincipalDisplayName = "Tier 1 Support",
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
* "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 {
* contributor, err := authorization.LookupRoleDefinition(ctx, &authorization.LookupRoleDefinitionArgs{
* RoleDefinitionId: pulumi.StringRef("b24988ac-6180-42a0-ab88-20f7382dd24c"),
* }, nil)
* if err != nil {
* return err
* }
* _, err = lighthouse.NewDefinition(ctx, "example", &lighthouse.DefinitionArgs{
* Name: pulumi.String("Sample definition"),
* Description: pulumi.String("This is a lighthouse definition created IaC"),
* ManagingTenantId: pulumi.String("00000000-0000-0000-0000-000000000000"),
* Scope: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000"),
* Authorizations: lighthouse.DefinitionAuthorizationArray{
* &lighthouse.DefinitionAuthorizationArgs{
* PrincipalId: pulumi.String("00000000-0000-0000-0000-000000000000"),
* RoleDefinitionId: pulumi.String(contributor.RoleDefinitionId),
* PrincipalDisplayName: pulumi.String("Tier 1 Support"),
* },
* },
* })
* 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.authorization.AuthorizationFunctions;
* import com.pulumi.azure.authorization.inputs.GetRoleDefinitionArgs;
* import com.pulumi.azure.lighthouse.Definition;
* import com.pulumi.azure.lighthouse.DefinitionArgs;
* import com.pulumi.azure.lighthouse.inputs.DefinitionAuthorizationArgs;
* 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 contributor = AuthorizationFunctions.getRoleDefinition(GetRoleDefinitionArgs.builder()
* .roleDefinitionId("b24988ac-6180-42a0-ab88-20f7382dd24c")
* .build());
* var example = new Definition("example", DefinitionArgs.builder()
* .name("Sample definition")
* .description("This is a lighthouse definition created IaC")
* .managingTenantId("00000000-0000-0000-0000-000000000000")
* .scope("/subscriptions/00000000-0000-0000-0000-000000000000")
* .authorizations(DefinitionAuthorizationArgs.builder()
* .principalId("00000000-0000-0000-0000-000000000000")
* .roleDefinitionId(contributor.applyValue(getRoleDefinitionResult -> getRoleDefinitionResult.roleDefinitionId()))
* .principalDisplayName("Tier 1 Support")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:lighthouse:Definition
* properties:
* name: Sample definition
* description: This is a lighthouse definition created IaC
* managingTenantId: 00000000-0000-0000-0000-000000000000
* scope: /subscriptions/00000000-0000-0000-0000-000000000000
* authorizations:
* - principalId: 00000000-0000-0000-0000-000000000000
* roleDefinitionId: ${contributor.roleDefinitionId}
* principalDisplayName: Tier 1 Support
* variables:
* contributor:
* fn::invoke:
* Function: azure:authorization:getRoleDefinition
* Arguments:
* roleDefinitionId: b24988ac-6180-42a0-ab88-20f7382dd24c
* ```
*
* ## Import
* Lighthouse Definitions can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:lighthouse/definition:Definition example /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ManagedServices/registrationDefinitions/00000000-0000-0000-0000-000000000000
* ```
*/
public class Definition internal constructor(
override val javaResource: com.pulumi.azure.lighthouse.Definition,
) : KotlinCustomResource(javaResource, DefinitionMapper) {
/**
* An `authorization` block as defined below.
*/
public val authorizations: Output>
get() = javaResource.authorizations().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> definitionAuthorizationToKotlin(args0) })
})
})
/**
* A description of the Lighthouse Definition.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* An `eligible_authorization` block as defined below.
*/
public val eligibleAuthorizations: Output>?
get() = javaResource.eligibleAuthorizations().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
definitionEligibleAuthorizationToKotlin(args0)
})
})
}).orElse(null)
})
/**
* A unique UUID/GUID which identifies this lighthouse definition - one will be generated if not specified. Changing this forces a new resource to be created.
*/
public val lighthouseDefinitionId: Output
get() = javaResource.lighthouseDefinitionId().applyValue({ args0 -> args0 })
/**
* The ID of the managing tenant. Changing this forces a new resource to be created.
*/
public val managingTenantId: Output
get() = javaResource.managingTenantId().applyValue({ args0 -> args0 })
/**
* The name of the Lighthouse Definition. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* A `plan` block as defined below.
*/
public val plan: Output?
get() = javaResource.plan().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
definitionPlanToKotlin(args0)
})
}).orElse(null)
})
/**
* The ID of the managed subscription. Changing this forces a new resource to be created.
*/
public val scope: Output
get() = javaResource.scope().applyValue({ args0 -> args0 })
}
public object DefinitionMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.lighthouse.Definition::class == javaResource::class
override fun map(javaResource: Resource): Definition = Definition(
javaResource as
com.pulumi.azure.lighthouse.Definition,
)
}
/**
* @see [Definition].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Definition].
*/
public suspend fun definition(name: String, block: suspend DefinitionResourceBuilder.() -> Unit): Definition {
val builder = DefinitionResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Definition].
* @param name The _unique_ name of the resulting resource.
*/
public fun definition(name: String): Definition {
val builder = DefinitionResourceBuilder()
builder.name(name)
return builder.build()
}