/
serviceQuota.go
373 lines (316 loc) · 16.6 KB
/
serviceQuota.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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
// 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 servicequotas
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages an individual Service Quota.
//
// > **NOTE:** Global quotas apply to all AWS regions, but can only be accessed in `us-east-1` in the Commercial partition or `us-gov-west-1` in the GovCloud partition. In other regions, the AWS API will return the error `The request failed because the specified service does not exist.`
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/servicequotas"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := servicequotas.NewServiceQuota(ctx, "example", &servicequotas.ServiceQuotaArgs{
// QuotaCode: pulumi.String("L-F678F1CE"),
// ServiceCode: pulumi.String("vpc"),
// Value: pulumi.Float64(75),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// ~> *NOTE* This resource does not require explicit import and will assume management of an existing service quota on resource creation. `aws_servicequotas_service_quota` can be imported by using the service code and quota code, separated by a front slash (`/`), e.g.,
//
// ```sh
//
// $ pulumi import aws:servicequotas/serviceQuota:ServiceQuota example vpc/L-F678F1CE
//
// ```
type ServiceQuota struct {
pulumi.CustomResourceState
// Whether the service quota can be increased.
Adjustable pulumi.BoolOutput `pulumi:"adjustable"`
// Amazon Resource Name (ARN) of the service quota.
Arn pulumi.StringOutput `pulumi:"arn"`
// Default value of the service quota.
DefaultValue pulumi.Float64Output `pulumi:"defaultValue"`
// Code of the service quota to track. For example: `L-F678F1CE`. Available values can be found with the [AWS CLI service-quotas list-service-quotas command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-service-quotas.html).
QuotaCode pulumi.StringOutput `pulumi:"quotaCode"`
// Name of the quota.
QuotaName pulumi.StringOutput `pulumi:"quotaName"`
RequestId pulumi.StringOutput `pulumi:"requestId"`
RequestStatus pulumi.StringOutput `pulumi:"requestStatus"`
// Code of the service to track. For example: `vpc`. Available values can be found with the [AWS CLI service-quotas list-services command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-services.html).
ServiceCode pulumi.StringOutput `pulumi:"serviceCode"`
// Name of the service.
ServiceName pulumi.StringOutput `pulumi:"serviceName"`
// Information about the measurement.
UsageMetrics ServiceQuotaUsageMetricArrayOutput `pulumi:"usageMetrics"`
// Float specifying the desired value for the service quota. If the desired value is higher than the current value, a quota increase request is submitted. When a known request is submitted and pending, the value reflects the desired value of the pending request.
Value pulumi.Float64Output `pulumi:"value"`
}
// NewServiceQuota registers a new resource with the given unique name, arguments, and options.
func NewServiceQuota(ctx *pulumi.Context,
name string, args *ServiceQuotaArgs, opts ...pulumi.ResourceOption) (*ServiceQuota, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.QuotaCode == nil {
return nil, errors.New("invalid value for required argument 'QuotaCode'")
}
if args.ServiceCode == nil {
return nil, errors.New("invalid value for required argument 'ServiceCode'")
}
if args.Value == nil {
return nil, errors.New("invalid value for required argument 'Value'")
}
var resource ServiceQuota
err := ctx.RegisterResource("aws:servicequotas/serviceQuota:ServiceQuota", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetServiceQuota gets an existing ServiceQuota 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 GetServiceQuota(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ServiceQuotaState, opts ...pulumi.ResourceOption) (*ServiceQuota, error) {
var resource ServiceQuota
err := ctx.ReadResource("aws:servicequotas/serviceQuota:ServiceQuota", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ServiceQuota resources.
type serviceQuotaState struct {
// Whether the service quota can be increased.
Adjustable *bool `pulumi:"adjustable"`
// Amazon Resource Name (ARN) of the service quota.
Arn *string `pulumi:"arn"`
// Default value of the service quota.
DefaultValue *float64 `pulumi:"defaultValue"`
// Code of the service quota to track. For example: `L-F678F1CE`. Available values can be found with the [AWS CLI service-quotas list-service-quotas command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-service-quotas.html).
QuotaCode *string `pulumi:"quotaCode"`
// Name of the quota.
QuotaName *string `pulumi:"quotaName"`
RequestId *string `pulumi:"requestId"`
RequestStatus *string `pulumi:"requestStatus"`
// Code of the service to track. For example: `vpc`. Available values can be found with the [AWS CLI service-quotas list-services command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-services.html).
ServiceCode *string `pulumi:"serviceCode"`
// Name of the service.
ServiceName *string `pulumi:"serviceName"`
// Information about the measurement.
UsageMetrics []ServiceQuotaUsageMetric `pulumi:"usageMetrics"`
// Float specifying the desired value for the service quota. If the desired value is higher than the current value, a quota increase request is submitted. When a known request is submitted and pending, the value reflects the desired value of the pending request.
Value *float64 `pulumi:"value"`
}
type ServiceQuotaState struct {
// Whether the service quota can be increased.
Adjustable pulumi.BoolPtrInput
// Amazon Resource Name (ARN) of the service quota.
Arn pulumi.StringPtrInput
// Default value of the service quota.
DefaultValue pulumi.Float64PtrInput
// Code of the service quota to track. For example: `L-F678F1CE`. Available values can be found with the [AWS CLI service-quotas list-service-quotas command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-service-quotas.html).
QuotaCode pulumi.StringPtrInput
// Name of the quota.
QuotaName pulumi.StringPtrInput
RequestId pulumi.StringPtrInput
RequestStatus pulumi.StringPtrInput
// Code of the service to track. For example: `vpc`. Available values can be found with the [AWS CLI service-quotas list-services command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-services.html).
ServiceCode pulumi.StringPtrInput
// Name of the service.
ServiceName pulumi.StringPtrInput
// Information about the measurement.
UsageMetrics ServiceQuotaUsageMetricArrayInput
// Float specifying the desired value for the service quota. If the desired value is higher than the current value, a quota increase request is submitted. When a known request is submitted and pending, the value reflects the desired value of the pending request.
Value pulumi.Float64PtrInput
}
func (ServiceQuotaState) ElementType() reflect.Type {
return reflect.TypeOf((*serviceQuotaState)(nil)).Elem()
}
type serviceQuotaArgs struct {
// Code of the service quota to track. For example: `L-F678F1CE`. Available values can be found with the [AWS CLI service-quotas list-service-quotas command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-service-quotas.html).
QuotaCode string `pulumi:"quotaCode"`
// Code of the service to track. For example: `vpc`. Available values can be found with the [AWS CLI service-quotas list-services command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-services.html).
ServiceCode string `pulumi:"serviceCode"`
// Float specifying the desired value for the service quota. If the desired value is higher than the current value, a quota increase request is submitted. When a known request is submitted and pending, the value reflects the desired value of the pending request.
Value float64 `pulumi:"value"`
}
// The set of arguments for constructing a ServiceQuota resource.
type ServiceQuotaArgs struct {
// Code of the service quota to track. For example: `L-F678F1CE`. Available values can be found with the [AWS CLI service-quotas list-service-quotas command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-service-quotas.html).
QuotaCode pulumi.StringInput
// Code of the service to track. For example: `vpc`. Available values can be found with the [AWS CLI service-quotas list-services command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-services.html).
ServiceCode pulumi.StringInput
// Float specifying the desired value for the service quota. If the desired value is higher than the current value, a quota increase request is submitted. When a known request is submitted and pending, the value reflects the desired value of the pending request.
Value pulumi.Float64Input
}
func (ServiceQuotaArgs) ElementType() reflect.Type {
return reflect.TypeOf((*serviceQuotaArgs)(nil)).Elem()
}
type ServiceQuotaInput interface {
pulumi.Input
ToServiceQuotaOutput() ServiceQuotaOutput
ToServiceQuotaOutputWithContext(ctx context.Context) ServiceQuotaOutput
}
func (*ServiceQuota) ElementType() reflect.Type {
return reflect.TypeOf((**ServiceQuota)(nil)).Elem()
}
func (i *ServiceQuota) ToServiceQuotaOutput() ServiceQuotaOutput {
return i.ToServiceQuotaOutputWithContext(context.Background())
}
func (i *ServiceQuota) ToServiceQuotaOutputWithContext(ctx context.Context) ServiceQuotaOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServiceQuotaOutput)
}
// ServiceQuotaArrayInput is an input type that accepts ServiceQuotaArray and ServiceQuotaArrayOutput values.
// You can construct a concrete instance of `ServiceQuotaArrayInput` via:
//
// ServiceQuotaArray{ ServiceQuotaArgs{...} }
type ServiceQuotaArrayInput interface {
pulumi.Input
ToServiceQuotaArrayOutput() ServiceQuotaArrayOutput
ToServiceQuotaArrayOutputWithContext(context.Context) ServiceQuotaArrayOutput
}
type ServiceQuotaArray []ServiceQuotaInput
func (ServiceQuotaArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ServiceQuota)(nil)).Elem()
}
func (i ServiceQuotaArray) ToServiceQuotaArrayOutput() ServiceQuotaArrayOutput {
return i.ToServiceQuotaArrayOutputWithContext(context.Background())
}
func (i ServiceQuotaArray) ToServiceQuotaArrayOutputWithContext(ctx context.Context) ServiceQuotaArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServiceQuotaArrayOutput)
}
// ServiceQuotaMapInput is an input type that accepts ServiceQuotaMap and ServiceQuotaMapOutput values.
// You can construct a concrete instance of `ServiceQuotaMapInput` via:
//
// ServiceQuotaMap{ "key": ServiceQuotaArgs{...} }
type ServiceQuotaMapInput interface {
pulumi.Input
ToServiceQuotaMapOutput() ServiceQuotaMapOutput
ToServiceQuotaMapOutputWithContext(context.Context) ServiceQuotaMapOutput
}
type ServiceQuotaMap map[string]ServiceQuotaInput
func (ServiceQuotaMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ServiceQuota)(nil)).Elem()
}
func (i ServiceQuotaMap) ToServiceQuotaMapOutput() ServiceQuotaMapOutput {
return i.ToServiceQuotaMapOutputWithContext(context.Background())
}
func (i ServiceQuotaMap) ToServiceQuotaMapOutputWithContext(ctx context.Context) ServiceQuotaMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServiceQuotaMapOutput)
}
type ServiceQuotaOutput struct{ *pulumi.OutputState }
func (ServiceQuotaOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ServiceQuota)(nil)).Elem()
}
func (o ServiceQuotaOutput) ToServiceQuotaOutput() ServiceQuotaOutput {
return o
}
func (o ServiceQuotaOutput) ToServiceQuotaOutputWithContext(ctx context.Context) ServiceQuotaOutput {
return o
}
// Whether the service quota can be increased.
func (o ServiceQuotaOutput) Adjustable() pulumi.BoolOutput {
return o.ApplyT(func(v *ServiceQuota) pulumi.BoolOutput { return v.Adjustable }).(pulumi.BoolOutput)
}
// Amazon Resource Name (ARN) of the service quota.
func (o ServiceQuotaOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// Default value of the service quota.
func (o ServiceQuotaOutput) DefaultValue() pulumi.Float64Output {
return o.ApplyT(func(v *ServiceQuota) pulumi.Float64Output { return v.DefaultValue }).(pulumi.Float64Output)
}
// Code of the service quota to track. For example: `L-F678F1CE`. Available values can be found with the [AWS CLI service-quotas list-service-quotas command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-service-quotas.html).
func (o ServiceQuotaOutput) QuotaCode() pulumi.StringOutput {
return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.QuotaCode }).(pulumi.StringOutput)
}
// Name of the quota.
func (o ServiceQuotaOutput) QuotaName() pulumi.StringOutput {
return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.QuotaName }).(pulumi.StringOutput)
}
func (o ServiceQuotaOutput) RequestId() pulumi.StringOutput {
return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.RequestId }).(pulumi.StringOutput)
}
func (o ServiceQuotaOutput) RequestStatus() pulumi.StringOutput {
return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.RequestStatus }).(pulumi.StringOutput)
}
// Code of the service to track. For example: `vpc`. Available values can be found with the [AWS CLI service-quotas list-services command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-services.html).
func (o ServiceQuotaOutput) ServiceCode() pulumi.StringOutput {
return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.ServiceCode }).(pulumi.StringOutput)
}
// Name of the service.
func (o ServiceQuotaOutput) ServiceName() pulumi.StringOutput {
return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.ServiceName }).(pulumi.StringOutput)
}
// Information about the measurement.
func (o ServiceQuotaOutput) UsageMetrics() ServiceQuotaUsageMetricArrayOutput {
return o.ApplyT(func(v *ServiceQuota) ServiceQuotaUsageMetricArrayOutput { return v.UsageMetrics }).(ServiceQuotaUsageMetricArrayOutput)
}
// Float specifying the desired value for the service quota. If the desired value is higher than the current value, a quota increase request is submitted. When a known request is submitted and pending, the value reflects the desired value of the pending request.
func (o ServiceQuotaOutput) Value() pulumi.Float64Output {
return o.ApplyT(func(v *ServiceQuota) pulumi.Float64Output { return v.Value }).(pulumi.Float64Output)
}
type ServiceQuotaArrayOutput struct{ *pulumi.OutputState }
func (ServiceQuotaArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ServiceQuota)(nil)).Elem()
}
func (o ServiceQuotaArrayOutput) ToServiceQuotaArrayOutput() ServiceQuotaArrayOutput {
return o
}
func (o ServiceQuotaArrayOutput) ToServiceQuotaArrayOutputWithContext(ctx context.Context) ServiceQuotaArrayOutput {
return o
}
func (o ServiceQuotaArrayOutput) Index(i pulumi.IntInput) ServiceQuotaOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ServiceQuota {
return vs[0].([]*ServiceQuota)[vs[1].(int)]
}).(ServiceQuotaOutput)
}
type ServiceQuotaMapOutput struct{ *pulumi.OutputState }
func (ServiceQuotaMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ServiceQuota)(nil)).Elem()
}
func (o ServiceQuotaMapOutput) ToServiceQuotaMapOutput() ServiceQuotaMapOutput {
return o
}
func (o ServiceQuotaMapOutput) ToServiceQuotaMapOutputWithContext(ctx context.Context) ServiceQuotaMapOutput {
return o
}
func (o ServiceQuotaMapOutput) MapIndex(k pulumi.StringInput) ServiceQuotaOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ServiceQuota {
return vs[0].(map[string]*ServiceQuota)[vs[1].(string)]
}).(ServiceQuotaOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ServiceQuotaInput)(nil)).Elem(), &ServiceQuota{})
pulumi.RegisterInputType(reflect.TypeOf((*ServiceQuotaArrayInput)(nil)).Elem(), ServiceQuotaArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ServiceQuotaMapInput)(nil)).Elem(), ServiceQuotaMap{})
pulumi.RegisterOutputType(ServiceQuotaOutput{})
pulumi.RegisterOutputType(ServiceQuotaArrayOutput{})
pulumi.RegisterOutputType(ServiceQuotaMapOutput{})
}