smithy.api.Retryable.scala Maven / Gradle / Ivy
package smithy.api
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.boolean
import smithy4s.schema.Schema.recursive
import smithy4s.schema.Schema.struct
/** Indicates that an error MAY be retried by the client.
* @param throttling
* Classifies the retry as throttling.
*/
final case class Retryable(throttling: Option[Boolean] = None)
object Retryable extends ShapeTag.Companion[Retryable] {
val id: ShapeId = ShapeId("smithy.api", "retryable")
val hints: Hints = Hints(
smithy.api.Documentation("Indicates that an error MAY be retried by the client."),
smithy.api.Trait(selector = Some("structure[trait|error]"), structurallyExclusive = None, conflicts = None, breakingChanges = Some(List(smithy.api.TraitDiffRule(change = smithy.api.TraitChangeType.REMOVE.widen, severity = smithy.api.Severity.ERROR.widen, path = None, message = None)))),
).lazily
// constructor using the original order from the spec
private def make(throttling: Option[Boolean]): Retryable = Retryable(throttling)
implicit val schema: Schema[Retryable] = recursive(struct(
boolean.optional[Retryable]("throttling", _.throttling).addHints(smithy.api.Documentation("Classifies the retry as throttling.")),
)(make).withId(id).addHints(hints))
}