github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ebs/getVolume.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 information about an EBS volume for use in other 15 // 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/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.LookupVolume(ctx, &ebs.LookupVolumeArgs{ 33 // MostRecent: pulumi.BoolRef(true), 34 // Filters: []ebs.GetVolumeFilter{ 35 // { 36 // Name: "volume-type", 37 // Values: []string{ 38 // "gp2", 39 // }, 40 // }, 41 // { 42 // Name: "tag:Name", 43 // Values: []string{ 44 // "Example", 45 // }, 46 // }, 47 // }, 48 // }, nil) 49 // if err != nil { 50 // return err 51 // } 52 // return nil 53 // }) 54 // } 55 // 56 // ``` 57 // <!--End PulumiCodeChooser --> 58 func LookupVolume(ctx *pulumi.Context, args *LookupVolumeArgs, opts ...pulumi.InvokeOption) (*LookupVolumeResult, error) { 59 opts = internal.PkgInvokeDefaultOpts(opts) 60 var rv LookupVolumeResult 61 err := ctx.Invoke("aws:ebs/getVolume:getVolume", args, &rv, opts...) 62 if err != nil { 63 return nil, err 64 } 65 return &rv, nil 66 } 67 68 // A collection of arguments for invoking getVolume. 69 type LookupVolumeArgs struct { 70 // One or more name/value pairs to filter off of. There are 71 // several valid keys, for a full reference, check out 72 // [describe-volumes in the AWS CLI reference][1]. 73 Filters []GetVolumeFilter `pulumi:"filters"` 74 // If more than one result is returned, use the most 75 // recent Volume. 76 MostRecent *bool `pulumi:"mostRecent"` 77 // Map of tags for the resource. 78 Tags map[string]string `pulumi:"tags"` 79 } 80 81 // A collection of values returned by getVolume. 82 type LookupVolumeResult struct { 83 // Volume ARN (e.g., arn:aws:ec2:us-east-1:0123456789012:volume/vol-59fcb34e). 84 Arn string `pulumi:"arn"` 85 // AZ where the EBS volume exists. 86 AvailabilityZone string `pulumi:"availabilityZone"` 87 // Whether the disk is encrypted. 88 Encrypted bool `pulumi:"encrypted"` 89 Filters []GetVolumeFilter `pulumi:"filters"` 90 // The provider-assigned unique ID for this managed resource. 91 Id string `pulumi:"id"` 92 // Amount of IOPS for the disk. 93 Iops int `pulumi:"iops"` 94 // ARN for the KMS encryption key. 95 KmsKeyId string `pulumi:"kmsKeyId"` 96 MostRecent *bool `pulumi:"mostRecent"` 97 // (Optional) Specifies whether Amazon EBS Multi-Attach is enabled. 98 MultiAttachEnabled bool `pulumi:"multiAttachEnabled"` 99 // ARN of the Outpost. 100 OutpostArn string `pulumi:"outpostArn"` 101 // Size of the drive in GiBs. 102 Size int `pulumi:"size"` 103 // Snapshot_id the EBS volume is based off. 104 SnapshotId string `pulumi:"snapshotId"` 105 // Map of tags for the resource. 106 Tags map[string]string `pulumi:"tags"` 107 // Throughput that the volume supports, in MiB/s. 108 Throughput int `pulumi:"throughput"` 109 // Volume ID (e.g., vol-59fcb34e). 110 VolumeId string `pulumi:"volumeId"` 111 // Type of EBS volume. 112 VolumeType string `pulumi:"volumeType"` 113 } 114 115 func LookupVolumeOutput(ctx *pulumi.Context, args LookupVolumeOutputArgs, opts ...pulumi.InvokeOption) LookupVolumeResultOutput { 116 return pulumi.ToOutputWithContext(context.Background(), args). 117 ApplyT(func(v interface{}) (LookupVolumeResult, error) { 118 args := v.(LookupVolumeArgs) 119 r, err := LookupVolume(ctx, &args, opts...) 120 var s LookupVolumeResult 121 if r != nil { 122 s = *r 123 } 124 return s, err 125 }).(LookupVolumeResultOutput) 126 } 127 128 // A collection of arguments for invoking getVolume. 129 type LookupVolumeOutputArgs struct { 130 // One or more name/value pairs to filter off of. There are 131 // several valid keys, for a full reference, check out 132 // [describe-volumes in the AWS CLI reference][1]. 133 Filters GetVolumeFilterArrayInput `pulumi:"filters"` 134 // If more than one result is returned, use the most 135 // recent Volume. 136 MostRecent pulumi.BoolPtrInput `pulumi:"mostRecent"` 137 // Map of tags for the resource. 138 Tags pulumi.StringMapInput `pulumi:"tags"` 139 } 140 141 func (LookupVolumeOutputArgs) ElementType() reflect.Type { 142 return reflect.TypeOf((*LookupVolumeArgs)(nil)).Elem() 143 } 144 145 // A collection of values returned by getVolume. 146 type LookupVolumeResultOutput struct{ *pulumi.OutputState } 147 148 func (LookupVolumeResultOutput) ElementType() reflect.Type { 149 return reflect.TypeOf((*LookupVolumeResult)(nil)).Elem() 150 } 151 152 func (o LookupVolumeResultOutput) ToLookupVolumeResultOutput() LookupVolumeResultOutput { 153 return o 154 } 155 156 func (o LookupVolumeResultOutput) ToLookupVolumeResultOutputWithContext(ctx context.Context) LookupVolumeResultOutput { 157 return o 158 } 159 160 // Volume ARN (e.g., arn:aws:ec2:us-east-1:0123456789012:volume/vol-59fcb34e). 161 func (o LookupVolumeResultOutput) Arn() pulumi.StringOutput { 162 return o.ApplyT(func(v LookupVolumeResult) string { return v.Arn }).(pulumi.StringOutput) 163 } 164 165 // AZ where the EBS volume exists. 166 func (o LookupVolumeResultOutput) AvailabilityZone() pulumi.StringOutput { 167 return o.ApplyT(func(v LookupVolumeResult) string { return v.AvailabilityZone }).(pulumi.StringOutput) 168 } 169 170 // Whether the disk is encrypted. 171 func (o LookupVolumeResultOutput) Encrypted() pulumi.BoolOutput { 172 return o.ApplyT(func(v LookupVolumeResult) bool { return v.Encrypted }).(pulumi.BoolOutput) 173 } 174 175 func (o LookupVolumeResultOutput) Filters() GetVolumeFilterArrayOutput { 176 return o.ApplyT(func(v LookupVolumeResult) []GetVolumeFilter { return v.Filters }).(GetVolumeFilterArrayOutput) 177 } 178 179 // The provider-assigned unique ID for this managed resource. 180 func (o LookupVolumeResultOutput) Id() pulumi.StringOutput { 181 return o.ApplyT(func(v LookupVolumeResult) string { return v.Id }).(pulumi.StringOutput) 182 } 183 184 // Amount of IOPS for the disk. 185 func (o LookupVolumeResultOutput) Iops() pulumi.IntOutput { 186 return o.ApplyT(func(v LookupVolumeResult) int { return v.Iops }).(pulumi.IntOutput) 187 } 188 189 // ARN for the KMS encryption key. 190 func (o LookupVolumeResultOutput) KmsKeyId() pulumi.StringOutput { 191 return o.ApplyT(func(v LookupVolumeResult) string { return v.KmsKeyId }).(pulumi.StringOutput) 192 } 193 194 func (o LookupVolumeResultOutput) MostRecent() pulumi.BoolPtrOutput { 195 return o.ApplyT(func(v LookupVolumeResult) *bool { return v.MostRecent }).(pulumi.BoolPtrOutput) 196 } 197 198 // (Optional) Specifies whether Amazon EBS Multi-Attach is enabled. 199 func (o LookupVolumeResultOutput) MultiAttachEnabled() pulumi.BoolOutput { 200 return o.ApplyT(func(v LookupVolumeResult) bool { return v.MultiAttachEnabled }).(pulumi.BoolOutput) 201 } 202 203 // ARN of the Outpost. 204 func (o LookupVolumeResultOutput) OutpostArn() pulumi.StringOutput { 205 return o.ApplyT(func(v LookupVolumeResult) string { return v.OutpostArn }).(pulumi.StringOutput) 206 } 207 208 // Size of the drive in GiBs. 209 func (o LookupVolumeResultOutput) Size() pulumi.IntOutput { 210 return o.ApplyT(func(v LookupVolumeResult) int { return v.Size }).(pulumi.IntOutput) 211 } 212 213 // Snapshot_id the EBS volume is based off. 214 func (o LookupVolumeResultOutput) SnapshotId() pulumi.StringOutput { 215 return o.ApplyT(func(v LookupVolumeResult) string { return v.SnapshotId }).(pulumi.StringOutput) 216 } 217 218 // Map of tags for the resource. 219 func (o LookupVolumeResultOutput) Tags() pulumi.StringMapOutput { 220 return o.ApplyT(func(v LookupVolumeResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput) 221 } 222 223 // Throughput that the volume supports, in MiB/s. 224 func (o LookupVolumeResultOutput) Throughput() pulumi.IntOutput { 225 return o.ApplyT(func(v LookupVolumeResult) int { return v.Throughput }).(pulumi.IntOutput) 226 } 227 228 // Volume ID (e.g., vol-59fcb34e). 229 func (o LookupVolumeResultOutput) VolumeId() pulumi.StringOutput { 230 return o.ApplyT(func(v LookupVolumeResult) string { return v.VolumeId }).(pulumi.StringOutput) 231 } 232 233 // Type of EBS volume. 234 func (o LookupVolumeResultOutput) VolumeType() pulumi.StringOutput { 235 return o.ApplyT(func(v LookupVolumeResult) string { return v.VolumeType }).(pulumi.StringOutput) 236 } 237 238 func init() { 239 pulumi.RegisterOutputType(LookupVolumeResultOutput{}) 240 }