Class IdempotentTrait

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

public final class IdempotentTrait extends AbstractTrait implements ToSmithyBuilder<IdempotentTrait>
Indicates that an operation is idempotent.

Optionally describes the errors returned when encountering unexpected resource states (already exists for creates, not found for deletes).

  • Field Details

    • ID

      public static final ShapeId ID
  • Constructor Details

    • IdempotentTrait

      public IdempotentTrait(ObjectNode object)
    • IdempotentTrait

      public IdempotentTrait()
  • Method Details

    • getExists

      public Optional<List<ShapeId>> getExists()
      Gets the errors returned when the resource already exists.

      When present, an empty list indicates the operation returns a successful response. When absent, the behavior is unspecified.

      Returns:
      The exists errors list, if present.
    • getExistsOrNull

      public List<ShapeId> getExistsOrNull()
      Gets the errors returned when the resource already exists, or null if not defined.
      Returns:
      The exists errors list, or null if not defined.
    • getNotFound

      public Optional<List<ShapeId>> getNotFound()
      Gets the errors returned when the resource does not exist.

      When present, an empty list indicates the operation returns a successful response. When absent, the behavior is unspecified.

      Returns:
      The notFound errors list, if present.
    • getNotFoundOrNull

      public List<ShapeId> getNotFoundOrNull()
      Gets the errors returned when the resource does not exist, or null if not defined.
      Returns:
      The notFound errors list, or null if not defined.
    • 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.
    • toBuilder

      public IdempotentTrait.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<IdempotentTrait>
      Returns:
      a builder for type T
    • fromNode

      public static IdempotentTrait fromNode(Node node)
      Creates a IdempotentTrait from a Node.
      Parameters:
      node - Node to create the IdempotentTrait from.
      Returns:
      Returns the created IdempotentTrait.
      Throws:
      ExpectationNotMetException - if the given Node is invalid.
    • builder

      public static IdempotentTrait.Builder builder()