github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ecr/getImage.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 ecr
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // The ECR Image data source allows the details of an image with a particular tag or digest to be retrieved.
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecr"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			_, err := ecr.GetImage(ctx, &ecr.GetImageArgs{
    32  //				RepositoryName: "my/service",
    33  //				ImageTag:       pulumi.StringRef("latest"),
    34  //			}, nil)
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			return nil
    39  //		})
    40  //	}
    41  //
    42  // ```
    43  // <!--End PulumiCodeChooser -->
    44  func GetImage(ctx *pulumi.Context, args *GetImageArgs, opts ...pulumi.InvokeOption) (*GetImageResult, error) {
    45  	opts = internal.PkgInvokeDefaultOpts(opts)
    46  	var rv GetImageResult
    47  	err := ctx.Invoke("aws:ecr/getImage:getImage", args, &rv, opts...)
    48  	if err != nil {
    49  		return nil, err
    50  	}
    51  	return &rv, nil
    52  }
    53  
    54  // A collection of arguments for invoking getImage.
    55  type GetImageArgs struct {
    56  	// Sha256 digest of the image manifest. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
    57  	ImageDigest *string `pulumi:"imageDigest"`
    58  	// Tag associated with this image. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
    59  	ImageTag *string `pulumi:"imageTag"`
    60  	// Return the most recently pushed image. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
    61  	MostRecent *bool `pulumi:"mostRecent"`
    62  	// ID of the Registry where the repository resides.
    63  	RegistryId *string `pulumi:"registryId"`
    64  	// Name of the ECR Repository.
    65  	RepositoryName string `pulumi:"repositoryName"`
    66  }
    67  
    68  // A collection of values returned by getImage.
    69  type GetImageResult struct {
    70  	// The provider-assigned unique ID for this managed resource.
    71  	Id          string `pulumi:"id"`
    72  	ImageDigest string `pulumi:"imageDigest"`
    73  	// Date and time, expressed as a unix timestamp, at which the current image was pushed to the repository.
    74  	ImagePushedAt int `pulumi:"imagePushedAt"`
    75  	// Size, in bytes, of the image in the repository.
    76  	ImageSizeInBytes int     `pulumi:"imageSizeInBytes"`
    77  	ImageTag         *string `pulumi:"imageTag"`
    78  	// List of tags associated with this image.
    79  	ImageTags []string `pulumi:"imageTags"`
    80  	// The URI for the specific image version specified by `imageTag` or `imageDigest`.
    81  	ImageUri       string `pulumi:"imageUri"`
    82  	MostRecent     *bool  `pulumi:"mostRecent"`
    83  	RegistryId     string `pulumi:"registryId"`
    84  	RepositoryName string `pulumi:"repositoryName"`
    85  }
    86  
    87  func GetImageOutput(ctx *pulumi.Context, args GetImageOutputArgs, opts ...pulumi.InvokeOption) GetImageResultOutput {
    88  	return pulumi.ToOutputWithContext(context.Background(), args).
    89  		ApplyT(func(v interface{}) (GetImageResult, error) {
    90  			args := v.(GetImageArgs)
    91  			r, err := GetImage(ctx, &args, opts...)
    92  			var s GetImageResult
    93  			if r != nil {
    94  				s = *r
    95  			}
    96  			return s, err
    97  		}).(GetImageResultOutput)
    98  }
    99  
   100  // A collection of arguments for invoking getImage.
   101  type GetImageOutputArgs struct {
   102  	// Sha256 digest of the image manifest. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
   103  	ImageDigest pulumi.StringPtrInput `pulumi:"imageDigest"`
   104  	// Tag associated with this image. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
   105  	ImageTag pulumi.StringPtrInput `pulumi:"imageTag"`
   106  	// Return the most recently pushed image. At least one of `imageDigest`, `imageTag`, or `mostRecent` must be specified.
   107  	MostRecent pulumi.BoolPtrInput `pulumi:"mostRecent"`
   108  	// ID of the Registry where the repository resides.
   109  	RegistryId pulumi.StringPtrInput `pulumi:"registryId"`
   110  	// Name of the ECR Repository.
   111  	RepositoryName pulumi.StringInput `pulumi:"repositoryName"`
   112  }
   113  
   114  func (GetImageOutputArgs) ElementType() reflect.Type {
   115  	return reflect.TypeOf((*GetImageArgs)(nil)).Elem()
   116  }
   117  
   118  // A collection of values returned by getImage.
   119  type GetImageResultOutput struct{ *pulumi.OutputState }
   120  
   121  func (GetImageResultOutput) ElementType() reflect.Type {
   122  	return reflect.TypeOf((*GetImageResult)(nil)).Elem()
   123  }
   124  
   125  func (o GetImageResultOutput) ToGetImageResultOutput() GetImageResultOutput {
   126  	return o
   127  }
   128  
   129  func (o GetImageResultOutput) ToGetImageResultOutputWithContext(ctx context.Context) GetImageResultOutput {
   130  	return o
   131  }
   132  
   133  // The provider-assigned unique ID for this managed resource.
   134  func (o GetImageResultOutput) Id() pulumi.StringOutput {
   135  	return o.ApplyT(func(v GetImageResult) string { return v.Id }).(pulumi.StringOutput)
   136  }
   137  
   138  func (o GetImageResultOutput) ImageDigest() pulumi.StringOutput {
   139  	return o.ApplyT(func(v GetImageResult) string { return v.ImageDigest }).(pulumi.StringOutput)
   140  }
   141  
   142  // Date and time, expressed as a unix timestamp, at which the current image was pushed to the repository.
   143  func (o GetImageResultOutput) ImagePushedAt() pulumi.IntOutput {
   144  	return o.ApplyT(func(v GetImageResult) int { return v.ImagePushedAt }).(pulumi.IntOutput)
   145  }
   146  
   147  // Size, in bytes, of the image in the repository.
   148  func (o GetImageResultOutput) ImageSizeInBytes() pulumi.IntOutput {
   149  	return o.ApplyT(func(v GetImageResult) int { return v.ImageSizeInBytes }).(pulumi.IntOutput)
   150  }
   151  
   152  func (o GetImageResultOutput) ImageTag() pulumi.StringPtrOutput {
   153  	return o.ApplyT(func(v GetImageResult) *string { return v.ImageTag }).(pulumi.StringPtrOutput)
   154  }
   155  
   156  // List of tags associated with this image.
   157  func (o GetImageResultOutput) ImageTags() pulumi.StringArrayOutput {
   158  	return o.ApplyT(func(v GetImageResult) []string { return v.ImageTags }).(pulumi.StringArrayOutput)
   159  }
   160  
   161  // The URI for the specific image version specified by `imageTag` or `imageDigest`.
   162  func (o GetImageResultOutput) ImageUri() pulumi.StringOutput {
   163  	return o.ApplyT(func(v GetImageResult) string { return v.ImageUri }).(pulumi.StringOutput)
   164  }
   165  
   166  func (o GetImageResultOutput) MostRecent() pulumi.BoolPtrOutput {
   167  	return o.ApplyT(func(v GetImageResult) *bool { return v.MostRecent }).(pulumi.BoolPtrOutput)
   168  }
   169  
   170  func (o GetImageResultOutput) RegistryId() pulumi.StringOutput {
   171  	return o.ApplyT(func(v GetImageResult) string { return v.RegistryId }).(pulumi.StringOutput)
   172  }
   173  
   174  func (o GetImageResultOutput) RepositoryName() pulumi.StringOutput {
   175  	return o.ApplyT(func(v GetImageResult) string { return v.RepositoryName }).(pulumi.StringOutput)
   176  }
   177  
   178  func init() {
   179  	pulumi.RegisterOutputType(GetImageResultOutput{})
   180  }