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

388 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"
)
// ## # NetworkAddressSet
//
// Network address sets are a list of either IPv4, IPv6 addresses with or without CIDR suffix. They can be used in source or destination fields of [ACLs](https://linuxcontainers.org/incus/docs/main/howto/network_acls/#network-acls-rules-properties).
//
// ## 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.NewNetworkAddressSet(ctx, "this", &incus.NetworkAddressSetArgs{
// Name: pulumi.String("Network Address Set"),
// Description: pulumi.String("Network Address Set description"),
// Addresses: pulumi.StringArray{
// pulumi.String("10.0.0.2"),
// pulumi.String("10.0.0.3"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## ACL Example
//
// ```go
// package main
//
// import (
//
// "fmt"
//
// "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 {
// this, err := incus.NewNetworkAddressSet(ctx, "this", &incus.NetworkAddressSetArgs{
// Name: pulumi.String("network_address_set"),
// Description: pulumi.String("Network Address Set description"),
// Addresses: pulumi.StringArray{
// pulumi.String("10.0.0.2"),
// pulumi.String("10.0.0.3"),
// },
// })
// if err != nil {
// return err
// }
// _, err = incus.NewNetworkAcl(ctx, "this", &incus.NetworkAclArgs{
// Name: pulumi.String("network_acl"),
// Ingresses: incus.NetworkAclIngressArray{
// &incus.NetworkAclIngressArgs{
// Action: pulumi.String("allow"),
// Source: pulumi.String("${incus_network_address_set.this.name}"),
// Destination_port: "22",
// Protocol: pulumi.String("tcp"),
// Description: this.Name.ApplyT(func(name string) (string, error) {
// return fmt.Sprintf("Incoming SSH connections from %v", name), nil
// }).(pulumi.StringOutput),
// State: pulumi.String("logged"),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type NetworkAddressSet struct {
pulumi.CustomResourceState
// **Required** - IP addresses of the address set.
Addresses pulumi.StringArrayOutput `pulumi:"addresses"`
// *Optional* - Map of key/value pairs of [network address set config settings](https://linuxcontainers.org/incus/docs/main/howto/network_address_sets/#address-set-configuration-options)
Config pulumi.StringMapOutput `pulumi:"config"`
// *Optional* - Description of the network address set.
Description pulumi.StringOutput `pulumi:"description"`
// **Required** - Name of the network address set.
Name pulumi.StringOutput `pulumi:"name"`
// *Optional* - Name of the project where the network address set will be created.
Project pulumi.StringPtrOutput `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"`
}
// NewNetworkAddressSet registers a new resource with the given unique name, arguments, and options.
func NewNetworkAddressSet(ctx *pulumi.Context,
name string, args *NetworkAddressSetArgs, opts ...pulumi.ResourceOption) (*NetworkAddressSet, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Addresses == nil {
return nil, errors.New("invalid value for required argument 'Addresses'")
}
if args.Name == nil {
return nil, errors.New("invalid value for required argument 'Name'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource NetworkAddressSet
err := ctx.RegisterResource("incus:index/networkAddressSet:NetworkAddressSet", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetNetworkAddressSet gets an existing NetworkAddressSet 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 GetNetworkAddressSet(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *NetworkAddressSetState, opts ...pulumi.ResourceOption) (*NetworkAddressSet, error) {
var resource NetworkAddressSet
err := ctx.ReadResource("incus:index/networkAddressSet:NetworkAddressSet", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering NetworkAddressSet resources.
type networkAddressSetState struct {
// **Required** - IP addresses of the address set.
Addresses []string `pulumi:"addresses"`
// *Optional* - Map of key/value pairs of [network address set config settings](https://linuxcontainers.org/incus/docs/main/howto/network_address_sets/#address-set-configuration-options)
Config map[string]string `pulumi:"config"`
// *Optional* - Description of the network address set.
Description *string `pulumi:"description"`
// **Required** - Name of the network address set.
Name *string `pulumi:"name"`
// *Optional* - Name of the project where the network address set 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"`
}
type NetworkAddressSetState struct {
// **Required** - IP addresses of the address set.
Addresses pulumi.StringArrayInput
// *Optional* - Map of key/value pairs of [network address set config settings](https://linuxcontainers.org/incus/docs/main/howto/network_address_sets/#address-set-configuration-options)
Config pulumi.StringMapInput
// *Optional* - Description of the network address set.
Description pulumi.StringPtrInput
// **Required** - Name of the network address set.
Name pulumi.StringPtrInput
// *Optional* - Name of the project where the network address set 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
}
func (NetworkAddressSetState) ElementType() reflect.Type {
return reflect.TypeOf((*networkAddressSetState)(nil)).Elem()
}
type networkAddressSetArgs struct {
// **Required** - IP addresses of the address set.
Addresses []string `pulumi:"addresses"`
// *Optional* - Map of key/value pairs of [network address set config settings](https://linuxcontainers.org/incus/docs/main/howto/network_address_sets/#address-set-configuration-options)
Config map[string]string `pulumi:"config"`
// *Optional* - Description of the network address set.
Description *string `pulumi:"description"`
// **Required** - Name of the network address set.
Name string `pulumi:"name"`
// *Optional* - Name of the project where the network address set 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"`
}
// The set of arguments for constructing a NetworkAddressSet resource.
type NetworkAddressSetArgs struct {
// **Required** - IP addresses of the address set.
Addresses pulumi.StringArrayInput
// *Optional* - Map of key/value pairs of [network address set config settings](https://linuxcontainers.org/incus/docs/main/howto/network_address_sets/#address-set-configuration-options)
Config pulumi.StringMapInput
// *Optional* - Description of the network address set.
Description pulumi.StringPtrInput
// **Required** - Name of the network address set.
Name pulumi.StringInput
// *Optional* - Name of the project where the network address set 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
}
func (NetworkAddressSetArgs) ElementType() reflect.Type {
return reflect.TypeOf((*networkAddressSetArgs)(nil)).Elem()
}
type NetworkAddressSetInput interface {
pulumi.Input
ToNetworkAddressSetOutput() NetworkAddressSetOutput
ToNetworkAddressSetOutputWithContext(ctx context.Context) NetworkAddressSetOutput
}
func (*NetworkAddressSet) ElementType() reflect.Type {
return reflect.TypeOf((**NetworkAddressSet)(nil)).Elem()
}
func (i *NetworkAddressSet) ToNetworkAddressSetOutput() NetworkAddressSetOutput {
return i.ToNetworkAddressSetOutputWithContext(context.Background())
}
func (i *NetworkAddressSet) ToNetworkAddressSetOutputWithContext(ctx context.Context) NetworkAddressSetOutput {
return pulumi.ToOutputWithContext(ctx, i).(NetworkAddressSetOutput)
}
// NetworkAddressSetArrayInput is an input type that accepts NetworkAddressSetArray and NetworkAddressSetArrayOutput values.
// You can construct a concrete instance of `NetworkAddressSetArrayInput` via:
//
// NetworkAddressSetArray{ NetworkAddressSetArgs{...} }
type NetworkAddressSetArrayInput interface {
pulumi.Input
ToNetworkAddressSetArrayOutput() NetworkAddressSetArrayOutput
ToNetworkAddressSetArrayOutputWithContext(context.Context) NetworkAddressSetArrayOutput
}
type NetworkAddressSetArray []NetworkAddressSetInput
func (NetworkAddressSetArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*NetworkAddressSet)(nil)).Elem()
}
func (i NetworkAddressSetArray) ToNetworkAddressSetArrayOutput() NetworkAddressSetArrayOutput {
return i.ToNetworkAddressSetArrayOutputWithContext(context.Background())
}
func (i NetworkAddressSetArray) ToNetworkAddressSetArrayOutputWithContext(ctx context.Context) NetworkAddressSetArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(NetworkAddressSetArrayOutput)
}
// NetworkAddressSetMapInput is an input type that accepts NetworkAddressSetMap and NetworkAddressSetMapOutput values.
// You can construct a concrete instance of `NetworkAddressSetMapInput` via:
//
// NetworkAddressSetMap{ "key": NetworkAddressSetArgs{...} }
type NetworkAddressSetMapInput interface {
pulumi.Input
ToNetworkAddressSetMapOutput() NetworkAddressSetMapOutput
ToNetworkAddressSetMapOutputWithContext(context.Context) NetworkAddressSetMapOutput
}
type NetworkAddressSetMap map[string]NetworkAddressSetInput
func (NetworkAddressSetMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*NetworkAddressSet)(nil)).Elem()
}
func (i NetworkAddressSetMap) ToNetworkAddressSetMapOutput() NetworkAddressSetMapOutput {
return i.ToNetworkAddressSetMapOutputWithContext(context.Background())
}
func (i NetworkAddressSetMap) ToNetworkAddressSetMapOutputWithContext(ctx context.Context) NetworkAddressSetMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(NetworkAddressSetMapOutput)
}
type NetworkAddressSetOutput struct{ *pulumi.OutputState }
func (NetworkAddressSetOutput) ElementType() reflect.Type {
return reflect.TypeOf((**NetworkAddressSet)(nil)).Elem()
}
func (o NetworkAddressSetOutput) ToNetworkAddressSetOutput() NetworkAddressSetOutput {
return o
}
func (o NetworkAddressSetOutput) ToNetworkAddressSetOutputWithContext(ctx context.Context) NetworkAddressSetOutput {
return o
}
// **Required** - IP addresses of the address set.
func (o NetworkAddressSetOutput) Addresses() pulumi.StringArrayOutput {
return o.ApplyT(func(v *NetworkAddressSet) pulumi.StringArrayOutput { return v.Addresses }).(pulumi.StringArrayOutput)
}
// *Optional* - Map of key/value pairs of [network address set config settings](https://linuxcontainers.org/incus/docs/main/howto/network_address_sets/#address-set-configuration-options)
func (o NetworkAddressSetOutput) Config() pulumi.StringMapOutput {
return o.ApplyT(func(v *NetworkAddressSet) pulumi.StringMapOutput { return v.Config }).(pulumi.StringMapOutput)
}
// *Optional* - Description of the network address set.
func (o NetworkAddressSetOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkAddressSet) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// **Required** - Name of the network address set.
func (o NetworkAddressSetOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *NetworkAddressSet) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// *Optional* - Name of the project where the network address set will be created.
func (o NetworkAddressSetOutput) Project() pulumi.StringPtrOutput {
return o.ApplyT(func(v *NetworkAddressSet) pulumi.StringPtrOutput { return v.Project }).(pulumi.StringPtrOutput)
}
// *Optional* - The remote in which the resource will be created. If
// not provided, the provider's default remote will be used.
func (o NetworkAddressSetOutput) Remote() pulumi.StringPtrOutput {
return o.ApplyT(func(v *NetworkAddressSet) pulumi.StringPtrOutput { return v.Remote }).(pulumi.StringPtrOutput)
}
type NetworkAddressSetArrayOutput struct{ *pulumi.OutputState }
func (NetworkAddressSetArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*NetworkAddressSet)(nil)).Elem()
}
func (o NetworkAddressSetArrayOutput) ToNetworkAddressSetArrayOutput() NetworkAddressSetArrayOutput {
return o
}
func (o NetworkAddressSetArrayOutput) ToNetworkAddressSetArrayOutputWithContext(ctx context.Context) NetworkAddressSetArrayOutput {
return o
}
func (o NetworkAddressSetArrayOutput) Index(i pulumi.IntInput) NetworkAddressSetOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *NetworkAddressSet {
return vs[0].([]*NetworkAddressSet)[vs[1].(int)]
}).(NetworkAddressSetOutput)
}
type NetworkAddressSetMapOutput struct{ *pulumi.OutputState }
func (NetworkAddressSetMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*NetworkAddressSet)(nil)).Elem()
}
func (o NetworkAddressSetMapOutput) ToNetworkAddressSetMapOutput() NetworkAddressSetMapOutput {
return o
}
func (o NetworkAddressSetMapOutput) ToNetworkAddressSetMapOutputWithContext(ctx context.Context) NetworkAddressSetMapOutput {
return o
}
func (o NetworkAddressSetMapOutput) MapIndex(k pulumi.StringInput) NetworkAddressSetOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *NetworkAddressSet {
return vs[0].(map[string]*NetworkAddressSet)[vs[1].(string)]
}).(NetworkAddressSetOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*NetworkAddressSetInput)(nil)).Elem(), &NetworkAddressSet{})
pulumi.RegisterInputType(reflect.TypeOf((*NetworkAddressSetArrayInput)(nil)).Elem(), NetworkAddressSetArray{})
pulumi.RegisterInputType(reflect.TypeOf((*NetworkAddressSetMapInput)(nil)).Elem(), NetworkAddressSetMap{})
pulumi.RegisterOutputType(NetworkAddressSetOutput{})
pulumi.RegisterOutputType(NetworkAddressSetArrayOutput{})
pulumi.RegisterOutputType(NetworkAddressSetMapOutput{})
}