github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/imagebuilder/getComponents.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  // Use this data source to get the ARNs and names of Image Builder Components 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/imagebuilder"
    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 := imagebuilder.GetComponents(ctx, &imagebuilder.GetComponentsArgs{
    32  //				Owner: pulumi.StringRef("Self"),
    33  //				Filters: []imagebuilder.GetComponentsFilter{
    34  //					{
    35  //						Name: "platform",
    36  //						Values: []string{
    37  //							"Linux",
    38  //						},
    39  //					},
    40  //				},
    41  //			}, nil)
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			return nil
    46  //		})
    47  //	}
    48  //
    49  // ```
    50  // <!--End PulumiCodeChooser -->
    51  func GetComponents(ctx *pulumi.Context, args *GetComponentsArgs, opts ...pulumi.InvokeOption) (*GetComponentsResult, error) {
    52  	opts = internal.PkgInvokeDefaultOpts(opts)
    53  	var rv GetComponentsResult
    54  	err := ctx.Invoke("aws:imagebuilder/getComponents:getComponents", args, &rv, opts...)
    55  	if err != nil {
    56  		return nil, err
    57  	}
    58  	return &rv, nil
    59  }
    60  
    61  // A collection of arguments for invoking getComponents.
    62  type GetComponentsArgs struct {
    63  	// Configuration block(s) for filtering. Detailed below.
    64  	Filters []GetComponentsFilter `pulumi:"filters"`
    65  	// Owner of the image recipes. Valid values are `Self`, `Shared`, `Amazon` and `ThirdParty`. Defaults to `Self`.
    66  	Owner *string `pulumi:"owner"`
    67  }
    68  
    69  // A collection of values returned by getComponents.
    70  type GetComponentsResult struct {
    71  	// Set of ARNs of the matched Image Builder Components.
    72  	Arns    []string              `pulumi:"arns"`
    73  	Filters []GetComponentsFilter `pulumi:"filters"`
    74  	// The provider-assigned unique ID for this managed resource.
    75  	Id string `pulumi:"id"`
    76  	// Set of names of the matched Image Builder Components.
    77  	Names []string `pulumi:"names"`
    78  	Owner *string  `pulumi:"owner"`
    79  }
    80  
    81  func GetComponentsOutput(ctx *pulumi.Context, args GetComponentsOutputArgs, opts ...pulumi.InvokeOption) GetComponentsResultOutput {
    82  	return pulumi.ToOutputWithContext(context.Background(), args).
    83  		ApplyT(func(v interface{}) (GetComponentsResult, error) {
    84  			args := v.(GetComponentsArgs)
    85  			r, err := GetComponents(ctx, &args, opts...)
    86  			var s GetComponentsResult
    87  			if r != nil {
    88  				s = *r
    89  			}
    90  			return s, err
    91  		}).(GetComponentsResultOutput)
    92  }
    93  
    94  // A collection of arguments for invoking getComponents.
    95  type GetComponentsOutputArgs struct {
    96  	// Configuration block(s) for filtering. Detailed below.
    97  	Filters GetComponentsFilterArrayInput `pulumi:"filters"`
    98  	// Owner of the image recipes. Valid values are `Self`, `Shared`, `Amazon` and `ThirdParty`. Defaults to `Self`.
    99  	Owner pulumi.StringPtrInput `pulumi:"owner"`
   100  }
   101  
   102  func (GetComponentsOutputArgs) ElementType() reflect.Type {
   103  	return reflect.TypeOf((*GetComponentsArgs)(nil)).Elem()
   104  }
   105  
   106  // A collection of values returned by getComponents.
   107  type GetComponentsResultOutput struct{ *pulumi.OutputState }
   108  
   109  func (GetComponentsResultOutput) ElementType() reflect.Type {
   110  	return reflect.TypeOf((*GetComponentsResult)(nil)).Elem()
   111  }
   112  
   113  func (o GetComponentsResultOutput) ToGetComponentsResultOutput() GetComponentsResultOutput {
   114  	return o
   115  }
   116  
   117  func (o GetComponentsResultOutput) ToGetComponentsResultOutputWithContext(ctx context.Context) GetComponentsResultOutput {
   118  	return o
   119  }
   120  
   121  // Set of ARNs of the matched Image Builder Components.
   122  func (o GetComponentsResultOutput) Arns() pulumi.StringArrayOutput {
   123  	return o.ApplyT(func(v GetComponentsResult) []string { return v.Arns }).(pulumi.StringArrayOutput)
   124  }
   125  
   126  func (o GetComponentsResultOutput) Filters() GetComponentsFilterArrayOutput {
   127  	return o.ApplyT(func(v GetComponentsResult) []GetComponentsFilter { return v.Filters }).(GetComponentsFilterArrayOutput)
   128  }
   129  
   130  // The provider-assigned unique ID for this managed resource.
   131  func (o GetComponentsResultOutput) Id() pulumi.StringOutput {
   132  	return o.ApplyT(func(v GetComponentsResult) string { return v.Id }).(pulumi.StringOutput)
   133  }
   134  
   135  // Set of names of the matched Image Builder Components.
   136  func (o GetComponentsResultOutput) Names() pulumi.StringArrayOutput {
   137  	return o.ApplyT(func(v GetComponentsResult) []string { return v.Names }).(pulumi.StringArrayOutput)
   138  }
   139  
   140  func (o GetComponentsResultOutput) Owner() pulumi.StringPtrOutput {
   141  	return o.ApplyT(func(v GetComponentsResult) *string { return v.Owner }).(pulumi.StringPtrOutput)
   142  }
   143  
   144  func init() {
   145  	pulumi.RegisterOutputType(GetComponentsResultOutput{})
   146  }