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

com.pulumi.aws.directconnect.kotlin.ConnectionAssociation.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

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

    public var args: ConnectionAssociationArgs = ConnectionAssociationArgs()

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

/**
 * Associates a Direct Connect Connection with a LAG.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.directconnect.Connection("example", {
 *     name: "example",
 *     bandwidth: "1Gbps",
 *     location: "EqSe2-EQ",
 * });
 * const exampleLinkAggregationGroup = new aws.directconnect.LinkAggregationGroup("example", {
 *     name: "example",
 *     connectionsBandwidth: "1Gbps",
 *     location: "EqSe2-EQ",
 * });
 * const exampleConnectionAssociation = new aws.directconnect.ConnectionAssociation("example", {
 *     connectionId: example.id,
 *     lagId: exampleLinkAggregationGroup.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.directconnect.Connection("example",
 *     name="example",
 *     bandwidth="1Gbps",
 *     location="EqSe2-EQ")
 * example_link_aggregation_group = aws.directconnect.LinkAggregationGroup("example",
 *     name="example",
 *     connections_bandwidth="1Gbps",
 *     location="EqSe2-EQ")
 * example_connection_association = aws.directconnect.ConnectionAssociation("example",
 *     connection_id=example.id,
 *     lag_id=example_link_aggregation_group.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.DirectConnect.Connection("example", new()
 *     {
 *         Name = "example",
 *         Bandwidth = "1Gbps",
 *         Location = "EqSe2-EQ",
 *     });
 *     var exampleLinkAggregationGroup = new Aws.DirectConnect.LinkAggregationGroup("example", new()
 *     {
 *         Name = "example",
 *         ConnectionsBandwidth = "1Gbps",
 *         Location = "EqSe2-EQ",
 *     });
 *     var exampleConnectionAssociation = new Aws.DirectConnect.ConnectionAssociation("example", new()
 *     {
 *         ConnectionId = example.Id,
 *         LagId = exampleLinkAggregationGroup.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/directconnect"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := directconnect.NewConnection(ctx, "example", &directconnect.ConnectionArgs{
 * 			Name:      pulumi.String("example"),
 * 			Bandwidth: pulumi.String("1Gbps"),
 * 			Location:  pulumi.String("EqSe2-EQ"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleLinkAggregationGroup, err := directconnect.NewLinkAggregationGroup(ctx, "example", &directconnect.LinkAggregationGroupArgs{
 * 			Name:                 pulumi.String("example"),
 * 			ConnectionsBandwidth: pulumi.String("1Gbps"),
 * 			Location:             pulumi.String("EqSe2-EQ"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = directconnect.NewConnectionAssociation(ctx, "example", &directconnect.ConnectionAssociationArgs{
 * 			ConnectionId: example.ID(),
 * 			LagId:        exampleLinkAggregationGroup.ID(),
 * 		})
 * 		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.directconnect.Connection;
 * import com.pulumi.aws.directconnect.ConnectionArgs;
 * import com.pulumi.aws.directconnect.LinkAggregationGroup;
 * import com.pulumi.aws.directconnect.LinkAggregationGroupArgs;
 * import com.pulumi.aws.directconnect.ConnectionAssociation;
 * import com.pulumi.aws.directconnect.ConnectionAssociationArgs;
 * 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 Connection("example", ConnectionArgs.builder()
 *             .name("example")
 *             .bandwidth("1Gbps")
 *             .location("EqSe2-EQ")
 *             .build());
 *         var exampleLinkAggregationGroup = new LinkAggregationGroup("exampleLinkAggregationGroup", LinkAggregationGroupArgs.builder()
 *             .name("example")
 *             .connectionsBandwidth("1Gbps")
 *             .location("EqSe2-EQ")
 *             .build());
 *         var exampleConnectionAssociation = new ConnectionAssociation("exampleConnectionAssociation", ConnectionAssociationArgs.builder()
 *             .connectionId(example.id())
 *             .lagId(exampleLinkAggregationGroup.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:directconnect:Connection
 *     properties:
 *       name: example
 *       bandwidth: 1Gbps
 *       location: EqSe2-EQ
 *   exampleLinkAggregationGroup:
 *     type: aws:directconnect:LinkAggregationGroup
 *     name: example
 *     properties:
 *       name: example
 *       connectionsBandwidth: 1Gbps
 *       location: EqSe2-EQ
 *   exampleConnectionAssociation:
 *     type: aws:directconnect:ConnectionAssociation
 *     name: example
 *     properties:
 *       connectionId: ${example.id}
 *       lagId: ${exampleLinkAggregationGroup.id}
 * ```
 * 
 */
public class ConnectionAssociation internal constructor(
    override val javaResource: com.pulumi.aws.directconnect.ConnectionAssociation,
) : KotlinCustomResource(javaResource, ConnectionAssociationMapper) {
    /**
     * The ID of the connection.
     */
    public val connectionId: Output
        get() = javaResource.connectionId().applyValue({ args0 -> args0 })

    /**
     * The ID of the LAG with which to associate the connection.
     */
    public val lagId: Output
        get() = javaResource.lagId().applyValue({ args0 -> args0 })
}

public object ConnectionAssociationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.directconnect.ConnectionAssociation::class == javaResource::class

    override fun map(javaResource: Resource): ConnectionAssociation =
        ConnectionAssociation(javaResource as com.pulumi.aws.directconnect.ConnectionAssociation)
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy