"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.RouterPeer = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * BGP information that must be configured into the routing stack to
 * establish BGP peering. This information must specify the peer ASN
 * and either the interface name, IP address, or peer IP address.
 * Please refer to RFC4273.
 *
 * To get more information about RouterBgpPeer, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/routers)
 * * How-to Guides
 *     * [Google Cloud Router](https://cloud.google.com/router/docs/)
 *
 * ## Example Usage
 *
 * ### Router Peer Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const peer = new gcp.compute.RouterPeer("peer", {
 *     name: "my-router-peer",
 *     router: "my-router",
 *     region: "us-central1",
 *     peerAsn: 65513,
 *     advertisedRoutePriority: 100,
 *     "interface": "interface-1",
 * });
 * ```
 * ### Router Peer Disabled
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const peer = new gcp.compute.RouterPeer("peer", {
 *     name: "my-router-peer",
 *     router: "my-router",
 *     region: "us-central1",
 *     peerIpAddress: "169.254.1.2",
 *     peerAsn: 65513,
 *     advertisedRoutePriority: 100,
 *     "interface": "interface-1",
 *     enable: false,
 * });
 * ```
 * ### Router Peer Bfd
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const peer = new gcp.compute.RouterPeer("peer", {
 *     name: "my-router-peer",
 *     router: "my-router",
 *     region: "us-central1",
 *     peerIpAddress: "169.254.1.2",
 *     peerAsn: 65513,
 *     advertisedRoutePriority: 100,
 *     "interface": "interface-1",
 *     bfd: {
 *         minReceiveInterval: 1000,
 *         minTransmitInterval: 1000,
 *         multiplier: 5,
 *         sessionInitializationMode: "ACTIVE",
 *     },
 * });
 * ```
 * ### Router Zero Custom Learend Route Priority
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const peer = new gcp.compute.RouterPeer("peer", {
 *     name: "my-router-peer",
 *     router: "my-router",
 *     region: "us-central1",
 *     "interface": "interface-1",
 *     peerAsn: 65513,
 *     customLearnedRoutePriority: 0,
 *     zeroCustomLearnedRoutePriority: true,
 * });
 * ```
 * ### Router Zero Advertised Route Priority
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const peer = new gcp.compute.RouterPeer("peer", {
 *     name: "my-router-peer",
 *     router: "my-router",
 *     region: "us-central1",
 *     "interface": "interface-1",
 *     peerAsn: 65513,
 *     advertisedRoutePriority: 0,
 *     zeroAdvertisedRoutePriority: true,
 * });
 * ```
 * ### Router Peer Router Appliance
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const network = new gcp.compute.Network("network", {
 *     name: "my-router-net",
 *     autoCreateSubnetworks: false,
 * });
 * const subnetwork = new gcp.compute.Subnetwork("subnetwork", {
 *     name: "my-router-sub",
 *     network: network.selfLink,
 *     ipCidrRange: "10.0.0.0/16",
 *     region: "us-central1",
 * });
 * const addrIntf = new gcp.compute.Address("addr_intf", {
 *     name: "my-router-addr-intf",
 *     region: subnetwork.region,
 *     subnetwork: subnetwork.id,
 *     addressType: "INTERNAL",
 * });
 * const addrIntfRedundant = new gcp.compute.Address("addr_intf_redundant", {
 *     name: "my-router-addr-intf-red",
 *     region: subnetwork.region,
 *     subnetwork: subnetwork.id,
 *     addressType: "INTERNAL",
 * });
 * const addrPeer = new gcp.compute.Address("addr_peer", {
 *     name: "my-router-addr-peer",
 *     region: subnetwork.region,
 *     subnetwork: subnetwork.id,
 *     addressType: "INTERNAL",
 * });
 * const instance = new gcp.compute.Instance("instance", {
 *     name: "router-appliance",
 *     zone: "us-central1-a",
 *     machineType: "e2-medium",
 *     canIpForward: true,
 *     bootDisk: {
 *         initializeParams: {
 *             image: "debian-cloud/debian-11",
 *         },
 *     },
 *     networkInterfaces: [{
 *         networkIp: addrPeer.address,
 *         subnetwork: subnetwork.selfLink,
 *     }],
 * });
 * const hub = new gcp.networkconnectivity.Hub("hub", {name: "my-router-hub"});
 * const spoke = new gcp.networkconnectivity.Spoke("spoke", {
 *     name: "my-router-spoke",
 *     location: subnetwork.region,
 *     hub: hub.id,
 *     linkedRouterApplianceInstances: {
 *         instances: [{
 *             virtualMachine: instance.selfLink,
 *             ipAddress: addrPeer.address,
 *         }],
 *         siteToSiteDataTransfer: false,
 *     },
 * });
 * const router = new gcp.compute.Router("router", {
 *     name: "my-router-router",
 *     region: subnetwork.region,
 *     network: network.selfLink,
 *     bgp: {
 *         asn: 64514,
 *     },
 * });
 * const interfaceRedundant = new gcp.compute.RouterInterface("interface_redundant", {
 *     name: "my-router-intf-red",
 *     region: router.region,
 *     router: router.name,
 *     subnetwork: subnetwork.selfLink,
 *     privateIpAddress: addrIntfRedundant.address,
 * });
 * const _interface = new gcp.compute.RouterInterface("interface", {
 *     name: "my-router-intf",
 *     region: router.region,
 *     router: router.name,
 *     subnetwork: subnetwork.selfLink,
 *     privateIpAddress: addrIntf.address,
 *     redundantInterface: interfaceRedundant.name,
 * });
 * const peer = new gcp.compute.RouterPeer("peer", {
 *     name: "my-router-peer",
 *     router: router.name,
 *     region: router.region,
 *     "interface": _interface.name,
 *     routerApplianceInstance: instance.selfLink,
 *     peerAsn: 65513,
 *     peerIpAddress: addrPeer.address,
 * });
 * ```
 *
 * ### Router Peer Md5 Authentication Key
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const foobar = new gcp.compute.RouterPeer("foobar", {
 *     name: "%s-peer",
 *     router: foobarGoogleComputeRouter.name,
 *     region: foobarGoogleComputeRouter.region,
 *     peerAsn: 65515,
 *     advertisedRoutePriority: 100,
 *     "interface": foobarGoogleComputeRouterInterface.name,
 *     peerIpAddress: "169.254.3.2",
 *     md5AuthenticationKey: {
 *         name: "%s-peer-key",
 *         key: "%s-peer-key-value",
 *     },
 * });
 * ```
 *
 * ### Router Peer Export And Import Policies
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const network = new gcp.compute.Network("network", {
 *     name: "my-router-net",
 *     autoCreateSubnetworks: false,
 * });
 * const subnetwork = new gcp.compute.Subnetwork("subnetwork", {
 *     name: "my-router-subnet",
 *     network: network.selfLink,
 *     ipCidrRange: "10.0.0.0/16",
 *     region: "us-central1",
 * });
 * const address = new gcp.compute.Address("address", {
 *     name: "my-router",
 *     region: subnetwork.region,
 * });
 * const vpnGateway = new gcp.compute.HaVpnGateway("vpn_gateway", {
 *     name: "my-router-gateway",
 *     network: network.selfLink,
 *     region: subnetwork.region,
 * });
 * const externalGateway = new gcp.compute.ExternalVpnGateway("external_gateway", {
 *     name: "my-router-external-gateway",
 *     redundancyType: "SINGLE_IP_INTERNALLY_REDUNDANT",
 *     description: "An externally managed VPN gateway",
 *     interfaces: [{
 *         id: 0,
 *         ipAddress: "8.8.8.8",
 *     }],
 * });
 * const router = new gcp.compute.Router("router", {
 *     name: "my-router",
 *     region: subnetwork.region,
 *     network: network.selfLink,
 *     bgp: {
 *         asn: 64514,
 *     },
 * });
 * const vpnTunnel = new gcp.compute.VPNTunnel("vpn_tunnel", {
 *     name: "my-router",
 *     region: subnetwork.region,
 *     vpnGateway: vpnGateway.id,
 *     peerExternalGateway: externalGateway.id,
 *     peerExternalGatewayInterface: 0,
 *     sharedSecret: "unguessable",
 *     router: router.name,
 *     vpnGatewayInterface: 0,
 * });
 * const routerInterface = new gcp.compute.RouterInterface("router_interface", {
 *     name: "my-router",
 *     router: router.name,
 *     region: router.region,
 *     vpnTunnel: vpnTunnel.name,
 * });
 * const rp_export = new gcp.compute.RouterRoutePolicy("rp-export", {
 *     name: "my-router-rp-export",
 *     router: router.name,
 *     region: router.region,
 *     type: "ROUTE_POLICY_TYPE_EXPORT",
 *     terms: [{
 *         priority: 2,
 *         match: {
 *             expression: "destination == '10.0.0.0/12'",
 *             title: "export_expression",
 *             description: "acceptance expression for export",
 *         },
 *         actions: [{
 *             expression: "accept()",
 *         }],
 *     }],
 * }, {
 *     dependsOn: [routerInterface],
 * });
 * const rp_import = new gcp.compute.RouterRoutePolicy("rp-import", {
 *     name: "my-router-rp-import",
 *     router: router.name,
 *     region: router.region,
 *     type: "ROUTE_POLICY_TYPE_IMPORT",
 *     terms: [{
 *         priority: 1,
 *         match: {
 *             expression: "destination == '10.0.0.0/12'",
 *             title: "import_expression",
 *             description: "acceptance expression for import",
 *         },
 *         actions: [{
 *             expression: "accept()",
 *         }],
 *     }],
 * }, {
 *     dependsOn: [
 *         routerInterface,
 *         rp_export,
 *     ],
 * });
 * const routerPeer = new gcp.compute.RouterPeer("router_peer", {
 *     name: "my-router-peer",
 *     router: router.name,
 *     region: router.region,
 *     peerAsn: 65515,
 *     advertisedRoutePriority: 100,
 *     "interface": routerInterface.name,
 *     md5AuthenticationKey: {
 *         name: "my-router-peer-key",
 *         key: "my-router-peer-key-value",
 *     },
 *     importPolicies: [rp_import.name],
 *     exportPolicies: [rp_export.name],
 * }, {
 *     dependsOn: [
 *         rp_export,
 *         rp_import,
 *         routerInterface,
 *     ],
 * });
 * ```
 *
 * ## Import
 *
 * RouterBgpPeer can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/regions/{{region}}/routers/{{router}}/{{name}}`
 *
 * * `{{project}}/{{region}}/{{router}}/{{name}}`
 *
 * * `{{region}}/{{router}}/{{name}}`
 *
 * * `{{router}}/{{name}}`
 *
 * When using the `pulumi import` command, RouterBgpPeer can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/routerPeer:RouterPeer default projects/{{project}}/regions/{{region}}/routers/{{router}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/routerPeer:RouterPeer default {{project}}/{{region}}/{{router}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/routerPeer:RouterPeer default {{region}}/{{router}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/routerPeer:RouterPeer default {{router}}/{{name}}
 * ```
 */
class RouterPeer extends pulumi.CustomResource {
    /**
     * Get an existing RouterPeer resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state Any extra arguments used during the lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, state, opts) {
        return new RouterPeer(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of RouterPeer.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === RouterPeer.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["advertiseMode"] = state?.advertiseMode;
            resourceInputs["advertisedGroups"] = state?.advertisedGroups;
            resourceInputs["advertisedIpRanges"] = state?.advertisedIpRanges;
            resourceInputs["advertisedRoutePriority"] = state?.advertisedRoutePriority;
            resourceInputs["bfd"] = state?.bfd;
            resourceInputs["customLearnedIpRanges"] = state?.customLearnedIpRanges;
            resourceInputs["customLearnedRoutePriority"] = state?.customLearnedRoutePriority;
            resourceInputs["enable"] = state?.enable;
            resourceInputs["enableIpv4"] = state?.enableIpv4;
            resourceInputs["enableIpv6"] = state?.enableIpv6;
            resourceInputs["exportPolicies"] = state?.exportPolicies;
            resourceInputs["importPolicies"] = state?.importPolicies;
            resourceInputs["interface"] = state?.interface;
            resourceInputs["ipAddress"] = state?.ipAddress;
            resourceInputs["ipv4NexthopAddress"] = state?.ipv4NexthopAddress;
            resourceInputs["ipv6NexthopAddress"] = state?.ipv6NexthopAddress;
            resourceInputs["isAdvertisedRoutePrioritySet"] = state?.isAdvertisedRoutePrioritySet;
            resourceInputs["isCustomLearnedPrioritySet"] = state?.isCustomLearnedPrioritySet;
            resourceInputs["managementType"] = state?.managementType;
            resourceInputs["md5AuthenticationKey"] = state?.md5AuthenticationKey;
            resourceInputs["name"] = state?.name;
            resourceInputs["peerAsn"] = state?.peerAsn;
            resourceInputs["peerIpAddress"] = state?.peerIpAddress;
            resourceInputs["peerIpv4NexthopAddress"] = state?.peerIpv4NexthopAddress;
            resourceInputs["peerIpv6NexthopAddress"] = state?.peerIpv6NexthopAddress;
            resourceInputs["project"] = state?.project;
            resourceInputs["region"] = state?.region;
            resourceInputs["router"] = state?.router;
            resourceInputs["routerApplianceInstance"] = state?.routerApplianceInstance;
            resourceInputs["zeroAdvertisedRoutePriority"] = state?.zeroAdvertisedRoutePriority;
            resourceInputs["zeroCustomLearnedRoutePriority"] = state?.zeroCustomLearnedRoutePriority;
        }
        else {
            const args = argsOrState;
            if (args?.interface === undefined && !opts.urn) {
                throw new Error("Missing required property 'interface'");
            }
            if (args?.peerAsn === undefined && !opts.urn) {
                throw new Error("Missing required property 'peerAsn'");
            }
            if (args?.router === undefined && !opts.urn) {
                throw new Error("Missing required property 'router'");
            }
            resourceInputs["advertiseMode"] = args?.advertiseMode;
            resourceInputs["advertisedGroups"] = args?.advertisedGroups;
            resourceInputs["advertisedIpRanges"] = args?.advertisedIpRanges;
            resourceInputs["advertisedRoutePriority"] = args?.advertisedRoutePriority;
            resourceInputs["bfd"] = args?.bfd;
            resourceInputs["customLearnedIpRanges"] = args?.customLearnedIpRanges;
            resourceInputs["customLearnedRoutePriority"] = args?.customLearnedRoutePriority;
            resourceInputs["enable"] = args?.enable;
            resourceInputs["enableIpv4"] = args?.enableIpv4;
            resourceInputs["enableIpv6"] = args?.enableIpv6;
            resourceInputs["exportPolicies"] = args?.exportPolicies;
            resourceInputs["importPolicies"] = args?.importPolicies;
            resourceInputs["interface"] = args?.interface;
            resourceInputs["ipAddress"] = args?.ipAddress;
            resourceInputs["ipv4NexthopAddress"] = args?.ipv4NexthopAddress;
            resourceInputs["ipv6NexthopAddress"] = args?.ipv6NexthopAddress;
            resourceInputs["md5AuthenticationKey"] = args?.md5AuthenticationKey;
            resourceInputs["name"] = args?.name;
            resourceInputs["peerAsn"] = args?.peerAsn;
            resourceInputs["peerIpAddress"] = args?.peerIpAddress;
            resourceInputs["peerIpv4NexthopAddress"] = args?.peerIpv4NexthopAddress;
            resourceInputs["peerIpv6NexthopAddress"] = args?.peerIpv6NexthopAddress;
            resourceInputs["project"] = args?.project;
            resourceInputs["region"] = args?.region;
            resourceInputs["router"] = args?.router;
            resourceInputs["routerApplianceInstance"] = args?.routerApplianceInstance;
            resourceInputs["zeroAdvertisedRoutePriority"] = args?.zeroAdvertisedRoutePriority;
            resourceInputs["zeroCustomLearnedRoutePriority"] = args?.zeroCustomLearnedRoutePriority;
            resourceInputs["isAdvertisedRoutePrioritySet"] = undefined /*out*/;
            resourceInputs["isCustomLearnedPrioritySet"] = undefined /*out*/;
            resourceInputs["managementType"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(RouterPeer.__pulumiType, name, resourceInputs, opts);
    }
}
exports.RouterPeer = RouterPeer;
/** @internal */
RouterPeer.__pulumiType = 'gcp:compute/routerPeer:RouterPeer';
//# sourceMappingURL=routerPeer.js.map