smithy4s.smithy.rules.EndpointExpectation.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.string
import smithy4s.schema.Schema.struct
/** A description of an expected endpoint to be resolved for an endpoint rule-set test case.
* @param url
* The expected endpoint URL to be resolved for this test case.
* @param headers
* The transport headers to be set for this test case.
* @param properties
* The properties for the endpoint for this test case.
*/
final case class EndpointExpectation(url: Option[String] = None, headers: Option[Map[String, List[String]]] = None, properties: Option[Map[String, Document]] = None)
object EndpointExpectation extends ShapeTag.Companion[EndpointExpectation] {
val id: ShapeId = ShapeId("smithy.rules", "EndpointExpectation")
val hints: Hints = Hints(
smithy.api.Documentation("A description of an expected endpoint to be resolved for an endpoint rule-set test case."),
smithy.api.Unstable(),
smithy.api.Private(),
).lazily
// constructor using the original order from the spec
private def make(url: Option[String], headers: Option[Map[String, List[String]]], properties: Option[Map[String, Document]]): EndpointExpectation = EndpointExpectation(url, headers, properties)
implicit val schema: Schema[EndpointExpectation] = struct(
string.optional[EndpointExpectation]("url", _.url).addHints(smithy.api.Documentation("The expected endpoint URL to be resolved for this test case.")),
EndpointHeaders.underlyingSchema.optional[EndpointExpectation]("headers", _.headers).addHints(smithy.api.Documentation("The transport headers to be set for this test case.")),
Properties.underlyingSchema.optional[EndpointExpectation]("properties", _.properties).addHints(smithy.api.Documentation("The properties for the endpoint for this test case.")),
)(make).withId(id).addHints(hints)
}