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

390 lines
14 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"
"git.kalinow.ski/nimbus/pulumi-incus/sdk/go/incus/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## # Image
//
// Manages a locally-stored Incus image.
//
// ## 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 {
// alpine, err := incus.NewImage(ctx, "alpine", &incus.ImageArgs{
// SourceImage: &incus.ImageSourceImageArgs{
// Remote: pulumi.String("images"),
// Name: pulumi.String("alpine/edge"),
// },
// })
// if err != nil {
// return err
// }
// _, err = incus.NewInstance(ctx, "test1", &incus.InstanceArgs{
// Name: pulumi.String("test1"),
// Image: alpine.Fingerprint,
// Ephemeral: pulumi.Bool(false),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Notes
//
// * See the Incus [documentation](https://linuxcontainers.org/incus/docs/main/howto/images_remote) for more info on default image remotes.
type Image struct {
pulumi.CustomResourceState
// *Optional* - A list of aliases to assign to the image after
// pulling.
Aliases pulumi.StringArrayOutput `pulumi:"aliases"`
// The list of aliases that were copied from the
// `sourceImage`.
CopiedAliases pulumi.StringArrayOutput `pulumi:"copiedAliases"`
// The datetime of image creation, in Unix time.
CreatedAt pulumi.IntOutput `pulumi:"createdAt"`
// The unique hash fingperint of the image.
Fingerprint pulumi.StringOutput `pulumi:"fingerprint"`
// *Optional* - Name of the project where the image will be stored.
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"`
ResourceId pulumi.StringOutput `pulumi:"resourceId"`
// *Optional* - The image file from the local file system from which the image will be created. See reference below.
SourceFile ImageSourceFilePtrOutput `pulumi:"sourceFile"`
// *Optional* - The source image from which the image will be created. See reference below.
SourceImage ImageSourceImagePtrOutput `pulumi:"sourceImage"`
// *Optional* - The source instance from which the image will be created. See reference below.
SourceInstance ImageSourceInstancePtrOutput `pulumi:"sourceInstance"`
}
// NewImage registers a new resource with the given unique name, arguments, and options.
func NewImage(ctx *pulumi.Context,
name string, args *ImageArgs, opts ...pulumi.ResourceOption) (*Image, error) {
if args == nil {
args = &ImageArgs{}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Image
err := ctx.RegisterResource("incus:index/image:Image", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetImage gets an existing Image 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 GetImage(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ImageState, opts ...pulumi.ResourceOption) (*Image, error) {
var resource Image
err := ctx.ReadResource("incus:index/image:Image", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Image resources.
type imageState struct {
// *Optional* - A list of aliases to assign to the image after
// pulling.
Aliases []string `pulumi:"aliases"`
// The list of aliases that were copied from the
// `sourceImage`.
CopiedAliases []string `pulumi:"copiedAliases"`
// The datetime of image creation, in Unix time.
CreatedAt *int `pulumi:"createdAt"`
// The unique hash fingperint of the image.
Fingerprint *string `pulumi:"fingerprint"`
// *Optional* - Name of the project where the image 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"`
ResourceId *string `pulumi:"resourceId"`
// *Optional* - The image file from the local file system from which the image will be created. See reference below.
SourceFile *ImageSourceFile `pulumi:"sourceFile"`
// *Optional* - The source image from which the image will be created. See reference below.
SourceImage *ImageSourceImage `pulumi:"sourceImage"`
// *Optional* - The source instance from which the image will be created. See reference below.
SourceInstance *ImageSourceInstance `pulumi:"sourceInstance"`
}
type ImageState struct {
// *Optional* - A list of aliases to assign to the image after
// pulling.
Aliases pulumi.StringArrayInput
// The list of aliases that were copied from the
// `sourceImage`.
CopiedAliases pulumi.StringArrayInput
// The datetime of image creation, in Unix time.
CreatedAt pulumi.IntPtrInput
// The unique hash fingperint of the image.
Fingerprint pulumi.StringPtrInput
// *Optional* - Name of the project where the image 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
ResourceId pulumi.StringPtrInput
// *Optional* - The image file from the local file system from which the image will be created. See reference below.
SourceFile ImageSourceFilePtrInput
// *Optional* - The source image from which the image will be created. See reference below.
SourceImage ImageSourceImagePtrInput
// *Optional* - The source instance from which the image will be created. See reference below.
SourceInstance ImageSourceInstancePtrInput
}
func (ImageState) ElementType() reflect.Type {
return reflect.TypeOf((*imageState)(nil)).Elem()
}
type imageArgs struct {
// *Optional* - A list of aliases to assign to the image after
// pulling.
Aliases []string `pulumi:"aliases"`
// *Optional* - Name of the project where the image 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* - The image file from the local file system from which the image will be created. See reference below.
SourceFile *ImageSourceFile `pulumi:"sourceFile"`
// *Optional* - The source image from which the image will be created. See reference below.
SourceImage *ImageSourceImage `pulumi:"sourceImage"`
// *Optional* - The source instance from which the image will be created. See reference below.
SourceInstance *ImageSourceInstance `pulumi:"sourceInstance"`
}
// The set of arguments for constructing a Image resource.
type ImageArgs struct {
// *Optional* - A list of aliases to assign to the image after
// pulling.
Aliases pulumi.StringArrayInput
// *Optional* - Name of the project where the image 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* - The image file from the local file system from which the image will be created. See reference below.
SourceFile ImageSourceFilePtrInput
// *Optional* - The source image from which the image will be created. See reference below.
SourceImage ImageSourceImagePtrInput
// *Optional* - The source instance from which the image will be created. See reference below.
SourceInstance ImageSourceInstancePtrInput
}
func (ImageArgs) ElementType() reflect.Type {
return reflect.TypeOf((*imageArgs)(nil)).Elem()
}
type ImageInput interface {
pulumi.Input
ToImageOutput() ImageOutput
ToImageOutputWithContext(ctx context.Context) ImageOutput
}
func (*Image) ElementType() reflect.Type {
return reflect.TypeOf((**Image)(nil)).Elem()
}
func (i *Image) ToImageOutput() ImageOutput {
return i.ToImageOutputWithContext(context.Background())
}
func (i *Image) ToImageOutputWithContext(ctx context.Context) ImageOutput {
return pulumi.ToOutputWithContext(ctx, i).(ImageOutput)
}
// ImageArrayInput is an input type that accepts ImageArray and ImageArrayOutput values.
// You can construct a concrete instance of `ImageArrayInput` via:
//
// ImageArray{ ImageArgs{...} }
type ImageArrayInput interface {
pulumi.Input
ToImageArrayOutput() ImageArrayOutput
ToImageArrayOutputWithContext(context.Context) ImageArrayOutput
}
type ImageArray []ImageInput
func (ImageArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Image)(nil)).Elem()
}
func (i ImageArray) ToImageArrayOutput() ImageArrayOutput {
return i.ToImageArrayOutputWithContext(context.Background())
}
func (i ImageArray) ToImageArrayOutputWithContext(ctx context.Context) ImageArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ImageArrayOutput)
}
// ImageMapInput is an input type that accepts ImageMap and ImageMapOutput values.
// You can construct a concrete instance of `ImageMapInput` via:
//
// ImageMap{ "key": ImageArgs{...} }
type ImageMapInput interface {
pulumi.Input
ToImageMapOutput() ImageMapOutput
ToImageMapOutputWithContext(context.Context) ImageMapOutput
}
type ImageMap map[string]ImageInput
func (ImageMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Image)(nil)).Elem()
}
func (i ImageMap) ToImageMapOutput() ImageMapOutput {
return i.ToImageMapOutputWithContext(context.Background())
}
func (i ImageMap) ToImageMapOutputWithContext(ctx context.Context) ImageMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ImageMapOutput)
}
type ImageOutput struct{ *pulumi.OutputState }
func (ImageOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Image)(nil)).Elem()
}
func (o ImageOutput) ToImageOutput() ImageOutput {
return o
}
func (o ImageOutput) ToImageOutputWithContext(ctx context.Context) ImageOutput {
return o
}
// *Optional* - A list of aliases to assign to the image after
// pulling.
func (o ImageOutput) Aliases() pulumi.StringArrayOutput {
return o.ApplyT(func(v *Image) pulumi.StringArrayOutput { return v.Aliases }).(pulumi.StringArrayOutput)
}
// The list of aliases that were copied from the
// `sourceImage`.
func (o ImageOutput) CopiedAliases() pulumi.StringArrayOutput {
return o.ApplyT(func(v *Image) pulumi.StringArrayOutput { return v.CopiedAliases }).(pulumi.StringArrayOutput)
}
// The datetime of image creation, in Unix time.
func (o ImageOutput) CreatedAt() pulumi.IntOutput {
return o.ApplyT(func(v *Image) pulumi.IntOutput { return v.CreatedAt }).(pulumi.IntOutput)
}
// The unique hash fingperint of the image.
func (o ImageOutput) Fingerprint() pulumi.StringOutput {
return o.ApplyT(func(v *Image) pulumi.StringOutput { return v.Fingerprint }).(pulumi.StringOutput)
}
// *Optional* - Name of the project where the image will be stored.
func (o ImageOutput) Project() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Image) 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 ImageOutput) Remote() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Image) pulumi.StringPtrOutput { return v.Remote }).(pulumi.StringPtrOutput)
}
func (o ImageOutput) ResourceId() pulumi.StringOutput {
return o.ApplyT(func(v *Image) pulumi.StringOutput { return v.ResourceId }).(pulumi.StringOutput)
}
// *Optional* - The image file from the local file system from which the image will be created. See reference below.
func (o ImageOutput) SourceFile() ImageSourceFilePtrOutput {
return o.ApplyT(func(v *Image) ImageSourceFilePtrOutput { return v.SourceFile }).(ImageSourceFilePtrOutput)
}
// *Optional* - The source image from which the image will be created. See reference below.
func (o ImageOutput) SourceImage() ImageSourceImagePtrOutput {
return o.ApplyT(func(v *Image) ImageSourceImagePtrOutput { return v.SourceImage }).(ImageSourceImagePtrOutput)
}
// *Optional* - The source instance from which the image will be created. See reference below.
func (o ImageOutput) SourceInstance() ImageSourceInstancePtrOutput {
return o.ApplyT(func(v *Image) ImageSourceInstancePtrOutput { return v.SourceInstance }).(ImageSourceInstancePtrOutput)
}
type ImageArrayOutput struct{ *pulumi.OutputState }
func (ImageArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Image)(nil)).Elem()
}
func (o ImageArrayOutput) ToImageArrayOutput() ImageArrayOutput {
return o
}
func (o ImageArrayOutput) ToImageArrayOutputWithContext(ctx context.Context) ImageArrayOutput {
return o
}
func (o ImageArrayOutput) Index(i pulumi.IntInput) ImageOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Image {
return vs[0].([]*Image)[vs[1].(int)]
}).(ImageOutput)
}
type ImageMapOutput struct{ *pulumi.OutputState }
func (ImageMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Image)(nil)).Elem()
}
func (o ImageMapOutput) ToImageMapOutput() ImageMapOutput {
return o
}
func (o ImageMapOutput) ToImageMapOutputWithContext(ctx context.Context) ImageMapOutput {
return o
}
func (o ImageMapOutput) MapIndex(k pulumi.StringInput) ImageOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Image {
return vs[0].(map[string]*Image)[vs[1].(string)]
}).(ImageOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ImageInput)(nil)).Elem(), &Image{})
pulumi.RegisterInputType(reflect.TypeOf((*ImageArrayInput)(nil)).Elem(), ImageArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ImageMapInput)(nil)).Elem(), ImageMap{})
pulumi.RegisterOutputType(ImageOutput{})
pulumi.RegisterOutputType(ImageArrayOutput{})
pulumi.RegisterOutputType(ImageMapOutput{})
}