/
getServiceQuota.go
188 lines (163 loc) · 8.37 KB
/
getServiceQuota.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
// 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"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Retrieve information about a 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.LookupServiceQuota(ctx, &servicequotas.LookupServiceQuotaArgs{
// QuotaCode: pulumi.StringRef("L-F678F1CE"),
// ServiceCode: "vpc",
// }, nil)
// if err != nil {
// return err
// }
// _, err = servicequotas.LookupServiceQuota(ctx, &servicequotas.LookupServiceQuotaArgs{
// QuotaName: pulumi.StringRef("VPCs per Region"),
// ServiceCode: "vpc",
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func LookupServiceQuota(ctx *pulumi.Context, args *LookupServiceQuotaArgs, opts ...pulumi.InvokeOption) (*LookupServiceQuotaResult, error) {
var rv LookupServiceQuotaResult
err := ctx.Invoke("aws:servicequotas/getServiceQuota:getServiceQuota", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getServiceQuota.
type LookupServiceQuotaArgs struct {
// Quota code within the service. When configured, the data source directly looks up the service quota. 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). One of `quotaCode` or `quotaName` must be specified.
QuotaCode *string `pulumi:"quotaCode"`
// Quota name within the service. When configured, the data source searches through all service quotas to find the matching quota name. 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). One of `quotaName` or `quotaCode` must be specified.
QuotaName *string `pulumi:"quotaName"`
// Service code for the quota. Available values can be found with the `servicequotas.getService` data source or [AWS CLI service-quotas list-services command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-services.html).
ServiceCode string `pulumi:"serviceCode"`
}
// A collection of values returned by getServiceQuota.
type LookupServiceQuotaResult struct {
// Whether the service quota is adjustable.
Adjustable bool `pulumi:"adjustable"`
// ARN of the service quota.
Arn string `pulumi:"arn"`
// Default value of the service quota.
DefaultValue float64 `pulumi:"defaultValue"`
// Whether the service quota is global for the AWS account.
GlobalQuota bool `pulumi:"globalQuota"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
QuotaCode string `pulumi:"quotaCode"`
QuotaName string `pulumi:"quotaName"`
ServiceCode string `pulumi:"serviceCode"`
// Name of the service.
ServiceName string `pulumi:"serviceName"`
// Information about the measurement.
UsageMetrics []GetServiceQuotaUsageMetric `pulumi:"usageMetrics"`
// Current value of the service quota.
Value float64 `pulumi:"value"`
}
func LookupServiceQuotaOutput(ctx *pulumi.Context, args LookupServiceQuotaOutputArgs, opts ...pulumi.InvokeOption) LookupServiceQuotaResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupServiceQuotaResult, error) {
args := v.(LookupServiceQuotaArgs)
r, err := LookupServiceQuota(ctx, &args, opts...)
var s LookupServiceQuotaResult
if r != nil {
s = *r
}
return s, err
}).(LookupServiceQuotaResultOutput)
}
// A collection of arguments for invoking getServiceQuota.
type LookupServiceQuotaOutputArgs struct {
// Quota code within the service. When configured, the data source directly looks up the service quota. 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). One of `quotaCode` or `quotaName` must be specified.
QuotaCode pulumi.StringPtrInput `pulumi:"quotaCode"`
// Quota name within the service. When configured, the data source searches through all service quotas to find the matching quota name. 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). One of `quotaName` or `quotaCode` must be specified.
QuotaName pulumi.StringPtrInput `pulumi:"quotaName"`
// Service code for the quota. Available values can be found with the `servicequotas.getService` data source or [AWS CLI service-quotas list-services command](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/list-services.html).
ServiceCode pulumi.StringInput `pulumi:"serviceCode"`
}
func (LookupServiceQuotaOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupServiceQuotaArgs)(nil)).Elem()
}
// A collection of values returned by getServiceQuota.
type LookupServiceQuotaResultOutput struct{ *pulumi.OutputState }
func (LookupServiceQuotaResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupServiceQuotaResult)(nil)).Elem()
}
func (o LookupServiceQuotaResultOutput) ToLookupServiceQuotaResultOutput() LookupServiceQuotaResultOutput {
return o
}
func (o LookupServiceQuotaResultOutput) ToLookupServiceQuotaResultOutputWithContext(ctx context.Context) LookupServiceQuotaResultOutput {
return o
}
// Whether the service quota is adjustable.
func (o LookupServiceQuotaResultOutput) Adjustable() pulumi.BoolOutput {
return o.ApplyT(func(v LookupServiceQuotaResult) bool { return v.Adjustable }).(pulumi.BoolOutput)
}
// ARN of the service quota.
func (o LookupServiceQuotaResultOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.Arn }).(pulumi.StringOutput)
}
// Default value of the service quota.
func (o LookupServiceQuotaResultOutput) DefaultValue() pulumi.Float64Output {
return o.ApplyT(func(v LookupServiceQuotaResult) float64 { return v.DefaultValue }).(pulumi.Float64Output)
}
// Whether the service quota is global for the AWS account.
func (o LookupServiceQuotaResultOutput) GlobalQuota() pulumi.BoolOutput {
return o.ApplyT(func(v LookupServiceQuotaResult) bool { return v.GlobalQuota }).(pulumi.BoolOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupServiceQuotaResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o LookupServiceQuotaResultOutput) QuotaCode() pulumi.StringOutput {
return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.QuotaCode }).(pulumi.StringOutput)
}
func (o LookupServiceQuotaResultOutput) QuotaName() pulumi.StringOutput {
return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.QuotaName }).(pulumi.StringOutput)
}
func (o LookupServiceQuotaResultOutput) ServiceCode() pulumi.StringOutput {
return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.ServiceCode }).(pulumi.StringOutput)
}
// Name of the service.
func (o LookupServiceQuotaResultOutput) ServiceName() pulumi.StringOutput {
return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.ServiceName }).(pulumi.StringOutput)
}
// Information about the measurement.
func (o LookupServiceQuotaResultOutput) UsageMetrics() GetServiceQuotaUsageMetricArrayOutput {
return o.ApplyT(func(v LookupServiceQuotaResult) []GetServiceQuotaUsageMetric { return v.UsageMetrics }).(GetServiceQuotaUsageMetricArrayOutput)
}
// Current value of the service quota.
func (o LookupServiceQuotaResultOutput) Value() pulumi.Float64Output {
return o.ApplyT(func(v LookupServiceQuotaResult) float64 { return v.Value }).(pulumi.Float64Output)
}
func init() {
pulumi.RegisterOutputType(LookupServiceQuotaResultOutput{})
}