github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/servicequotas/serviceQuota.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 servicequotas
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Manages an individual Service Quota.
    16  //
    17  // > **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.`
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/servicequotas"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := servicequotas.NewServiceQuota(ctx, "example", &servicequotas.ServiceQuotaArgs{
    35  //				QuotaCode:   pulumi.String("L-F678F1CE"),
    36  //				ServiceCode: pulumi.String("vpc"),
    37  //				Value:       pulumi.Float64(75),
    38  //			})
    39  //			if err != nil {
    40  //				return err
    41  //			}
    42  //			return nil
    43  //		})
    44  //	}
    45  //
    46  // ```
    47  // <!--End PulumiCodeChooser -->
    48  //
    49  // ## Import
    50  //
    51  // Using `pulumi import`, import `aws_servicequotas_service_quota` using the service code and quota code, separated by a front slash (`/`). For example:
    52  //
    53  // ~> __NOTE:__ This resource does not require explicit import and will assume management of an existing service quota on Pulumi resource creation.
    54  //
    55  // ```sh
    56  // $ pulumi import aws:servicequotas/serviceQuota:ServiceQuota example vpc/L-F678F1CE
    57  // ```
    58  type ServiceQuota struct {
    59  	pulumi.CustomResourceState
    60  
    61  	// Whether the service quota can be increased.
    62  	Adjustable pulumi.BoolOutput `pulumi:"adjustable"`
    63  	// Amazon Resource Name (ARN) of the service quota.
    64  	Arn pulumi.StringOutput `pulumi:"arn"`
    65  	// Default value of the service quota.
    66  	DefaultValue pulumi.Float64Output `pulumi:"defaultValue"`
    67  	// 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).
    68  	QuotaCode pulumi.StringOutput `pulumi:"quotaCode"`
    69  	// Name of the quota.
    70  	QuotaName     pulumi.StringOutput `pulumi:"quotaName"`
    71  	RequestId     pulumi.StringOutput `pulumi:"requestId"`
    72  	RequestStatus pulumi.StringOutput `pulumi:"requestStatus"`
    73  	// 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).
    74  	ServiceCode pulumi.StringOutput `pulumi:"serviceCode"`
    75  	// Name of the service.
    76  	ServiceName pulumi.StringOutput `pulumi:"serviceName"`
    77  	// Information about the measurement.
    78  	UsageMetrics ServiceQuotaUsageMetricArrayOutput `pulumi:"usageMetrics"`
    79  	// 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.
    80  	Value pulumi.Float64Output `pulumi:"value"`
    81  }
    82  
    83  // NewServiceQuota registers a new resource with the given unique name, arguments, and options.
    84  func NewServiceQuota(ctx *pulumi.Context,
    85  	name string, args *ServiceQuotaArgs, opts ...pulumi.ResourceOption) (*ServiceQuota, error) {
    86  	if args == nil {
    87  		return nil, errors.New("missing one or more required arguments")
    88  	}
    89  
    90  	if args.QuotaCode == nil {
    91  		return nil, errors.New("invalid value for required argument 'QuotaCode'")
    92  	}
    93  	if args.ServiceCode == nil {
    94  		return nil, errors.New("invalid value for required argument 'ServiceCode'")
    95  	}
    96  	if args.Value == nil {
    97  		return nil, errors.New("invalid value for required argument 'Value'")
    98  	}
    99  	opts = internal.PkgResourceDefaultOpts(opts)
   100  	var resource ServiceQuota
   101  	err := ctx.RegisterResource("aws:servicequotas/serviceQuota:ServiceQuota", name, args, &resource, opts...)
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  	return &resource, nil
   106  }
   107  
   108  // GetServiceQuota gets an existing ServiceQuota resource's state with the given name, ID, and optional
   109  // state properties that are used to uniquely qualify the lookup (nil if not required).
   110  func GetServiceQuota(ctx *pulumi.Context,
   111  	name string, id pulumi.IDInput, state *ServiceQuotaState, opts ...pulumi.ResourceOption) (*ServiceQuota, error) {
   112  	var resource ServiceQuota
   113  	err := ctx.ReadResource("aws:servicequotas/serviceQuota:ServiceQuota", name, id, state, &resource, opts...)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	return &resource, nil
   118  }
   119  
   120  // Input properties used for looking up and filtering ServiceQuota resources.
   121  type serviceQuotaState struct {
   122  	// Whether the service quota can be increased.
   123  	Adjustable *bool `pulumi:"adjustable"`
   124  	// Amazon Resource Name (ARN) of the service quota.
   125  	Arn *string `pulumi:"arn"`
   126  	// Default value of the service quota.
   127  	DefaultValue *float64 `pulumi:"defaultValue"`
   128  	// 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).
   129  	QuotaCode *string `pulumi:"quotaCode"`
   130  	// Name of the quota.
   131  	QuotaName     *string `pulumi:"quotaName"`
   132  	RequestId     *string `pulumi:"requestId"`
   133  	RequestStatus *string `pulumi:"requestStatus"`
   134  	// 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).
   135  	ServiceCode *string `pulumi:"serviceCode"`
   136  	// Name of the service.
   137  	ServiceName *string `pulumi:"serviceName"`
   138  	// Information about the measurement.
   139  	UsageMetrics []ServiceQuotaUsageMetric `pulumi:"usageMetrics"`
   140  	// 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.
   141  	Value *float64 `pulumi:"value"`
   142  }
   143  
   144  type ServiceQuotaState struct {
   145  	// Whether the service quota can be increased.
   146  	Adjustable pulumi.BoolPtrInput
   147  	// Amazon Resource Name (ARN) of the service quota.
   148  	Arn pulumi.StringPtrInput
   149  	// Default value of the service quota.
   150  	DefaultValue pulumi.Float64PtrInput
   151  	// 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).
   152  	QuotaCode pulumi.StringPtrInput
   153  	// Name of the quota.
   154  	QuotaName     pulumi.StringPtrInput
   155  	RequestId     pulumi.StringPtrInput
   156  	RequestStatus pulumi.StringPtrInput
   157  	// 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).
   158  	ServiceCode pulumi.StringPtrInput
   159  	// Name of the service.
   160  	ServiceName pulumi.StringPtrInput
   161  	// Information about the measurement.
   162  	UsageMetrics ServiceQuotaUsageMetricArrayInput
   163  	// 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.
   164  	Value pulumi.Float64PtrInput
   165  }
   166  
   167  func (ServiceQuotaState) ElementType() reflect.Type {
   168  	return reflect.TypeOf((*serviceQuotaState)(nil)).Elem()
   169  }
   170  
   171  type serviceQuotaArgs struct {
   172  	// 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).
   173  	QuotaCode string `pulumi:"quotaCode"`
   174  	// 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).
   175  	ServiceCode string `pulumi:"serviceCode"`
   176  	// 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.
   177  	Value float64 `pulumi:"value"`
   178  }
   179  
   180  // The set of arguments for constructing a ServiceQuota resource.
   181  type ServiceQuotaArgs struct {
   182  	// 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).
   183  	QuotaCode pulumi.StringInput
   184  	// 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).
   185  	ServiceCode pulumi.StringInput
   186  	// 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.
   187  	Value pulumi.Float64Input
   188  }
   189  
   190  func (ServiceQuotaArgs) ElementType() reflect.Type {
   191  	return reflect.TypeOf((*serviceQuotaArgs)(nil)).Elem()
   192  }
   193  
   194  type ServiceQuotaInput interface {
   195  	pulumi.Input
   196  
   197  	ToServiceQuotaOutput() ServiceQuotaOutput
   198  	ToServiceQuotaOutputWithContext(ctx context.Context) ServiceQuotaOutput
   199  }
   200  
   201  func (*ServiceQuota) ElementType() reflect.Type {
   202  	return reflect.TypeOf((**ServiceQuota)(nil)).Elem()
   203  }
   204  
   205  func (i *ServiceQuota) ToServiceQuotaOutput() ServiceQuotaOutput {
   206  	return i.ToServiceQuotaOutputWithContext(context.Background())
   207  }
   208  
   209  func (i *ServiceQuota) ToServiceQuotaOutputWithContext(ctx context.Context) ServiceQuotaOutput {
   210  	return pulumi.ToOutputWithContext(ctx, i).(ServiceQuotaOutput)
   211  }
   212  
   213  // ServiceQuotaArrayInput is an input type that accepts ServiceQuotaArray and ServiceQuotaArrayOutput values.
   214  // You can construct a concrete instance of `ServiceQuotaArrayInput` via:
   215  //
   216  //	ServiceQuotaArray{ ServiceQuotaArgs{...} }
   217  type ServiceQuotaArrayInput interface {
   218  	pulumi.Input
   219  
   220  	ToServiceQuotaArrayOutput() ServiceQuotaArrayOutput
   221  	ToServiceQuotaArrayOutputWithContext(context.Context) ServiceQuotaArrayOutput
   222  }
   223  
   224  type ServiceQuotaArray []ServiceQuotaInput
   225  
   226  func (ServiceQuotaArray) ElementType() reflect.Type {
   227  	return reflect.TypeOf((*[]*ServiceQuota)(nil)).Elem()
   228  }
   229  
   230  func (i ServiceQuotaArray) ToServiceQuotaArrayOutput() ServiceQuotaArrayOutput {
   231  	return i.ToServiceQuotaArrayOutputWithContext(context.Background())
   232  }
   233  
   234  func (i ServiceQuotaArray) ToServiceQuotaArrayOutputWithContext(ctx context.Context) ServiceQuotaArrayOutput {
   235  	return pulumi.ToOutputWithContext(ctx, i).(ServiceQuotaArrayOutput)
   236  }
   237  
   238  // ServiceQuotaMapInput is an input type that accepts ServiceQuotaMap and ServiceQuotaMapOutput values.
   239  // You can construct a concrete instance of `ServiceQuotaMapInput` via:
   240  //
   241  //	ServiceQuotaMap{ "key": ServiceQuotaArgs{...} }
   242  type ServiceQuotaMapInput interface {
   243  	pulumi.Input
   244  
   245  	ToServiceQuotaMapOutput() ServiceQuotaMapOutput
   246  	ToServiceQuotaMapOutputWithContext(context.Context) ServiceQuotaMapOutput
   247  }
   248  
   249  type ServiceQuotaMap map[string]ServiceQuotaInput
   250  
   251  func (ServiceQuotaMap) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*map[string]*ServiceQuota)(nil)).Elem()
   253  }
   254  
   255  func (i ServiceQuotaMap) ToServiceQuotaMapOutput() ServiceQuotaMapOutput {
   256  	return i.ToServiceQuotaMapOutputWithContext(context.Background())
   257  }
   258  
   259  func (i ServiceQuotaMap) ToServiceQuotaMapOutputWithContext(ctx context.Context) ServiceQuotaMapOutput {
   260  	return pulumi.ToOutputWithContext(ctx, i).(ServiceQuotaMapOutput)
   261  }
   262  
   263  type ServiceQuotaOutput struct{ *pulumi.OutputState }
   264  
   265  func (ServiceQuotaOutput) ElementType() reflect.Type {
   266  	return reflect.TypeOf((**ServiceQuota)(nil)).Elem()
   267  }
   268  
   269  func (o ServiceQuotaOutput) ToServiceQuotaOutput() ServiceQuotaOutput {
   270  	return o
   271  }
   272  
   273  func (o ServiceQuotaOutput) ToServiceQuotaOutputWithContext(ctx context.Context) ServiceQuotaOutput {
   274  	return o
   275  }
   276  
   277  // Whether the service quota can be increased.
   278  func (o ServiceQuotaOutput) Adjustable() pulumi.BoolOutput {
   279  	return o.ApplyT(func(v *ServiceQuota) pulumi.BoolOutput { return v.Adjustable }).(pulumi.BoolOutput)
   280  }
   281  
   282  // Amazon Resource Name (ARN) of the service quota.
   283  func (o ServiceQuotaOutput) Arn() pulumi.StringOutput {
   284  	return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   285  }
   286  
   287  // Default value of the service quota.
   288  func (o ServiceQuotaOutput) DefaultValue() pulumi.Float64Output {
   289  	return o.ApplyT(func(v *ServiceQuota) pulumi.Float64Output { return v.DefaultValue }).(pulumi.Float64Output)
   290  }
   291  
   292  // 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).
   293  func (o ServiceQuotaOutput) QuotaCode() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.QuotaCode }).(pulumi.StringOutput)
   295  }
   296  
   297  // Name of the quota.
   298  func (o ServiceQuotaOutput) QuotaName() pulumi.StringOutput {
   299  	return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.QuotaName }).(pulumi.StringOutput)
   300  }
   301  
   302  func (o ServiceQuotaOutput) RequestId() pulumi.StringOutput {
   303  	return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.RequestId }).(pulumi.StringOutput)
   304  }
   305  
   306  func (o ServiceQuotaOutput) RequestStatus() pulumi.StringOutput {
   307  	return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.RequestStatus }).(pulumi.StringOutput)
   308  }
   309  
   310  // 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).
   311  func (o ServiceQuotaOutput) ServiceCode() pulumi.StringOutput {
   312  	return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.ServiceCode }).(pulumi.StringOutput)
   313  }
   314  
   315  // Name of the service.
   316  func (o ServiceQuotaOutput) ServiceName() pulumi.StringOutput {
   317  	return o.ApplyT(func(v *ServiceQuota) pulumi.StringOutput { return v.ServiceName }).(pulumi.StringOutput)
   318  }
   319  
   320  // Information about the measurement.
   321  func (o ServiceQuotaOutput) UsageMetrics() ServiceQuotaUsageMetricArrayOutput {
   322  	return o.ApplyT(func(v *ServiceQuota) ServiceQuotaUsageMetricArrayOutput { return v.UsageMetrics }).(ServiceQuotaUsageMetricArrayOutput)
   323  }
   324  
   325  // 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.
   326  func (o ServiceQuotaOutput) Value() pulumi.Float64Output {
   327  	return o.ApplyT(func(v *ServiceQuota) pulumi.Float64Output { return v.Value }).(pulumi.Float64Output)
   328  }
   329  
   330  type ServiceQuotaArrayOutput struct{ *pulumi.OutputState }
   331  
   332  func (ServiceQuotaArrayOutput) ElementType() reflect.Type {
   333  	return reflect.TypeOf((*[]*ServiceQuota)(nil)).Elem()
   334  }
   335  
   336  func (o ServiceQuotaArrayOutput) ToServiceQuotaArrayOutput() ServiceQuotaArrayOutput {
   337  	return o
   338  }
   339  
   340  func (o ServiceQuotaArrayOutput) ToServiceQuotaArrayOutputWithContext(ctx context.Context) ServiceQuotaArrayOutput {
   341  	return o
   342  }
   343  
   344  func (o ServiceQuotaArrayOutput) Index(i pulumi.IntInput) ServiceQuotaOutput {
   345  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ServiceQuota {
   346  		return vs[0].([]*ServiceQuota)[vs[1].(int)]
   347  	}).(ServiceQuotaOutput)
   348  }
   349  
   350  type ServiceQuotaMapOutput struct{ *pulumi.OutputState }
   351  
   352  func (ServiceQuotaMapOutput) ElementType() reflect.Type {
   353  	return reflect.TypeOf((*map[string]*ServiceQuota)(nil)).Elem()
   354  }
   355  
   356  func (o ServiceQuotaMapOutput) ToServiceQuotaMapOutput() ServiceQuotaMapOutput {
   357  	return o
   358  }
   359  
   360  func (o ServiceQuotaMapOutput) ToServiceQuotaMapOutputWithContext(ctx context.Context) ServiceQuotaMapOutput {
   361  	return o
   362  }
   363  
   364  func (o ServiceQuotaMapOutput) MapIndex(k pulumi.StringInput) ServiceQuotaOutput {
   365  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ServiceQuota {
   366  		return vs[0].(map[string]*ServiceQuota)[vs[1].(string)]
   367  	}).(ServiceQuotaOutput)
   368  }
   369  
   370  func init() {
   371  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceQuotaInput)(nil)).Elem(), &ServiceQuota{})
   372  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceQuotaArrayInput)(nil)).Elem(), ServiceQuotaArray{})
   373  	pulumi.RegisterInputType(reflect.TypeOf((*ServiceQuotaMapInput)(nil)).Elem(), ServiceQuotaMap{})
   374  	pulumi.RegisterOutputType(ServiceQuotaOutput{})
   375  	pulumi.RegisterOutputType(ServiceQuotaArrayOutput{})
   376  	pulumi.RegisterOutputType(ServiceQuotaMapOutput{})
   377  }