github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/sagemaker/imageVersion.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package sagemaker
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Provides a SageMaker Image Version resource.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sagemaker"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := sagemaker.NewImageVersion(ctx, "test", &sagemaker.ImageVersionArgs{
    35  //				ImageName: pulumi.Any(testAwsSagemakerImage.Id),
    36  //				BaseImage: pulumi.String("012345678912.dkr.ecr.us-west-2.amazonaws.com/image:latest"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ## Import
    49  //
    50  // Using `pulumi import`, import SageMaker Image Versions using the `name`. For example:
    51  //
    52  // ```sh
    53  // $ pulumi import aws:sagemaker/imageVersion:ImageVersion test_image my-code-repo
    54  // ```
    55  type ImageVersion struct {
    56  	pulumi.CustomResourceState
    57  
    58  	// The Amazon Resource Name (ARN) assigned by AWS to this Image Version.
    59  	Arn pulumi.StringOutput `pulumi:"arn"`
    60  	// The registry path of the container image on which this image version is based.
    61  	BaseImage pulumi.StringOutput `pulumi:"baseImage"`
    62  	// The registry path of the container image that contains this image version.
    63  	ContainerImage pulumi.StringOutput `pulumi:"containerImage"`
    64  	// The Amazon Resource Name (ARN) of the image the version is based on.
    65  	ImageArn pulumi.StringOutput `pulumi:"imageArn"`
    66  	// The name of the image. Must be unique to your account.
    67  	ImageName pulumi.StringOutput `pulumi:"imageName"`
    68  	Version   pulumi.IntOutput    `pulumi:"version"`
    69  }
    70  
    71  // NewImageVersion registers a new resource with the given unique name, arguments, and options.
    72  func NewImageVersion(ctx *pulumi.Context,
    73  	name string, args *ImageVersionArgs, opts ...pulumi.ResourceOption) (*ImageVersion, error) {
    74  	if args == nil {
    75  		return nil, errors.New("missing one or more required arguments")
    76  	}
    77  
    78  	if args.BaseImage == nil {
    79  		return nil, errors.New("invalid value for required argument 'BaseImage'")
    80  	}
    81  	if args.ImageName == nil {
    82  		return nil, errors.New("invalid value for required argument 'ImageName'")
    83  	}
    84  	opts = internal.PkgResourceDefaultOpts(opts)
    85  	var resource ImageVersion
    86  	err := ctx.RegisterResource("aws:sagemaker/imageVersion:ImageVersion", name, args, &resource, opts...)
    87  	if err != nil {
    88  		return nil, err
    89  	}
    90  	return &resource, nil
    91  }
    92  
    93  // GetImageVersion gets an existing ImageVersion resource's state with the given name, ID, and optional
    94  // state properties that are used to uniquely qualify the lookup (nil if not required).
    95  func GetImageVersion(ctx *pulumi.Context,
    96  	name string, id pulumi.IDInput, state *ImageVersionState, opts ...pulumi.ResourceOption) (*ImageVersion, error) {
    97  	var resource ImageVersion
    98  	err := ctx.ReadResource("aws:sagemaker/imageVersion:ImageVersion", name, id, state, &resource, opts...)
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return &resource, nil
   103  }
   104  
   105  // Input properties used for looking up and filtering ImageVersion resources.
   106  type imageVersionState struct {
   107  	// The Amazon Resource Name (ARN) assigned by AWS to this Image Version.
   108  	Arn *string `pulumi:"arn"`
   109  	// The registry path of the container image on which this image version is based.
   110  	BaseImage *string `pulumi:"baseImage"`
   111  	// The registry path of the container image that contains this image version.
   112  	ContainerImage *string `pulumi:"containerImage"`
   113  	// The Amazon Resource Name (ARN) of the image the version is based on.
   114  	ImageArn *string `pulumi:"imageArn"`
   115  	// The name of the image. Must be unique to your account.
   116  	ImageName *string `pulumi:"imageName"`
   117  	Version   *int    `pulumi:"version"`
   118  }
   119  
   120  type ImageVersionState struct {
   121  	// The Amazon Resource Name (ARN) assigned by AWS to this Image Version.
   122  	Arn pulumi.StringPtrInput
   123  	// The registry path of the container image on which this image version is based.
   124  	BaseImage pulumi.StringPtrInput
   125  	// The registry path of the container image that contains this image version.
   126  	ContainerImage pulumi.StringPtrInput
   127  	// The Amazon Resource Name (ARN) of the image the version is based on.
   128  	ImageArn pulumi.StringPtrInput
   129  	// The name of the image. Must be unique to your account.
   130  	ImageName pulumi.StringPtrInput
   131  	Version   pulumi.IntPtrInput
   132  }
   133  
   134  func (ImageVersionState) ElementType() reflect.Type {
   135  	return reflect.TypeOf((*imageVersionState)(nil)).Elem()
   136  }
   137  
   138  type imageVersionArgs struct {
   139  	// The registry path of the container image on which this image version is based.
   140  	BaseImage string `pulumi:"baseImage"`
   141  	// The name of the image. Must be unique to your account.
   142  	ImageName string `pulumi:"imageName"`
   143  }
   144  
   145  // The set of arguments for constructing a ImageVersion resource.
   146  type ImageVersionArgs struct {
   147  	// The registry path of the container image on which this image version is based.
   148  	BaseImage pulumi.StringInput
   149  	// The name of the image. Must be unique to your account.
   150  	ImageName pulumi.StringInput
   151  }
   152  
   153  func (ImageVersionArgs) ElementType() reflect.Type {
   154  	return reflect.TypeOf((*imageVersionArgs)(nil)).Elem()
   155  }
   156  
   157  type ImageVersionInput interface {
   158  	pulumi.Input
   159  
   160  	ToImageVersionOutput() ImageVersionOutput
   161  	ToImageVersionOutputWithContext(ctx context.Context) ImageVersionOutput
   162  }
   163  
   164  func (*ImageVersion) ElementType() reflect.Type {
   165  	return reflect.TypeOf((**ImageVersion)(nil)).Elem()
   166  }
   167  
   168  func (i *ImageVersion) ToImageVersionOutput() ImageVersionOutput {
   169  	return i.ToImageVersionOutputWithContext(context.Background())
   170  }
   171  
   172  func (i *ImageVersion) ToImageVersionOutputWithContext(ctx context.Context) ImageVersionOutput {
   173  	return pulumi.ToOutputWithContext(ctx, i).(ImageVersionOutput)
   174  }
   175  
   176  // ImageVersionArrayInput is an input type that accepts ImageVersionArray and ImageVersionArrayOutput values.
   177  // You can construct a concrete instance of `ImageVersionArrayInput` via:
   178  //
   179  //	ImageVersionArray{ ImageVersionArgs{...} }
   180  type ImageVersionArrayInput interface {
   181  	pulumi.Input
   182  
   183  	ToImageVersionArrayOutput() ImageVersionArrayOutput
   184  	ToImageVersionArrayOutputWithContext(context.Context) ImageVersionArrayOutput
   185  }
   186  
   187  type ImageVersionArray []ImageVersionInput
   188  
   189  func (ImageVersionArray) ElementType() reflect.Type {
   190  	return reflect.TypeOf((*[]*ImageVersion)(nil)).Elem()
   191  }
   192  
   193  func (i ImageVersionArray) ToImageVersionArrayOutput() ImageVersionArrayOutput {
   194  	return i.ToImageVersionArrayOutputWithContext(context.Background())
   195  }
   196  
   197  func (i ImageVersionArray) ToImageVersionArrayOutputWithContext(ctx context.Context) ImageVersionArrayOutput {
   198  	return pulumi.ToOutputWithContext(ctx, i).(ImageVersionArrayOutput)
   199  }
   200  
   201  // ImageVersionMapInput is an input type that accepts ImageVersionMap and ImageVersionMapOutput values.
   202  // You can construct a concrete instance of `ImageVersionMapInput` via:
   203  //
   204  //	ImageVersionMap{ "key": ImageVersionArgs{...} }
   205  type ImageVersionMapInput interface {
   206  	pulumi.Input
   207  
   208  	ToImageVersionMapOutput() ImageVersionMapOutput
   209  	ToImageVersionMapOutputWithContext(context.Context) ImageVersionMapOutput
   210  }
   211  
   212  type ImageVersionMap map[string]ImageVersionInput
   213  
   214  func (ImageVersionMap) ElementType() reflect.Type {
   215  	return reflect.TypeOf((*map[string]*ImageVersion)(nil)).Elem()
   216  }
   217  
   218  func (i ImageVersionMap) ToImageVersionMapOutput() ImageVersionMapOutput {
   219  	return i.ToImageVersionMapOutputWithContext(context.Background())
   220  }
   221  
   222  func (i ImageVersionMap) ToImageVersionMapOutputWithContext(ctx context.Context) ImageVersionMapOutput {
   223  	return pulumi.ToOutputWithContext(ctx, i).(ImageVersionMapOutput)
   224  }
   225  
   226  type ImageVersionOutput struct{ *pulumi.OutputState }
   227  
   228  func (ImageVersionOutput) ElementType() reflect.Type {
   229  	return reflect.TypeOf((**ImageVersion)(nil)).Elem()
   230  }
   231  
   232  func (o ImageVersionOutput) ToImageVersionOutput() ImageVersionOutput {
   233  	return o
   234  }
   235  
   236  func (o ImageVersionOutput) ToImageVersionOutputWithContext(ctx context.Context) ImageVersionOutput {
   237  	return o
   238  }
   239  
   240  // The Amazon Resource Name (ARN) assigned by AWS to this Image Version.
   241  func (o ImageVersionOutput) Arn() pulumi.StringOutput {
   242  	return o.ApplyT(func(v *ImageVersion) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   243  }
   244  
   245  // The registry path of the container image on which this image version is based.
   246  func (o ImageVersionOutput) BaseImage() pulumi.StringOutput {
   247  	return o.ApplyT(func(v *ImageVersion) pulumi.StringOutput { return v.BaseImage }).(pulumi.StringOutput)
   248  }
   249  
   250  // The registry path of the container image that contains this image version.
   251  func (o ImageVersionOutput) ContainerImage() pulumi.StringOutput {
   252  	return o.ApplyT(func(v *ImageVersion) pulumi.StringOutput { return v.ContainerImage }).(pulumi.StringOutput)
   253  }
   254  
   255  // The Amazon Resource Name (ARN) of the image the version is based on.
   256  func (o ImageVersionOutput) ImageArn() pulumi.StringOutput {
   257  	return o.ApplyT(func(v *ImageVersion) pulumi.StringOutput { return v.ImageArn }).(pulumi.StringOutput)
   258  }
   259  
   260  // The name of the image. Must be unique to your account.
   261  func (o ImageVersionOutput) ImageName() pulumi.StringOutput {
   262  	return o.ApplyT(func(v *ImageVersion) pulumi.StringOutput { return v.ImageName }).(pulumi.StringOutput)
   263  }
   264  
   265  func (o ImageVersionOutput) Version() pulumi.IntOutput {
   266  	return o.ApplyT(func(v *ImageVersion) pulumi.IntOutput { return v.Version }).(pulumi.IntOutput)
   267  }
   268  
   269  type ImageVersionArrayOutput struct{ *pulumi.OutputState }
   270  
   271  func (ImageVersionArrayOutput) ElementType() reflect.Type {
   272  	return reflect.TypeOf((*[]*ImageVersion)(nil)).Elem()
   273  }
   274  
   275  func (o ImageVersionArrayOutput) ToImageVersionArrayOutput() ImageVersionArrayOutput {
   276  	return o
   277  }
   278  
   279  func (o ImageVersionArrayOutput) ToImageVersionArrayOutputWithContext(ctx context.Context) ImageVersionArrayOutput {
   280  	return o
   281  }
   282  
   283  func (o ImageVersionArrayOutput) Index(i pulumi.IntInput) ImageVersionOutput {
   284  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ImageVersion {
   285  		return vs[0].([]*ImageVersion)[vs[1].(int)]
   286  	}).(ImageVersionOutput)
   287  }
   288  
   289  type ImageVersionMapOutput struct{ *pulumi.OutputState }
   290  
   291  func (ImageVersionMapOutput) ElementType() reflect.Type {
   292  	return reflect.TypeOf((*map[string]*ImageVersion)(nil)).Elem()
   293  }
   294  
   295  func (o ImageVersionMapOutput) ToImageVersionMapOutput() ImageVersionMapOutput {
   296  	return o
   297  }
   298  
   299  func (o ImageVersionMapOutput) ToImageVersionMapOutputWithContext(ctx context.Context) ImageVersionMapOutput {
   300  	return o
   301  }
   302  
   303  func (o ImageVersionMapOutput) MapIndex(k pulumi.StringInput) ImageVersionOutput {
   304  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ImageVersion {
   305  		return vs[0].(map[string]*ImageVersion)[vs[1].(string)]
   306  	}).(ImageVersionOutput)
   307  }
   308  
   309  func init() {
   310  	pulumi.RegisterInputType(reflect.TypeOf((*ImageVersionInput)(nil)).Elem(), &ImageVersion{})
   311  	pulumi.RegisterInputType(reflect.TypeOf((*ImageVersionArrayInput)(nil)).Elem(), ImageVersionArray{})
   312  	pulumi.RegisterInputType(reflect.TypeOf((*ImageVersionMapInput)(nil)).Elem(), ImageVersionMap{})
   313  	pulumi.RegisterOutputType(ImageVersionOutput{})
   314  	pulumi.RegisterOutputType(ImageVersionArrayOutput{})
   315  	pulumi.RegisterOutputType(ImageVersionMapOutput{})
   316  }