github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getAmiIds.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 ec2
     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  // Use this data source to get a list of AMI IDs matching the specified criteria.
    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/ec2"
    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 := ec2.GetAmiIds(ctx, &ec2.GetAmiIdsArgs{
    32  //				Owners: []string{
    33  //					"099720109477",
    34  //				},
    35  //				Filters: []ec2.GetAmiIdsFilter{
    36  //					{
    37  //						Name: "name",
    38  //						Values: []string{
    39  //							"ubuntu/images/ubuntu-*-*-amd64-server-*",
    40  //						},
    41  //					},
    42  //				},
    43  //			}, nil)
    44  //			if err != nil {
    45  //				return err
    46  //			}
    47  //			return nil
    48  //		})
    49  //	}
    50  //
    51  // ```
    52  // <!--End PulumiCodeChooser -->
    53  func GetAmiIds(ctx *pulumi.Context, args *GetAmiIdsArgs, opts ...pulumi.InvokeOption) (*GetAmiIdsResult, error) {
    54  	opts = internal.PkgInvokeDefaultOpts(opts)
    55  	var rv GetAmiIdsResult
    56  	err := ctx.Invoke("aws:ec2/getAmiIds:getAmiIds", args, &rv, opts...)
    57  	if err != nil {
    58  		return nil, err
    59  	}
    60  	return &rv, nil
    61  }
    62  
    63  // A collection of arguments for invoking getAmiIds.
    64  type GetAmiIdsArgs struct {
    65  	// Limit search to users with *explicit* launch
    66  	// permission on  the image. Valid items are the numeric account ID or `self`.
    67  	ExecutableUsers []string `pulumi:"executableUsers"`
    68  	// One or more name/value pairs to filter off of. There
    69  	// are several valid keys, for a full reference, check out
    70  	// [describe-images in the AWS CLI reference][1].
    71  	Filters []GetAmiIdsFilter `pulumi:"filters"`
    72  	// If true, all deprecated AMIs are included in the response.
    73  	// If false, no deprecated AMIs are included in the response. If no value is specified, the default value is `false`.
    74  	IncludeDeprecated *bool `pulumi:"includeDeprecated"`
    75  	// Regex string to apply to the AMI list returned
    76  	// by AWS. This allows more advanced filtering not supported from the AWS API.
    77  	// This filtering is done locally on what AWS returns, and could have a performance
    78  	// impact if the result is large. Combine this with other
    79  	// options to narrow down the list AWS returns.
    80  	NameRegex *string `pulumi:"nameRegex"`
    81  	// List of AMI owners to limit search. At least 1 value must be specified. Valid values: an AWS account ID, `self` (the current account), or an AWS owner alias (e.g., `amazon`, `aws-marketplace`, `microsoft`).
    82  	Owners []string `pulumi:"owners"`
    83  	// Used to sort AMIs by creation time.
    84  	// If no value is specified, the default value is `false`.
    85  	SortAscending *bool `pulumi:"sortAscending"`
    86  }
    87  
    88  // A collection of values returned by getAmiIds.
    89  type GetAmiIdsResult struct {
    90  	ExecutableUsers []string          `pulumi:"executableUsers"`
    91  	Filters         []GetAmiIdsFilter `pulumi:"filters"`
    92  	// The provider-assigned unique ID for this managed resource.
    93  	Id                string   `pulumi:"id"`
    94  	Ids               []string `pulumi:"ids"`
    95  	IncludeDeprecated *bool    `pulumi:"includeDeprecated"`
    96  	NameRegex         *string  `pulumi:"nameRegex"`
    97  	Owners            []string `pulumi:"owners"`
    98  	SortAscending     *bool    `pulumi:"sortAscending"`
    99  }
   100  
   101  func GetAmiIdsOutput(ctx *pulumi.Context, args GetAmiIdsOutputArgs, opts ...pulumi.InvokeOption) GetAmiIdsResultOutput {
   102  	return pulumi.ToOutputWithContext(context.Background(), args).
   103  		ApplyT(func(v interface{}) (GetAmiIdsResult, error) {
   104  			args := v.(GetAmiIdsArgs)
   105  			r, err := GetAmiIds(ctx, &args, opts...)
   106  			var s GetAmiIdsResult
   107  			if r != nil {
   108  				s = *r
   109  			}
   110  			return s, err
   111  		}).(GetAmiIdsResultOutput)
   112  }
   113  
   114  // A collection of arguments for invoking getAmiIds.
   115  type GetAmiIdsOutputArgs struct {
   116  	// Limit search to users with *explicit* launch
   117  	// permission on  the image. Valid items are the numeric account ID or `self`.
   118  	ExecutableUsers pulumi.StringArrayInput `pulumi:"executableUsers"`
   119  	// One or more name/value pairs to filter off of. There
   120  	// are several valid keys, for a full reference, check out
   121  	// [describe-images in the AWS CLI reference][1].
   122  	Filters GetAmiIdsFilterArrayInput `pulumi:"filters"`
   123  	// If true, all deprecated AMIs are included in the response.
   124  	// If false, no deprecated AMIs are included in the response. If no value is specified, the default value is `false`.
   125  	IncludeDeprecated pulumi.BoolPtrInput `pulumi:"includeDeprecated"`
   126  	// Regex string to apply to the AMI list returned
   127  	// by AWS. This allows more advanced filtering not supported from the AWS API.
   128  	// This filtering is done locally on what AWS returns, and could have a performance
   129  	// impact if the result is large. Combine this with other
   130  	// options to narrow down the list AWS returns.
   131  	NameRegex pulumi.StringPtrInput `pulumi:"nameRegex"`
   132  	// List of AMI owners to limit search. At least 1 value must be specified. Valid values: an AWS account ID, `self` (the current account), or an AWS owner alias (e.g., `amazon`, `aws-marketplace`, `microsoft`).
   133  	Owners pulumi.StringArrayInput `pulumi:"owners"`
   134  	// Used to sort AMIs by creation time.
   135  	// If no value is specified, the default value is `false`.
   136  	SortAscending pulumi.BoolPtrInput `pulumi:"sortAscending"`
   137  }
   138  
   139  func (GetAmiIdsOutputArgs) ElementType() reflect.Type {
   140  	return reflect.TypeOf((*GetAmiIdsArgs)(nil)).Elem()
   141  }
   142  
   143  // A collection of values returned by getAmiIds.
   144  type GetAmiIdsResultOutput struct{ *pulumi.OutputState }
   145  
   146  func (GetAmiIdsResultOutput) ElementType() reflect.Type {
   147  	return reflect.TypeOf((*GetAmiIdsResult)(nil)).Elem()
   148  }
   149  
   150  func (o GetAmiIdsResultOutput) ToGetAmiIdsResultOutput() GetAmiIdsResultOutput {
   151  	return o
   152  }
   153  
   154  func (o GetAmiIdsResultOutput) ToGetAmiIdsResultOutputWithContext(ctx context.Context) GetAmiIdsResultOutput {
   155  	return o
   156  }
   157  
   158  func (o GetAmiIdsResultOutput) ExecutableUsers() pulumi.StringArrayOutput {
   159  	return o.ApplyT(func(v GetAmiIdsResult) []string { return v.ExecutableUsers }).(pulumi.StringArrayOutput)
   160  }
   161  
   162  func (o GetAmiIdsResultOutput) Filters() GetAmiIdsFilterArrayOutput {
   163  	return o.ApplyT(func(v GetAmiIdsResult) []GetAmiIdsFilter { return v.Filters }).(GetAmiIdsFilterArrayOutput)
   164  }
   165  
   166  // The provider-assigned unique ID for this managed resource.
   167  func (o GetAmiIdsResultOutput) Id() pulumi.StringOutput {
   168  	return o.ApplyT(func(v GetAmiIdsResult) string { return v.Id }).(pulumi.StringOutput)
   169  }
   170  
   171  func (o GetAmiIdsResultOutput) Ids() pulumi.StringArrayOutput {
   172  	return o.ApplyT(func(v GetAmiIdsResult) []string { return v.Ids }).(pulumi.StringArrayOutput)
   173  }
   174  
   175  func (o GetAmiIdsResultOutput) IncludeDeprecated() pulumi.BoolPtrOutput {
   176  	return o.ApplyT(func(v GetAmiIdsResult) *bool { return v.IncludeDeprecated }).(pulumi.BoolPtrOutput)
   177  }
   178  
   179  func (o GetAmiIdsResultOutput) NameRegex() pulumi.StringPtrOutput {
   180  	return o.ApplyT(func(v GetAmiIdsResult) *string { return v.NameRegex }).(pulumi.StringPtrOutput)
   181  }
   182  
   183  func (o GetAmiIdsResultOutput) Owners() pulumi.StringArrayOutput {
   184  	return o.ApplyT(func(v GetAmiIdsResult) []string { return v.Owners }).(pulumi.StringArrayOutput)
   185  }
   186  
   187  func (o GetAmiIdsResultOutput) SortAscending() pulumi.BoolPtrOutput {
   188  	return o.ApplyT(func(v GetAmiIdsResult) *bool { return v.SortAscending }).(pulumi.BoolPtrOutput)
   189  }
   190  
   191  func init() {
   192  	pulumi.RegisterOutputType(GetAmiIdsResultOutput{})
   193  }