scala.googleapis.storage.DefaultObjectAccessControlsClient.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 DefaultObjectAccessControlsClient[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: DefaultObjectAccessControlsClient.InsertParams =
DefaultObjectAccessControlsClient.InsertParams(),
)(input: ObjectAccessControl): F[ObjectAccessControl] = expectJson[ObjectAccessControl](
requestWithBody(
method = Method.POST,
uri = (baseUri / "b" / s"${bucket}" / "defaultObjectAcl")
.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: DefaultObjectAccessControlsClient.DeleteParams =
DefaultObjectAccessControlsClient.DeleteParams(),
): F[Status] = client.status(
request(
method = Method.DELETE,
uri = (baseUri / "b" / s"${bucket}" / "defaultObjectAcl" / 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: DefaultObjectAccessControlsClient.GetParams =
DefaultObjectAccessControlsClient.GetParams(),
): F[ObjectAccessControl] = expectJson[ObjectAccessControl](
request(
method = Method.GET,
uri = (baseUri / "b" / s"${bucket}" / "defaultObjectAcl" / 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: DefaultObjectAccessControlsClient.UpdateParams =
DefaultObjectAccessControlsClient.UpdateParams(),
)(input: ObjectAccessControl): F[ObjectAccessControl] = expectJson[ObjectAccessControl](
requestWithBody(
method = Method.PUT,
uri = (baseUri / "b" / s"${bucket}" / "defaultObjectAcl" / 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: DefaultObjectAccessControlsClient.PatchParams =
DefaultObjectAccessControlsClient.PatchParams(),
)(input: ObjectAccessControl): F[ObjectAccessControl] = expectJson[ObjectAccessControl](
requestWithBody(
method = Method.PATCH,
uri = (baseUri / "b" / s"${bucket}" / "defaultObjectAcl" / s"${entity}")
.copy(query = Query("userProject" -> query.userProject)),
)(input)
)
def list(
/** Name of a bucket.
*/
bucket: String,
query: DefaultObjectAccessControlsClient.ListParams =
DefaultObjectAccessControlsClient.ListParams(),
): F[ObjectAccessControls] = expectJson[ObjectAccessControls](
request(
method = Method.GET,
uri = (baseUri / "b" / s"${bucket}" / "defaultObjectAcl").copy(query =
Query(
"ifMetagenerationMatch" -> query.ifMetagenerationMatch,
"ifMetagenerationNotMatch" -> query.ifMetagenerationNotMatch,
"userProject" -> query.userProject,
)
),
)
)
}
object DefaultObjectAccessControlsClient {
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(
/** If present, only return default ACL listing if the bucket's current metageneration matches this value.
*/
ifMetagenerationMatch: Option[String] = None,
/** If present, only return default ACL listing if the bucket's current metageneration does not match the given value.
*/
ifMetagenerationNotMatch: Option[String] = None,
/** The project to be billed for this request. Required for Requester Pays buckets.
*/
userProject: Option[String] = None,
)
}