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

smithy.api.RequestCompression.scala Maven / Gradle / Ivy

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

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

/** Indicates that an operation supports compressing requests from clients to
  * services.
  * @param encodings
  *   Defines the priority-ordered list of compression algorithms supported by
  *   the service operation.
  */
final case class RequestCompression(encodings: List[String])

object RequestCompression extends ShapeTag.Companion[RequestCompression] {
  val id: ShapeId = ShapeId("smithy.api", "requestCompression")

  val hints: Hints = Hints(
    smithy.api.Documentation("Indicates that an operation supports compressing requests from clients to\nservices."),
    smithy.api.Trait(selector = Some("operation"), structurallyExclusive = None, conflicts = None, breakingChanges = Some(List(smithy.api.TraitDiffRule(change = smithy.api.TraitChangeType.REMOVE.widen, severity = smithy.api.Severity.DANGER.widen, path = None, message = Some("Trait was removed so newly generated clients will no longer compress requests, but the service MUST continue to support removed compression algorithms in `encodings`.")), smithy.api.TraitDiffRule(change = smithy.api.TraitChangeType.REMOVE.widen, severity = smithy.api.Severity.ERROR.widen, path = Some("/encodings"), message = Some("`encodings` was removed, but is required for the requestCompression trait.")), smithy.api.TraitDiffRule(change = smithy.api.TraitChangeType.ADD.widen, severity = smithy.api.Severity.NOTE.widen, path = Some("/encodings/member"), message = Some("Members of `encodings` were added. Once a compression algorithm is added, the service MUST support the compression algorithm.")), smithy.api.TraitDiffRule(change = smithy.api.TraitChangeType.REMOVE.widen, severity = smithy.api.Severity.DANGER.widen, path = Some("/encodings/member"), message = Some("Members of `encodings` were removed so newly generated clients will no longer compress requests for removed compression algorithms. The service MUST continue to support old clients by supporting removed compression algorithms.")), smithy.api.TraitDiffRule(change = smithy.api.TraitChangeType.UPDATE.widen, severity = smithy.api.Severity.DANGER.widen, path = Some("/encodings/member"), message = Some("Members of `encodings` were updated so newly generated clients will no longer compress requests for compression algorithms prior to the updates. The service MUST continue to support old clients by supporting compression algorithms prior to the updates."))))),
  ).lazily

  // constructor using the original order from the spec
  private def make(encodings: List[String]): RequestCompression = RequestCompression(encodings)

  implicit val schema: Schema[RequestCompression] = recursive(struct(
    RequestCompressionEncodingsList.underlyingSchema.required[RequestCompression]("encodings", _.encodings),
  )(make).withId(id).addHints(hints))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy