Class EventStreamUtils
- java.lang.Object
-
- software.amazon.awssdk.codegen.poet.eventstream.EventStreamUtils
-
public class EventStreamUtils extends Object
Utils for event streaming code generation.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
doesShapeContainsEventStream(ShapeModel parentShape, ShapeModel childEventStreamShape)
Returns true if the #childEventStreamShape is a member of the #parentShape.static Collection<OperationModel>
findOperationsWithEventStream(IntermediateModel model, ShapeModel eventStreamShape)
Returns the all operations that contain the given event stream shape.static Optional<ShapeModel>
getBaseEventStreamShape(IntermediateModel model, ShapeModel eventShape)
Returns the event streamShapeModel
that contains the given event.static List<ShapeModel>
getBaseEventStreamShapes(IntermediateModel model, ShapeModel eventShape)
static Stream<MemberModel>
getEventMembers(ShapeModel eventStreamShape)
Returns the stream of event members ('event: true') excluding exceptions from the input event stream shape ('eventstream: true').static Stream<MemberModel>
getEvents(ShapeModel eventStreamShape)
Returns the stream of event members ('event: true') excluding exceptions from the input event stream shape ('eventstream: true').static ShapeModel
getEventStreamInRequest(ShapeModel requestShape)
Get eventstream member from a request shape model.static ShapeModel
getEventStreamInResponse(ShapeModel responseShape)
Get eventstream member from a response shape model.static boolean
isEventStreamParentModel(ShapeModel shapeModel)
static boolean
isRequestEvent(IntermediateModel model, ShapeModel eventShape)
Returns true if the given event shape is a sub-member of any operation request.
-
-
-
Method Detail
-
getEventStreamInRequest
public static ShapeModel getEventStreamInRequest(ShapeModel requestShape)
Get eventstream member from a request shape model. If shape doesn't have any eventstream member, throw an IllegalStateException.- Parameters:
requestShape
- request shape of an operation- Returns:
- eventstream member (shape with "eventstream" trait set to true) in the request shape. If there is no eventstream member, thrown IllegalStateException.
-
getEventStreamInResponse
public static ShapeModel getEventStreamInResponse(ShapeModel responseShape)
Get eventstream member from a response shape model. If shape doesn't have any eventstream member, throw an IllegalStateException.- Parameters:
responseShape
- response shape of an operation- Returns:
- eventstream member (shape with "eventstream" trait set to true) in the response shape. If there is no eventstream member, thrown IllegalStateException.
-
getBaseEventStreamShape
public static Optional<ShapeModel> getBaseEventStreamShape(IntermediateModel model, ShapeModel eventShape)
Returns the event streamShapeModel
that contains the given event.- Parameters:
model
- Intermediate modeleventShape
- shape with "event: true" trait- Returns:
- the event stream shape (eventstream: true) that contains the given event, or an empty optional if the C2J shape is marked as an event but the intermediate model representation is not used by an event stream
-
getBaseEventStreamShapes
public static List<ShapeModel> getBaseEventStreamShapes(IntermediateModel model, ShapeModel eventShape)
-
getEvents
public static Stream<MemberModel> getEvents(ShapeModel eventStreamShape)
Returns the stream of event members ('event: true') excluding exceptions from the input event stream shape ('eventstream: true').
-
getEventMembers
public static Stream<MemberModel> getEventMembers(ShapeModel eventStreamShape)
Returns the stream of event members ('event: true') excluding exceptions from the input event stream shape ('eventstream: true').
-
findOperationsWithEventStream
public static Collection<OperationModel> findOperationsWithEventStream(IntermediateModel model, ShapeModel eventStreamShape)
Returns the all operations that contain the given event stream shape. The event stream can be in operation request or response shape.
-
doesShapeContainsEventStream
public static boolean doesShapeContainsEventStream(ShapeModel parentShape, ShapeModel childEventStreamShape)
Returns true if the #childEventStreamShape is a member of the #parentShape. Otherwise false.
-
isRequestEvent
public static boolean isRequestEvent(IntermediateModel model, ShapeModel eventShape)
Returns true if the given event shape is a sub-member of any operation request.
-
isEventStreamParentModel
public static boolean isEventStreamParentModel(ShapeModel shapeModel)
- Returns:
- true if the provide model is a request/response shape model that contains event stream shape. Otherwise return false.
-
-