Class ResourceLifecycleIndex

java.lang.Object
software.amazon.smithy.model.knowledge.ResourceLifecycleIndex
All Implemented Interfaces:
KnowledgeIndex

public final class ResourceLifecycleIndex extends Object implements KnowledgeIndex
Index that provides efficient lookups for resource lifecycle relationships declared via @createsResources, @deletesResources, @putsResources, @readsResources, and @updatesResources.

This index enables two primary query patterns:

  • Given an operation, what resources does it affect (by lifecycle type)?
  • Given a resource, what operations affect it (by lifecycle type)?

This index only covers relationships declared via the lifecycle traits. It does not include the standard 1:1Lifecycle bindings on resource shapes (create, put, read, update, delete). Use BottomUpIndex or ResourceShape directly for those.

  • Method Details

    • of

      public static ResourceLifecycleIndex of(Model model)
    • getResources

      public Set<ShapeId> getResources(ToShapeId operation, ResourceLifecycleIndex.Lifecycle lifecycle)
      Gets the resources affected by an operation for a specific lifecycle type.
      Parameters:
      operation - The operation to query.
      lifecycle - The lifecycle type to filter by.
      Returns:
      The set of resource shape IDs, or empty if none.
    • getResources

      public Map<ResourceLifecycleIndex.Lifecycle,Set<ShapeId>> getResources(ToShapeId operation)
      Gets all resources affected by an operation across all lifecycle types.
      Parameters:
      operation - The operation to query.
      Returns:
      A map of lifecycle type to the set of affected resource shape IDs.
    • getOperations

      public Set<ShapeId> getOperations(ToShapeId resource, ResourceLifecycleIndex.Lifecycle lifecycle)
      Gets the operations that affect a resource for a specific lifecycle type.
      Parameters:
      resource - The resource to query.
      lifecycle - The lifecycle type to filter by.
      Returns:
      The set of operation shape IDs, or empty if none.
    • getOperations

      public Map<ResourceLifecycleIndex.Lifecycle,Set<ShapeId>> getOperations(ToShapeId resource)
      Gets all operations that affect a resource across all lifecycle types.
      Parameters:
      resource - The resource to query.
      Returns:
      A map of lifecycle type to the set of operation shape IDs.