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

com.pulumi.azure.iotcentral.kotlin.Organization.kt Maven / Gradle / Ivy

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

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

    public var args: OrganizationArgs = OrganizationArgs()

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

/**
 * Manages an IoT Central Organization
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resource",
 *     location: "West Europe",
 * });
 * const exampleApplication = new azure.iotcentral.Application("example", {
 *     name: "example-iotcentral-app",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     subDomain: "example-iotcentral-app-subdomain",
 *     displayName: "example-iotcentral-app-display-name",
 *     sku: "ST1",
 *     template: "[email protected]",
 *     tags: {
 *         Foo: "Bar",
 *     },
 * });
 * const exampleParent = new azure.iotcentral.Organization("example_parent", {
 *     iotcentralApplicationId: exampleApplication.id,
 *     organizationId: "example-parent-organization-id",
 *     displayName: "Org example parent",
 * });
 * const exampleOrganization = new azure.iotcentral.Organization("example", {
 *     iotcentralApplicationId: exampleApplication.id,
 *     organizationId: "example-child-organization-id",
 *     displayName: "Org example",
 *     parentOrganizationId: exampleParent.organizationId,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resource",
 *     location="West Europe")
 * example_application = azure.iotcentral.Application("example",
 *     name="example-iotcentral-app",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     sub_domain="example-iotcentral-app-subdomain",
 *     display_name="example-iotcentral-app-display-name",
 *     sku="ST1",
 *     template="[email protected]",
 *     tags={
 *         "Foo": "Bar",
 *     })
 * example_parent = azure.iotcentral.Organization("example_parent",
 *     iotcentral_application_id=example_application.id,
 *     organization_id="example-parent-organization-id",
 *     display_name="Org example parent")
 * example_organization = azure.iotcentral.Organization("example",
 *     iotcentral_application_id=example_application.id,
 *     organization_id="example-child-organization-id",
 *     display_name="Org example",
 *     parent_organization_id=example_parent.organization_id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resource",
 *         Location = "West Europe",
 *     });
 *     var exampleApplication = new Azure.IotCentral.Application("example", new()
 *     {
 *         Name = "example-iotcentral-app",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         SubDomain = "example-iotcentral-app-subdomain",
 *         DisplayName = "example-iotcentral-app-display-name",
 *         Sku = "ST1",
 *         Template = "[email protected]",
 *         Tags =
 *         {
 *             { "Foo", "Bar" },
 *         },
 *     });
 *     var exampleParent = new Azure.IotCentral.Organization("example_parent", new()
 *     {
 *         IotcentralApplicationId = exampleApplication.Id,
 *         OrganizationId = "example-parent-organization-id",
 *         DisplayName = "Org example parent",
 *     });
 *     var exampleOrganization = new Azure.IotCentral.Organization("example", new()
 *     {
 *         IotcentralApplicationId = exampleApplication.Id,
 *         OrganizationId = "example-child-organization-id",
 *         DisplayName = "Org example",
 *         ParentOrganizationId = exampleParent.OrganizationId,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/iotcentral"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resource"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleApplication, err := iotcentral.NewApplication(ctx, "example", &iotcentral.ApplicationArgs{
 * 			Name:              pulumi.String("example-iotcentral-app"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			SubDomain:         pulumi.String("example-iotcentral-app-subdomain"),
 * 			DisplayName:       pulumi.String("example-iotcentral-app-display-name"),
 * 			Sku:               pulumi.String("ST1"),
 * 			Template:          pulumi.String("[email protected]"),
 * 			Tags: pulumi.StringMap{
 * 				"Foo": pulumi.String("Bar"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleParent, err := iotcentral.NewOrganization(ctx, "example_parent", &iotcentral.OrganizationArgs{
 * 			IotcentralApplicationId: exampleApplication.ID(),
 * 			OrganizationId:          pulumi.String("example-parent-organization-id"),
 * 			DisplayName:             pulumi.String("Org example parent"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = iotcentral.NewOrganization(ctx, "example", &iotcentral.OrganizationArgs{
 * 			IotcentralApplicationId: exampleApplication.ID(),
 * 			OrganizationId:          pulumi.String("example-child-organization-id"),
 * 			DisplayName:             pulumi.String("Org example"),
 * 			ParentOrganizationId:    exampleParent.OrganizationId,
 * 		})
 * 		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.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.iotcentral.Application;
 * import com.pulumi.azure.iotcentral.ApplicationArgs;
 * import com.pulumi.azure.iotcentral.Organization;
 * import com.pulumi.azure.iotcentral.OrganizationArgs;
 * 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 ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resource")
 *             .location("West Europe")
 *             .build());
 *         var exampleApplication = new Application("exampleApplication", ApplicationArgs.builder()
 *             .name("example-iotcentral-app")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .subDomain("example-iotcentral-app-subdomain")
 *             .displayName("example-iotcentral-app-display-name")
 *             .sku("ST1")
 *             .template("[email protected]")
 *             .tags(Map.of("Foo", "Bar"))
 *             .build());
 *         var exampleParent = new Organization("exampleParent", OrganizationArgs.builder()
 *             .iotcentralApplicationId(exampleApplication.id())
 *             .organizationId("example-parent-organization-id")
 *             .displayName("Org example parent")
 *             .build());
 *         var exampleOrganization = new Organization("exampleOrganization", OrganizationArgs.builder()
 *             .iotcentralApplicationId(exampleApplication.id())
 *             .organizationId("example-child-organization-id")
 *             .displayName("Org example")
 *             .parentOrganizationId(exampleParent.organizationId())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resource
 *       location: West Europe
 *   exampleApplication:
 *     type: azure:iotcentral:Application
 *     name: example
 *     properties:
 *       name: example-iotcentral-app
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       subDomain: example-iotcentral-app-subdomain
 *       displayName: example-iotcentral-app-display-name
 *       sku: ST1
 *       template: [email protected]
 *       tags:
 *         Foo: Bar
 *   exampleParent:
 *     type: azure:iotcentral:Organization
 *     name: example_parent
 *     properties:
 *       iotcentralApplicationId: ${exampleApplication.id}
 *       organizationId: example-parent-organization-id
 *       displayName: Org example parent
 *   exampleOrganization:
 *     type: azure:iotcentral:Organization
 *     name: example
 *     properties:
 *       iotcentralApplicationId: ${exampleApplication.id}
 *       organizationId: example-child-organization-id
 *       displayName: Org example
 *       parentOrganizationId: ${exampleParent.organizationId}
 * ```
 * 
 * ## Import
 * The IoT Central Organization can be imported using the `id`, e.g.
 * ```sh
 * $ pulumi import azure:iotcentral/organization:Organization example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.IoTCentral/iotApps/example/organizations/example
 * ```
 */
public class Organization internal constructor(
    override val javaResource: com.pulumi.azure.iotcentral.Organization,
) : KotlinCustomResource(javaResource, OrganizationMapper) {
    /**
     * Custom `display_name` for the organization.
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * The application `id`. Changing this forces a new resource to be created.
     */
    public val iotcentralApplicationId: Output
        get() = javaResource.iotcentralApplicationId().applyValue({ args0 -> args0 })

    /**
     * The ID of the organization. Changing this forces a new resource to be created.
     */
    public val organizationId: Output
        get() = javaResource.organizationId().applyValue({ args0 -> args0 })

    /**
     * The `organization_id` of the parent organization. Changing this forces a new resource to be created.
     */
    public val parentOrganizationId: Output?
        get() = javaResource.parentOrganizationId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object OrganizationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.iotcentral.Organization::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy