/
spotDatafeedSubscription.go
281 lines (233 loc) · 10.8 KB
/
spotDatafeedSubscription.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package ec2
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// > **Note:** There is only a single subscription allowed per account.
//
// To help you understand the charges for your Spot instances, Amazon EC2 provides a data feed that describes your Spot instance usage and pricing.
// This data feed is sent to an Amazon S3 bucket that you specify when you subscribe to the data feed.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := s3.NewBucketV2(ctx, "default", &s3.BucketV2Args{
// Bucket: pulumi.String("tf-spot-datafeed"),
// })
// if err != nil {
// return err
// }
// _, err = ec2.NewSpotDatafeedSubscription(ctx, "default", &ec2.SpotDatafeedSubscriptionArgs{
// Bucket: _default.ID(),
// Prefix: pulumi.String("my_subdirectory"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Using `pulumi import`, import a Spot Datafeed Subscription using the word `spot-datafeed-subscription`. For example:
//
// ```sh
// $ pulumi import aws:ec2/spotDatafeedSubscription:SpotDatafeedSubscription mysubscription spot-datafeed-subscription
// ```
type SpotDatafeedSubscription struct {
pulumi.CustomResourceState
// The Amazon S3 bucket in which to store the Spot instance data feed.
Bucket pulumi.StringOutput `pulumi:"bucket"`
// Path of folder inside bucket to place spot pricing data.
Prefix pulumi.StringPtrOutput `pulumi:"prefix"`
}
// NewSpotDatafeedSubscription registers a new resource with the given unique name, arguments, and options.
func NewSpotDatafeedSubscription(ctx *pulumi.Context,
name string, args *SpotDatafeedSubscriptionArgs, opts ...pulumi.ResourceOption) (*SpotDatafeedSubscription, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Bucket == nil {
return nil, errors.New("invalid value for required argument 'Bucket'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource SpotDatafeedSubscription
err := ctx.RegisterResource("aws:ec2/spotDatafeedSubscription:SpotDatafeedSubscription", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSpotDatafeedSubscription gets an existing SpotDatafeedSubscription 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 GetSpotDatafeedSubscription(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SpotDatafeedSubscriptionState, opts ...pulumi.ResourceOption) (*SpotDatafeedSubscription, error) {
var resource SpotDatafeedSubscription
err := ctx.ReadResource("aws:ec2/spotDatafeedSubscription:SpotDatafeedSubscription", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering SpotDatafeedSubscription resources.
type spotDatafeedSubscriptionState struct {
// The Amazon S3 bucket in which to store the Spot instance data feed.
Bucket *string `pulumi:"bucket"`
// Path of folder inside bucket to place spot pricing data.
Prefix *string `pulumi:"prefix"`
}
type SpotDatafeedSubscriptionState struct {
// The Amazon S3 bucket in which to store the Spot instance data feed.
Bucket pulumi.StringPtrInput
// Path of folder inside bucket to place spot pricing data.
Prefix pulumi.StringPtrInput
}
func (SpotDatafeedSubscriptionState) ElementType() reflect.Type {
return reflect.TypeOf((*spotDatafeedSubscriptionState)(nil)).Elem()
}
type spotDatafeedSubscriptionArgs struct {
// The Amazon S3 bucket in which to store the Spot instance data feed.
Bucket string `pulumi:"bucket"`
// Path of folder inside bucket to place spot pricing data.
Prefix *string `pulumi:"prefix"`
}
// The set of arguments for constructing a SpotDatafeedSubscription resource.
type SpotDatafeedSubscriptionArgs struct {
// The Amazon S3 bucket in which to store the Spot instance data feed.
Bucket pulumi.StringInput
// Path of folder inside bucket to place spot pricing data.
Prefix pulumi.StringPtrInput
}
func (SpotDatafeedSubscriptionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*spotDatafeedSubscriptionArgs)(nil)).Elem()
}
type SpotDatafeedSubscriptionInput interface {
pulumi.Input
ToSpotDatafeedSubscriptionOutput() SpotDatafeedSubscriptionOutput
ToSpotDatafeedSubscriptionOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionOutput
}
func (*SpotDatafeedSubscription) ElementType() reflect.Type {
return reflect.TypeOf((**SpotDatafeedSubscription)(nil)).Elem()
}
func (i *SpotDatafeedSubscription) ToSpotDatafeedSubscriptionOutput() SpotDatafeedSubscriptionOutput {
return i.ToSpotDatafeedSubscriptionOutputWithContext(context.Background())
}
func (i *SpotDatafeedSubscription) ToSpotDatafeedSubscriptionOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionOutput {
return pulumi.ToOutputWithContext(ctx, i).(SpotDatafeedSubscriptionOutput)
}
// SpotDatafeedSubscriptionArrayInput is an input type that accepts SpotDatafeedSubscriptionArray and SpotDatafeedSubscriptionArrayOutput values.
// You can construct a concrete instance of `SpotDatafeedSubscriptionArrayInput` via:
//
// SpotDatafeedSubscriptionArray{ SpotDatafeedSubscriptionArgs{...} }
type SpotDatafeedSubscriptionArrayInput interface {
pulumi.Input
ToSpotDatafeedSubscriptionArrayOutput() SpotDatafeedSubscriptionArrayOutput
ToSpotDatafeedSubscriptionArrayOutputWithContext(context.Context) SpotDatafeedSubscriptionArrayOutput
}
type SpotDatafeedSubscriptionArray []SpotDatafeedSubscriptionInput
func (SpotDatafeedSubscriptionArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SpotDatafeedSubscription)(nil)).Elem()
}
func (i SpotDatafeedSubscriptionArray) ToSpotDatafeedSubscriptionArrayOutput() SpotDatafeedSubscriptionArrayOutput {
return i.ToSpotDatafeedSubscriptionArrayOutputWithContext(context.Background())
}
func (i SpotDatafeedSubscriptionArray) ToSpotDatafeedSubscriptionArrayOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SpotDatafeedSubscriptionArrayOutput)
}
// SpotDatafeedSubscriptionMapInput is an input type that accepts SpotDatafeedSubscriptionMap and SpotDatafeedSubscriptionMapOutput values.
// You can construct a concrete instance of `SpotDatafeedSubscriptionMapInput` via:
//
// SpotDatafeedSubscriptionMap{ "key": SpotDatafeedSubscriptionArgs{...} }
type SpotDatafeedSubscriptionMapInput interface {
pulumi.Input
ToSpotDatafeedSubscriptionMapOutput() SpotDatafeedSubscriptionMapOutput
ToSpotDatafeedSubscriptionMapOutputWithContext(context.Context) SpotDatafeedSubscriptionMapOutput
}
type SpotDatafeedSubscriptionMap map[string]SpotDatafeedSubscriptionInput
func (SpotDatafeedSubscriptionMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SpotDatafeedSubscription)(nil)).Elem()
}
func (i SpotDatafeedSubscriptionMap) ToSpotDatafeedSubscriptionMapOutput() SpotDatafeedSubscriptionMapOutput {
return i.ToSpotDatafeedSubscriptionMapOutputWithContext(context.Background())
}
func (i SpotDatafeedSubscriptionMap) ToSpotDatafeedSubscriptionMapOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SpotDatafeedSubscriptionMapOutput)
}
type SpotDatafeedSubscriptionOutput struct{ *pulumi.OutputState }
func (SpotDatafeedSubscriptionOutput) ElementType() reflect.Type {
return reflect.TypeOf((**SpotDatafeedSubscription)(nil)).Elem()
}
func (o SpotDatafeedSubscriptionOutput) ToSpotDatafeedSubscriptionOutput() SpotDatafeedSubscriptionOutput {
return o
}
func (o SpotDatafeedSubscriptionOutput) ToSpotDatafeedSubscriptionOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionOutput {
return o
}
// The Amazon S3 bucket in which to store the Spot instance data feed.
func (o SpotDatafeedSubscriptionOutput) Bucket() pulumi.StringOutput {
return o.ApplyT(func(v *SpotDatafeedSubscription) pulumi.StringOutput { return v.Bucket }).(pulumi.StringOutput)
}
// Path of folder inside bucket to place spot pricing data.
func (o SpotDatafeedSubscriptionOutput) Prefix() pulumi.StringPtrOutput {
return o.ApplyT(func(v *SpotDatafeedSubscription) pulumi.StringPtrOutput { return v.Prefix }).(pulumi.StringPtrOutput)
}
type SpotDatafeedSubscriptionArrayOutput struct{ *pulumi.OutputState }
func (SpotDatafeedSubscriptionArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*SpotDatafeedSubscription)(nil)).Elem()
}
func (o SpotDatafeedSubscriptionArrayOutput) ToSpotDatafeedSubscriptionArrayOutput() SpotDatafeedSubscriptionArrayOutput {
return o
}
func (o SpotDatafeedSubscriptionArrayOutput) ToSpotDatafeedSubscriptionArrayOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionArrayOutput {
return o
}
func (o SpotDatafeedSubscriptionArrayOutput) Index(i pulumi.IntInput) SpotDatafeedSubscriptionOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SpotDatafeedSubscription {
return vs[0].([]*SpotDatafeedSubscription)[vs[1].(int)]
}).(SpotDatafeedSubscriptionOutput)
}
type SpotDatafeedSubscriptionMapOutput struct{ *pulumi.OutputState }
func (SpotDatafeedSubscriptionMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*SpotDatafeedSubscription)(nil)).Elem()
}
func (o SpotDatafeedSubscriptionMapOutput) ToSpotDatafeedSubscriptionMapOutput() SpotDatafeedSubscriptionMapOutput {
return o
}
func (o SpotDatafeedSubscriptionMapOutput) ToSpotDatafeedSubscriptionMapOutputWithContext(ctx context.Context) SpotDatafeedSubscriptionMapOutput {
return o
}
func (o SpotDatafeedSubscriptionMapOutput) MapIndex(k pulumi.StringInput) SpotDatafeedSubscriptionOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SpotDatafeedSubscription {
return vs[0].(map[string]*SpotDatafeedSubscription)[vs[1].(string)]
}).(SpotDatafeedSubscriptionOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*SpotDatafeedSubscriptionInput)(nil)).Elem(), &SpotDatafeedSubscription{})
pulumi.RegisterInputType(reflect.TypeOf((*SpotDatafeedSubscriptionArrayInput)(nil)).Elem(), SpotDatafeedSubscriptionArray{})
pulumi.RegisterInputType(reflect.TypeOf((*SpotDatafeedSubscriptionMapInput)(nil)).Elem(), SpotDatafeedSubscriptionMap{})
pulumi.RegisterOutputType(SpotDatafeedSubscriptionOutput{})
pulumi.RegisterOutputType(SpotDatafeedSubscriptionArrayOutput{})
pulumi.RegisterOutputType(SpotDatafeedSubscriptionMapOutput{})
}