smithy.api.Endpoint.scala Maven / Gradle / Ivy
package smithy.api
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.recursive
import smithy4s.schema.Schema.struct
/** Configures a custom operation endpoint.
* @param hostPrefix
* A host prefix pattern for the operation.
*
* Labels defined in the host pattern are used to bind top-level
* operation input members to the host.
*/
final case class Endpoint(hostPrefix: NonEmptyString)
object Endpoint extends ShapeTag.Companion[Endpoint] {
val id: ShapeId = ShapeId("smithy.api", "endpoint")
val hints: Hints = Hints(
smithy.api.Documentation("Configures a custom operation endpoint."),
smithy.api.Trait(selector = Some("operation"), structurallyExclusive = None, conflicts = None, breakingChanges = Some(List(smithy.api.TraitDiffRule(change = smithy.api.TraitChangeType.ANY.widen, severity = smithy.api.Severity.ERROR.widen, path = None, message = None)))),
).lazily
// constructor using the original order from the spec
private def make(hostPrefix: NonEmptyString): Endpoint = Endpoint(hostPrefix)
implicit val schema: Schema[Endpoint] = recursive(struct(
NonEmptyString.schema.required[Endpoint]("hostPrefix", _.hostPrefix).addHints(smithy.api.Documentation("A host prefix pattern for the operation.\n\nLabels defined in the host pattern are used to bind top-level\noperation input members to the host.")),
)(make).withId(id).addHints(hints))
}