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

com.pulumi.gcp.compute.kotlin.Interconnect.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: 8.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.compute.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.compute.kotlin.outputs.InterconnectCircuitInfo
import com.pulumi.gcp.compute.kotlin.outputs.InterconnectExpectedOutage
import com.pulumi.gcp.compute.kotlin.outputs.InterconnectMacsec
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.compute.kotlin.outputs.InterconnectCircuitInfo.Companion.toKotlin as interconnectCircuitInfoToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InterconnectExpectedOutage.Companion.toKotlin as interconnectExpectedOutageToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.InterconnectMacsec.Companion.toKotlin as interconnectMacsecToKotlin

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

    public var args: InterconnectArgs = InterconnectArgs()

    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 InterconnectArgsBuilder.() -> Unit) {
        val builder = InterconnectArgsBuilder()
        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(): Interconnect {
        val builtJavaResource = com.pulumi.gcp.compute.Interconnect(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Interconnect(builtJavaResource)
    }
}

/**
 * Represents an Interconnect resource. The Interconnect resource is a dedicated connection between
 * Google's network and your on-premises network.
 * To get more information about Interconnect, see:
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/interconnects)
 * * How-to Guides
 *     * [Create a Dedicated Interconnect](https://cloud.google.com/network-connectivity/docs/interconnect/concepts/dedicated-overview)
 * ## Example Usage
 * ### Compute Interconnect Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = gcp.organizations.getProject({});
 * const example_interconnect = new gcp.compute.Interconnect("example-interconnect", {
 *     name: "example-interconnect",
 *     customerName: "example_customer",
 *     interconnectType: "DEDICATED",
 *     linkType: "LINK_TYPE_ETHERNET_10G_LR",
 *     location: project.then(project => `https://www.googleapis.com/compute/v1/projects/${project.name}/global/interconnectLocations/iad-zone1-1`),
 *     requestedLinkCount: 1,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.get_project()
 * example_interconnect = gcp.compute.Interconnect("example-interconnect",
 *     name="example-interconnect",
 *     customer_name="example_customer",
 *     interconnect_type="DEDICATED",
 *     link_type="LINK_TYPE_ETHERNET_10G_LR",
 *     location=f"https://www.googleapis.com/compute/v1/projects/{project.name}/global/interconnectLocations/iad-zone1-1",
 *     requested_link_count=1)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var example_interconnect = new Gcp.Compute.Interconnect("example-interconnect", new()
 *     {
 *         Name = "example-interconnect",
 *         CustomerName = "example_customer",
 *         InterconnectType = "DEDICATED",
 *         LinkType = "LINK_TYPE_ETHERNET_10G_LR",
 *         Location = $"https://www.googleapis.com/compute/v1/projects/{project.Apply(getProjectResult => getProjectResult.Name)}/global/interconnectLocations/iad-zone1-1",
 *         RequestedLinkCount = 1,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		project, err := organizations.LookupProject(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewInterconnect(ctx, "example-interconnect", &compute.InterconnectArgs{
 * 			Name:               pulumi.String("example-interconnect"),
 * 			CustomerName:       pulumi.String("example_customer"),
 * 			InterconnectType:   pulumi.String("DEDICATED"),
 * 			LinkType:           pulumi.String("LINK_TYPE_ETHERNET_10G_LR"),
 * 			Location:           pulumi.String(fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%v/global/interconnectLocations/iad-zone1-1", project.Name)),
 * 			RequestedLinkCount: pulumi.Int(1),
 * 		})
 * 		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.gcp.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.compute.Interconnect;
 * import com.pulumi.gcp.compute.InterconnectArgs;
 * 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 project = OrganizationsFunctions.getProject();
 *         var example_interconnect = new Interconnect("example-interconnect", InterconnectArgs.builder()
 *             .name("example-interconnect")
 *             .customerName("example_customer")
 *             .interconnectType("DEDICATED")
 *             .linkType("LINK_TYPE_ETHERNET_10G_LR")
 *             .location(String.format("https://www.googleapis.com/compute/v1/projects/%s/global/interconnectLocations/iad-zone1-1", project.applyValue(getProjectResult -> getProjectResult.name())))
 *             .requestedLinkCount(1)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example-interconnect:
 *     type: gcp:compute:Interconnect
 *     properties:
 *       name: example-interconnect
 *       customerName: example_customer
 *       interconnectType: DEDICATED
 *       linkType: LINK_TYPE_ETHERNET_10G_LR
 *       location: https://www.googleapis.com/compute/v1/projects/${project.name}/global/interconnectLocations/iad-zone1-1
 *       requestedLinkCount: 1
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Interconnect can be imported using any of these accepted formats:
 * * `projects/{{project}}/global/interconnects/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Interconnect can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:compute/interconnect:Interconnect default projects/{{project}}/global/interconnects/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/interconnect:Interconnect default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:compute/interconnect:Interconnect default {{name}}
 * ```
 */
public class Interconnect internal constructor(
    override val javaResource: com.pulumi.gcp.compute.Interconnect,
) : KotlinCustomResource(javaResource, InterconnectMapper) {
    /**
     * Administrative status of the interconnect. When this is set to true, the Interconnect is
     * functional and can carry traffic. When set to false, no packets can be carried over the
     * interconnect and no BGP routes are exchanged over it. By default, the status is set to true.
     */
    public val adminEnabled: Output?
        get() = javaResource.adminEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * interconnects.list of features available for this Interconnect connection. Can take the value:
     * MACSEC. If present then the Interconnect connection is provisioned on MACsec capable hardware
     * ports. If not present then the Interconnect connection is provisioned on non-MACsec capable
     * ports and MACsec isn't supported and enabling MACsec fails).
     */
    public val availableFeatures: Output>
        get() = javaResource.availableFeatures().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * A list of CircuitInfo objects, that describe the individual circuits in this LAG.
     * Structure is documented below.
     */
    public val circuitInfos: Output>
        get() = javaResource.circuitInfos().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    interconnectCircuitInfoToKotlin(args0)
                })
            })
        })

    /**
     * Creation timestamp in RFC3339 text format.
     */
    public val creationTimestamp: Output
        get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })

    /**
     * Customer name, to put in the Letter of Authorization as the party authorized to request a
     * crossconnect.
     * - - -
     */
    public val customerName: Output
        get() = javaResource.customerName().applyValue({ args0 -> args0 })

    /**
     * An optional description of this resource. Provide this property when you create the resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * A list of outages expected for this Interconnect.
     * Structure is documented below.
     */
    public val expectedOutages: Output>
        get() = javaResource.expectedOutages().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> interconnectExpectedOutageToKotlin(args0) })
            })
        })

    /**
     * IP address configured on the Google side of the Interconnect link.
     * This can be used only for ping tests.
     */
    public val googleIpAddress: Output
        get() = javaResource.googleIpAddress().applyValue({ args0 -> args0 })

    /**
     * Google reference ID to be used when raising support tickets with Google or otherwise to debug
     * backend connectivity issues.
     */
    public val googleReferenceId: Output
        get() = javaResource.googleReferenceId().applyValue({ args0 -> args0 })

    /**
     * A list of the URLs of all InterconnectAttachments configured to use this Interconnect.
     */
    public val interconnectAttachments: Output>
        get() = javaResource.interconnectAttachments().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            })
        })

    /**
     * Type of interconnect. Note that a value IT_PRIVATE has been deprecated in favor of DEDICATED.
     * Can take one of the following values:
     * - PARTNER: A partner-managed interconnection shared between customers though a partner.
     * - DEDICATED: A dedicated physical interconnection with the customer.
     * Possible values are: `DEDICATED`, `PARTNER`, `IT_PRIVATE`.
     */
    public val interconnectType: Output
        get() = javaResource.interconnectType().applyValue({ args0 -> args0 })

    /**
     * A fingerprint for the labels being applied to this Interconnect, which is essentially a hash
     * of the labels set used for optimistic locking. The fingerprint is initially generated by
     * Compute Engine and changes after every request to modify or update labels.
     * You must always provide an up-to-date fingerprint hash in order to update or change labels,
     * otherwise the request will fail with error 412 conditionNotMet.
     */
    public val labelFingerprint: Output
        get() = javaResource.labelFingerprint().applyValue({ args0 -> args0 })

    /**
     * Labels for this resource. These can only be added or modified by the setLabels
     * method. Each label key/value pair must comply with RFC1035. Label values may be empty.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Type of link requested. Note that this field indicates the speed of each of the links in the
     * bundle, not the speed of the entire bundle. Can take one of the following values:
     * - LINK_TYPE_ETHERNET_10G_LR: A 10G Ethernet with LR optics.
     * - LINK_TYPE_ETHERNET_100G_LR: A 100G Ethernet with LR optics.
     * Possible values are: `LINK_TYPE_ETHERNET_10G_LR`, `LINK_TYPE_ETHERNET_100G_LR`.
     */
    public val linkType: Output
        get() = javaResource.linkType().applyValue({ args0 -> args0 })

    /**
     * URL of the InterconnectLocation object that represents where this connection is to be provisioned.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Configuration that enables Media Access Control security (MACsec) on the Cloud
     * Interconnect connection between Google and your on-premises router.
     * Structure is documented below.
     */
    public val macsec: Output?
        get() = javaResource.macsec().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    interconnectMacsecToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Enable or disable MACsec on this Interconnect connection.
     * MACsec enablement fails if the MACsec object is not specified.
     */
    public val macsecEnabled: Output?
        get() = javaResource.macsecEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Name of the resource. Provided by the client when the resource is created. The name must be
     * 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters
     * long and match the regular expression `a-z?` which means the first
     * character must be a lowercase letter, and all following characters must be a dash,
     * lowercase letter, or digit, except the last character, which cannot be a dash.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Email address to contact the customer NOC for operations and maintenance notifications
     * regarding this Interconnect. If specified, this will be used for notifications in addition to
     * all other forms described, such as Cloud Monitoring logs alerting and Cloud Notifications.
     * This field is required for users who sign up for Cloud Interconnect using workforce identity
     * federation.
     */
    public val nocContactEmail: Output?
        get() = javaResource.nocContactEmail().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The current status of this Interconnect's functionality, which can take one of the following values:
     * - OS_ACTIVE: A valid Interconnect, which is turned up and is ready to use. Attachments may
     * be provisioned on this Interconnect.
     * - OS_UNPROVISIONED: An Interconnect that has not completed turnup. No attachments may be
     * provisioned on this Interconnect.
     * - OS_UNDER_MAINTENANCE: An Interconnect that is undergoing internal maintenance. No
     * attachments may be provisioned or updated on this Interconnect.
     */
    public val operationalStatus: Output
        get() = javaResource.operationalStatus().applyValue({ args0 -> args0 })

    /**
     * IP address configured on the customer side of the Interconnect link.
     * The customer should configure this IP address during turnup when prompted by Google NOC.
     * This can be used only for ping tests.
     */
    public val peerIpAddress: Output
        get() = javaResource.peerIpAddress().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Number of links actually provisioned in this interconnect.
     */
    public val provisionedLinkCount: Output
        get() = javaResource.provisionedLinkCount().applyValue({ args0 -> args0 })

    /**
     * The combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Indicates that this is a Cross-Cloud Interconnect. This field specifies the location outside
     * of Google's network that the interconnect is connected to.
     */
    public val remoteLocation: Output?
        get() = javaResource.remoteLocation().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * interconnects.list of features requested for this Interconnect connection. Options: MACSEC (
     * If specified then the connection is created on MACsec capable hardware ports. If not
     * specified, the default value is false, which allocates non-MACsec capable ports first if
     * available).
     * Each value may be one of: `MACSEC`.
     */
    public val requestedFeatures: Output>?
        get() = javaResource.requestedFeatures().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * Target number of physical links in the link bundle, as requested by the customer.
     */
    public val requestedLinkCount: Output
        get() = javaResource.requestedLinkCount().applyValue({ args0 -> args0 })

    /**
     * Reserved for future use.
     */
    public val satisfiesPzs: Output
        get() = javaResource.satisfiesPzs().applyValue({ args0 -> args0 })

    /**
     * (Output)
     * State of this notification. Note that the versions of this enum prefixed with "NS_" have
     * been deprecated in favor of the unprefixed values. Can take one of the following values:
     * - ACTIVE: This outage notification is active. The event could be in the past, present,
     * or future. See startTime and endTime for scheduling.
     * - CANCELLED: The outage associated with this notification was cancelled before the
     * outage was due to start.
     * - COMPLETED: The outage associated with this notification is complete.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })
}

public object InterconnectMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.compute.Interconnect::class == javaResource::class

    override fun map(javaResource: Resource): Interconnect = Interconnect(
        javaResource as
            com.pulumi.gcp.compute.Interconnect,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy