smithy4s.smithy.rules.OperationInput.scala Maven / Gradle / Ivy
package smithy.rules
import smithy4s.Document
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.document
import smithy4s.schema.Schema.string
import smithy4s.schema.Schema.struct
/** A description of a service operation and input used to verify an endpoint rule-set test case.
* @param operationName
* The name of the service operation targeted by the test.
* @param operationParams
* Defines the input parameters used to generate the operation request.
* These parameters MUST be compatible with the input of the operation.
* @param builtInParams
* Defines the set of rule-set built-ins and their corresponding values to be set.
* @param clientParams
* Defines the set of client configuration parameters to be set.
*/
final case class OperationInput(operationName: String, operationParams: Option[Document] = None, builtInParams: Option[Document] = None, clientParams: Option[Document] = None)
object OperationInput extends ShapeTag.Companion[OperationInput] {
val id: ShapeId = ShapeId("smithy.rules", "OperationInput")
val hints: Hints = Hints(
smithy.api.Documentation("A description of a service operation and input used to verify an endpoint rule-set test case."),
smithy.api.Unstable(),
smithy.api.Private(),
).lazily
// constructor using the original order from the spec
private def make(operationName: String, operationParams: Option[Document], builtInParams: Option[Document], clientParams: Option[Document]): OperationInput = OperationInput(operationName, operationParams, builtInParams, clientParams)
implicit val schema: Schema[OperationInput] = struct(
string.required[OperationInput]("operationName", _.operationName).addHints(smithy.api.Documentation("The name of the service operation targeted by the test.")),
document.optional[OperationInput]("operationParams", _.operationParams).addHints(smithy.api.Documentation("Defines the input parameters used to generate the operation request.\nThese parameters MUST be compatible with the input of the operation.")),
document.optional[OperationInput]("builtInParams", _.builtInParams).addHints(smithy.api.Documentation("Defines the set of rule-set built-ins and their corresponding values to be set.")),
document.optional[OperationInput]("clientParams", _.clientParams).addHints(smithy.api.Documentation("Defines the set of client configuration parameters to be set.")),
)(make).withId(id).addHints(hints)
}