github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/servicequotas/getServiceQuota.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Retrieve information about a Service Quota.
    15  //
    16  // > **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.`
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/servicequotas"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := servicequotas.LookupServiceQuota(ctx, &servicequotas.LookupServiceQuotaArgs{
    34  //				QuotaCode:   pulumi.StringRef("L-F678F1CE"),
    35  //				ServiceCode: "vpc",
    36  //			}, nil)
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			_, err = servicequotas.LookupServiceQuota(ctx, &servicequotas.LookupServiceQuotaArgs{
    41  //				QuotaName:   pulumi.StringRef("VPCs per Region"),
    42  //				ServiceCode: "vpc",
    43  //			}, nil)
    44  //			if err != nil {
    45  //				return err
    46  //			}
    47  //			return nil
    48  //		})
    49  //	}
    50  //
    51  // ```
    52  // <!--End PulumiCodeChooser -->
    53  func LookupServiceQuota(ctx *pulumi.Context, args *LookupServiceQuotaArgs, opts ...pulumi.InvokeOption) (*LookupServiceQuotaResult, error) {
    54  	opts = internal.PkgInvokeDefaultOpts(opts)
    55  	var rv LookupServiceQuotaResult
    56  	err := ctx.Invoke("aws:servicequotas/getServiceQuota:getServiceQuota", args, &rv, opts...)
    57  	if err != nil {
    58  		return nil, err
    59  	}
    60  	return &rv, nil
    61  }
    62  
    63  // A collection of arguments for invoking getServiceQuota.
    64  type LookupServiceQuotaArgs struct {
    65  	// 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.
    66  	QuotaCode *string `pulumi:"quotaCode"`
    67  	// 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.
    68  	QuotaName *string `pulumi:"quotaName"`
    69  	// 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).
    70  	ServiceCode string `pulumi:"serviceCode"`
    71  }
    72  
    73  // A collection of values returned by getServiceQuota.
    74  type LookupServiceQuotaResult struct {
    75  	// Whether the service quota is adjustable.
    76  	Adjustable bool `pulumi:"adjustable"`
    77  	// ARN of the service quota.
    78  	Arn string `pulumi:"arn"`
    79  	// Default value of the service quota.
    80  	DefaultValue float64 `pulumi:"defaultValue"`
    81  	// Whether the service quota is global for the AWS account.
    82  	GlobalQuota bool `pulumi:"globalQuota"`
    83  	// The provider-assigned unique ID for this managed resource.
    84  	Id          string `pulumi:"id"`
    85  	QuotaCode   string `pulumi:"quotaCode"`
    86  	QuotaName   string `pulumi:"quotaName"`
    87  	ServiceCode string `pulumi:"serviceCode"`
    88  	// Name of the service.
    89  	ServiceName string `pulumi:"serviceName"`
    90  	// Information about the measurement.
    91  	UsageMetrics []GetServiceQuotaUsageMetric `pulumi:"usageMetrics"`
    92  	// Current value of the service quota.
    93  	Value float64 `pulumi:"value"`
    94  }
    95  
    96  func LookupServiceQuotaOutput(ctx *pulumi.Context, args LookupServiceQuotaOutputArgs, opts ...pulumi.InvokeOption) LookupServiceQuotaResultOutput {
    97  	return pulumi.ToOutputWithContext(context.Background(), args).
    98  		ApplyT(func(v interface{}) (LookupServiceQuotaResult, error) {
    99  			args := v.(LookupServiceQuotaArgs)
   100  			r, err := LookupServiceQuota(ctx, &args, opts...)
   101  			var s LookupServiceQuotaResult
   102  			if r != nil {
   103  				s = *r
   104  			}
   105  			return s, err
   106  		}).(LookupServiceQuotaResultOutput)
   107  }
   108  
   109  // A collection of arguments for invoking getServiceQuota.
   110  type LookupServiceQuotaOutputArgs struct {
   111  	// 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.
   112  	QuotaCode pulumi.StringPtrInput `pulumi:"quotaCode"`
   113  	// 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.
   114  	QuotaName pulumi.StringPtrInput `pulumi:"quotaName"`
   115  	// 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).
   116  	ServiceCode pulumi.StringInput `pulumi:"serviceCode"`
   117  }
   118  
   119  func (LookupServiceQuotaOutputArgs) ElementType() reflect.Type {
   120  	return reflect.TypeOf((*LookupServiceQuotaArgs)(nil)).Elem()
   121  }
   122  
   123  // A collection of values returned by getServiceQuota.
   124  type LookupServiceQuotaResultOutput struct{ *pulumi.OutputState }
   125  
   126  func (LookupServiceQuotaResultOutput) ElementType() reflect.Type {
   127  	return reflect.TypeOf((*LookupServiceQuotaResult)(nil)).Elem()
   128  }
   129  
   130  func (o LookupServiceQuotaResultOutput) ToLookupServiceQuotaResultOutput() LookupServiceQuotaResultOutput {
   131  	return o
   132  }
   133  
   134  func (o LookupServiceQuotaResultOutput) ToLookupServiceQuotaResultOutputWithContext(ctx context.Context) LookupServiceQuotaResultOutput {
   135  	return o
   136  }
   137  
   138  // Whether the service quota is adjustable.
   139  func (o LookupServiceQuotaResultOutput) Adjustable() pulumi.BoolOutput {
   140  	return o.ApplyT(func(v LookupServiceQuotaResult) bool { return v.Adjustable }).(pulumi.BoolOutput)
   141  }
   142  
   143  // ARN of the service quota.
   144  func (o LookupServiceQuotaResultOutput) Arn() pulumi.StringOutput {
   145  	return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.Arn }).(pulumi.StringOutput)
   146  }
   147  
   148  // Default value of the service quota.
   149  func (o LookupServiceQuotaResultOutput) DefaultValue() pulumi.Float64Output {
   150  	return o.ApplyT(func(v LookupServiceQuotaResult) float64 { return v.DefaultValue }).(pulumi.Float64Output)
   151  }
   152  
   153  // Whether the service quota is global for the AWS account.
   154  func (o LookupServiceQuotaResultOutput) GlobalQuota() pulumi.BoolOutput {
   155  	return o.ApplyT(func(v LookupServiceQuotaResult) bool { return v.GlobalQuota }).(pulumi.BoolOutput)
   156  }
   157  
   158  // The provider-assigned unique ID for this managed resource.
   159  func (o LookupServiceQuotaResultOutput) Id() pulumi.StringOutput {
   160  	return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.Id }).(pulumi.StringOutput)
   161  }
   162  
   163  func (o LookupServiceQuotaResultOutput) QuotaCode() pulumi.StringOutput {
   164  	return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.QuotaCode }).(pulumi.StringOutput)
   165  }
   166  
   167  func (o LookupServiceQuotaResultOutput) QuotaName() pulumi.StringOutput {
   168  	return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.QuotaName }).(pulumi.StringOutput)
   169  }
   170  
   171  func (o LookupServiceQuotaResultOutput) ServiceCode() pulumi.StringOutput {
   172  	return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.ServiceCode }).(pulumi.StringOutput)
   173  }
   174  
   175  // Name of the service.
   176  func (o LookupServiceQuotaResultOutput) ServiceName() pulumi.StringOutput {
   177  	return o.ApplyT(func(v LookupServiceQuotaResult) string { return v.ServiceName }).(pulumi.StringOutput)
   178  }
   179  
   180  // Information about the measurement.
   181  func (o LookupServiceQuotaResultOutput) UsageMetrics() GetServiceQuotaUsageMetricArrayOutput {
   182  	return o.ApplyT(func(v LookupServiceQuotaResult) []GetServiceQuotaUsageMetric { return v.UsageMetrics }).(GetServiceQuotaUsageMetricArrayOutput)
   183  }
   184  
   185  // Current value of the service quota.
   186  func (o LookupServiceQuotaResultOutput) Value() pulumi.Float64Output {
   187  	return o.ApplyT(func(v LookupServiceQuotaResult) float64 { return v.Value }).(pulumi.Float64Output)
   188  }
   189  
   190  func init() {
   191  	pulumi.RegisterOutputType(LookupServiceQuotaResultOutput{})
   192  }