github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/autoscaling/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 autoscaling
     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 Autoscaling Groups data source allows access to the list of AWS
    15  // ASGs within a specific region. This will allow you to pass a list of AutoScaling Groups to other resources.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			groups, err := autoscaling.GetAmiIds(ctx, &autoscaling.GetAmiIdsArgs{
    33  //				Filters: []autoscaling.GetAmiIdsFilter{
    34  //					{
    35  //						Name: "tag:Team",
    36  //						Values: []string{
    37  //							"Pets",
    38  //						},
    39  //					},
    40  //					{
    41  //						Name: "tag-key",
    42  //						Values: []string{
    43  //							"Environment",
    44  //						},
    45  //					},
    46  //				},
    47  //			}, nil)
    48  //			if err != nil {
    49  //				return err
    50  //			}
    51  //			_, err = autoscaling.NewNotification(ctx, "slack_notifications", &autoscaling.NotificationArgs{
    52  //				GroupNames: interface{}(groups.Names),
    53  //				Notifications: pulumi.StringArray{
    54  //					pulumi.String("autoscaling:EC2_INSTANCE_LAUNCH"),
    55  //					pulumi.String("autoscaling:EC2_INSTANCE_TERMINATE"),
    56  //					pulumi.String("autoscaling:EC2_INSTANCE_LAUNCH_ERROR"),
    57  //					pulumi.String("autoscaling:EC2_INSTANCE_TERMINATE_ERROR"),
    58  //				},
    59  //				TopicArn: pulumi.String("TOPIC ARN"),
    60  //			})
    61  //			if err != nil {
    62  //				return err
    63  //			}
    64  //			return nil
    65  //		})
    66  //	}
    67  //
    68  // ```
    69  // <!--End PulumiCodeChooser -->
    70  func GetAmiIds(ctx *pulumi.Context, args *GetAmiIdsArgs, opts ...pulumi.InvokeOption) (*GetAmiIdsResult, error) {
    71  	opts = internal.PkgInvokeDefaultOpts(opts)
    72  	var rv GetAmiIdsResult
    73  	err := ctx.Invoke("aws:autoscaling/getAmiIds:getAmiIds", args, &rv, opts...)
    74  	if err != nil {
    75  		return nil, err
    76  	}
    77  	return &rv, nil
    78  }
    79  
    80  // A collection of arguments for invoking getAmiIds.
    81  type GetAmiIdsArgs struct {
    82  	// Filter used to scope the list e.g., by tags. See [related docs](http://docs.aws.amazon.com/AutoScaling/latest/APIReference/API_Filter.html).
    83  	Filters []GetAmiIdsFilter `pulumi:"filters"`
    84  	// List of autoscaling group names
    85  	Names []string `pulumi:"names"`
    86  }
    87  
    88  // A collection of values returned by getAmiIds.
    89  type GetAmiIdsResult struct {
    90  	// List of the Autoscaling Groups Arns in the current region.
    91  	Arns    []string          `pulumi:"arns"`
    92  	Filters []GetAmiIdsFilter `pulumi:"filters"`
    93  	// The provider-assigned unique ID for this managed resource.
    94  	Id string `pulumi:"id"`
    95  	// List of the Autoscaling Groups in the current region.
    96  	Names []string `pulumi:"names"`
    97  }
    98  
    99  func GetAmiIdsOutput(ctx *pulumi.Context, args GetAmiIdsOutputArgs, opts ...pulumi.InvokeOption) GetAmiIdsResultOutput {
   100  	return pulumi.ToOutputWithContext(context.Background(), args).
   101  		ApplyT(func(v interface{}) (GetAmiIdsResult, error) {
   102  			args := v.(GetAmiIdsArgs)
   103  			r, err := GetAmiIds(ctx, &args, opts...)
   104  			var s GetAmiIdsResult
   105  			if r != nil {
   106  				s = *r
   107  			}
   108  			return s, err
   109  		}).(GetAmiIdsResultOutput)
   110  }
   111  
   112  // A collection of arguments for invoking getAmiIds.
   113  type GetAmiIdsOutputArgs struct {
   114  	// Filter used to scope the list e.g., by tags. See [related docs](http://docs.aws.amazon.com/AutoScaling/latest/APIReference/API_Filter.html).
   115  	Filters GetAmiIdsFilterArrayInput `pulumi:"filters"`
   116  	// List of autoscaling group names
   117  	Names pulumi.StringArrayInput `pulumi:"names"`
   118  }
   119  
   120  func (GetAmiIdsOutputArgs) ElementType() reflect.Type {
   121  	return reflect.TypeOf((*GetAmiIdsArgs)(nil)).Elem()
   122  }
   123  
   124  // A collection of values returned by getAmiIds.
   125  type GetAmiIdsResultOutput struct{ *pulumi.OutputState }
   126  
   127  func (GetAmiIdsResultOutput) ElementType() reflect.Type {
   128  	return reflect.TypeOf((*GetAmiIdsResult)(nil)).Elem()
   129  }
   130  
   131  func (o GetAmiIdsResultOutput) ToGetAmiIdsResultOutput() GetAmiIdsResultOutput {
   132  	return o
   133  }
   134  
   135  func (o GetAmiIdsResultOutput) ToGetAmiIdsResultOutputWithContext(ctx context.Context) GetAmiIdsResultOutput {
   136  	return o
   137  }
   138  
   139  // List of the Autoscaling Groups Arns in the current region.
   140  func (o GetAmiIdsResultOutput) Arns() pulumi.StringArrayOutput {
   141  	return o.ApplyT(func(v GetAmiIdsResult) []string { return v.Arns }).(pulumi.StringArrayOutput)
   142  }
   143  
   144  func (o GetAmiIdsResultOutput) Filters() GetAmiIdsFilterArrayOutput {
   145  	return o.ApplyT(func(v GetAmiIdsResult) []GetAmiIdsFilter { return v.Filters }).(GetAmiIdsFilterArrayOutput)
   146  }
   147  
   148  // The provider-assigned unique ID for this managed resource.
   149  func (o GetAmiIdsResultOutput) Id() pulumi.StringOutput {
   150  	return o.ApplyT(func(v GetAmiIdsResult) string { return v.Id }).(pulumi.StringOutput)
   151  }
   152  
   153  // List of the Autoscaling Groups in the current region.
   154  func (o GetAmiIdsResultOutput) Names() pulumi.StringArrayOutput {
   155  	return o.ApplyT(func(v GetAmiIdsResult) []string { return v.Names }).(pulumi.StringArrayOutput)
   156  }
   157  
   158  func init() {
   159  	pulumi.RegisterOutputType(GetAmiIdsResultOutput{})
   160  }