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

com.pulumi.azure.graph.kotlin.ServicesAccount.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.graph.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
import kotlin.collections.Map

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

    public var args: ServicesAccountArgs = ServicesAccountArgs()

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

/**
 * Manages a Microsoft Graph Services Account.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as azuread from "@pulumi/azuread";
 * const example = new azuread.Application("example", {displayName: "example-app"});
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleServicesAccount = new azure.graph.ServicesAccount("example", {
 *     name: "example",
 *     resourceGroupName: exampleResourceGroup.name,
 *     applicationId: example.applicationId,
 *     tags: {
 *         environment: "Production",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_azuread as azuread
 * example = azuread.Application("example", display_name="example-app")
 * example_resource_group = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_services_account = azure.graph.ServicesAccount("example",
 *     name="example",
 *     resource_group_name=example_resource_group.name,
 *     application_id=example.application_id,
 *     tags={
 *         "environment": "Production",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using AzureAD = Pulumi.AzureAD;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new AzureAD.Application("example", new()
 *     {
 *         DisplayName = "example-app",
 *     });
 *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleServicesAccount = new Azure.Graph.ServicesAccount("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         ApplicationId = example.ApplicationId,
 *         Tags =
 *         {
 *             { "environment", "Production" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/graph"
 * 	"github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := azuread.NewApplication(ctx, "example", &azuread.ApplicationArgs{
 * 			DisplayName: pulumi.String("example-app"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = graph.NewServicesAccount(ctx, "example", &graph.ServicesAccountArgs{
 * 			Name:              pulumi.String("example"),
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			ApplicationId:     example.ApplicationId,
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("Production"),
 * 			},
 * 		})
 * 		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.azuread.Application;
 * import com.pulumi.azuread.ApplicationArgs;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.graph.ServicesAccount;
 * import com.pulumi.azure.graph.ServicesAccountArgs;
 * 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 Application("example", ApplicationArgs.builder()
 *             .displayName("example-app")
 *             .build());
 *         var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var exampleServicesAccount = new ServicesAccount("exampleServicesAccount", ServicesAccountArgs.builder()
 *             .name("example")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .applicationId(example.applicationId())
 *             .tags(Map.of("environment", "Production"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azuread:Application
 *     properties:
 *       displayName: example-app
 *   exampleResourceGroup:
 *     type: azure:core:ResourceGroup
 *     name: example
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleServicesAccount:
 *     type: azure:graph:ServicesAccount
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       applicationId: ${example.applicationId}
 *       tags:
 *         environment: Production
 * ```
 * 
 * ## Import
 * An existing Account can be imported into Terraform using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:graph/servicesAccount:ServicesAccount example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.GraphServices/accounts/account1
 * ```
 */
public class ServicesAccount internal constructor(
    override val javaResource: com.pulumi.azure.graph.ServicesAccount,
) : KotlinCustomResource(javaResource, ServicesAccountMapper) {
    /**
     * Customer owned application ID. Changing this forces a new Account to be created.
     */
    public val applicationId: Output
        get() = javaResource.applicationId().applyValue({ args0 -> args0 })

    /**
     * Billing Plan Id.
     */
    public val billingPlanId: Output
        get() = javaResource.billingPlanId().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of this Account. Changing this forces a new Account to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the Resource Group within which this Account should exist. Changing this forces a new Account to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags which should be assigned to the Account.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object ServicesAccountMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.graph.ServicesAccount::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy