github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/imagebuilder/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 imagebuilder
     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  // Provides details about an Image Builder Image.
    15  //
    16  // ## Example Usage
    17  //
    18  // ### Latest
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/imagebuilder"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := imagebuilder.LookupImage(ctx, &imagebuilder.LookupImageArgs{
    34  //				Arn: "arn:aws:imagebuilder:us-west-2:aws:image/amazon-linux-2-x86/x.x.x",
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  func LookupImage(ctx *pulumi.Context, args *LookupImageArgs, opts ...pulumi.InvokeOption) (*LookupImageResult, error) {
    46  	opts = internal.PkgInvokeDefaultOpts(opts)
    47  	var rv LookupImageResult
    48  	err := ctx.Invoke("aws:imagebuilder/getImage:getImage", args, &rv, opts...)
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	return &rv, nil
    53  }
    54  
    55  // A collection of arguments for invoking getImage.
    56  type LookupImageArgs struct {
    57  	// ARN of the image. The suffix can either be specified with wildcards (`x.x.x`) to fetch the latest build version or a full build version (e.g., `2020.11.26/1`) to fetch an exact version.
    58  	Arn string `pulumi:"arn"`
    59  	// Key-value map of resource tags for the image.
    60  	Tags map[string]string `pulumi:"tags"`
    61  }
    62  
    63  // A collection of values returned by getImage.
    64  type LookupImageResult struct {
    65  	Arn string `pulumi:"arn"`
    66  	// Build version ARN of the image. This will always have the `#.#.#/#` suffix.
    67  	BuildVersionArn string `pulumi:"buildVersionArn"`
    68  	// ARN of the container recipe.
    69  	ContainerRecipeArn string `pulumi:"containerRecipeArn"`
    70  	// Date the image was created.
    71  	DateCreated string `pulumi:"dateCreated"`
    72  	// ARN of the Image Builder Distribution Configuration.
    73  	DistributionConfigurationArn string `pulumi:"distributionConfigurationArn"`
    74  	// Whether additional information about the image being created is collected.
    75  	EnhancedImageMetadataEnabled bool `pulumi:"enhancedImageMetadataEnabled"`
    76  	// The provider-assigned unique ID for this managed resource.
    77  	Id string `pulumi:"id"`
    78  	// ARN of the image recipe.
    79  	ImageRecipeArn string `pulumi:"imageRecipeArn"`
    80  	// List of an object with image scanning configuration fields.
    81  	ImageScanningConfigurations []GetImageImageScanningConfiguration `pulumi:"imageScanningConfigurations"`
    82  	// List of an object with image tests configuration.
    83  	ImageTestsConfigurations []GetImageImageTestsConfiguration `pulumi:"imageTestsConfigurations"`
    84  	// ARN of the Image Builder Infrastructure Configuration.
    85  	InfrastructureConfigurationArn string `pulumi:"infrastructureConfigurationArn"`
    86  	// Name of the AMI.
    87  	Name string `pulumi:"name"`
    88  	// Operating System version of the image.
    89  	OsVersion string `pulumi:"osVersion"`
    90  	// List of objects with resources created by the image.
    91  	OutputResources []GetImageOutputResource `pulumi:"outputResources"`
    92  	// Platform of the image.
    93  	Platform string `pulumi:"platform"`
    94  	// Key-value map of resource tags for the image.
    95  	Tags map[string]string `pulumi:"tags"`
    96  	// Version of the image.
    97  	Version string `pulumi:"version"`
    98  }
    99  
   100  func LookupImageOutput(ctx *pulumi.Context, args LookupImageOutputArgs, opts ...pulumi.InvokeOption) LookupImageResultOutput {
   101  	return pulumi.ToOutputWithContext(context.Background(), args).
   102  		ApplyT(func(v interface{}) (LookupImageResult, error) {
   103  			args := v.(LookupImageArgs)
   104  			r, err := LookupImage(ctx, &args, opts...)
   105  			var s LookupImageResult
   106  			if r != nil {
   107  				s = *r
   108  			}
   109  			return s, err
   110  		}).(LookupImageResultOutput)
   111  }
   112  
   113  // A collection of arguments for invoking getImage.
   114  type LookupImageOutputArgs struct {
   115  	// ARN of the image. The suffix can either be specified with wildcards (`x.x.x`) to fetch the latest build version or a full build version (e.g., `2020.11.26/1`) to fetch an exact version.
   116  	Arn pulumi.StringInput `pulumi:"arn"`
   117  	// Key-value map of resource tags for the image.
   118  	Tags pulumi.StringMapInput `pulumi:"tags"`
   119  }
   120  
   121  func (LookupImageOutputArgs) ElementType() reflect.Type {
   122  	return reflect.TypeOf((*LookupImageArgs)(nil)).Elem()
   123  }
   124  
   125  // A collection of values returned by getImage.
   126  type LookupImageResultOutput struct{ *pulumi.OutputState }
   127  
   128  func (LookupImageResultOutput) ElementType() reflect.Type {
   129  	return reflect.TypeOf((*LookupImageResult)(nil)).Elem()
   130  }
   131  
   132  func (o LookupImageResultOutput) ToLookupImageResultOutput() LookupImageResultOutput {
   133  	return o
   134  }
   135  
   136  func (o LookupImageResultOutput) ToLookupImageResultOutputWithContext(ctx context.Context) LookupImageResultOutput {
   137  	return o
   138  }
   139  
   140  func (o LookupImageResultOutput) Arn() pulumi.StringOutput {
   141  	return o.ApplyT(func(v LookupImageResult) string { return v.Arn }).(pulumi.StringOutput)
   142  }
   143  
   144  // Build version ARN of the image. This will always have the `#.#.#/#` suffix.
   145  func (o LookupImageResultOutput) BuildVersionArn() pulumi.StringOutput {
   146  	return o.ApplyT(func(v LookupImageResult) string { return v.BuildVersionArn }).(pulumi.StringOutput)
   147  }
   148  
   149  // ARN of the container recipe.
   150  func (o LookupImageResultOutput) ContainerRecipeArn() pulumi.StringOutput {
   151  	return o.ApplyT(func(v LookupImageResult) string { return v.ContainerRecipeArn }).(pulumi.StringOutput)
   152  }
   153  
   154  // Date the image was created.
   155  func (o LookupImageResultOutput) DateCreated() pulumi.StringOutput {
   156  	return o.ApplyT(func(v LookupImageResult) string { return v.DateCreated }).(pulumi.StringOutput)
   157  }
   158  
   159  // ARN of the Image Builder Distribution Configuration.
   160  func (o LookupImageResultOutput) DistributionConfigurationArn() pulumi.StringOutput {
   161  	return o.ApplyT(func(v LookupImageResult) string { return v.DistributionConfigurationArn }).(pulumi.StringOutput)
   162  }
   163  
   164  // Whether additional information about the image being created is collected.
   165  func (o LookupImageResultOutput) EnhancedImageMetadataEnabled() pulumi.BoolOutput {
   166  	return o.ApplyT(func(v LookupImageResult) bool { return v.EnhancedImageMetadataEnabled }).(pulumi.BoolOutput)
   167  }
   168  
   169  // The provider-assigned unique ID for this managed resource.
   170  func (o LookupImageResultOutput) Id() pulumi.StringOutput {
   171  	return o.ApplyT(func(v LookupImageResult) string { return v.Id }).(pulumi.StringOutput)
   172  }
   173  
   174  // ARN of the image recipe.
   175  func (o LookupImageResultOutput) ImageRecipeArn() pulumi.StringOutput {
   176  	return o.ApplyT(func(v LookupImageResult) string { return v.ImageRecipeArn }).(pulumi.StringOutput)
   177  }
   178  
   179  // List of an object with image scanning configuration fields.
   180  func (o LookupImageResultOutput) ImageScanningConfigurations() GetImageImageScanningConfigurationArrayOutput {
   181  	return o.ApplyT(func(v LookupImageResult) []GetImageImageScanningConfiguration { return v.ImageScanningConfigurations }).(GetImageImageScanningConfigurationArrayOutput)
   182  }
   183  
   184  // List of an object with image tests configuration.
   185  func (o LookupImageResultOutput) ImageTestsConfigurations() GetImageImageTestsConfigurationArrayOutput {
   186  	return o.ApplyT(func(v LookupImageResult) []GetImageImageTestsConfiguration { return v.ImageTestsConfigurations }).(GetImageImageTestsConfigurationArrayOutput)
   187  }
   188  
   189  // ARN of the Image Builder Infrastructure Configuration.
   190  func (o LookupImageResultOutput) InfrastructureConfigurationArn() pulumi.StringOutput {
   191  	return o.ApplyT(func(v LookupImageResult) string { return v.InfrastructureConfigurationArn }).(pulumi.StringOutput)
   192  }
   193  
   194  // Name of the AMI.
   195  func (o LookupImageResultOutput) Name() pulumi.StringOutput {
   196  	return o.ApplyT(func(v LookupImageResult) string { return v.Name }).(pulumi.StringOutput)
   197  }
   198  
   199  // Operating System version of the image.
   200  func (o LookupImageResultOutput) OsVersion() pulumi.StringOutput {
   201  	return o.ApplyT(func(v LookupImageResult) string { return v.OsVersion }).(pulumi.StringOutput)
   202  }
   203  
   204  // List of objects with resources created by the image.
   205  func (o LookupImageResultOutput) OutputResources() GetImageOutputResourceArrayOutput {
   206  	return o.ApplyT(func(v LookupImageResult) []GetImageOutputResource { return v.OutputResources }).(GetImageOutputResourceArrayOutput)
   207  }
   208  
   209  // Platform of the image.
   210  func (o LookupImageResultOutput) Platform() pulumi.StringOutput {
   211  	return o.ApplyT(func(v LookupImageResult) string { return v.Platform }).(pulumi.StringOutput)
   212  }
   213  
   214  // Key-value map of resource tags for the image.
   215  func (o LookupImageResultOutput) Tags() pulumi.StringMapOutput {
   216  	return o.ApplyT(func(v LookupImageResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   217  }
   218  
   219  // Version of the image.
   220  func (o LookupImageResultOutput) Version() pulumi.StringOutput {
   221  	return o.ApplyT(func(v LookupImageResult) string { return v.Version }).(pulumi.StringOutput)
   222  }
   223  
   224  func init() {
   225  	pulumi.RegisterOutputType(LookupImageResultOutput{})
   226  }