Files
pulumi-incus/sdk/go/incus/networkPeer.go
2025-12-08 10:47:09 -05:00

432 lines
16 KiB
Go
Generated

// Code generated by pulumi-language-go DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package incus
import (
"context"
"reflect"
"errors"
"git.kalinow.ski/kiterun/pulumi-incus/sdk/go/incus/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## # 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
//
// ```go
// package main
//
// import (
//
// "git.kalinow.ski/kiterun/pulumi-incus/sdk/go/incus"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// lan0, err := incus.NewNetwork(ctx, "lan0", &incus.NetworkArgs{
// Name: pulumi.String("lan0"),
// Type: pulumi.String("ovn"),
// Config: pulumi.StringMap{},
// })
// if err != nil {
// return err
// }
// lan1, err := incus.NewNetwork(ctx, "lan1", &incus.NetworkArgs{
// Name: pulumi.String("lan1"),
// Type: pulumi.String("ovn"),
// Config: pulumi.StringMap{},
// })
// if err != nil {
// return err
// }
// _, err = incus.NewNetworkPeer(ctx, "lan0_lan1", &incus.NetworkPeerArgs{
// Name: pulumi.String("lab0-lan1"),
// Description: pulumi.String("A meaningful description"),
// Network: lan0.Name,
// Project: pulumi.String("default"),
// TargetNetwork: lan1.Name,
// TargetProject: pulumi.String("default"),
// })
// if err != nil {
// return err
// }
// _, err = incus.NewNetworkPeer(ctx, "lan1_lan0", &incus.NetworkPeerArgs{
// Name: pulumi.String("lab1-lan0"),
// Description: pulumi.String("A meaningful description"),
// Network: lan1.Name,
// Project: pulumi.String("default"),
// TargetNetwork: lan0.Name,
// TargetProject: pulumi.String("default"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type NetworkPeer struct {
pulumi.CustomResourceState
// *Optional* - Configuration options as key/value pairs (only user.* custom keys supported)
Config pulumi.StringMapOutput `pulumi:"config"`
// *Optional* - Description of the network peering
Description pulumi.StringOutput `pulumi:"description"`
// **required** - Name of the network peering on the local network
Name pulumi.StringOutput `pulumi:"name"`
// **Required** - Name of the local network.
Network pulumi.StringPtrOutput `pulumi:"network"`
// *Optional* - Name of the project where the network is located.
Project pulumi.StringOutput `pulumi:"project"`
// *Optional* - The remote in which the resource will be created. If
// not provided, the provider's default remote will be used.
Remote pulumi.StringPtrOutput `pulumi:"remote"`
Status pulumi.StringOutput `pulumi:"status"`
TargetIntegration pulumi.StringOutput `pulumi:"targetIntegration"`
// **required** - Which network to create a peering with (required at create time for local peers)
TargetNetwork pulumi.StringOutput `pulumi:"targetNetwork"`
// *Optional* - Which project the target network exists in (required at create time for local peers)
TargetProject pulumi.StringOutput `pulumi:"targetProject"`
// *Optional* - Type of network peering
Type pulumi.StringOutput `pulumi:"type"`
}
// NewNetworkPeer registers a new resource with the given unique name, arguments, and options.
func NewNetworkPeer(ctx *pulumi.Context,
name string, args *NetworkPeerArgs, opts ...pulumi.ResourceOption) (*NetworkPeer, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Name == nil {
return nil, errors.New("invalid value for required argument 'Name'")
}
if args.Project == nil {
args.Project = pulumi.StringPtr("default")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource NetworkPeer
err := ctx.RegisterResource("incus:index/networkPeer:NetworkPeer", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetNetworkPeer gets an existing NetworkPeer resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetNetworkPeer(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *NetworkPeerState, opts ...pulumi.ResourceOption) (*NetworkPeer, error) {
var resource NetworkPeer
err := ctx.ReadResource("incus:index/networkPeer:NetworkPeer", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering NetworkPeer resources.
type networkPeerState struct {
// *Optional* - Configuration options as key/value pairs (only user.* custom keys supported)
Config map[string]string `pulumi:"config"`
// *Optional* - Description of the network peering
Description *string `pulumi:"description"`
// **required** - Name of the network peering on the local network
Name *string `pulumi:"name"`
// **Required** - Name of the local network.
Network *string `pulumi:"network"`
// *Optional* - Name of the project where the network is located.
Project *string `pulumi:"project"`
// *Optional* - The remote in which the resource will be created. If
// not provided, the provider's default remote will be used.
Remote *string `pulumi:"remote"`
Status *string `pulumi:"status"`
TargetIntegration *string `pulumi:"targetIntegration"`
// **required** - Which network to create a peering with (required at create time for local peers)
TargetNetwork *string `pulumi:"targetNetwork"`
// *Optional* - Which project the target network exists in (required at create time for local peers)
TargetProject *string `pulumi:"targetProject"`
// *Optional* - Type of network peering
Type *string `pulumi:"type"`
}
type NetworkPeerState struct {
// *Optional* - Configuration options as key/value pairs (only user.* custom keys supported)
Config pulumi.StringMapInput
// *Optional* - Description of the network peering
Description pulumi.StringPtrInput
// **required** - Name of the network peering on the local network
Name pulumi.StringPtrInput
// **Required** - Name of the local network.
Network pulumi.StringPtrInput
// *Optional* - Name of the project where the network is located.
Project pulumi.StringPtrInput
// *Optional* - The remote in which the resource will be created. If
// not provided, the provider's default remote will be used.
Remote pulumi.StringPtrInput
Status pulumi.StringPtrInput
TargetIntegration pulumi.StringPtrInput
// **required** - Which network to create a peering with (required at create time for local peers)
TargetNetwork pulumi.StringPtrInput
// *Optional* - Which project the target network exists in (required at create time for local peers)
TargetProject pulumi.StringPtrInput
// *Optional* - Type of network peering
Type pulumi.StringPtrInput
}
func (NetworkPeerState) ElementType() reflect.Type {
return reflect.TypeOf((*networkPeerState)(nil)).Elem()
}
type networkPeerArgs struct {
// *Optional* - Configuration options as key/value pairs (only user.* custom keys supported)
Config map[string]string `pulumi:"config"`
// *Optional* - Description of the network peering
Description *string `pulumi:"description"`
// **required** - Name of the network peering on the local network
Name string `pulumi:"name"`
// **Required** - Name of the local network.
Network *string `pulumi:"network"`
// *Optional* - Name of the project where the network is located.
Project *string `pulumi:"project"`
// *Optional* - The remote in which the resource will be created. If
// not provided, the provider's default remote will be used.
Remote *string `pulumi:"remote"`
TargetIntegration *string `pulumi:"targetIntegration"`
// **required** - Which network to create a peering with (required at create time for local peers)
TargetNetwork *string `pulumi:"targetNetwork"`
// *Optional* - Which project the target network exists in (required at create time for local peers)
TargetProject *string `pulumi:"targetProject"`
// *Optional* - Type of network peering
Type *string `pulumi:"type"`
}
// The set of arguments for constructing a NetworkPeer resource.
type NetworkPeerArgs struct {
// *Optional* - Configuration options as key/value pairs (only user.* custom keys supported)
Config pulumi.StringMapInput
// *Optional* - Description of the network peering
Description pulumi.StringPtrInput
// **required** - Name of the network peering on the local network
Name pulumi.StringInput
// **Required** - Name of the local network.
Network pulumi.StringPtrInput
// *Optional* - Name of the project where the network is located.
Project pulumi.StringPtrInput
// *Optional* - The remote in which the resource will be created. If
// not provided, the provider's default remote will be used.
Remote pulumi.StringPtrInput
TargetIntegration pulumi.StringPtrInput
// **required** - Which network to create a peering with (required at create time for local peers)
TargetNetwork pulumi.StringPtrInput
// *Optional* - Which project the target network exists in (required at create time for local peers)
TargetProject pulumi.StringPtrInput
// *Optional* - Type of network peering
Type pulumi.StringPtrInput
}
func (NetworkPeerArgs) ElementType() reflect.Type {
return reflect.TypeOf((*networkPeerArgs)(nil)).Elem()
}
type NetworkPeerInput interface {
pulumi.Input
ToNetworkPeerOutput() NetworkPeerOutput
ToNetworkPeerOutputWithContext(ctx context.Context) NetworkPeerOutput
}
func (*NetworkPeer) ElementType() reflect.Type {
return reflect.TypeOf((**NetworkPeer)(nil)).Elem()
}
func (i *NetworkPeer) ToNetworkPeerOutput() NetworkPeerOutput {
return i.ToNetworkPeerOutputWithContext(context.Background())
}
func (i *NetworkPeer) ToNetworkPeerOutputWithContext(ctx context.Context) NetworkPeerOutput {
return pulumi.ToOutputWithContext(ctx, i).(NetworkPeerOutput)
}
// NetworkPeerArrayInput is an input type that accepts NetworkPeerArray and NetworkPeerArrayOutput values.
// You can construct a concrete instance of `NetworkPeerArrayInput` via:
//
// NetworkPeerArray{ NetworkPeerArgs{...} }
type NetworkPeerArrayInput interface {
pulumi.Input
ToNetworkPeerArrayOutput() NetworkPeerArrayOutput
ToNetworkPeerArrayOutputWithContext(context.Context) NetworkPeerArrayOutput
}
type NetworkPeerArray []NetworkPeerInput
func (NetworkPeerArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*NetworkPeer)(nil)).Elem()
}
func (i NetworkPeerArray) ToNetworkPeerArrayOutput() NetworkPeerArrayOutput {
return i.ToNetworkPeerArrayOutputWithContext(context.Background())
}
func (i NetworkPeerArray) ToNetworkPeerArrayOutputWithContext(ctx context.Context) NetworkPeerArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(NetworkPeerArrayOutput)
}
// NetworkPeerMapInput is an input type that accepts NetworkPeerMap and NetworkPeerMapOutput values.
// You can construct a concrete instance of `NetworkPeerMapInput` via:
//
// NetworkPeerMap{ "key": NetworkPeerArgs{...} }
type NetworkPeerMapInput interface {
pulumi.Input
ToNetworkPeerMapOutput() NetworkPeerMapOutput
ToNetworkPeerMapOutputWithContext(context.Context) NetworkPeerMapOutput
}
type NetworkPeerMap map[string]NetworkPeerInput
func (NetworkPeerMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*NetworkPeer)(nil)).Elem()
}
func (i NetworkPeerMap) ToNetworkPeerMapOutput() NetworkPeerMapOutput {
return i.ToNetworkPeerMapOutputWithContext(context.Background())
}
func (i NetworkPeerMap) ToNetworkPeerMapOutputWithContext(ctx context.Context) NetworkPeerMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(NetworkPeerMapOutput)
}
type NetworkPeerOutput struct{ *pulumi.OutputState }
func (NetworkPeerOutput) ElementType() reflect.Type {
return reflect.TypeOf((**NetworkPeer)(nil)).Elem()
}
func (o NetworkPeerOutput) ToNetworkPeerOutput() NetworkPeerOutput {
return o
}
func (o NetworkPeerOutput) ToNetworkPeerOutputWithContext(ctx context.Context) NetworkPeerOutput {
return o
}
// *Optional* - Configuration options as key/value pairs (only user.* custom keys supported)
func (o NetworkPeerOutput) Config() pulumi.StringMapOutput {
return o.ApplyT(func(v *NetworkPeer) pulumi.StringMapOutput { return v.Config }).(pulumi.StringMapOutput)
}
// *Optional* - Description of the network peering
func (o NetworkPeerOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkPeer) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// **required** - Name of the network peering on the local network
func (o NetworkPeerOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkPeer) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// **Required** - Name of the local network.
func (o NetworkPeerOutput) Network() pulumi.StringPtrOutput {
return o.ApplyT(func(v *NetworkPeer) pulumi.StringPtrOutput { return v.Network }).(pulumi.StringPtrOutput)
}
// *Optional* - Name of the project where the network is located.
func (o NetworkPeerOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkPeer) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// *Optional* - The remote in which the resource will be created. If
// not provided, the provider's default remote will be used.
func (o NetworkPeerOutput) Remote() pulumi.StringPtrOutput {
return o.ApplyT(func(v *NetworkPeer) pulumi.StringPtrOutput { return v.Remote }).(pulumi.StringPtrOutput)
}
func (o NetworkPeerOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkPeer) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
func (o NetworkPeerOutput) TargetIntegration() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkPeer) pulumi.StringOutput { return v.TargetIntegration }).(pulumi.StringOutput)
}
// **required** - Which network to create a peering with (required at create time for local peers)
func (o NetworkPeerOutput) TargetNetwork() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkPeer) pulumi.StringOutput { return v.TargetNetwork }).(pulumi.StringOutput)
}
// *Optional* - Which project the target network exists in (required at create time for local peers)
func (o NetworkPeerOutput) TargetProject() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkPeer) pulumi.StringOutput { return v.TargetProject }).(pulumi.StringOutput)
}
// *Optional* - Type of network peering
func (o NetworkPeerOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkPeer) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
}
type NetworkPeerArrayOutput struct{ *pulumi.OutputState }
func (NetworkPeerArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*NetworkPeer)(nil)).Elem()
}
func (o NetworkPeerArrayOutput) ToNetworkPeerArrayOutput() NetworkPeerArrayOutput {
return o
}
func (o NetworkPeerArrayOutput) ToNetworkPeerArrayOutputWithContext(ctx context.Context) NetworkPeerArrayOutput {
return o
}
func (o NetworkPeerArrayOutput) Index(i pulumi.IntInput) NetworkPeerOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *NetworkPeer {
return vs[0].([]*NetworkPeer)[vs[1].(int)]
}).(NetworkPeerOutput)
}
type NetworkPeerMapOutput struct{ *pulumi.OutputState }
func (NetworkPeerMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*NetworkPeer)(nil)).Elem()
}
func (o NetworkPeerMapOutput) ToNetworkPeerMapOutput() NetworkPeerMapOutput {
return o
}
func (o NetworkPeerMapOutput) ToNetworkPeerMapOutputWithContext(ctx context.Context) NetworkPeerMapOutput {
return o
}
func (o NetworkPeerMapOutput) MapIndex(k pulumi.StringInput) NetworkPeerOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *NetworkPeer {
return vs[0].(map[string]*NetworkPeer)[vs[1].(string)]
}).(NetworkPeerOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*NetworkPeerInput)(nil)).Elem(), &NetworkPeer{})
pulumi.RegisterInputType(reflect.TypeOf((*NetworkPeerArrayInput)(nil)).Elem(), NetworkPeerArray{})
pulumi.RegisterInputType(reflect.TypeOf((*NetworkPeerMapInput)(nil)).Elem(), NetworkPeerMap{})
pulumi.RegisterOutputType(NetworkPeerOutput{})
pulumi.RegisterOutputType(NetworkPeerArrayOutput{})
pulumi.RegisterOutputType(NetworkPeerMapOutput{})
}