github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ebs/getSnapshotIds.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 ebs 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 EBS Snapshot IDs matching the specified 15 // criteria. 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/ebs" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // _, err := ebs.GetSnapshotIds(ctx, &ebs.GetSnapshotIdsArgs{ 33 // Owners: []string{ 34 // "self", 35 // }, 36 // Filters: []ebs.GetSnapshotIdsFilter{ 37 // { 38 // Name: "volume-size", 39 // Values: []string{ 40 // "40", 41 // }, 42 // }, 43 // { 44 // Name: "tag:Name", 45 // Values: []string{ 46 // "Example", 47 // }, 48 // }, 49 // }, 50 // }, nil) 51 // if err != nil { 52 // return err 53 // } 54 // return nil 55 // }) 56 // } 57 // 58 // ``` 59 // <!--End PulumiCodeChooser --> 60 func GetSnapshotIds(ctx *pulumi.Context, args *GetSnapshotIdsArgs, opts ...pulumi.InvokeOption) (*GetSnapshotIdsResult, error) { 61 opts = internal.PkgInvokeDefaultOpts(opts) 62 var rv GetSnapshotIdsResult 63 err := ctx.Invoke("aws:ebs/getSnapshotIds:getSnapshotIds", args, &rv, opts...) 64 if err != nil { 65 return nil, err 66 } 67 return &rv, nil 68 } 69 70 // A collection of arguments for invoking getSnapshotIds. 71 type GetSnapshotIdsArgs struct { 72 // One or more name/value pairs to filter off of. There are 73 // several valid keys, for a full reference, check out 74 // [describe-volumes in the AWS CLI reference][1]. 75 Filters []GetSnapshotIdsFilter `pulumi:"filters"` 76 // Returns the snapshots owned by the specified owner id. Multiple owners can be specified. 77 Owners []string `pulumi:"owners"` 78 // One or more AWS accounts IDs that can create volumes from the snapshot. 79 RestorableByUserIds []string `pulumi:"restorableByUserIds"` 80 } 81 82 // A collection of values returned by getSnapshotIds. 83 type GetSnapshotIdsResult struct { 84 Filters []GetSnapshotIdsFilter `pulumi:"filters"` 85 // The provider-assigned unique ID for this managed resource. 86 Id string `pulumi:"id"` 87 // Set of EBS snapshot IDs, sorted by creation time in descending order. 88 Ids []string `pulumi:"ids"` 89 Owners []string `pulumi:"owners"` 90 RestorableByUserIds []string `pulumi:"restorableByUserIds"` 91 } 92 93 func GetSnapshotIdsOutput(ctx *pulumi.Context, args GetSnapshotIdsOutputArgs, opts ...pulumi.InvokeOption) GetSnapshotIdsResultOutput { 94 return pulumi.ToOutputWithContext(context.Background(), args). 95 ApplyT(func(v interface{}) (GetSnapshotIdsResult, error) { 96 args := v.(GetSnapshotIdsArgs) 97 r, err := GetSnapshotIds(ctx, &args, opts...) 98 var s GetSnapshotIdsResult 99 if r != nil { 100 s = *r 101 } 102 return s, err 103 }).(GetSnapshotIdsResultOutput) 104 } 105 106 // A collection of arguments for invoking getSnapshotIds. 107 type GetSnapshotIdsOutputArgs struct { 108 // One or more name/value pairs to filter off of. There are 109 // several valid keys, for a full reference, check out 110 // [describe-volumes in the AWS CLI reference][1]. 111 Filters GetSnapshotIdsFilterArrayInput `pulumi:"filters"` 112 // Returns the snapshots owned by the specified owner id. Multiple owners can be specified. 113 Owners pulumi.StringArrayInput `pulumi:"owners"` 114 // One or more AWS accounts IDs that can create volumes from the snapshot. 115 RestorableByUserIds pulumi.StringArrayInput `pulumi:"restorableByUserIds"` 116 } 117 118 func (GetSnapshotIdsOutputArgs) ElementType() reflect.Type { 119 return reflect.TypeOf((*GetSnapshotIdsArgs)(nil)).Elem() 120 } 121 122 // A collection of values returned by getSnapshotIds. 123 type GetSnapshotIdsResultOutput struct{ *pulumi.OutputState } 124 125 func (GetSnapshotIdsResultOutput) ElementType() reflect.Type { 126 return reflect.TypeOf((*GetSnapshotIdsResult)(nil)).Elem() 127 } 128 129 func (o GetSnapshotIdsResultOutput) ToGetSnapshotIdsResultOutput() GetSnapshotIdsResultOutput { 130 return o 131 } 132 133 func (o GetSnapshotIdsResultOutput) ToGetSnapshotIdsResultOutputWithContext(ctx context.Context) GetSnapshotIdsResultOutput { 134 return o 135 } 136 137 func (o GetSnapshotIdsResultOutput) Filters() GetSnapshotIdsFilterArrayOutput { 138 return o.ApplyT(func(v GetSnapshotIdsResult) []GetSnapshotIdsFilter { return v.Filters }).(GetSnapshotIdsFilterArrayOutput) 139 } 140 141 // The provider-assigned unique ID for this managed resource. 142 func (o GetSnapshotIdsResultOutput) Id() pulumi.StringOutput { 143 return o.ApplyT(func(v GetSnapshotIdsResult) string { return v.Id }).(pulumi.StringOutput) 144 } 145 146 // Set of EBS snapshot IDs, sorted by creation time in descending order. 147 func (o GetSnapshotIdsResultOutput) Ids() pulumi.StringArrayOutput { 148 return o.ApplyT(func(v GetSnapshotIdsResult) []string { return v.Ids }).(pulumi.StringArrayOutput) 149 } 150 151 func (o GetSnapshotIdsResultOutput) Owners() pulumi.StringArrayOutput { 152 return o.ApplyT(func(v GetSnapshotIdsResult) []string { return v.Owners }).(pulumi.StringArrayOutput) 153 } 154 155 func (o GetSnapshotIdsResultOutput) RestorableByUserIds() pulumi.StringArrayOutput { 156 return o.ApplyT(func(v GetSnapshotIdsResult) []string { return v.RestorableByUserIds }).(pulumi.StringArrayOutput) 157 } 158 159 func init() { 160 pulumi.RegisterOutputType(GetSnapshotIdsResultOutput{}) 161 }