Files
pulumi-incus/sdk/go/incus/instanceSnapshot.go

353 lines
13 KiB
Go
Generated

// Code generated by the Pulumi Terraform Bridge (tfgen) Tool 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/nimbus/pulumi-incus/sdk/go/incus/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## # InstanceSnapshot
//
// Manages a snapshot of an Incus instance.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "git.kalinow.ski/nimbus/pulumi-incus/sdk/go/incus"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// instance, err := incus.NewInstance(ctx, "instance", &incus.InstanceArgs{
// Name: pulumi.String("my-instance"),
// Image: pulumi.String("ubuntu"),
// Ephemeral: pulumi.Bool(false),
// })
// if err != nil {
// return err
// }
// _, err = incus.NewInstanceSnapshot(ctx, "snap1", &incus.InstanceSnapshotArgs{
// Name: pulumi.String("my-snapshot-1"),
// Instance: instance.Name,
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type InstanceSnapshot struct {
pulumi.CustomResourceState
// The time Incus reported the snapshot was successfully created,
// in UTC.
CreatedAt pulumi.IntOutput `pulumi:"createdAt"`
// **Required** - The name of the instance to snapshot.
Instance pulumi.StringOutput `pulumi:"instance"`
// **Required** - Name of the snapshot.
Name pulumi.StringOutput `pulumi:"name"`
// *Optional* - Name of the project where the snapshot will be stored.
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"`
// *Optional* - Set to `true` to create a stateful snapshot,
// `false` for stateless. Stateful snapshots include runtime state. Defaults to
// `false`.
Stateful pulumi.BoolOutput `pulumi:"stateful"`
}
// NewInstanceSnapshot registers a new resource with the given unique name, arguments, and options.
func NewInstanceSnapshot(ctx *pulumi.Context,
name string, args *InstanceSnapshotArgs, opts ...pulumi.ResourceOption) (*InstanceSnapshot, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Instance == nil {
return nil, errors.New("invalid value for required argument 'Instance'")
}
if args.Project == nil {
args.Project = pulumi.StringPtr("default")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource InstanceSnapshot
err := ctx.RegisterResource("incus:index/instanceSnapshot:InstanceSnapshot", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetInstanceSnapshot gets an existing InstanceSnapshot 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 GetInstanceSnapshot(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *InstanceSnapshotState, opts ...pulumi.ResourceOption) (*InstanceSnapshot, error) {
var resource InstanceSnapshot
err := ctx.ReadResource("incus:index/instanceSnapshot:InstanceSnapshot", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering InstanceSnapshot resources.
type instanceSnapshotState struct {
// The time Incus reported the snapshot was successfully created,
// in UTC.
CreatedAt *int `pulumi:"createdAt"`
// **Required** - The name of the instance to snapshot.
Instance *string `pulumi:"instance"`
// **Required** - Name of the snapshot.
Name *string `pulumi:"name"`
// *Optional* - Name of the project where the snapshot will be stored.
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"`
// *Optional* - Set to `true` to create a stateful snapshot,
// `false` for stateless. Stateful snapshots include runtime state. Defaults to
// `false`.
Stateful *bool `pulumi:"stateful"`
}
type InstanceSnapshotState struct {
// The time Incus reported the snapshot was successfully created,
// in UTC.
CreatedAt pulumi.IntPtrInput
// **Required** - The name of the instance to snapshot.
Instance pulumi.StringPtrInput
// **Required** - Name of the snapshot.
Name pulumi.StringPtrInput
// *Optional* - Name of the project where the snapshot will be stored.
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
// *Optional* - Set to `true` to create a stateful snapshot,
// `false` for stateless. Stateful snapshots include runtime state. Defaults to
// `false`.
Stateful pulumi.BoolPtrInput
}
func (InstanceSnapshotState) ElementType() reflect.Type {
return reflect.TypeOf((*instanceSnapshotState)(nil)).Elem()
}
type instanceSnapshotArgs struct {
// **Required** - The name of the instance to snapshot.
Instance string `pulumi:"instance"`
// **Required** - Name of the snapshot.
Name *string `pulumi:"name"`
// *Optional* - Name of the project where the snapshot will be stored.
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"`
// *Optional* - Set to `true` to create a stateful snapshot,
// `false` for stateless. Stateful snapshots include runtime state. Defaults to
// `false`.
Stateful *bool `pulumi:"stateful"`
}
// The set of arguments for constructing a InstanceSnapshot resource.
type InstanceSnapshotArgs struct {
// **Required** - The name of the instance to snapshot.
Instance pulumi.StringInput
// **Required** - Name of the snapshot.
Name pulumi.StringPtrInput
// *Optional* - Name of the project where the snapshot will be stored.
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
// *Optional* - Set to `true` to create a stateful snapshot,
// `false` for stateless. Stateful snapshots include runtime state. Defaults to
// `false`.
Stateful pulumi.BoolPtrInput
}
func (InstanceSnapshotArgs) ElementType() reflect.Type {
return reflect.TypeOf((*instanceSnapshotArgs)(nil)).Elem()
}
type InstanceSnapshotInput interface {
pulumi.Input
ToInstanceSnapshotOutput() InstanceSnapshotOutput
ToInstanceSnapshotOutputWithContext(ctx context.Context) InstanceSnapshotOutput
}
func (*InstanceSnapshot) ElementType() reflect.Type {
return reflect.TypeOf((**InstanceSnapshot)(nil)).Elem()
}
func (i *InstanceSnapshot) ToInstanceSnapshotOutput() InstanceSnapshotOutput {
return i.ToInstanceSnapshotOutputWithContext(context.Background())
}
func (i *InstanceSnapshot) ToInstanceSnapshotOutputWithContext(ctx context.Context) InstanceSnapshotOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceSnapshotOutput)
}
// InstanceSnapshotArrayInput is an input type that accepts InstanceSnapshotArray and InstanceSnapshotArrayOutput values.
// You can construct a concrete instance of `InstanceSnapshotArrayInput` via:
//
// InstanceSnapshotArray{ InstanceSnapshotArgs{...} }
type InstanceSnapshotArrayInput interface {
pulumi.Input
ToInstanceSnapshotArrayOutput() InstanceSnapshotArrayOutput
ToInstanceSnapshotArrayOutputWithContext(context.Context) InstanceSnapshotArrayOutput
}
type InstanceSnapshotArray []InstanceSnapshotInput
func (InstanceSnapshotArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*InstanceSnapshot)(nil)).Elem()
}
func (i InstanceSnapshotArray) ToInstanceSnapshotArrayOutput() InstanceSnapshotArrayOutput {
return i.ToInstanceSnapshotArrayOutputWithContext(context.Background())
}
func (i InstanceSnapshotArray) ToInstanceSnapshotArrayOutputWithContext(ctx context.Context) InstanceSnapshotArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceSnapshotArrayOutput)
}
// InstanceSnapshotMapInput is an input type that accepts InstanceSnapshotMap and InstanceSnapshotMapOutput values.
// You can construct a concrete instance of `InstanceSnapshotMapInput` via:
//
// InstanceSnapshotMap{ "key": InstanceSnapshotArgs{...} }
type InstanceSnapshotMapInput interface {
pulumi.Input
ToInstanceSnapshotMapOutput() InstanceSnapshotMapOutput
ToInstanceSnapshotMapOutputWithContext(context.Context) InstanceSnapshotMapOutput
}
type InstanceSnapshotMap map[string]InstanceSnapshotInput
func (InstanceSnapshotMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*InstanceSnapshot)(nil)).Elem()
}
func (i InstanceSnapshotMap) ToInstanceSnapshotMapOutput() InstanceSnapshotMapOutput {
return i.ToInstanceSnapshotMapOutputWithContext(context.Background())
}
func (i InstanceSnapshotMap) ToInstanceSnapshotMapOutputWithContext(ctx context.Context) InstanceSnapshotMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceSnapshotMapOutput)
}
type InstanceSnapshotOutput struct{ *pulumi.OutputState }
func (InstanceSnapshotOutput) ElementType() reflect.Type {
return reflect.TypeOf((**InstanceSnapshot)(nil)).Elem()
}
func (o InstanceSnapshotOutput) ToInstanceSnapshotOutput() InstanceSnapshotOutput {
return o
}
func (o InstanceSnapshotOutput) ToInstanceSnapshotOutputWithContext(ctx context.Context) InstanceSnapshotOutput {
return o
}
// The time Incus reported the snapshot was successfully created,
// in UTC.
func (o InstanceSnapshotOutput) CreatedAt() pulumi.IntOutput {
return o.ApplyT(func(v *InstanceSnapshot) pulumi.IntOutput { return v.CreatedAt }).(pulumi.IntOutput)
}
// **Required** - The name of the instance to snapshot.
func (o InstanceSnapshotOutput) Instance() pulumi.StringOutput {
return o.ApplyT(func(v *InstanceSnapshot) pulumi.StringOutput { return v.Instance }).(pulumi.StringOutput)
}
// **Required** - Name of the snapshot.
func (o InstanceSnapshotOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *InstanceSnapshot) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// *Optional* - Name of the project where the snapshot will be stored.
func (o InstanceSnapshotOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *InstanceSnapshot) 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 InstanceSnapshotOutput) Remote() pulumi.StringPtrOutput {
return o.ApplyT(func(v *InstanceSnapshot) pulumi.StringPtrOutput { return v.Remote }).(pulumi.StringPtrOutput)
}
// *Optional* - Set to `true` to create a stateful snapshot,
// `false` for stateless. Stateful snapshots include runtime state. Defaults to
// `false`.
func (o InstanceSnapshotOutput) Stateful() pulumi.BoolOutput {
return o.ApplyT(func(v *InstanceSnapshot) pulumi.BoolOutput { return v.Stateful }).(pulumi.BoolOutput)
}
type InstanceSnapshotArrayOutput struct{ *pulumi.OutputState }
func (InstanceSnapshotArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*InstanceSnapshot)(nil)).Elem()
}
func (o InstanceSnapshotArrayOutput) ToInstanceSnapshotArrayOutput() InstanceSnapshotArrayOutput {
return o
}
func (o InstanceSnapshotArrayOutput) ToInstanceSnapshotArrayOutputWithContext(ctx context.Context) InstanceSnapshotArrayOutput {
return o
}
func (o InstanceSnapshotArrayOutput) Index(i pulumi.IntInput) InstanceSnapshotOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *InstanceSnapshot {
return vs[0].([]*InstanceSnapshot)[vs[1].(int)]
}).(InstanceSnapshotOutput)
}
type InstanceSnapshotMapOutput struct{ *pulumi.OutputState }
func (InstanceSnapshotMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*InstanceSnapshot)(nil)).Elem()
}
func (o InstanceSnapshotMapOutput) ToInstanceSnapshotMapOutput() InstanceSnapshotMapOutput {
return o
}
func (o InstanceSnapshotMapOutput) ToInstanceSnapshotMapOutputWithContext(ctx context.Context) InstanceSnapshotMapOutput {
return o
}
func (o InstanceSnapshotMapOutput) MapIndex(k pulumi.StringInput) InstanceSnapshotOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *InstanceSnapshot {
return vs[0].(map[string]*InstanceSnapshot)[vs[1].(string)]
}).(InstanceSnapshotOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*InstanceSnapshotInput)(nil)).Elem(), &InstanceSnapshot{})
pulumi.RegisterInputType(reflect.TypeOf((*InstanceSnapshotArrayInput)(nil)).Elem(), InstanceSnapshotArray{})
pulumi.RegisterInputType(reflect.TypeOf((*InstanceSnapshotMapInput)(nil)).Elem(), InstanceSnapshotMap{})
pulumi.RegisterOutputType(InstanceSnapshotOutput{})
pulumi.RegisterOutputType(InstanceSnapshotArrayOutput{})
pulumi.RegisterOutputType(InstanceSnapshotMapOutput{})
}