/
volume.go
154 lines (141 loc) · 5.82 KB
/
volume.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package ebs
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Manages a single EBS volume.
type Volume struct {
pulumi.CustomResourceState
// The volume ARN (e.g. arn:aws:ec2:us-east-1:0123456789012:volume/vol-59fcb34e).
Arn pulumi.StringOutput `pulumi:"arn"`
// The AZ where the EBS volume will exist.
AvailabilityZone pulumi.StringOutput `pulumi:"availabilityZone"`
// If true, the disk will be encrypted.
Encrypted pulumi.BoolOutput `pulumi:"encrypted"`
// The amount of IOPS to provision for the disk.
Iops pulumi.IntOutput `pulumi:"iops"`
// The ARN for the KMS encryption key. When specifying `kmsKeyId`, `encrypted` needs to be set to true.
KmsKeyId pulumi.StringOutput `pulumi:"kmsKeyId"`
// The size of the drive in GiBs.
Size pulumi.IntOutput `pulumi:"size"`
// A snapshot to base the EBS volume off of.
SnapshotId pulumi.StringOutput `pulumi:"snapshotId"`
// A mapping of tags to assign to the resource.
Tags pulumi.MapOutput `pulumi:"tags"`
// The type of EBS volume. Can be "standard", "gp2", "io1", "sc1" or "st1" (Default: "gp2").
Type pulumi.StringOutput `pulumi:"type"`
}
// NewVolume registers a new resource with the given unique name, arguments, and options.
func NewVolume(ctx *pulumi.Context,
name string, args *VolumeArgs, opts ...pulumi.ResourceOption) (*Volume, error) {
if args == nil || args.AvailabilityZone == nil {
return nil, errors.New("missing required argument 'AvailabilityZone'")
}
if args == nil {
args = &VolumeArgs{}
}
var resource Volume
err := ctx.RegisterResource("aws:ebs/volume:Volume", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetVolume gets an existing Volume resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetVolume(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *VolumeState, opts ...pulumi.ResourceOption) (*Volume, error) {
var resource Volume
err := ctx.ReadResource("aws:ebs/volume:Volume", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Volume resources.
type volumeState struct {
// The volume ARN (e.g. arn:aws:ec2:us-east-1:0123456789012:volume/vol-59fcb34e).
Arn *string `pulumi:"arn"`
// The AZ where the EBS volume will exist.
AvailabilityZone *string `pulumi:"availabilityZone"`
// If true, the disk will be encrypted.
Encrypted *bool `pulumi:"encrypted"`
// The amount of IOPS to provision for the disk.
Iops *int `pulumi:"iops"`
// The ARN for the KMS encryption key. When specifying `kmsKeyId`, `encrypted` needs to be set to true.
KmsKeyId *string `pulumi:"kmsKeyId"`
// The size of the drive in GiBs.
Size *int `pulumi:"size"`
// A snapshot to base the EBS volume off of.
SnapshotId *string `pulumi:"snapshotId"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
// The type of EBS volume. Can be "standard", "gp2", "io1", "sc1" or "st1" (Default: "gp2").
Type *string `pulumi:"type"`
}
type VolumeState struct {
// The volume ARN (e.g. arn:aws:ec2:us-east-1:0123456789012:volume/vol-59fcb34e).
Arn pulumi.StringPtrInput
// The AZ where the EBS volume will exist.
AvailabilityZone pulumi.StringPtrInput
// If true, the disk will be encrypted.
Encrypted pulumi.BoolPtrInput
// The amount of IOPS to provision for the disk.
Iops pulumi.IntPtrInput
// The ARN for the KMS encryption key. When specifying `kmsKeyId`, `encrypted` needs to be set to true.
KmsKeyId pulumi.StringPtrInput
// The size of the drive in GiBs.
Size pulumi.IntPtrInput
// A snapshot to base the EBS volume off of.
SnapshotId pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
// The type of EBS volume. Can be "standard", "gp2", "io1", "sc1" or "st1" (Default: "gp2").
Type pulumi.StringPtrInput
}
func (VolumeState) ElementType() reflect.Type {
return reflect.TypeOf((*volumeState)(nil)).Elem()
}
type volumeArgs struct {
// The AZ where the EBS volume will exist.
AvailabilityZone string `pulumi:"availabilityZone"`
// If true, the disk will be encrypted.
Encrypted *bool `pulumi:"encrypted"`
// The amount of IOPS to provision for the disk.
Iops *int `pulumi:"iops"`
// The ARN for the KMS encryption key. When specifying `kmsKeyId`, `encrypted` needs to be set to true.
KmsKeyId *string `pulumi:"kmsKeyId"`
// The size of the drive in GiBs.
Size *int `pulumi:"size"`
// A snapshot to base the EBS volume off of.
SnapshotId *string `pulumi:"snapshotId"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
// The type of EBS volume. Can be "standard", "gp2", "io1", "sc1" or "st1" (Default: "gp2").
Type *string `pulumi:"type"`
}
// The set of arguments for constructing a Volume resource.
type VolumeArgs struct {
// The AZ where the EBS volume will exist.
AvailabilityZone pulumi.StringInput
// If true, the disk will be encrypted.
Encrypted pulumi.BoolPtrInput
// The amount of IOPS to provision for the disk.
Iops pulumi.IntPtrInput
// The ARN for the KMS encryption key. When specifying `kmsKeyId`, `encrypted` needs to be set to true.
KmsKeyId pulumi.StringPtrInput
// The size of the drive in GiBs.
Size pulumi.IntPtrInput
// A snapshot to base the EBS volume off of.
SnapshotId pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
// The type of EBS volume. Can be "standard", "gp2", "io1", "sc1" or "st1" (Default: "gp2").
Type pulumi.StringPtrInput
}
func (VolumeArgs) ElementType() reflect.Type {
return reflect.TypeOf((*volumeArgs)(nil)).Elem()
}