Class GatewayResponsesTrait

java.lang.Object
software.amazon.smithy.model.traits.AbstractTrait
software.amazon.smithy.aws.apigateway.traits.GatewayResponsesTrait
All Implemented Interfaces:
FromSourceLocation, ToNode, ToShapeId, Trait, ToSmithyBuilder<GatewayResponsesTrait>

public final class GatewayResponsesTrait extends AbstractTrait implements ToSmithyBuilder<GatewayResponsesTrait>
Defines custom gateway responses for an API Gateway REST API. Gateway responses customize error responses for authentication failures, integration errors, and other API Gateway-generated errors.
See Also:
  • Field Details

    • ID

      public static final ShapeId ID
  • Method Details

    • builder

      public static GatewayResponsesTrait.Builder builder()
      Creates a builder for the trait.
      Returns:
      Returns the created builder.
    • getResponses

      public Map<String,GatewayResponse> getResponses()
      Gets all gateway responses.
      Returns:
      Returns the immutable map of response type keys to definitions.
    • getResponse

      public Optional<GatewayResponse> getResponse(String type)
      Gets a specific gateway response by type key.
      Parameters:
      type - Response type key (e.g., DEFAULT_4XX).
      Returns:
      Returns the optionally found gateway response.
    • getValue

      public ObjectNode getValue()
      Gets the gateway responses as an ObjectNode.
      Returns:
      Returns the gateway responses map as a Node.
    • toBuilder

      public GatewayResponsesTrait.Builder toBuilder()
      Description copied from interface: ToSmithyBuilder
      Take this object and create a builder that contains all of the current property values of this object.
      Specified by:
      toBuilder in interface ToSmithyBuilder<GatewayResponsesTrait>
      Returns:
      a builder for type T
    • createNode

      protected Node createNode()
      Description copied from class: AbstractTrait
      The result of toNode is used for hashCodes and equality. Subclasses must implement createNode to turn the trait into a Node. This is then cached for subsequent retrievals.
      Specified by:
      createNode in class AbstractTrait
      Returns:
      Returns the trait as a node.