github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apigatewayv2/getApi.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 apigatewayv2
     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  // Provides details about a specific Amazon API Gateway Version 2 API.
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			_, err := apigatewayv2.LookupApi(ctx, &apigatewayv2.LookupApiArgs{
    32  //				ApiId: "aabbccddee",
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  func LookupApi(ctx *pulumi.Context, args *LookupApiArgs, opts ...pulumi.InvokeOption) (*LookupApiResult, error) {
    44  	opts = internal.PkgInvokeDefaultOpts(opts)
    45  	var rv LookupApiResult
    46  	err := ctx.Invoke("aws:apigatewayv2/getApi:getApi", args, &rv, opts...)
    47  	if err != nil {
    48  		return nil, err
    49  	}
    50  	return &rv, nil
    51  }
    52  
    53  // A collection of arguments for invoking getApi.
    54  type LookupApiArgs struct {
    55  	// API identifier.
    56  	ApiId string `pulumi:"apiId"`
    57  	// Map of resource tags.
    58  	Tags map[string]string `pulumi:"tags"`
    59  }
    60  
    61  // A collection of values returned by getApi.
    62  type LookupApiResult struct {
    63  	// URI of the API, of the form `https://{api-id}.execute-api.{region}.amazonaws.com` for HTTP APIs and `wss://{api-id}.execute-api.{region}.amazonaws.com` for WebSocket APIs.
    64  	ApiEndpoint string `pulumi:"apiEndpoint"`
    65  	ApiId       string `pulumi:"apiId"`
    66  	// An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions).
    67  	// Applicable for WebSocket APIs.
    68  	ApiKeySelectionExpression string `pulumi:"apiKeySelectionExpression"`
    69  	// ARN of the API.
    70  	Arn string `pulumi:"arn"`
    71  	// Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html).
    72  	// Applicable for HTTP APIs.
    73  	CorsConfigurations []GetApiCorsConfiguration `pulumi:"corsConfigurations"`
    74  	// Description of the API.
    75  	Description string `pulumi:"description"`
    76  	// Whether clients can invoke the API by using the default `execute-api` endpoint.
    77  	DisableExecuteApiEndpoint bool `pulumi:"disableExecuteApiEndpoint"`
    78  	// ARN prefix to be used in an `lambda.Permission`'s `sourceArn` attribute
    79  	// or in an `iam.Policy` to authorize access to the [`@connections` API](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html).
    80  	// See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-control-access-iam.html) for details.
    81  	ExecutionArn string `pulumi:"executionArn"`
    82  	// The provider-assigned unique ID for this managed resource.
    83  	Id string `pulumi:"id"`
    84  	// Name of the API.
    85  	Name string `pulumi:"name"`
    86  	// API protocol.
    87  	ProtocolType string `pulumi:"protocolType"`
    88  	// The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API.
    89  	RouteSelectionExpression string `pulumi:"routeSelectionExpression"`
    90  	// Map of resource tags.
    91  	Tags map[string]string `pulumi:"tags"`
    92  	// Version identifier for the API.
    93  	Version string `pulumi:"version"`
    94  }
    95  
    96  func LookupApiOutput(ctx *pulumi.Context, args LookupApiOutputArgs, opts ...pulumi.InvokeOption) LookupApiResultOutput {
    97  	return pulumi.ToOutputWithContext(context.Background(), args).
    98  		ApplyT(func(v interface{}) (LookupApiResult, error) {
    99  			args := v.(LookupApiArgs)
   100  			r, err := LookupApi(ctx, &args, opts...)
   101  			var s LookupApiResult
   102  			if r != nil {
   103  				s = *r
   104  			}
   105  			return s, err
   106  		}).(LookupApiResultOutput)
   107  }
   108  
   109  // A collection of arguments for invoking getApi.
   110  type LookupApiOutputArgs struct {
   111  	// API identifier.
   112  	ApiId pulumi.StringInput `pulumi:"apiId"`
   113  	// Map of resource tags.
   114  	Tags pulumi.StringMapInput `pulumi:"tags"`
   115  }
   116  
   117  func (LookupApiOutputArgs) ElementType() reflect.Type {
   118  	return reflect.TypeOf((*LookupApiArgs)(nil)).Elem()
   119  }
   120  
   121  // A collection of values returned by getApi.
   122  type LookupApiResultOutput struct{ *pulumi.OutputState }
   123  
   124  func (LookupApiResultOutput) ElementType() reflect.Type {
   125  	return reflect.TypeOf((*LookupApiResult)(nil)).Elem()
   126  }
   127  
   128  func (o LookupApiResultOutput) ToLookupApiResultOutput() LookupApiResultOutput {
   129  	return o
   130  }
   131  
   132  func (o LookupApiResultOutput) ToLookupApiResultOutputWithContext(ctx context.Context) LookupApiResultOutput {
   133  	return o
   134  }
   135  
   136  // URI of the API, of the form `https://{api-id}.execute-api.{region}.amazonaws.com` for HTTP APIs and `wss://{api-id}.execute-api.{region}.amazonaws.com` for WebSocket APIs.
   137  func (o LookupApiResultOutput) ApiEndpoint() pulumi.StringOutput {
   138  	return o.ApplyT(func(v LookupApiResult) string { return v.ApiEndpoint }).(pulumi.StringOutput)
   139  }
   140  
   141  func (o LookupApiResultOutput) ApiId() pulumi.StringOutput {
   142  	return o.ApplyT(func(v LookupApiResult) string { return v.ApiId }).(pulumi.StringOutput)
   143  }
   144  
   145  // An [API key selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions).
   146  // Applicable for WebSocket APIs.
   147  func (o LookupApiResultOutput) ApiKeySelectionExpression() pulumi.StringOutput {
   148  	return o.ApplyT(func(v LookupApiResult) string { return v.ApiKeySelectionExpression }).(pulumi.StringOutput)
   149  }
   150  
   151  // ARN of the API.
   152  func (o LookupApiResultOutput) Arn() pulumi.StringOutput {
   153  	return o.ApplyT(func(v LookupApiResult) string { return v.Arn }).(pulumi.StringOutput)
   154  }
   155  
   156  // Cross-origin resource sharing (CORS) [configuration](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html).
   157  // Applicable for HTTP APIs.
   158  func (o LookupApiResultOutput) CorsConfigurations() GetApiCorsConfigurationArrayOutput {
   159  	return o.ApplyT(func(v LookupApiResult) []GetApiCorsConfiguration { return v.CorsConfigurations }).(GetApiCorsConfigurationArrayOutput)
   160  }
   161  
   162  // Description of the API.
   163  func (o LookupApiResultOutput) Description() pulumi.StringOutput {
   164  	return o.ApplyT(func(v LookupApiResult) string { return v.Description }).(pulumi.StringOutput)
   165  }
   166  
   167  // Whether clients can invoke the API by using the default `execute-api` endpoint.
   168  func (o LookupApiResultOutput) DisableExecuteApiEndpoint() pulumi.BoolOutput {
   169  	return o.ApplyT(func(v LookupApiResult) bool { return v.DisableExecuteApiEndpoint }).(pulumi.BoolOutput)
   170  }
   171  
   172  // ARN prefix to be used in an `lambda.Permission`'s `sourceArn` attribute
   173  // or in an `iam.Policy` to authorize access to the [`@connections` API](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html).
   174  // See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-control-access-iam.html) for details.
   175  func (o LookupApiResultOutput) ExecutionArn() pulumi.StringOutput {
   176  	return o.ApplyT(func(v LookupApiResult) string { return v.ExecutionArn }).(pulumi.StringOutput)
   177  }
   178  
   179  // The provider-assigned unique ID for this managed resource.
   180  func (o LookupApiResultOutput) Id() pulumi.StringOutput {
   181  	return o.ApplyT(func(v LookupApiResult) string { return v.Id }).(pulumi.StringOutput)
   182  }
   183  
   184  // Name of the API.
   185  func (o LookupApiResultOutput) Name() pulumi.StringOutput {
   186  	return o.ApplyT(func(v LookupApiResult) string { return v.Name }).(pulumi.StringOutput)
   187  }
   188  
   189  // API protocol.
   190  func (o LookupApiResultOutput) ProtocolType() pulumi.StringOutput {
   191  	return o.ApplyT(func(v LookupApiResult) string { return v.ProtocolType }).(pulumi.StringOutput)
   192  }
   193  
   194  // The [route selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-selection-expressions) for the API.
   195  func (o LookupApiResultOutput) RouteSelectionExpression() pulumi.StringOutput {
   196  	return o.ApplyT(func(v LookupApiResult) string { return v.RouteSelectionExpression }).(pulumi.StringOutput)
   197  }
   198  
   199  // Map of resource tags.
   200  func (o LookupApiResultOutput) Tags() pulumi.StringMapOutput {
   201  	return o.ApplyT(func(v LookupApiResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   202  }
   203  
   204  // Version identifier for the API.
   205  func (o LookupApiResultOutput) Version() pulumi.StringOutput {
   206  	return o.ApplyT(func(v LookupApiResult) string { return v.Version }).(pulumi.StringOutput)
   207  }
   208  
   209  func init() {
   210  	pulumi.RegisterOutputType(LookupApiResultOutput{})
   211  }