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

scala.googleapis.storage.Notification.scala Maven / Gradle / Ivy

The newest version!
package googleapis.storage

import io.circe._
import io.circe.syntax._

final case class Notification(
    /** HTTP 1.1 Entity tag for this subscription notification.
      */
    etag: Option[String] = None,
    /** The desired content of the Payload.
      */
    payload_format: Option[String] = None,
    /** The canonical URL of this notification.
      */
    selfLink: Option[String] = None,
    /** An optional list of additional attributes to attach to each Cloud PubSub message published for this notification subscription.
      */
    custom_attributes: Option[Map[String, String]] = None,
    /** The ID of the notification.
      */
    id: Option[String] = None,
    /** If present, only send notifications about listed event types. If empty, sent notifications for all event types.
      */
    event_types: Option[List[String]] = None,
    /** If present, only apply this notification configuration to object names that begin with this prefix.
      */
    object_name_prefix: Option[String] = None,
    /** The Cloud PubSub topic to which this subscription publishes. Formatted as: '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topic}'
      */
    topic: Option[String] = None,
    /** The kind of item this is. For notifications, this is always storage#notification.
      */
    kind: Option[String] = None,
)
object Notification {
  implicit val encoder: Encoder[Notification] = Encoder.instance { x =>
    Json.obj(
      "etag" := x.etag,
      "payload_format" := x.payload_format,
      "selfLink" := x.selfLink,
      "custom_attributes" := x.custom_attributes,
      "id" := x.id,
      "event_types" := x.event_types,
      "object_name_prefix" := x.object_name_prefix,
      "topic" := x.topic,
      "kind" := x.kind,
    )
  }
  implicit val decoder: Decoder[Notification] = Decoder.instance { c =>
    for {
      v0 <- c.get[Option[String]]("etag")
      v1 <- c.get[Option[String]]("payload_format")
      v2 <- c.get[Option[String]]("selfLink")
      v3 <- c.get[Option[Map[String, String]]]("custom_attributes")
      v4 <- c.get[Option[String]]("id")
      v5 <- c.get[Option[List[String]]]("event_types")
      v6 <- c.get[Option[String]]("object_name_prefix")
      v7 <- c.get[Option[String]]("topic")
      v8 <- c.get[Option[String]]("kind")
    } yield Notification(v0, v1, v2, v3, v4, v5, v6, v7, v8)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy