smithy.waiters.Waitable.scala Maven / Gradle / Ivy
package smithy.waiters
import smithy4s.Hints
import smithy4s.Newtype
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.schema.Schema.bijection
import smithy4s.schema.Schema.map
import smithy4s.schema.Schema.recursive
/** Indicates that an operation has various named "waiters" that can be used
* to poll a resource until it enters a desired state.
* @param value
* Defines an individual operation waiter.
*/
object Waitable extends Newtype[Map[WaiterName, Waiter]] {
val id: ShapeId = ShapeId("smithy.waiters", "waitable")
val hints: Hints = Hints(
smithy.api.Documentation("Indicates that an operation has various named \"waiters\" that can be used\nto poll a resource until it enters a desired state."),
smithy.api.Trait(selector = Some("operation :not(-[input, output]-> structure > member > union[trait|streaming])"), structurallyExclusive = None, conflicts = None, breakingChanges = None),
).lazily
val underlyingSchema: Schema[Map[WaiterName, Waiter]] = map(WaiterName.schema, Waiter.schema).withId(id).addHints(hints).validated(smithy.api.Length(min = Some(1L), max = None))
implicit val schema: Schema[Waitable] = recursive(bijection(underlyingSchema, asBijection))
}