scala.googleapis.storage.Policy.scala Maven / Gradle / Ivy
The newest version!
package googleapis.storage
import JsonInstances._
import io.circe._
import io.circe.syntax._
import scodec.bits.ByteVector
final case class Policy(
/** The ID of the resource to which this policy belongs. Will be of the form projects/_/buckets/bucket for buckets, projects/_/buckets/bucket/objects/object for objects, and projects/_/buckets/bucket/managedFolders/managedFolder. A specific generation may be specified by appending #generationNumber to the end of the object name, e.g. projects/_/buckets/my-bucket/objects/data.txt#17. The current generation can be denoted with #0. This field is ignored on input.
*/
resourceId: Option[String] = None,
/** HTTP 1.1 Entity tag for the policy.
*/
etag: Option[ByteVector] = None,
/** An association between a role, which comes with a set of permissions, and members who may assume that role.
*/
bindings: Option[List[PolicyBinding]] = None,
/** The IAM policy format version.
*/
version: Option[Int] = None,
/** The kind of item this is. For policies, this is always storage#policy. This field is ignored on input.
*/
kind: Option[String] = None,
)
object Policy {
implicit val encoder: Encoder[Policy] = Encoder.instance { x =>
Json.obj(
"resourceId" := x.resourceId,
"etag" := x.etag,
"bindings" := x.bindings,
"version" := x.version,
"kind" := x.kind,
)
}
implicit val decoder: Decoder[Policy] = Decoder.instance { c =>
for {
v0 <- c.get[Option[String]]("resourceId")
v1 <- c.get[Option[ByteVector]]("etag")
v2 <- c.get[Option[List[PolicyBinding]]]("bindings")
v3 <- c.get[Option[Int]]("version")
v4 <- c.get[Option[String]]("kind")
} yield Policy(v0, v1, v2, v3, v4)
}
}