Class RpcV2JsonProtocolConverter
- All Implemented Interfaces:
OpenApiProtocol<Rpcv2JsonTrait>
smithy.protocols#rpcv2Json protocol to OpenAPI.
Each operation is mapped to a POST request with a path of
/service/{serviceName}/operation/{operationName}, where
serviceName is the service shape name (without namespace).
-
Nested Class Summary
Nested classes/interfaces inherited from interface software.amazon.smithy.openapi.fromsmithy.OpenApiProtocol
OpenApiProtocol.Operation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateOperation(Context<Rpcv2JsonTrait> context, OperationShape operation) Each operation will have a separate path in the format /service/{serviceName}/operation/{operationName}getOperationMethod(Context<Rpcv2JsonTrait> context, OperationShape operation) Gets the HTTP method of an operation.getOperationResponseStatusCode(Context<Rpcv2JsonTrait> context, ToShapeId operationOrError) Gets the response status code of an operation or error shape.getOperationUri(Context<Rpcv2JsonTrait> context, OperationShape operation) Gets the URI of an operation.getProtocolRequestHeaders(Context<Rpcv2JsonTrait> context, OperationShape operationShape) Gets the unmodeled protocol-specific HTTP headers of a request that are considered significant for the provided operation.getProtocolResponseHeaders(Context<Rpcv2JsonTrait> context, OperationShape operationShape) Gets the unmodeled protocol-specific HTTP headers of a response that are considered significant for the provided operation.Gets the protocol type that this converter handles.voidupdateDefaultSettings(Model model, OpenApiConfig config) Sets protocol-specific default values on the OpenAPI configuration object.
-
Constructor Details
-
RpcV2JsonProtocolConverter
public RpcV2JsonProtocolConverter()
-
-
Method Details
-
getProtocolType
Description copied from interface:OpenApiProtocolGets the protocol type that this converter handles.- Specified by:
getProtocolTypein interfaceOpenApiProtocol<Rpcv2JsonTrait>- Returns:
- Returns the shape ID.
-
updateDefaultSettings
Description copied from interface:OpenApiProtocolSets protocol-specific default values on the OpenAPI configuration object.- Specified by:
updateDefaultSettingsin interfaceOpenApiProtocol<Rpcv2JsonTrait>- Parameters:
model- Model being converted.config- Configuration object to modify.
-
createOperation
public Optional<OpenApiProtocol.Operation> createOperation(Context<Rpcv2JsonTrait> context, OperationShape operation) Each operation will have a separate path in the format /service/{serviceName}/operation/{operationName}- Specified by:
createOperationin interfaceOpenApiProtocol<Rpcv2JsonTrait>- Parameters:
context- The build context.operation- The operation shape to create.- Returns:
- Returns the optionally created operation entry.
-
getOperationResponseStatusCode
public String getOperationResponseStatusCode(Context<Rpcv2JsonTrait> context, ToShapeId operationOrError) Description copied from interface:OpenApiProtocolGets the response status code of an operation or error shape.The default implementation will attempt to use HTTP binding traits to determine the HTTP status code of an operation or error structure.
- Specified by:
getOperationResponseStatusCodein interfaceOpenApiProtocol<Rpcv2JsonTrait>- Parameters:
context- The build context.operationOrError- Operation or error shape ID.- Returns:
- Returns the status code as a string.
-
getOperationMethod
Description copied from interface:OpenApiProtocolGets the HTTP method of an operation.The default implementation will attempt to get the HTTP method defined by the
HttpTraittrait. If no HTTP trait can be found, the default implementation will throw an exception.- Specified by:
getOperationMethodin interfaceOpenApiProtocol<Rpcv2JsonTrait>- Parameters:
context- The build context.operation- The operation to get the method of.- Returns:
- Returns the method.
-
getOperationUri
Description copied from interface:OpenApiProtocolGets the URI of an operation.The default implementation will attempt to get the HTTP URI defined by the
HttpTraittrait. If no HTTP trait can be found, the default implementation will throw an exception.- Specified by:
getOperationUriin interfaceOpenApiProtocol<Rpcv2JsonTrait>- Parameters:
context- The build context.operation- The operation to get the URI of.- Returns:
- Returns the operation URI.
-
getProtocolRequestHeaders
public Set<String> getProtocolRequestHeaders(Context<Rpcv2JsonTrait> context, OperationShape operationShape) Description copied from interface:OpenApiProtocolGets the unmodeled protocol-specific HTTP headers of a request that are considered significant for the provided operation.These protocol specific headers are not automatically added to requests, but are used when integrating with things like CORS.
- Specified by:
getProtocolRequestHeadersin interfaceOpenApiProtocol<Rpcv2JsonTrait>- Parameters:
context- OpenAPI contextoperationShape- Smithy operation- Returns:
- Returns a set of header names.
-
getProtocolResponseHeaders
public Set<String> getProtocolResponseHeaders(Context<Rpcv2JsonTrait> context, OperationShape operationShape) Description copied from interface:OpenApiProtocolGets the unmodeled protocol-specific HTTP headers of a response that are considered significant for the provided operation.These protocol specific headers are not automatically added to responses, but are used when integrating with things like CORS.
- Specified by:
getProtocolResponseHeadersin interfaceOpenApiProtocol<Rpcv2JsonTrait>- Parameters:
context- OpenAPI contextoperationShape- Smithy operation- Returns:
- Returns a set of header names.
-