Class IntegrationResponse


  • public class IntegrationResponse
    extends com.pulumi.resources.CustomResource
    Provides an HTTP Method Integration Response for an API Gateway Resource. > **Note:** Depends on having `aws.apigateway.Integration` inside your REST API. To ensure this you might need to add an explicit `dependsOn` for clean runs. ## Example Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.apigateway.RestApi;
     import com.pulumi.aws.apigateway.RestApiArgs;
     import com.pulumi.aws.apigateway.Resource;
     import com.pulumi.aws.apigateway.ResourceArgs;
     import com.pulumi.aws.apigateway.Method;
     import com.pulumi.aws.apigateway.MethodArgs;
     import com.pulumi.aws.apigateway.Integration;
     import com.pulumi.aws.apigateway.IntegrationArgs;
     import com.pulumi.aws.apigateway.MethodResponse;
     import com.pulumi.aws.apigateway.MethodResponseArgs;
     import com.pulumi.aws.apigateway.IntegrationResponse;
     import com.pulumi.aws.apigateway.IntegrationResponseArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var myDemoAPI = new RestApi("myDemoAPI", RestApiArgs.builder()
                 .name("MyDemoAPI")
                 .description("This is my API for demonstration purposes")
                 .build());
     
             var myDemoResource = new Resource("myDemoResource", ResourceArgs.builder()
                 .restApi(myDemoAPI.id())
                 .parentId(myDemoAPI.rootResourceId())
                 .pathPart("mydemoresource")
                 .build());
     
             var myDemoMethod = new Method("myDemoMethod", MethodArgs.builder()
                 .restApi(myDemoAPI.id())
                 .resourceId(myDemoResource.id())
                 .httpMethod("GET")
                 .authorization("NONE")
                 .build());
     
             var myDemoIntegration = new Integration("myDemoIntegration", IntegrationArgs.builder()
                 .restApi(myDemoAPI.id())
                 .resourceId(myDemoResource.id())
                 .httpMethod(myDemoMethod.httpMethod())
                 .type("MOCK")
                 .build());
     
             var response200 = new MethodResponse("response200", MethodResponseArgs.builder()
                 .restApi(myDemoAPI.id())
                 .resourceId(myDemoResource.id())
                 .httpMethod(myDemoMethod.httpMethod())
                 .statusCode("200")
                 .build());
     
             var myDemoIntegrationResponse = new IntegrationResponse("myDemoIntegrationResponse", IntegrationResponseArgs.builder()
                 .restApi(myDemoAPI.id())
                 .resourceId(myDemoResource.id())
                 .httpMethod(myDemoMethod.httpMethod())
                 .statusCode(response200.statusCode())
                 .responseTemplates(Map.of("application/xml", """
     #set($inputRoot = $input.path('$'))
     <?xml version=\"1.0\" encoding=\"UTF-8\"?>
     <message>
         $inputRoot.body
     </message>
                 """))
                 .build());
     
         }
     }
     
     
    ## Import ### Identity Schema #### Required * `restApiId` (String) ID of the associated REST API. * `resourceId` (String) API resource ID. * `httpMethod` (String) HTTP Method. * `statusCode` (String) HTTP status code. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import `aws.apigateway.IntegrationResponse` using `REST-API-ID/RESOURCE-ID/HTTP-METHOD/STATUS-CODE`. For example: ```sh $ pulumi import aws:apigateway/integrationResponse:IntegrationResponse example 12345abcde/67890fghij/GET/200 ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> contentHandling()  
      static IntegrationResponse get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, IntegrationResponseState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> httpMethod()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.lang.String> resourceId()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> responseParameters()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> responseTemplates()  
      com.pulumi.core.Output<java.lang.String> restApi()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> selectionPattern()  
      com.pulumi.core.Output<java.lang.String> statusCode()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IntegrationResponse

        public IntegrationResponse​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • IntegrationResponse

        public IntegrationResponse​(java.lang.String name,
                                   IntegrationResponseArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • IntegrationResponse

        public IntegrationResponse​(java.lang.String name,
                                   IntegrationResponseArgs args,
                                   @Nullable
                                   com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • contentHandling

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> contentHandling()
        Returns:
        How to handle request payload content type conversions. Supported values are `CONVERT_TO_BINARY` and `CONVERT_TO_TEXT`. If this property is not defined, the response payload will be passed through from the integration response to the method response without modification.
      • httpMethod

        public com.pulumi.core.Output<java.lang.String> httpMethod()
        Returns:
        HTTP method (`GET`, `POST`, `PUT`, `DELETE`, `HEAD`, `OPTIONS`, `ANY`).
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • resourceId

        public com.pulumi.core.Output<java.lang.String> resourceId()
        Returns:
        API resource ID.
      • responseParameters

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> responseParameters()
        Returns:
        Map of response parameters that can be read from the backend response. For example: `responseParameters = { "method.response.header.X-Some-Header" = "integration.response.header.X-Some-Other-Header" }`.
      • responseTemplates

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> responseTemplates()
        Returns:
        Map of templates used to transform the integration response body.
      • restApi

        public com.pulumi.core.Output<java.lang.String> restApi()
        Returns:
        ID of the associated REST API.
      • selectionPattern

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> selectionPattern()
        Returns:
        Regular expression pattern used to choose an integration response based on the response from the backend. Omit configuring this to make the integration the default one. If the backend is an `AWS` Lambda function, the AWS Lambda function error header is matched. For all other `HTTP` and `AWS` backends, the HTTP status code is matched.
      • statusCode

        public com.pulumi.core.Output<java.lang.String> statusCode()
        Returns:
        HTTP status code. The following arguments are optional:
      • get

        public static IntegrationResponse get​(java.lang.String name,
                                              com.pulumi.core.Output<java.lang.String> id,
                                              @Nullable
                                              IntegrationResponseState state,
                                              @Nullable
                                              com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.