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

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

The newest version!
package googleapis.storage

import cats.effect.Concurrent
import org.http4s._
import org.http4s.implicits._
import org.http4s.client.Client

class ObjectAccessControlsClient[F[_]: Concurrent](client: Client[F])
    extends AbstractClient[F](client) {
  val baseUri = uri"https://storage.googleapis.com/storage/v1"
  def insert(
      /** Name of a bucket.
        */
      bucket: String,
      /** Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
        */
      `object`: String,
      query: ObjectAccessControlsClient.InsertParams = ObjectAccessControlsClient.InsertParams(),
  )(input: ObjectAccessControl): F[ObjectAccessControl] = expectJson[ObjectAccessControl](
    requestWithBody(
      method = Method.POST,
      uri = (baseUri / "b" / s"${bucket}" / "o" / s"${`object`}" / "acl")
        .copy(query = Query("generation" -> query.generation, "userProject" -> query.userProject)),
    )(input)
  )
  def delete(
      /** Name of a bucket.
        */
      bucket: String,
      /** Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
        */
      `object`: String,
      /** The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.
        */
      entity: String,
      query: ObjectAccessControlsClient.DeleteParams = ObjectAccessControlsClient.DeleteParams(),
  ): F[Status] = client.status(
    request(
      method = Method.DELETE,
      uri = (baseUri / "b" / s"${bucket}" / "o" / s"${`object`}" / "acl" / s"${entity}")
        .copy(query = Query("generation" -> query.generation, "userProject" -> query.userProject)),
    )
  )
  def get(
      /** Name of a bucket.
        */
      bucket: String,
      /** Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
        */
      `object`: String,
      /** The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.
        */
      entity: String,
      query: ObjectAccessControlsClient.GetParams = ObjectAccessControlsClient.GetParams(),
  ): F[ObjectAccessControl] = expectJson[ObjectAccessControl](
    request(
      method = Method.GET,
      uri = (baseUri / "b" / s"${bucket}" / "o" / s"${`object`}" / "acl" / s"${entity}")
        .copy(query = Query("generation" -> query.generation, "userProject" -> query.userProject)),
    )
  )
  def update(
      /** Name of a bucket.
        */
      bucket: String,
      /** Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
        */
      `object`: String,
      /** The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.
        */
      entity: String,
      query: ObjectAccessControlsClient.UpdateParams = ObjectAccessControlsClient.UpdateParams(),
  )(input: ObjectAccessControl): F[ObjectAccessControl] = expectJson[ObjectAccessControl](
    requestWithBody(
      method = Method.PUT,
      uri = (baseUri / "b" / s"${bucket}" / "o" / s"${`object`}" / "acl" / s"${entity}")
        .copy(query = Query("generation" -> query.generation, "userProject" -> query.userProject)),
    )(input)
  )
  def patch(
      /** Name of a bucket.
        */
      bucket: String,
      /** Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
        */
      `object`: String,
      /** The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.
        */
      entity: String,
      query: ObjectAccessControlsClient.PatchParams = ObjectAccessControlsClient.PatchParams(),
  )(input: ObjectAccessControl): F[ObjectAccessControl] = expectJson[ObjectAccessControl](
    requestWithBody(
      method = Method.PATCH,
      uri = (baseUri / "b" / s"${bucket}" / "o" / s"${`object`}" / "acl" / s"${entity}")
        .copy(query = Query("generation" -> query.generation, "userProject" -> query.userProject)),
    )(input)
  )
  def list(
      /** Name of a bucket.
        */
      bucket: String,
      /** Name of the object. For information about how to URL encode object names to be path safe, see [Encoding URI Path Parts](https://cloud.google.com/storage/docs/request-endpoints#encoding).
        */
      `object`: String,
      query: ObjectAccessControlsClient.ListParams = ObjectAccessControlsClient.ListParams(),
  ): F[ObjectAccessControls] = expectJson[ObjectAccessControls](
    request(
      method = Method.GET,
      uri = (baseUri / "b" / s"${bucket}" / "o" / s"${`object`}" / "acl")
        .copy(query = Query("generation" -> query.generation, "userProject" -> query.userProject)),
    )
  )
}
object ObjectAccessControlsClient {
  final case class InsertParams(
      /** If present, selects a specific revision of this object (as opposed to the latest version, the default).
        */
      generation: Option[String] = None,
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None,
  )
  final case class DeleteParams(
      /** If present, selects a specific revision of this object (as opposed to the latest version, the default).
        */
      generation: Option[String] = None,
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None,
  )
  final case class GetParams(
      /** If present, selects a specific revision of this object (as opposed to the latest version, the default).
        */
      generation: Option[String] = None,
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None,
  )
  final case class UpdateParams(
      /** If present, selects a specific revision of this object (as opposed to the latest version, the default).
        */
      generation: Option[String] = None,
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None,
  )
  final case class PatchParams(
      /** If present, selects a specific revision of this object (as opposed to the latest version, the default).
        */
      generation: Option[String] = None,
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None,
  )
  final case class ListParams(
      /** If present, selects a specific revision of this object (as opposed to the latest version, the default).
        */
      generation: Option[String] = None,
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None,
  )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy