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

391 lines
15 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"
)
// ## # NetworkIntegration
//
// Manage integrations between the local Incus deployment and remote networks hosted on Incus or other platforms. Currently available only for [OVN networks](https://linuxcontainers.org/incus/docs/main/reference/network_ovn/#network-ovn).
//
// ## Basic Example
//
// ```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 {
// _, err := incus.NewNetworkIntegration(ctx, "this", &incus.NetworkIntegrationArgs{
// Name: pulumi.String("ovn-region"),
// Type: pulumi.String("ovn"),
// Config: pulumi.StringMap{
// "ovn.northbound_connection": pulumi.String("tcp:[192.0.2.12]:6645,tcp:[192.0.3.13]:6645,tcp:[192.0.3.14]:6645"),
// "ovn.southbound_connection": pulumi.String("tcp:[192.0.2.12]:6646,tcp:[192.0.3.13]:6646,tcp:[192.0.3.14]:6646"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Peer Example
//
// ```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 {
// _default, err := incus.NewNetwork(ctx, "default", &incus.NetworkArgs{
// Name: pulumi.String("default"),
// Type: pulumi.String("ovn"),
// Config: pulumi.StringMap{
// "ipv4.address": pulumi.String("192.168.2.0/24"),
// "ipv4.nat": pulumi.String("true"),
// },
// })
// if err != nil {
// return err
// }
// this, err := incus.NewNetworkIntegration(ctx, "this", &incus.NetworkIntegrationArgs{
// Name: pulumi.String("ovn-region"),
// Type: pulumi.String("ovn"),
// Config: pulumi.StringMap{
// "ovn.northbound_connection": pulumi.String("tcp:[192.0.2.12]:6645,tcp:[192.0.3.13]:6645,tcp:[192.0.3.14]:6645"),
// "ovn.southbound_connection": pulumi.String("tcp:[192.0.2.12]:6646,tcp:[192.0.3.13]:6646,tcp:[192.0.3.14]:6646"),
// },
// })
// if err != nil {
// return err
// }
// _, err = incus.NewNetworkPeer(ctx, "this", &incus.NetworkPeerArgs{
// Name: pulumi.String("ovn-peer"),
// Network: _default.Name,
// TargetIntegration: this.Name,
// Type: pulumi.String("remote"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type NetworkIntegration struct {
pulumi.CustomResourceState
// *Optional* - Map of key/value pairs of [network integration config settings](https://linuxcontainers.org/incus/docs/main/howto/network_integrations/)
Config pulumi.StringMapOutput `pulumi:"config"`
// *Optional* - Description of the network integration.
Description pulumi.StringOutput `pulumi:"description"`
// **Required** - Name of the network integration.
Name pulumi.StringOutput `pulumi:"name"`
// *Optional* - Name of the project where the network will be created.
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"`
// **Required** - The type of the network integration. Currently, only supports `ovn` type.
Type pulumi.StringOutput `pulumi:"type"`
}
// NewNetworkIntegration registers a new resource with the given unique name, arguments, and options.
func NewNetworkIntegration(ctx *pulumi.Context,
name string, args *NetworkIntegrationArgs, opts ...pulumi.ResourceOption) (*NetworkIntegration, 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.Type == nil {
return nil, errors.New("invalid value for required argument 'Type'")
}
if args.Project == nil {
args.Project = pulumi.StringPtr("default")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource NetworkIntegration
err := ctx.RegisterResource("incus:index/networkIntegration:NetworkIntegration", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetNetworkIntegration gets an existing NetworkIntegration 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 GetNetworkIntegration(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *NetworkIntegrationState, opts ...pulumi.ResourceOption) (*NetworkIntegration, error) {
var resource NetworkIntegration
err := ctx.ReadResource("incus:index/networkIntegration:NetworkIntegration", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering NetworkIntegration resources.
type networkIntegrationState struct {
// *Optional* - Map of key/value pairs of [network integration config settings](https://linuxcontainers.org/incus/docs/main/howto/network_integrations/)
Config map[string]string `pulumi:"config"`
// *Optional* - Description of the network integration.
Description *string `pulumi:"description"`
// **Required** - Name of the network integration.
Name *string `pulumi:"name"`
// *Optional* - Name of the project where the network will be created.
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"`
// **Required** - The type of the network integration. Currently, only supports `ovn` type.
Type *string `pulumi:"type"`
}
type NetworkIntegrationState struct {
// *Optional* - Map of key/value pairs of [network integration config settings](https://linuxcontainers.org/incus/docs/main/howto/network_integrations/)
Config pulumi.StringMapInput
// *Optional* - Description of the network integration.
Description pulumi.StringPtrInput
// **Required** - Name of the network integration.
Name pulumi.StringPtrInput
// *Optional* - Name of the project where the network will be created.
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
// **Required** - The type of the network integration. Currently, only supports `ovn` type.
Type pulumi.StringPtrInput
}
func (NetworkIntegrationState) ElementType() reflect.Type {
return reflect.TypeOf((*networkIntegrationState)(nil)).Elem()
}
type networkIntegrationArgs struct {
// *Optional* - Map of key/value pairs of [network integration config settings](https://linuxcontainers.org/incus/docs/main/howto/network_integrations/)
Config map[string]string `pulumi:"config"`
// *Optional* - Description of the network integration.
Description *string `pulumi:"description"`
// **Required** - Name of the network integration.
Name string `pulumi:"name"`
// *Optional* - Name of the project where the network will be created.
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"`
// **Required** - The type of the network integration. Currently, only supports `ovn` type.
Type string `pulumi:"type"`
}
// The set of arguments for constructing a NetworkIntegration resource.
type NetworkIntegrationArgs struct {
// *Optional* - Map of key/value pairs of [network integration config settings](https://linuxcontainers.org/incus/docs/main/howto/network_integrations/)
Config pulumi.StringMapInput
// *Optional* - Description of the network integration.
Description pulumi.StringPtrInput
// **Required** - Name of the network integration.
Name pulumi.StringInput
// *Optional* - Name of the project where the network will be created.
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
// **Required** - The type of the network integration. Currently, only supports `ovn` type.
Type pulumi.StringInput
}
func (NetworkIntegrationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*networkIntegrationArgs)(nil)).Elem()
}
type NetworkIntegrationInput interface {
pulumi.Input
ToNetworkIntegrationOutput() NetworkIntegrationOutput
ToNetworkIntegrationOutputWithContext(ctx context.Context) NetworkIntegrationOutput
}
func (*NetworkIntegration) ElementType() reflect.Type {
return reflect.TypeOf((**NetworkIntegration)(nil)).Elem()
}
func (i *NetworkIntegration) ToNetworkIntegrationOutput() NetworkIntegrationOutput {
return i.ToNetworkIntegrationOutputWithContext(context.Background())
}
func (i *NetworkIntegration) ToNetworkIntegrationOutputWithContext(ctx context.Context) NetworkIntegrationOutput {
return pulumi.ToOutputWithContext(ctx, i).(NetworkIntegrationOutput)
}
// NetworkIntegrationArrayInput is an input type that accepts NetworkIntegrationArray and NetworkIntegrationArrayOutput values.
// You can construct a concrete instance of `NetworkIntegrationArrayInput` via:
//
// NetworkIntegrationArray{ NetworkIntegrationArgs{...} }
type NetworkIntegrationArrayInput interface {
pulumi.Input
ToNetworkIntegrationArrayOutput() NetworkIntegrationArrayOutput
ToNetworkIntegrationArrayOutputWithContext(context.Context) NetworkIntegrationArrayOutput
}
type NetworkIntegrationArray []NetworkIntegrationInput
func (NetworkIntegrationArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*NetworkIntegration)(nil)).Elem()
}
func (i NetworkIntegrationArray) ToNetworkIntegrationArrayOutput() NetworkIntegrationArrayOutput {
return i.ToNetworkIntegrationArrayOutputWithContext(context.Background())
}
func (i NetworkIntegrationArray) ToNetworkIntegrationArrayOutputWithContext(ctx context.Context) NetworkIntegrationArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(NetworkIntegrationArrayOutput)
}
// NetworkIntegrationMapInput is an input type that accepts NetworkIntegrationMap and NetworkIntegrationMapOutput values.
// You can construct a concrete instance of `NetworkIntegrationMapInput` via:
//
// NetworkIntegrationMap{ "key": NetworkIntegrationArgs{...} }
type NetworkIntegrationMapInput interface {
pulumi.Input
ToNetworkIntegrationMapOutput() NetworkIntegrationMapOutput
ToNetworkIntegrationMapOutputWithContext(context.Context) NetworkIntegrationMapOutput
}
type NetworkIntegrationMap map[string]NetworkIntegrationInput
func (NetworkIntegrationMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*NetworkIntegration)(nil)).Elem()
}
func (i NetworkIntegrationMap) ToNetworkIntegrationMapOutput() NetworkIntegrationMapOutput {
return i.ToNetworkIntegrationMapOutputWithContext(context.Background())
}
func (i NetworkIntegrationMap) ToNetworkIntegrationMapOutputWithContext(ctx context.Context) NetworkIntegrationMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(NetworkIntegrationMapOutput)
}
type NetworkIntegrationOutput struct{ *pulumi.OutputState }
func (NetworkIntegrationOutput) ElementType() reflect.Type {
return reflect.TypeOf((**NetworkIntegration)(nil)).Elem()
}
func (o NetworkIntegrationOutput) ToNetworkIntegrationOutput() NetworkIntegrationOutput {
return o
}
func (o NetworkIntegrationOutput) ToNetworkIntegrationOutputWithContext(ctx context.Context) NetworkIntegrationOutput {
return o
}
// *Optional* - Map of key/value pairs of [network integration config settings](https://linuxcontainers.org/incus/docs/main/howto/network_integrations/)
func (o NetworkIntegrationOutput) Config() pulumi.StringMapOutput {
return o.ApplyT(func(v *NetworkIntegration) pulumi.StringMapOutput { return v.Config }).(pulumi.StringMapOutput)
}
// *Optional* - Description of the network integration.
func (o NetworkIntegrationOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkIntegration) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// **Required** - Name of the network integration.
func (o NetworkIntegrationOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkIntegration) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// *Optional* - Name of the project where the network will be created.
func (o NetworkIntegrationOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkIntegration) 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 NetworkIntegrationOutput) Remote() pulumi.StringPtrOutput {
return o.ApplyT(func(v *NetworkIntegration) pulumi.StringPtrOutput { return v.Remote }).(pulumi.StringPtrOutput)
}
// **Required** - The type of the network integration. Currently, only supports `ovn` type.
func (o NetworkIntegrationOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkIntegration) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
}
type NetworkIntegrationArrayOutput struct{ *pulumi.OutputState }
func (NetworkIntegrationArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*NetworkIntegration)(nil)).Elem()
}
func (o NetworkIntegrationArrayOutput) ToNetworkIntegrationArrayOutput() NetworkIntegrationArrayOutput {
return o
}
func (o NetworkIntegrationArrayOutput) ToNetworkIntegrationArrayOutputWithContext(ctx context.Context) NetworkIntegrationArrayOutput {
return o
}
func (o NetworkIntegrationArrayOutput) Index(i pulumi.IntInput) NetworkIntegrationOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *NetworkIntegration {
return vs[0].([]*NetworkIntegration)[vs[1].(int)]
}).(NetworkIntegrationOutput)
}
type NetworkIntegrationMapOutput struct{ *pulumi.OutputState }
func (NetworkIntegrationMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*NetworkIntegration)(nil)).Elem()
}
func (o NetworkIntegrationMapOutput) ToNetworkIntegrationMapOutput() NetworkIntegrationMapOutput {
return o
}
func (o NetworkIntegrationMapOutput) ToNetworkIntegrationMapOutputWithContext(ctx context.Context) NetworkIntegrationMapOutput {
return o
}
func (o NetworkIntegrationMapOutput) MapIndex(k pulumi.StringInput) NetworkIntegrationOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *NetworkIntegration {
return vs[0].(map[string]*NetworkIntegration)[vs[1].(string)]
}).(NetworkIntegrationOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*NetworkIntegrationInput)(nil)).Elem(), &NetworkIntegration{})
pulumi.RegisterInputType(reflect.TypeOf((*NetworkIntegrationArrayInput)(nil)).Elem(), NetworkIntegrationArray{})
pulumi.RegisterInputType(reflect.TypeOf((*NetworkIntegrationMapInput)(nil)).Elem(), NetworkIntegrationMap{})
pulumi.RegisterOutputType(NetworkIntegrationOutput{})
pulumi.RegisterOutputType(NetworkIntegrationArrayOutput{})
pulumi.RegisterOutputType(NetworkIntegrationMapOutput{})
}