Class ModelAuthSchemeKnowledgeIndex

java.lang.Object
software.amazon.awssdk.codegen.poet.auth.scheme.ModelAuthSchemeKnowledgeIndex

public final class ModelAuthSchemeKnowledgeIndex extends Object
Knowledge index to get access to the configured service auth schemes and operations overrides. This index is optimized for code generation of switch statements therefore the data is grouped by operations that share the same auth schemes. This index is a building block for AuthSchemeCodegenKnowledgeIndex and SigV4AuthSchemeCodegenKnowledgeIndex indexes that have a friendly interface for the codegen use cases.
  • Method Details

    • of

      public static ModelAuthSchemeKnowledgeIndex of(IntermediateModel intermediateModel)
      Creates a new knowledge index using the given model.
    • operationsToMetadata

      public Map<List<String>,List<AuthSchemeCodegenMetadata>> operationsToMetadata()
      Returns a map from a list of operations to the list of auth-types modeled for those operations. The AuthTrait values are taken directly from the OperationModel.

      This method groups operations by their authentication requirements and chunked encoding needs:

      • Operations with identical auth traits are grouped together
      • Operations requiring chunked encoding (streaming operations with HTTP checksum traits - either requestAlgorithmMember or isRequestChecksumRequired) are separated from regular operations and marked with CHUNK_ENCODING_ENABLED property. This ensures they get distinct auth scheme metadata even if they share the same base auth traits.
      • Operations using service defaults are keyed with an empty list

      Processing flow:

      1. Identify all operations requiring chunked encoding
        Example: PutObject (streaming + checksum) → chunked encoding needed
      2. Get operations with custom auth traits (validation applied during this step: WriteGetObjectResponse is filtered out for services with custom auth scheme overrides, other operations with custom auth in those services throw exception)
        Example: Operations with bearer auth → grouped by auth trait
      3. Process each operation group:
        • Split into regular and chunked encoding operations
          Example: [GetObject, PutObject] with SigV4 → [GetObject] regular, [PutObject] chunked
        • Add regular operations with their auth metadata
          Example: [GetObject] → SigV4 metadata
        • Add chunked operations with CHUNK_ENCODING_ENABLED property
          Example: [PutObject] → SigV4 metadata + CHUNK_ENCODING_ENABLED
      4. Process remaining chunked encoding operations that use service defaults
        Example: [UploadPart] (chunked, no custom auth) → service defaults + CHUNK_ENCODING_ENABLED
      5. Add service-wide defaults with empty list key
        Example: [] → SigV4 metadata (fallback for all other operations)
      Returns:
      Map where keys are lists of operation names and values are their auth scheme metadata. Empty list key represents service-wide defaults.