smithy.api.TimestampFormat.scala Maven / Gradle / Ivy
package smithy.api
import smithy4s.Enumeration
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.EnumTag
import smithy4s.schema.Schema.enumeration
/** @param DATE_TIME
* Date time as defined by the date-time production in RFC3339 section 5.6
* with no UTC offset (for example, 1985-04-12T23:20:50.52Z).
* @param EPOCH_SECONDS
* Also known as Unix time, the number of seconds that have elapsed since
* 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970,
* with decimal precision (for example, 1515531081.1234).
* @param HTTP_DATE
* An HTTP date as defined by the IMF-fixdate production in
* RFC 7231#section-7.1.1.1 (for example, Tue, 29 Apr 2014 18:30:38 GMT).
*/
sealed abstract class TimestampFormat(_value: String, _name: String, _intValue: Int, _hints: Hints) extends Enumeration.Value {
override type EnumType = TimestampFormat
override val value: String = _value
override val name: String = _name
override val intValue: Int = _intValue
override val hints: Hints = _hints
override def enumeration: Enumeration[EnumType] = TimestampFormat
@inline final def widen: TimestampFormat = this
}
object TimestampFormat extends Enumeration[TimestampFormat] with ShapeTag.Companion[TimestampFormat] {
val id: ShapeId = ShapeId("smithy.api", "timestampFormat")
val hints: Hints = Hints(
smithy.api.Trait(selector = Some(":test(timestamp, member > timestamp)"), 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
/** Date time as defined by the date-time production in RFC3339 section 5.6
* with no UTC offset (for example, 1985-04-12T23:20:50.52Z).
*/
case object DATE_TIME extends TimestampFormat("date-time", "DATE_TIME", 0, Hints.empty) {
override val hints: Hints = Hints(smithy.api.Documentation("Date time as defined by the date-time production in RFC3339 section 5.6\nwith no UTC offset (for example, 1985-04-12T23:20:50.52Z).")).lazily
}
/** Also known as Unix time, the number of seconds that have elapsed since
* 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970,
* with decimal precision (for example, 1515531081.1234).
*/
case object EPOCH_SECONDS extends TimestampFormat("epoch-seconds", "EPOCH_SECONDS", 1, Hints.empty) {
override val hints: Hints = Hints(smithy.api.Documentation("Also known as Unix time, the number of seconds that have elapsed since\n00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970,\nwith decimal precision (for example, 1515531081.1234).")).lazily
}
/** An HTTP date as defined by the IMF-fixdate production in
* RFC 7231#section-7.1.1.1 (for example, Tue, 29 Apr 2014 18:30:38 GMT).
*/
case object HTTP_DATE extends TimestampFormat("http-date", "HTTP_DATE", 2, Hints.empty) {
override val hints: Hints = Hints(smithy.api.Documentation("An HTTP date as defined by the IMF-fixdate production in\nRFC 7231#section-7.1.1.1 (for example, Tue, 29 Apr 2014 18:30:38 GMT).")).lazily
}
val values: List[TimestampFormat] = List(
DATE_TIME,
EPOCH_SECONDS,
HTTP_DATE,
)
val tag: EnumTag[TimestampFormat] = EnumTag.ClosedStringEnum
implicit val schema: Schema[TimestampFormat] = enumeration(tag, values).withId(id).addHints(hints)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy