All Downloads are FREE. Search and download functionalities are using the official Maven repository.

smithy.waiters.Acceptor.scala Maven / Gradle / Ivy

There is a newer version: 0.19.0-41-91762fb
Show newest version
package smithy.waiters

import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.struct

/** Represents an acceptor in a waiter's state machine.
  * @param state
  *   The state the acceptor transitions to when matched.
  * @param matcher
  *   The matcher used to test if the resource is in a given state.
  */
final case class Acceptor(state: AcceptorState, matcher: Matcher)

object Acceptor extends ShapeTag.Companion[Acceptor] {
  val id: ShapeId = ShapeId("smithy.waiters", "Acceptor")

  val hints: Hints = Hints(
    smithy.api.Documentation("Represents an acceptor in a waiter\'s state machine."),
    smithy.api.Private(),
  ).lazily

  // constructor using the original order from the spec
  private def make(state: AcceptorState, matcher: Matcher): Acceptor = Acceptor(state, matcher)

  implicit val schema: Schema[Acceptor] = struct(
    AcceptorState.schema.required[Acceptor]("state", _.state).addHints(smithy.api.Documentation("The state the acceptor transitions to when matched.")),
    Matcher.schema.required[Acceptor]("matcher", _.matcher).addHints(smithy.api.Documentation("The matcher used to test if the resource is in a given state.")),
  )(make).withId(id).addHints(hints)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy