github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/servicequotas/getService.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 Quotas Service.
    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.GetService(ctx, &servicequotas.GetServiceArgs{
    34  //				ServiceName: "Amazon Virtual Private Cloud (Amazon VPC)",
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  func GetService(ctx *pulumi.Context, args *GetServiceArgs, opts ...pulumi.InvokeOption) (*GetServiceResult, error) {
    46  	opts = internal.PkgInvokeDefaultOpts(opts)
    47  	var rv GetServiceResult
    48  	err := ctx.Invoke("aws:servicequotas/getService:getService", args, &rv, opts...)
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	return &rv, nil
    53  }
    54  
    55  // A collection of arguments for invoking getService.
    56  type GetServiceArgs struct {
    57  	// Service name to lookup within Service Quotas. 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).
    58  	ServiceName string `pulumi:"serviceName"`
    59  }
    60  
    61  // A collection of values returned by getService.
    62  type GetServiceResult struct {
    63  	// The provider-assigned unique ID for this managed resource.
    64  	Id string `pulumi:"id"`
    65  	// Code of the service.
    66  	ServiceCode string `pulumi:"serviceCode"`
    67  	ServiceName string `pulumi:"serviceName"`
    68  }
    69  
    70  func GetServiceOutput(ctx *pulumi.Context, args GetServiceOutputArgs, opts ...pulumi.InvokeOption) GetServiceResultOutput {
    71  	return pulumi.ToOutputWithContext(context.Background(), args).
    72  		ApplyT(func(v interface{}) (GetServiceResult, error) {
    73  			args := v.(GetServiceArgs)
    74  			r, err := GetService(ctx, &args, opts...)
    75  			var s GetServiceResult
    76  			if r != nil {
    77  				s = *r
    78  			}
    79  			return s, err
    80  		}).(GetServiceResultOutput)
    81  }
    82  
    83  // A collection of arguments for invoking getService.
    84  type GetServiceOutputArgs struct {
    85  	// Service name to lookup within Service Quotas. 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).
    86  	ServiceName pulumi.StringInput `pulumi:"serviceName"`
    87  }
    88  
    89  func (GetServiceOutputArgs) ElementType() reflect.Type {
    90  	return reflect.TypeOf((*GetServiceArgs)(nil)).Elem()
    91  }
    92  
    93  // A collection of values returned by getService.
    94  type GetServiceResultOutput struct{ *pulumi.OutputState }
    95  
    96  func (GetServiceResultOutput) ElementType() reflect.Type {
    97  	return reflect.TypeOf((*GetServiceResult)(nil)).Elem()
    98  }
    99  
   100  func (o GetServiceResultOutput) ToGetServiceResultOutput() GetServiceResultOutput {
   101  	return o
   102  }
   103  
   104  func (o GetServiceResultOutput) ToGetServiceResultOutputWithContext(ctx context.Context) GetServiceResultOutput {
   105  	return o
   106  }
   107  
   108  // The provider-assigned unique ID for this managed resource.
   109  func (o GetServiceResultOutput) Id() pulumi.StringOutput {
   110  	return o.ApplyT(func(v GetServiceResult) string { return v.Id }).(pulumi.StringOutput)
   111  }
   112  
   113  // Code of the service.
   114  func (o GetServiceResultOutput) ServiceCode() pulumi.StringOutput {
   115  	return o.ApplyT(func(v GetServiceResult) string { return v.ServiceCode }).(pulumi.StringOutput)
   116  }
   117  
   118  func (o GetServiceResultOutput) ServiceName() pulumi.StringOutput {
   119  	return o.ApplyT(func(v GetServiceResult) string { return v.ServiceName }).(pulumi.StringOutput)
   120  }
   121  
   122  func init() {
   123  	pulumi.RegisterOutputType(GetServiceResultOutput{})
   124  }