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

scala.googleapis.storage.AnywhereCachesClient.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 AnywhereCachesClient[F[_]: Concurrent](client: Client[F]) extends AbstractClient[F](client) {
  val baseUri = uri"https://storage.googleapis.com/storage/v1"
  def resume(
      /** Name of the parent bucket.
        */
      bucket: String,
      /** The ID of requested Anywhere Cache instance.
        */
      anywhereCacheId: String,
  ): F[AnywhereCache] = expectJson[AnywhereCache](
    request(
      method = Method.POST,
      uri = baseUri / "b" / s"${bucket}" / "anywhereCaches" / s"${anywhereCacheId}" / "resume",
    )
  )
  def insert(
      /** Name of the parent bucket.
        */
      bucket: String
  )(input: AnywhereCache): F[GoogleLongrunningOperation] = expectJson[GoogleLongrunningOperation](
    requestWithBody(method = Method.POST, uri = baseUri / "b" / s"${bucket}" / "anywhereCaches")(
      input
    )
  )
  def pause(
      /** Name of the parent bucket.
        */
      bucket: String,
      /** The ID of requested Anywhere Cache instance.
        */
      anywhereCacheId: String,
  ): F[AnywhereCache] = expectJson[AnywhereCache](
    request(
      method = Method.POST,
      uri = baseUri / "b" / s"${bucket}" / "anywhereCaches" / s"${anywhereCacheId}" / "pause",
    )
  )
  def disable(
      /** Name of the parent bucket.
        */
      bucket: String,
      /** The ID of requested Anywhere Cache instance.
        */
      anywhereCacheId: String,
  ): F[AnywhereCache] = expectJson[AnywhereCache](
    request(
      method = Method.POST,
      uri = baseUri / "b" / s"${bucket}" / "anywhereCaches" / s"${anywhereCacheId}" / "disable",
    )
  )
  def get(
      /** Name of the parent bucket.
        */
      bucket: String,
      /** The ID of requested Anywhere Cache instance.
        */
      anywhereCacheId: String,
  ): F[AnywhereCache] = expectJson[AnywhereCache](
    request(
      method = Method.GET,
      uri = baseUri / "b" / s"${bucket}" / "anywhereCaches" / s"${anywhereCacheId}",
    )
  )
  def update(
      /** Name of the parent bucket.
        */
      bucket: String,
      /** The ID of requested Anywhere Cache instance.
        */
      anywhereCacheId: String,
  )(input: AnywhereCache): F[GoogleLongrunningOperation] = expectJson[GoogleLongrunningOperation](
    requestWithBody(
      method = Method.PATCH,
      uri = baseUri / "b" / s"${bucket}" / "anywhereCaches" / s"${anywhereCacheId}",
    )(input)
  )
  def list(
      /** Name of the parent bucket.
        */
      bucket: String,
      query: AnywhereCachesClient.ListParams = AnywhereCachesClient.ListParams(),
  ): F[AnywhereCaches] = expectJson[AnywhereCaches](
    request(
      method = Method.GET,
      uri = (baseUri / "b" / s"${bucket}" / "anywhereCaches").copy(query =
        Query(
          "pageSize" -> query.pageSize.map(s => QueryParamEncoder[Int].encode(s).value),
          "pageToken" -> query.pageToken,
        )
      ),
    )
  )
}
object AnywhereCachesClient {
  final case class ListParams(
      /** Maximum number of items to return in a single page of responses. Maximum 1000.
        */
      pageSize: Option[Int] = None,
      /** A previously-returned page token representing part of the larger set of results to view.
        */
      pageToken: Option[String] = None,
  )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy