Class GatewayResponse.Builder

java.lang.Object
software.amazon.smithy.aws.apigateway.traits.GatewayResponse.Builder
All Implemented Interfaces:
SmithyBuilder<GatewayResponse>
Enclosing class:
GatewayResponse

public static final class GatewayResponse.Builder extends Object implements SmithyBuilder<GatewayResponse>
Builder used to create a GatewayResponse.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • build

      public GatewayResponse build()
      Description copied from interface: SmithyBuilder
      Creates an immutable object that is created from the properties that have been set on the builder.
      Specified by:
      build in interface SmithyBuilder<GatewayResponse>
      Returns:
      an instance of T
    • statusCode

      public GatewayResponse.Builder statusCode(String statusCode)
      Sets the HTTP status code for the gateway response.
      Parameters:
      statusCode - Status code to set.
      Returns:
      Returns the builder.
    • putResponseParameter

      public GatewayResponse.Builder putResponseParameter(String key, String value)
      Adds a response parameter.
      Parameters:
      key - Parameter key (e.g., gatewayresponse.header.Access-Control-Allow-Origin).
      value - Parameter value.
      Returns:
      Returns the builder.
    • putResponseTemplate

      public GatewayResponse.Builder putResponseTemplate(String mediaType, String template)
      Adds a response template.
      Parameters:
      mediaType - Media type key (e.g., application/json).
      template - Template value.
      Returns:
      Returns the builder.
    • responseParameters

      public GatewayResponse.Builder responseParameters(Map<String,String> responseParameters)
      Replaces all response parameters with the given map.
      Parameters:
      responseParameters - Map of response parameters.
      Returns:
      Returns the builder.
    • responseTemplates

      public GatewayResponse.Builder responseTemplates(Map<String,String> responseTemplates)
      Replaces all response templates with the given map.
      Parameters:
      responseTemplates - Map of response templates.
      Returns:
      Returns the builder.