Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package smithy.api
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.int
import smithy4s.schema.Schema.recursive
import smithy4s.schema.Schema.struct
/** Defines how a service supports cross-origin resource sharing.
* @param origin
* The origin from which browser script-originating requests will be
* allowed.
* @param maxAge
* The maximum number of seconds for which browsers are allowed to cache
* the results of a preflight OPTIONS request.
*
* Defaults to 600, the maximum age permitted by several browsers.
* Set to -1 to disable caching entirely.
* @param additionalAllowedHeaders
* The names of headers that should be included in the
* Access-Control-Allow-Headers header in responses to preflight OPTIONS
* requests. This list will be used in addition to the names of all
* request headers bound to an input data member via the httpHeader, as
* well as any headers required by the protocol or authentication scheme.
* @param additionalExposedHeaders
* The names of headers that should be included in the
* Access-Control-Expose-Headers header in all responses sent by the
* service. This list will be used in addition to the names of all
* request headers bound to an output data member via the httpHeader,
* as well as any headers required by the protocol or authentication
* scheme.
*/
final case class Cors(origin: NonEmptyString = smithy.api.NonEmptyString("*"), maxAge: Int = 600, additionalAllowedHeaders: Option[List[NonEmptyString]] = None, additionalExposedHeaders: Option[List[NonEmptyString]] = None)
object Cors extends ShapeTag.Companion[Cors] {
val id: ShapeId = ShapeId("smithy.api", "cors")
val hints: Hints = Hints(
smithy.api.Documentation("Defines how a service supports cross-origin resource sharing."),
smithy.api.Trait(selector = Some("service"), 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(origin: NonEmptyString, maxAge: Int, additionalAllowedHeaders: Option[List[NonEmptyString]], additionalExposedHeaders: Option[List[NonEmptyString]]): Cors = Cors(origin, maxAge, additionalAllowedHeaders, additionalExposedHeaders)
implicit val schema: Schema[Cors] = recursive(struct(
NonEmptyString.schema.field[Cors]("origin", _.origin).addHints(smithy.api.Documentation("The origin from which browser script-originating requests will be\nallowed."), smithy.api.Default(smithy4s.Document.fromString("*"))),
int.field[Cors]("maxAge", _.maxAge).addHints(smithy.api.Documentation("The maximum number of seconds for which browsers are allowed to cache\nthe results of a preflight OPTIONS request.\n\nDefaults to 600, the maximum age permitted by several browsers.\nSet to -1 to disable caching entirely."), smithy.api.Default(smithy4s.Document.fromDouble(600.0d))),
NonEmptyStringList.underlyingSchema.optional[Cors]("additionalAllowedHeaders", _.additionalAllowedHeaders).addHints(smithy.api.Documentation("The names of headers that should be included in the\nAccess-Control-Allow-Headers header in responses to preflight OPTIONS\nrequests. This list will be used in addition to the names of all\nrequest headers bound to an input data member via the httpHeader, as\nwell as any headers required by the protocol or authentication scheme.")),
NonEmptyStringList.underlyingSchema.optional[Cors]("additionalExposedHeaders", _.additionalExposedHeaders).addHints(smithy.api.Documentation("The names of headers that should be included in the\nAccess-Control-Expose-Headers header in all responses sent by the\nservice. This list will be used in addition to the names of all\nrequest headers bound to an output data member via the httpHeader,\nas well as any headers required by the protocol or authentication\nscheme.")),
)(make).withId(id).addHints(hints))
}