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

scala.googleapis.storage.BucketAccessControlsClient.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 BucketAccessControlsClient[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,
      query: BucketAccessControlsClient.InsertParams = BucketAccessControlsClient.InsertParams(),
  )(input: BucketAccessControl): F[BucketAccessControl] = expectJson[BucketAccessControl](
    requestWithBody(
      method = Method.POST,
      uri = (baseUri / "b" / s"${bucket}" / "acl")
        .copy(query = Query("userProject" -> query.userProject)),
    )(input)
  )
  def delete(
      /** Name of a bucket.
        */
      bucket: String,
      /** The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.
        */
      entity: String,
      query: BucketAccessControlsClient.DeleteParams = BucketAccessControlsClient.DeleteParams(),
  ): F[Status] = client.status(
    request(
      method = Method.DELETE,
      uri = (baseUri / "b" / s"${bucket}" / "acl" / s"${entity}")
        .copy(query = Query("userProject" -> query.userProject)),
    )
  )
  def get(
      /** Name of a bucket.
        */
      bucket: String,
      /** The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.
        */
      entity: String,
      query: BucketAccessControlsClient.GetParams = BucketAccessControlsClient.GetParams(),
  ): F[BucketAccessControl] = expectJson[BucketAccessControl](
    request(
      method = Method.GET,
      uri = (baseUri / "b" / s"${bucket}" / "acl" / s"${entity}")
        .copy(query = Query("userProject" -> query.userProject)),
    )
  )
  def update(
      /** Name of a bucket.
        */
      bucket: String,
      /** The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.
        */
      entity: String,
      query: BucketAccessControlsClient.UpdateParams = BucketAccessControlsClient.UpdateParams(),
  )(input: BucketAccessControl): F[BucketAccessControl] = expectJson[BucketAccessControl](
    requestWithBody(
      method = Method.PUT,
      uri = (baseUri / "b" / s"${bucket}" / "acl" / s"${entity}")
        .copy(query = Query("userProject" -> query.userProject)),
    )(input)
  )
  def patch(
      /** Name of a bucket.
        */
      bucket: String,
      /** The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, group-emailAddress, allUsers, or allAuthenticatedUsers.
        */
      entity: String,
      query: BucketAccessControlsClient.PatchParams = BucketAccessControlsClient.PatchParams(),
  )(input: BucketAccessControl): F[BucketAccessControl] = expectJson[BucketAccessControl](
    requestWithBody(
      method = Method.PATCH,
      uri = (baseUri / "b" / s"${bucket}" / "acl" / s"${entity}")
        .copy(query = Query("userProject" -> query.userProject)),
    )(input)
  )
  def list(
      /** Name of a bucket.
        */
      bucket: String,
      query: BucketAccessControlsClient.ListParams = BucketAccessControlsClient.ListParams(),
  ): F[BucketAccessControls] = expectJson[BucketAccessControls](
    request(
      method = Method.GET,
      uri = (baseUri / "b" / s"${bucket}" / "acl")
        .copy(query = Query("userProject" -> query.userProject)),
    )
  )
}
object BucketAccessControlsClient {
  final case class InsertParams(
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None
  )
  final case class DeleteParams(
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None
  )
  final case class GetParams(
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None
  )
  final case class UpdateParams(
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None
  )
  final case class PatchParams(
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None
  )
  final case class ListParams(
      /** The project to be billed for this request. Required for Requester Pays buckets.
        */
      userProject: Option[String] = None
  )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy