github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apigatewayv2/integrationResponse.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  	"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 Amazon API Gateway Version 2 integration response.
    16  // More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).
    17  //
    18  // ## Example Usage
    19  //
    20  // ### Basic
    21  //
    22  // <!--Start PulumiCodeChooser -->
    23  // ```go
    24  // package main
    25  //
    26  // import (
    27  //
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			_, err := apigatewayv2.NewIntegrationResponse(ctx, "example", &apigatewayv2.IntegrationResponseArgs{
    36  //				ApiId:                  pulumi.Any(exampleAwsApigatewayv2Api.Id),
    37  //				IntegrationId:          pulumi.Any(exampleAwsApigatewayv2Integration.Id),
    38  //				IntegrationResponseKey: pulumi.String("/200/"),
    39  //			})
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			return nil
    44  //		})
    45  //	}
    46  //
    47  // ```
    48  // <!--End PulumiCodeChooser -->
    49  //
    50  // ## Import
    51  //
    52  // Using `pulumi import`, import `aws_apigatewayv2_integration_response` using the API identifier, integration identifier and integration response identifier. For example:
    53  //
    54  // ```sh
    55  // $ pulumi import aws:apigatewayv2/integrationResponse:IntegrationResponse example aabbccddee/1122334/998877
    56  // ```
    57  type IntegrationResponse struct {
    58  	pulumi.CustomResourceState
    59  
    60  	// API identifier.
    61  	ApiId pulumi.StringOutput `pulumi:"apiId"`
    62  	// How to handle response payload content type conversions. Valid values: `CONVERT_TO_BINARY`, `CONVERT_TO_TEXT`.
    63  	ContentHandlingStrategy pulumi.StringPtrOutput `pulumi:"contentHandlingStrategy"`
    64  	// Identifier of the `apigatewayv2.Integration`.
    65  	IntegrationId pulumi.StringOutput `pulumi:"integrationId"`
    66  	// Integration response key.
    67  	IntegrationResponseKey pulumi.StringOutput `pulumi:"integrationResponseKey"`
    68  	// Map of Velocity templates that are applied on the request payload based on the value of the Content-Type header sent by the client.
    69  	ResponseTemplates pulumi.StringMapOutput `pulumi:"responseTemplates"`
    70  	// The [template selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-template-selection-expressions) for the integration response.
    71  	TemplateSelectionExpression pulumi.StringPtrOutput `pulumi:"templateSelectionExpression"`
    72  }
    73  
    74  // NewIntegrationResponse registers a new resource with the given unique name, arguments, and options.
    75  func NewIntegrationResponse(ctx *pulumi.Context,
    76  	name string, args *IntegrationResponseArgs, opts ...pulumi.ResourceOption) (*IntegrationResponse, error) {
    77  	if args == nil {
    78  		return nil, errors.New("missing one or more required arguments")
    79  	}
    80  
    81  	if args.ApiId == nil {
    82  		return nil, errors.New("invalid value for required argument 'ApiId'")
    83  	}
    84  	if args.IntegrationId == nil {
    85  		return nil, errors.New("invalid value for required argument 'IntegrationId'")
    86  	}
    87  	if args.IntegrationResponseKey == nil {
    88  		return nil, errors.New("invalid value for required argument 'IntegrationResponseKey'")
    89  	}
    90  	opts = internal.PkgResourceDefaultOpts(opts)
    91  	var resource IntegrationResponse
    92  	err := ctx.RegisterResource("aws:apigatewayv2/integrationResponse:IntegrationResponse", name, args, &resource, opts...)
    93  	if err != nil {
    94  		return nil, err
    95  	}
    96  	return &resource, nil
    97  }
    98  
    99  // GetIntegrationResponse gets an existing IntegrationResponse resource's state with the given name, ID, and optional
   100  // state properties that are used to uniquely qualify the lookup (nil if not required).
   101  func GetIntegrationResponse(ctx *pulumi.Context,
   102  	name string, id pulumi.IDInput, state *IntegrationResponseState, opts ...pulumi.ResourceOption) (*IntegrationResponse, error) {
   103  	var resource IntegrationResponse
   104  	err := ctx.ReadResource("aws:apigatewayv2/integrationResponse:IntegrationResponse", name, id, state, &resource, opts...)
   105  	if err != nil {
   106  		return nil, err
   107  	}
   108  	return &resource, nil
   109  }
   110  
   111  // Input properties used for looking up and filtering IntegrationResponse resources.
   112  type integrationResponseState struct {
   113  	// API identifier.
   114  	ApiId *string `pulumi:"apiId"`
   115  	// How to handle response payload content type conversions. Valid values: `CONVERT_TO_BINARY`, `CONVERT_TO_TEXT`.
   116  	ContentHandlingStrategy *string `pulumi:"contentHandlingStrategy"`
   117  	// Identifier of the `apigatewayv2.Integration`.
   118  	IntegrationId *string `pulumi:"integrationId"`
   119  	// Integration response key.
   120  	IntegrationResponseKey *string `pulumi:"integrationResponseKey"`
   121  	// Map of Velocity templates that are applied on the request payload based on the value of the Content-Type header sent by the client.
   122  	ResponseTemplates map[string]string `pulumi:"responseTemplates"`
   123  	// The [template selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-template-selection-expressions) for the integration response.
   124  	TemplateSelectionExpression *string `pulumi:"templateSelectionExpression"`
   125  }
   126  
   127  type IntegrationResponseState struct {
   128  	// API identifier.
   129  	ApiId pulumi.StringPtrInput
   130  	// How to handle response payload content type conversions. Valid values: `CONVERT_TO_BINARY`, `CONVERT_TO_TEXT`.
   131  	ContentHandlingStrategy pulumi.StringPtrInput
   132  	// Identifier of the `apigatewayv2.Integration`.
   133  	IntegrationId pulumi.StringPtrInput
   134  	// Integration response key.
   135  	IntegrationResponseKey pulumi.StringPtrInput
   136  	// Map of Velocity templates that are applied on the request payload based on the value of the Content-Type header sent by the client.
   137  	ResponseTemplates pulumi.StringMapInput
   138  	// The [template selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-template-selection-expressions) for the integration response.
   139  	TemplateSelectionExpression pulumi.StringPtrInput
   140  }
   141  
   142  func (IntegrationResponseState) ElementType() reflect.Type {
   143  	return reflect.TypeOf((*integrationResponseState)(nil)).Elem()
   144  }
   145  
   146  type integrationResponseArgs struct {
   147  	// API identifier.
   148  	ApiId string `pulumi:"apiId"`
   149  	// How to handle response payload content type conversions. Valid values: `CONVERT_TO_BINARY`, `CONVERT_TO_TEXT`.
   150  	ContentHandlingStrategy *string `pulumi:"contentHandlingStrategy"`
   151  	// Identifier of the `apigatewayv2.Integration`.
   152  	IntegrationId string `pulumi:"integrationId"`
   153  	// Integration response key.
   154  	IntegrationResponseKey string `pulumi:"integrationResponseKey"`
   155  	// Map of Velocity templates that are applied on the request payload based on the value of the Content-Type header sent by the client.
   156  	ResponseTemplates map[string]string `pulumi:"responseTemplates"`
   157  	// The [template selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-template-selection-expressions) for the integration response.
   158  	TemplateSelectionExpression *string `pulumi:"templateSelectionExpression"`
   159  }
   160  
   161  // The set of arguments for constructing a IntegrationResponse resource.
   162  type IntegrationResponseArgs struct {
   163  	// API identifier.
   164  	ApiId pulumi.StringInput
   165  	// How to handle response payload content type conversions. Valid values: `CONVERT_TO_BINARY`, `CONVERT_TO_TEXT`.
   166  	ContentHandlingStrategy pulumi.StringPtrInput
   167  	// Identifier of the `apigatewayv2.Integration`.
   168  	IntegrationId pulumi.StringInput
   169  	// Integration response key.
   170  	IntegrationResponseKey pulumi.StringInput
   171  	// Map of Velocity templates that are applied on the request payload based on the value of the Content-Type header sent by the client.
   172  	ResponseTemplates pulumi.StringMapInput
   173  	// The [template selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-template-selection-expressions) for the integration response.
   174  	TemplateSelectionExpression pulumi.StringPtrInput
   175  }
   176  
   177  func (IntegrationResponseArgs) ElementType() reflect.Type {
   178  	return reflect.TypeOf((*integrationResponseArgs)(nil)).Elem()
   179  }
   180  
   181  type IntegrationResponseInput interface {
   182  	pulumi.Input
   183  
   184  	ToIntegrationResponseOutput() IntegrationResponseOutput
   185  	ToIntegrationResponseOutputWithContext(ctx context.Context) IntegrationResponseOutput
   186  }
   187  
   188  func (*IntegrationResponse) ElementType() reflect.Type {
   189  	return reflect.TypeOf((**IntegrationResponse)(nil)).Elem()
   190  }
   191  
   192  func (i *IntegrationResponse) ToIntegrationResponseOutput() IntegrationResponseOutput {
   193  	return i.ToIntegrationResponseOutputWithContext(context.Background())
   194  }
   195  
   196  func (i *IntegrationResponse) ToIntegrationResponseOutputWithContext(ctx context.Context) IntegrationResponseOutput {
   197  	return pulumi.ToOutputWithContext(ctx, i).(IntegrationResponseOutput)
   198  }
   199  
   200  // IntegrationResponseArrayInput is an input type that accepts IntegrationResponseArray and IntegrationResponseArrayOutput values.
   201  // You can construct a concrete instance of `IntegrationResponseArrayInput` via:
   202  //
   203  //	IntegrationResponseArray{ IntegrationResponseArgs{...} }
   204  type IntegrationResponseArrayInput interface {
   205  	pulumi.Input
   206  
   207  	ToIntegrationResponseArrayOutput() IntegrationResponseArrayOutput
   208  	ToIntegrationResponseArrayOutputWithContext(context.Context) IntegrationResponseArrayOutput
   209  }
   210  
   211  type IntegrationResponseArray []IntegrationResponseInput
   212  
   213  func (IntegrationResponseArray) ElementType() reflect.Type {
   214  	return reflect.TypeOf((*[]*IntegrationResponse)(nil)).Elem()
   215  }
   216  
   217  func (i IntegrationResponseArray) ToIntegrationResponseArrayOutput() IntegrationResponseArrayOutput {
   218  	return i.ToIntegrationResponseArrayOutputWithContext(context.Background())
   219  }
   220  
   221  func (i IntegrationResponseArray) ToIntegrationResponseArrayOutputWithContext(ctx context.Context) IntegrationResponseArrayOutput {
   222  	return pulumi.ToOutputWithContext(ctx, i).(IntegrationResponseArrayOutput)
   223  }
   224  
   225  // IntegrationResponseMapInput is an input type that accepts IntegrationResponseMap and IntegrationResponseMapOutput values.
   226  // You can construct a concrete instance of `IntegrationResponseMapInput` via:
   227  //
   228  //	IntegrationResponseMap{ "key": IntegrationResponseArgs{...} }
   229  type IntegrationResponseMapInput interface {
   230  	pulumi.Input
   231  
   232  	ToIntegrationResponseMapOutput() IntegrationResponseMapOutput
   233  	ToIntegrationResponseMapOutputWithContext(context.Context) IntegrationResponseMapOutput
   234  }
   235  
   236  type IntegrationResponseMap map[string]IntegrationResponseInput
   237  
   238  func (IntegrationResponseMap) ElementType() reflect.Type {
   239  	return reflect.TypeOf((*map[string]*IntegrationResponse)(nil)).Elem()
   240  }
   241  
   242  func (i IntegrationResponseMap) ToIntegrationResponseMapOutput() IntegrationResponseMapOutput {
   243  	return i.ToIntegrationResponseMapOutputWithContext(context.Background())
   244  }
   245  
   246  func (i IntegrationResponseMap) ToIntegrationResponseMapOutputWithContext(ctx context.Context) IntegrationResponseMapOutput {
   247  	return pulumi.ToOutputWithContext(ctx, i).(IntegrationResponseMapOutput)
   248  }
   249  
   250  type IntegrationResponseOutput struct{ *pulumi.OutputState }
   251  
   252  func (IntegrationResponseOutput) ElementType() reflect.Type {
   253  	return reflect.TypeOf((**IntegrationResponse)(nil)).Elem()
   254  }
   255  
   256  func (o IntegrationResponseOutput) ToIntegrationResponseOutput() IntegrationResponseOutput {
   257  	return o
   258  }
   259  
   260  func (o IntegrationResponseOutput) ToIntegrationResponseOutputWithContext(ctx context.Context) IntegrationResponseOutput {
   261  	return o
   262  }
   263  
   264  // API identifier.
   265  func (o IntegrationResponseOutput) ApiId() pulumi.StringOutput {
   266  	return o.ApplyT(func(v *IntegrationResponse) pulumi.StringOutput { return v.ApiId }).(pulumi.StringOutput)
   267  }
   268  
   269  // How to handle response payload content type conversions. Valid values: `CONVERT_TO_BINARY`, `CONVERT_TO_TEXT`.
   270  func (o IntegrationResponseOutput) ContentHandlingStrategy() pulumi.StringPtrOutput {
   271  	return o.ApplyT(func(v *IntegrationResponse) pulumi.StringPtrOutput { return v.ContentHandlingStrategy }).(pulumi.StringPtrOutput)
   272  }
   273  
   274  // Identifier of the `apigatewayv2.Integration`.
   275  func (o IntegrationResponseOutput) IntegrationId() pulumi.StringOutput {
   276  	return o.ApplyT(func(v *IntegrationResponse) pulumi.StringOutput { return v.IntegrationId }).(pulumi.StringOutput)
   277  }
   278  
   279  // Integration response key.
   280  func (o IntegrationResponseOutput) IntegrationResponseKey() pulumi.StringOutput {
   281  	return o.ApplyT(func(v *IntegrationResponse) pulumi.StringOutput { return v.IntegrationResponseKey }).(pulumi.StringOutput)
   282  }
   283  
   284  // Map of Velocity templates that are applied on the request payload based on the value of the Content-Type header sent by the client.
   285  func (o IntegrationResponseOutput) ResponseTemplates() pulumi.StringMapOutput {
   286  	return o.ApplyT(func(v *IntegrationResponse) pulumi.StringMapOutput { return v.ResponseTemplates }).(pulumi.StringMapOutput)
   287  }
   288  
   289  // The [template selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-template-selection-expressions) for the integration response.
   290  func (o IntegrationResponseOutput) TemplateSelectionExpression() pulumi.StringPtrOutput {
   291  	return o.ApplyT(func(v *IntegrationResponse) pulumi.StringPtrOutput { return v.TemplateSelectionExpression }).(pulumi.StringPtrOutput)
   292  }
   293  
   294  type IntegrationResponseArrayOutput struct{ *pulumi.OutputState }
   295  
   296  func (IntegrationResponseArrayOutput) ElementType() reflect.Type {
   297  	return reflect.TypeOf((*[]*IntegrationResponse)(nil)).Elem()
   298  }
   299  
   300  func (o IntegrationResponseArrayOutput) ToIntegrationResponseArrayOutput() IntegrationResponseArrayOutput {
   301  	return o
   302  }
   303  
   304  func (o IntegrationResponseArrayOutput) ToIntegrationResponseArrayOutputWithContext(ctx context.Context) IntegrationResponseArrayOutput {
   305  	return o
   306  }
   307  
   308  func (o IntegrationResponseArrayOutput) Index(i pulumi.IntInput) IntegrationResponseOutput {
   309  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *IntegrationResponse {
   310  		return vs[0].([]*IntegrationResponse)[vs[1].(int)]
   311  	}).(IntegrationResponseOutput)
   312  }
   313  
   314  type IntegrationResponseMapOutput struct{ *pulumi.OutputState }
   315  
   316  func (IntegrationResponseMapOutput) ElementType() reflect.Type {
   317  	return reflect.TypeOf((*map[string]*IntegrationResponse)(nil)).Elem()
   318  }
   319  
   320  func (o IntegrationResponseMapOutput) ToIntegrationResponseMapOutput() IntegrationResponseMapOutput {
   321  	return o
   322  }
   323  
   324  func (o IntegrationResponseMapOutput) ToIntegrationResponseMapOutputWithContext(ctx context.Context) IntegrationResponseMapOutput {
   325  	return o
   326  }
   327  
   328  func (o IntegrationResponseMapOutput) MapIndex(k pulumi.StringInput) IntegrationResponseOutput {
   329  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *IntegrationResponse {
   330  		return vs[0].(map[string]*IntegrationResponse)[vs[1].(string)]
   331  	}).(IntegrationResponseOutput)
   332  }
   333  
   334  func init() {
   335  	pulumi.RegisterInputType(reflect.TypeOf((*IntegrationResponseInput)(nil)).Elem(), &IntegrationResponse{})
   336  	pulumi.RegisterInputType(reflect.TypeOf((*IntegrationResponseArrayInput)(nil)).Elem(), IntegrationResponseArray{})
   337  	pulumi.RegisterInputType(reflect.TypeOf((*IntegrationResponseMapInput)(nil)).Elem(), IntegrationResponseMap{})
   338  	pulumi.RegisterOutputType(IntegrationResponseOutput{})
   339  	pulumi.RegisterOutputType(IntegrationResponseArrayOutput{})
   340  	pulumi.RegisterOutputType(IntegrationResponseMapOutput{})
   341  }