Files
pulumi-incus/sdk/nodejs/networkPeer.ts

264 lines
8.9 KiB
TypeScript
Generated

// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as utilities from "./utilities";
/**
* ## # incus.NetworkPeer
*
* Incus allows creating peer routing relationships between two OVN networks. Using this method, traffic between the two
* networks can go directly from one OVN network to the other and thus stays within the OVN subsystem, rather than transiting
* through the uplink network.
*
* > The peer resource is exclusively compatible with OVN (Open Virtual Network).
*
* For more information, please refer to [How to create peer routing relationships](https://linuxcontainers.org/incus/docs/main/howto/network_ovn_peers/)
* in the official Incus documentation.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as incus from "@kiterun/incus";
*
* const lan0 = new incus.Network("lan0", {
* name: "lan0",
* type: "ovn",
* config: {},
* });
* const lan1 = new incus.Network("lan1", {
* name: "lan1",
* type: "ovn",
* config: {},
* });
* const lan0Lan1 = new incus.NetworkPeer("lan0_lan1", {
* name: "lab0-lan1",
* description: "A meaningful description",
* network: lan0.name,
* project: "default",
* targetNetwork: lan1.name,
* targetProject: "default",
* });
* const lan1Lan0 = new incus.NetworkPeer("lan1_lan0", {
* name: "lab1-lan0",
* description: "A meaningful description",
* network: lan1.name,
* project: "default",
* targetNetwork: lan0.name,
* targetProject: "default",
* });
* ```
*/
export class NetworkPeer extends pulumi.CustomResource {
/**
* Get an existing NetworkPeer 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.
*/
public static get(
name: string,
id: pulumi.Input<pulumi.ID>,
state?: NetworkPeerState,
opts?: pulumi.CustomResourceOptions,
): NetworkPeer {
return new NetworkPeer(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = "incus:index/networkPeer:NetworkPeer";
/**
* Returns true if the given object is an instance of NetworkPeer. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is NetworkPeer {
if (obj === undefined || obj === null) {
return false;
}
return obj["__pulumiType"] === NetworkPeer.__pulumiType;
}
/**
* *Optional* - Configuration options as key/value pairs (only user.* custom keys supported)
*/
declare public readonly config: pulumi.Output<{ [key: string]: string }>;
/**
* *Optional* - Description of the network peering
*/
declare public readonly description: pulumi.Output<string>;
/**
* **required** - Name of the network peering on the local network
*/
declare public readonly name: pulumi.Output<string>;
/**
* **Required** - Name of the local network.
*/
declare public readonly network: pulumi.Output<string | undefined>;
/**
* *Optional* - Name of the project where the network is located.
*/
declare public readonly project: pulumi.Output<string>;
/**
* *Optional* - The remote in which the resource will be created. If
* not provided, the provider's default remote will be used.
*/
declare public readonly remote: pulumi.Output<string | undefined>;
declare public readonly /*out*/ status: pulumi.Output<string>;
declare public readonly targetIntegration: pulumi.Output<string>;
/**
* **required** - Which network to create a peering with (required at create time for local peers)
*/
declare public readonly targetNetwork: pulumi.Output<string>;
/**
* *Optional* - Which project the target network exists in (required at create time for local peers)
*/
declare public readonly targetProject: pulumi.Output<string>;
/**
* *Optional* - Type of network peering
*/
declare public readonly type: pulumi.Output<string>;
/**
* Create a NetworkPeer resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: NetworkPeerArgs, opts?: pulumi.CustomResourceOptions);
constructor(
name: string,
argsOrState?: NetworkPeerArgs | NetworkPeerState,
opts?: pulumi.CustomResourceOptions,
) {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState as NetworkPeerState | undefined;
resourceInputs["config"] = state?.config;
resourceInputs["description"] = state?.description;
resourceInputs["name"] = state?.name;
resourceInputs["network"] = state?.network;
resourceInputs["project"] = state?.project;
resourceInputs["remote"] = state?.remote;
resourceInputs["status"] = state?.status;
resourceInputs["targetIntegration"] = state?.targetIntegration;
resourceInputs["targetNetwork"] = state?.targetNetwork;
resourceInputs["targetProject"] = state?.targetProject;
resourceInputs["type"] = state?.type;
} else {
const args = argsOrState as NetworkPeerArgs | undefined;
if (args?.name === undefined && !opts.urn) {
throw new Error("Missing required property 'name'");
}
resourceInputs["config"] = args?.config;
resourceInputs["description"] = args?.description;
resourceInputs["name"] = args?.name;
resourceInputs["network"] = args?.network;
resourceInputs["project"] = args?.project ?? "default";
resourceInputs["remote"] = args?.remote;
resourceInputs["targetIntegration"] = args?.targetIntegration;
resourceInputs["targetNetwork"] = args?.targetNetwork;
resourceInputs["targetProject"] = args?.targetProject;
resourceInputs["type"] = args?.type;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NetworkPeer.__pulumiType, name, resourceInputs, opts);
}
}
/**
* Input properties used for looking up and filtering NetworkPeer resources.
*/
export interface NetworkPeerState {
/**
* *Optional* - Configuration options as key/value pairs (only user.* custom keys supported)
*/
config?: pulumi.Input<{ [key: string]: pulumi.Input<string> }>;
/**
* *Optional* - Description of the network peering
*/
description?: pulumi.Input<string>;
/**
* **required** - Name of the network peering on the local network
*/
name?: pulumi.Input<string>;
/**
* **Required** - Name of the local network.
*/
network?: pulumi.Input<string>;
/**
* *Optional* - Name of the project where the network is located.
*/
project?: pulumi.Input<string>;
/**
* *Optional* - The remote in which the resource will be created. If
* not provided, the provider's default remote will be used.
*/
remote?: pulumi.Input<string>;
status?: pulumi.Input<string>;
targetIntegration?: pulumi.Input<string>;
/**
* **required** - Which network to create a peering with (required at create time for local peers)
*/
targetNetwork?: pulumi.Input<string>;
/**
* *Optional* - Which project the target network exists in (required at create time for local peers)
*/
targetProject?: pulumi.Input<string>;
/**
* *Optional* - Type of network peering
*/
type?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a NetworkPeer resource.
*/
export interface NetworkPeerArgs {
/**
* *Optional* - Configuration options as key/value pairs (only user.* custom keys supported)
*/
config?: pulumi.Input<{ [key: string]: pulumi.Input<string> }>;
/**
* *Optional* - Description of the network peering
*/
description?: pulumi.Input<string>;
/**
* **required** - Name of the network peering on the local network
*/
name: pulumi.Input<string>;
/**
* **Required** - Name of the local network.
*/
network?: pulumi.Input<string>;
/**
* *Optional* - Name of the project where the network is located.
*/
project?: pulumi.Input<string>;
/**
* *Optional* - The remote in which the resource will be created. If
* not provided, the provider's default remote will be used.
*/
remote?: pulumi.Input<string>;
targetIntegration?: pulumi.Input<string>;
/**
* **required** - Which network to create a peering with (required at create time for local peers)
*/
targetNetwork?: pulumi.Input<string>;
/**
* *Optional* - Which project the target network exists in (required at create time for local peers)
*/
targetProject?: pulumi.Input<string>;
/**
* *Optional* - Type of network peering
*/
type?: pulumi.Input<string>;
}