smithy.waiters.Waiter.scala Maven / Gradle / Ivy
package smithy.waiters
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.boolean
import smithy4s.schema.Schema.string
import smithy4s.schema.Schema.struct
/** Defines an individual operation waiter.
* @param acceptors
* An ordered array of acceptors to check after executing an operation.
* @param tags
* A list of tags associated with the waiter that allow waiters to be
* categorized and grouped.
* @param documentation
* Documentation about the waiter. Can use CommonMark.
* @param maxDelay
* The maximum amount of time in seconds to delay between each retry.
* This value defaults to 120 if not specified (or, 2 minutes). If
* specified, this value MUST be greater than or equal to 1.
* @param deprecated
* Indicates if the waiter is considered deprecated. A waiter SHOULD
* be marked as deprecated if it has been replaced by another waiter or
* if it is no longer needed (for example, if a resource changes from
* eventually consistent to strongly consistent).
* @param minDelay
* The minimum amount of time in seconds to delay between each retry.
* This value defaults to 2 if not specified. If specified, this value
* MUST be greater than or equal to 1 and less than or equal to
* `maxDelay`.
*/
final case class Waiter(acceptors: List[Acceptor], minDelay: WaiterDelay = smithy.waiters.WaiterDelay(2), maxDelay: WaiterDelay = smithy.waiters.WaiterDelay(120), documentation: Option[String] = None, deprecated: Option[Boolean] = None, tags: Option[List[NonEmptyString]] = None)
object Waiter extends ShapeTag.Companion[Waiter] {
val id: ShapeId = ShapeId("smithy.waiters", "Waiter")
val hints: Hints = Hints(
smithy.api.Documentation("Defines an individual operation waiter."),
smithy.api.Private(),
).lazily
// constructor using the original order from the spec
private def make(documentation: Option[String], acceptors: List[Acceptor], minDelay: WaiterDelay, maxDelay: WaiterDelay, deprecated: Option[Boolean], tags: Option[List[NonEmptyString]]): Waiter = Waiter(acceptors, minDelay, maxDelay, documentation, deprecated, tags)
implicit val schema: Schema[Waiter] = struct(
string.optional[Waiter]("documentation", _.documentation).addHints(smithy.api.Documentation("Documentation about the waiter. Can use CommonMark.")),
Acceptors.underlyingSchema.required[Waiter]("acceptors", _.acceptors).addHints(smithy.api.Documentation("An ordered array of acceptors to check after executing an operation.")),
WaiterDelay.schema.field[Waiter]("minDelay", _.minDelay).addHints(smithy.api.Documentation("The minimum amount of time in seconds to delay between each retry.\nThis value defaults to 2 if not specified. If specified, this value\nMUST be greater than or equal to 1 and less than or equal to\n`maxDelay`."), smithy.api.Default(smithy4s.Document.fromDouble(2.0d))),
WaiterDelay.schema.field[Waiter]("maxDelay", _.maxDelay).addHints(smithy.api.Documentation("The maximum amount of time in seconds to delay between each retry.\nThis value defaults to 120 if not specified (or, 2 minutes). If\nspecified, this value MUST be greater than or equal to 1."), smithy.api.Default(smithy4s.Document.fromDouble(120.0d))),
boolean.optional[Waiter]("deprecated", _.deprecated).addHints(smithy.api.Documentation("Indicates if the waiter is considered deprecated. A waiter SHOULD\nbe marked as deprecated if it has been replaced by another waiter or\nif it is no longer needed (for example, if a resource changes from\neventually consistent to strongly consistent).")),
NonEmptyStringList.underlyingSchema.optional[Waiter]("tags", _.tags).addHints(smithy.api.Documentation("A list of tags associated with the waiter that allow waiters to be\ncategorized and grouped.")),
)(make).withId(id).addHints(hints)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy