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

com.pulumi.aws.chime.kotlin.VoiceConnectorGroup.kt Maven / Gradle / Ivy

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

package com.pulumi.aws.chime.kotlin

import com.pulumi.aws.chime.kotlin.outputs.VoiceConnectorGroupConnector
import com.pulumi.aws.chime.kotlin.outputs.VoiceConnectorGroupConnector.Companion.toKotlin
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

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

    public var args: VoiceConnectorGroupArgs = VoiceConnectorGroupArgs()

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

/**
 * Creates an Amazon Chime Voice Connector group under the administrator's AWS account. You can associate Amazon Chime Voice Connectors with the Amazon Chime Voice Connector group by including VoiceConnectorItems in the request.
 * You can include Amazon Chime Voice Connectors from different AWS Regions in your group. This creates a fault tolerant mechanism for fallback in case of availability events.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const vc1 = new aws.chime.VoiceConnector("vc1", {
 *     name: "connector-test-1",
 *     requireEncryption: true,
 *     awsRegion: "us-east-1",
 * });
 * const vc2 = new aws.chime.VoiceConnector("vc2", {
 *     name: "connector-test-2",
 *     requireEncryption: true,
 *     awsRegion: "us-west-2",
 * });
 * const group = new aws.chime.VoiceConnectorGroup("group", {
 *     name: "test-group",
 *     connectors: [
 *         {
 *             voiceConnectorId: vc1.id,
 *             priority: 1,
 *         },
 *         {
 *             voiceConnectorId: vc2.id,
 *             priority: 3,
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * vc1 = aws.chime.VoiceConnector("vc1",
 *     name="connector-test-1",
 *     require_encryption=True,
 *     aws_region="us-east-1")
 * vc2 = aws.chime.VoiceConnector("vc2",
 *     name="connector-test-2",
 *     require_encryption=True,
 *     aws_region="us-west-2")
 * group = aws.chime.VoiceConnectorGroup("group",
 *     name="test-group",
 *     connectors=[
 *         {
 *             "voice_connector_id": vc1.id,
 *             "priority": 1,
 *         },
 *         {
 *             "voice_connector_id": vc2.id,
 *             "priority": 3,
 *         },
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var vc1 = new Aws.Chime.VoiceConnector("vc1", new()
 *     {
 *         Name = "connector-test-1",
 *         RequireEncryption = true,
 *         AwsRegion = "us-east-1",
 *     });
 *     var vc2 = new Aws.Chime.VoiceConnector("vc2", new()
 *     {
 *         Name = "connector-test-2",
 *         RequireEncryption = true,
 *         AwsRegion = "us-west-2",
 *     });
 *     var @group = new Aws.Chime.VoiceConnectorGroup("group", new()
 *     {
 *         Name = "test-group",
 *         Connectors = new[]
 *         {
 *             new Aws.Chime.Inputs.VoiceConnectorGroupConnectorArgs
 *             {
 *                 VoiceConnectorId = vc1.Id,
 *                 Priority = 1,
 *             },
 *             new Aws.Chime.Inputs.VoiceConnectorGroupConnectorArgs
 *             {
 *                 VoiceConnectorId = vc2.Id,
 *                 Priority = 3,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/chime"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		vc1, err := chime.NewVoiceConnector(ctx, "vc1", &chime.VoiceConnectorArgs{
 * 			Name:              pulumi.String("connector-test-1"),
 * 			RequireEncryption: pulumi.Bool(true),
 * 			AwsRegion:         pulumi.String("us-east-1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		vc2, err := chime.NewVoiceConnector(ctx, "vc2", &chime.VoiceConnectorArgs{
 * 			Name:              pulumi.String("connector-test-2"),
 * 			RequireEncryption: pulumi.Bool(true),
 * 			AwsRegion:         pulumi.String("us-west-2"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = chime.NewVoiceConnectorGroup(ctx, "group", &chime.VoiceConnectorGroupArgs{
 * 			Name: pulumi.String("test-group"),
 * 			Connectors: chime.VoiceConnectorGroupConnectorArray{
 * 				&chime.VoiceConnectorGroupConnectorArgs{
 * 					VoiceConnectorId: vc1.ID(),
 * 					Priority:         pulumi.Int(1),
 * 				},
 * 				&chime.VoiceConnectorGroupConnectorArgs{
 * 					VoiceConnectorId: vc2.ID(),
 * 					Priority:         pulumi.Int(3),
 * 				},
 * 			},
 * 		})
 * 		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.chime.VoiceConnector;
 * import com.pulumi.aws.chime.VoiceConnectorArgs;
 * import com.pulumi.aws.chime.VoiceConnectorGroup;
 * import com.pulumi.aws.chime.VoiceConnectorGroupArgs;
 * import com.pulumi.aws.chime.inputs.VoiceConnectorGroupConnectorArgs;
 * 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 vc1 = new VoiceConnector("vc1", VoiceConnectorArgs.builder()
 *             .name("connector-test-1")
 *             .requireEncryption(true)
 *             .awsRegion("us-east-1")
 *             .build());
 *         var vc2 = new VoiceConnector("vc2", VoiceConnectorArgs.builder()
 *             .name("connector-test-2")
 *             .requireEncryption(true)
 *             .awsRegion("us-west-2")
 *             .build());
 *         var group = new VoiceConnectorGroup("group", VoiceConnectorGroupArgs.builder()
 *             .name("test-group")
 *             .connectors(
 *                 VoiceConnectorGroupConnectorArgs.builder()
 *                     .voiceConnectorId(vc1.id())
 *                     .priority(1)
 *                     .build(),
 *                 VoiceConnectorGroupConnectorArgs.builder()
 *                     .voiceConnectorId(vc2.id())
 *                     .priority(3)
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   vc1:
 *     type: aws:chime:VoiceConnector
 *     properties:
 *       name: connector-test-1
 *       requireEncryption: true
 *       awsRegion: us-east-1
 *   vc2:
 *     type: aws:chime:VoiceConnector
 *     properties:
 *       name: connector-test-2
 *       requireEncryption: true
 *       awsRegion: us-west-2
 *   group:
 *     type: aws:chime:VoiceConnectorGroup
 *     properties:
 *       name: test-group
 *       connectors:
 *         - voiceConnectorId: ${vc1.id}
 *           priority: 1
 *         - voiceConnectorId: ${vc2.id}
 *           priority: 3
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import Configuration Recorder using the name. For example:
 * ```sh
 * $ pulumi import aws:chime/voiceConnectorGroup:VoiceConnectorGroup default example
 * ```
 */
public class VoiceConnectorGroup internal constructor(
    override val javaResource: com.pulumi.aws.chime.VoiceConnectorGroup,
) : KotlinCustomResource(javaResource, VoiceConnectorGroupMapper) {
    /**
     * The Amazon Chime Voice Connectors to route inbound calls to.
     */
    public val connectors: Output>?
        get() = javaResource.connectors().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> toKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The name of the Amazon Chime Voice Connector group.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })
}

public object VoiceConnectorGroupMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.chime.VoiceConnectorGroup::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy