Class OperationIndex
- All Implemented Interfaces:
KnowledgeIndex
This index performs no validation that the input, output, and errors actually reference valid structures. Such operation inputs, outputs, and errors may be discarded as if they do not exist.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionexpectInputShape
(ToShapeId operation) Gets the input shape of an operation, and returns Smithy's Unit type trait if the operation has no meaningful input.expectOutputShape
(ToShapeId operation) Gets the output shape of an operation, and returns Smithy's unit type trait if the operation has no meaningful output.getErrorBindings
(ToShapeId error) Gets all the operations and services that bind the given shape as an error.Gets the list of error structures defined on an operation.Gets the list of error structures defined on an operation, including any common errors inherited from a service shape.Gets the optional input structure of an operation, and returns an empty optional if the input targetssmithy.api#Unit
.getInputBindings
(ToShapeId input) Gets all the operations that bind the given shape as input.getInputMembers
(ToShapeId operation) Gets the input members of an operation as a map of member names toMemberShape
.getInputShape
(ToShapeId operation) Gets the optional input structure of an operation.Gets the optional output structure of an operation, and returns an empty optional if the output targetssmithy.api#Unit
.getOutputBindings
(ToShapeId output) Gets all the operations that bind the given shape as output.getOutputMembers
(ToShapeId operation) Gets the output members of an operation as a map of member names toMemberShape
.getOutputShape
(ToShapeId operation) Gets the optional output structure of an operation.boolean
isInputStructure
(ToShapeId structureId) Returns true if the given structure is used as input by any operation in the model or is marked with the input trait.boolean
isOutputStructure
(ToShapeId structureId) Returns true if the given structure is used as output by any operation in the model or is marked with the output trait.static OperationIndex
-
Constructor Details
-
OperationIndex
-
-
Method Details
-
of
-
getInput
Gets the optional input structure of an operation, and returns an empty optional if the input targetssmithy.api#Unit
.- Parameters:
operation
- Operation to get the input structure of.- Returns:
- Returns the optional operation input structure.
-
getInputShape
Gets the optional input structure of an operation.Operations in the model always have input. This operation will only return an empty optional if the given operation shape cannot be found in the model or if it is not an operation shape.
- Parameters:
operation
- Operation to get the input structure of.- Returns:
- Returns the optional operation input structure.
-
expectInputShape
Gets the input shape of an operation, and returns Smithy's Unit type trait if the operation has no meaningful input.In general, this method should be used instead of
getInputShape(ToShapeId)
when getting the input of operations that are known to exist.- Parameters:
operation
- Operation to get the input of.- Returns:
- Returns the input shape of the operation.
- Throws:
ExpectationNotMetException
- if the operation shape cannot be found.
-
getInputMembers
Gets the input members of an operation as a map of member names toMemberShape
.The return map is ordered using the same order defined in the model. If the operation has no input, an empty map is returned.
- Parameters:
operation
- Operation to get the input members of.- Returns:
- Returns the map of members, or an empty map.
-
isInputStructure
Returns true if the given structure is used as input by any operation in the model or is marked with the input trait.- Parameters:
structureId
- Structure to check.- Returns:
- Returns true if the structure is used as input.
-
getInputBindings
Gets all the operations that bind the given shape as input.- Parameters:
input
- The structure that may be used as input.- Returns:
- Returns a set of operations that bind the given input shape.
-
getOutput
Gets the optional output structure of an operation, and returns an empty optional if the output targetssmithy.api#Unit
.- Parameters:
operation
- Operation to get the output structure of.- Returns:
- Returns the optional operation output structure.
-
getOutputShape
Gets the optional output structure of an operation.Operations in the model always have output. This operation will only return an empty optional if the given operation shape cannot be found in the model or if it is not an operation shape.
- Parameters:
operation
- Operation to get the output structure of.- Returns:
- Returns the optional operation output structure.
-
expectOutputShape
Gets the output shape of an operation, and returns Smithy's unit type trait if the operation has no meaningful output.In general, this method should be used instead of
getOutputShape(ToShapeId)
when getting the output of operations that are known to exist.- Parameters:
operation
- Operation to get the output of.- Returns:
- Returns the output shape of the operation.
- Throws:
ExpectationNotMetException
- if the operation shape cannot be found.
-
getOutputMembers
Gets the output members of an operation as a map of member names toMemberShape
.The return map is ordered using the same order defined in the model. If the operation has no output, an empty map is returned.
- Parameters:
operation
- Operation to get the output members of.- Returns:
- Returns the map of members, or an empty map.
-
isOutputStructure
Returns true if the given structure is used as output by any operation in the model or is marked with the output trait.- Parameters:
structureId
- Structure to check.- Returns:
- Returns true if the structure is used as output.
-
getOutputBindings
Gets all the operations that bind the given shape as output.- Parameters:
output
- The structure that may be used as output.- Returns:
- Returns a set of operations that bind the given output shape.
-
getErrors
Gets the list of error structures defined on an operation.An empty list is returned if the operation is not found or has no errors.
- Parameters:
operation
- Operation to get the errors of.- Returns:
- Returns the list of error structures, or an empty list.
- See Also:
-
getErrors
Gets the list of error structures defined on an operation, including any common errors inherited from a service shape.An empty list is returned if the operation is not found or has no errors.
- Parameters:
service
- Service shape to inherit common errors from.operation
- Operation to get the errors of.- Returns:
- Returns the list of error structures, or an empty list.
-
getErrorBindings
Gets all the operations and services that bind the given shape as an error.- Parameters:
error
- The structure that may be used as an error.- Returns:
- Returns a set of operations and services that bind the given error shape.
-