# NOTE: This file is auto generated by googly. Do not edit it manually. defmodule Googly.CloudStorage.Buckets do @moduledoc """ Endpoints for the `Buckets` resource. """ alias Googly.CloudStorage.Request @doc """ Deletes an empty bucket. Deletions are permanent unless soft delete is enabled on the bucket. ## Parameters * `bucket` (*type:* `String.t()`) - Name of a bucket. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `if_metageneration_match` (*type:* `String.t()`) - If set, only deletes the bucket if its metageneration matches this value. * `if_metageneration_not_match` (*type:* `String.t()`) - If set, only deletes the bucket if its metageneration does not match this value. * `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets. ## Returns * `{:ok, Req.Response.t()}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec delete(String.t(), keyword()) :: {:ok, Req.Response.t()} | {:error, term()} def delete(bucket, opts \\ []) do Request.run( method: :delete, url: "/storage/v1/b/{bucket}", path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)}, query: [], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, if_metageneration_match: {:query, "ifMetagenerationMatch"}, if_metageneration_not_match: {:query, "ifMetagenerationNotMatch"}, user_project: {:query, "userProject"} }, decode: nil, opts: opts ) end @doc """ Returns metadata for the specified bucket. ## Parameters * `bucket` (*type:* `String.t()`) - Name of a bucket. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `generation` (*type:* `String.t()`) - If present, specifies the generation of the bucket. This is required if softDeleted is true. * `if_metageneration_match` (*type:* `String.t()`) - Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value. * `if_metageneration_not_match` (*type:* `String.t()`) - Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value. * `projection` (*type:* `String.t()`) - Set of properties to return. Defaults to noAcl. * `soft_deleted` (*type:* `boolean()`) - If true, return the soft-deleted version of this bucket. The default is false. For more information, see [Soft Delete](https://cloud.google.com/storage/docs/soft-delete). * `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets. ## Returns * `{:ok, %Googly.CloudStorage.Model.Bucket{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec get(String.t(), keyword()) :: {:ok, Googly.CloudStorage.Model.Bucket.t()} | {:error, term()} def get(bucket, opts \\ []) do Request.run( method: :get, url: "/storage/v1/b/{bucket}", path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)}, query: [], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, generation: {:query, "generation"}, if_metageneration_match: {:query, "ifMetagenerationMatch"}, if_metageneration_not_match: {:query, "ifMetagenerationNotMatch"}, projection: {:query, "projection"}, soft_deleted: {:query, "softDeleted"}, user_project: {:query, "userProject"} }, decode: Googly.CloudStorage.Model.Bucket, opts: opts ) end @doc """ Returns an IAM policy for the specified bucket. ## Parameters * `bucket` (*type:* `String.t()`) - Name of a bucket. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `options_requested_policy_version` (*type:* `integer()`) - The IAM policy format version to be returned. If the optionsRequestedPolicyVersion is for an older version that doesn't support part of the requested IAM policy, the request fails. * `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets. ## Returns * `{:ok, %Googly.CloudStorage.Model.Policy{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec get_iam_policy(String.t(), keyword()) :: {:ok, Googly.CloudStorage.Model.Policy.t()} | {:error, term()} def get_iam_policy(bucket, opts \\ []) do Request.run( method: :get, url: "/storage/v1/b/{bucket}/iam", path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)}, query: [], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, options_requested_policy_version: {:query, "optionsRequestedPolicyVersion"}, user_project: {:query, "userProject"} }, decode: Googly.CloudStorage.Model.Policy, opts: opts ) end @doc """ Returns the storage layout configuration for the specified bucket. Note that this operation requires storage.objects.list permission. ## Parameters * `bucket` (*type:* `String.t()`) - Name of a bucket. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `prefix` (*type:* `String.t()`) - An optional prefix used for permission check. It is useful when the caller only has storage.objects.list permission under a specific prefix. ## Returns * `{:ok, %Googly.CloudStorage.Model.BucketStorageLayout{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec get_storage_layout(String.t(), keyword()) :: {:ok, Googly.CloudStorage.Model.BucketStorageLayout.t()} | {:error, term()} def get_storage_layout(bucket, opts \\ []) do Request.run( method: :get, url: "/storage/v1/b/{bucket}/storageLayout", path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)}, query: [], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, prefix: {:query, "prefix"} }, decode: Googly.CloudStorage.Model.BucketStorageLayout, opts: opts ) end @doc """ Creates a new bucket. ## Parameters * `project` (*type:* `String.t()`) - A valid API project identifier. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `enable_object_retention` (*type:* `boolean()`) - When set to true, object retention is enabled for this bucket. * `predefined_acl` (*type:* `String.t()`) - Apply a predefined set of access controls to this bucket. * `predefined_default_object_acl` (*type:* `String.t()`) - Apply a predefined set of default object access controls to this bucket. * `projection` (*type:* `String.t()`) - Set of properties to return. Defaults to noAcl, unless the bucket resource specifies acl or defaultObjectAcl properties, when it defaults to full. * `user_project` (*type:* `String.t()`) - The project to be billed for this request. * `body` (*type:* `Googly.CloudStorage.Model.Bucket.t()`) - ## Returns * `{:ok, %Googly.CloudStorage.Model.Bucket{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec insert(String.t(), keyword()) :: {:ok, Googly.CloudStorage.Model.Bucket.t()} | {:error, term()} def insert(project, opts \\ []) do Request.run( method: :post, url: "/storage/v1/b", path_params: %{}, query: [{"project", project}], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, enable_object_retention: {:query, "enableObjectRetention"}, predefined_acl: {:query, "predefinedAcl"}, predefined_default_object_acl: {:query, "predefinedDefaultObjectAcl"}, projection: {:query, "projection"}, user_project: {:query, "userProject"}, body: {:body, nil} }, decode: Googly.CloudStorage.Model.Bucket, opts: opts ) end @doc """ Retrieves a list of buckets for a given project. ## Parameters * `project` (*type:* `String.t()`) - A valid API project identifier. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `max_results` (*type:* `integer()`) - Maximum number of buckets to return in a single response. The service will use this parameter or 1,000 items, whichever is smaller. * `page_token` (*type:* `String.t()`) - A previously-returned page token representing part of the larger set of results to view. * `prefix` (*type:* `String.t()`) - Filter results to buckets whose names begin with this prefix. * `projection` (*type:* `String.t()`) - Set of properties to return. Defaults to noAcl. * `return_partial_success` (*type:* `boolean()`) - If true, return a list of bucket resource names for buckets that are in unreachable locations. * `soft_deleted` (*type:* `boolean()`) - If true, only soft-deleted bucket versions will be returned. The default is false. For more information, see [Soft Delete](https://cloud.google.com/storage/docs/soft-delete). * `user_project` (*type:* `String.t()`) - The project to be billed for this request. ## Returns * `{:ok, %Googly.CloudStorage.Model.Buckets{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec list(String.t(), keyword()) :: {:ok, Googly.CloudStorage.Model.Buckets.t()} | {:error, term()} def list(project, opts \\ []) do Request.run( method: :get, url: "/storage/v1/b", path_params: %{}, query: [{"project", project}], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, max_results: {:query, "maxResults"}, page_token: {:query, "pageToken"}, prefix: {:query, "prefix"}, projection: {:query, "projection"}, return_partial_success: {:query, "returnPartialSuccess"}, soft_deleted: {:query, "softDeleted"}, user_project: {:query, "userProject"} }, decode: Googly.CloudStorage.Model.Buckets, opts: opts ) end @doc """ Locks retention policy on a bucket. ## Parameters * `bucket` (*type:* `String.t()`) - Name of a bucket. * `if_metageneration_match` (*type:* `String.t()`) - Makes the operation conditional on whether bucket's current metageneration matches the given value. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets. ## Returns * `{:ok, %Googly.CloudStorage.Model.Bucket{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec lock_retention_policy(String.t(), String.t(), keyword()) :: {:ok, Googly.CloudStorage.Model.Bucket.t()} | {:error, term()} def lock_retention_policy(bucket, if_metageneration_match, opts \\ []) do Request.run( method: :post, url: "/storage/v1/b/{bucket}/lockRetentionPolicy", path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)}, query: [{"ifMetagenerationMatch", if_metageneration_match}], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, user_project: {:query, "userProject"} }, decode: Googly.CloudStorage.Model.Bucket, opts: opts ) end @doc """ Patches a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. ## Parameters * `bucket` (*type:* `String.t()`) - Name of a bucket. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `if_metageneration_match` (*type:* `String.t()`) - Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value. * `if_metageneration_not_match` (*type:* `String.t()`) - Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value. * `predefined_acl` (*type:* `String.t()`) - Apply a predefined set of access controls to this bucket. * `predefined_default_object_acl` (*type:* `String.t()`) - Apply a predefined set of default object access controls to this bucket. * `projection` (*type:* `String.t()`) - Set of properties to return. Defaults to full. * `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets. * `body` (*type:* `Googly.CloudStorage.Model.Bucket.t()`) - ## Returns * `{:ok, %Googly.CloudStorage.Model.Bucket{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec patch(String.t(), keyword()) :: {:ok, Googly.CloudStorage.Model.Bucket.t()} | {:error, term()} def patch(bucket, opts \\ []) do Request.run( method: :patch, url: "/storage/v1/b/{bucket}", path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)}, query: [], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, if_metageneration_match: {:query, "ifMetagenerationMatch"}, if_metageneration_not_match: {:query, "ifMetagenerationNotMatch"}, predefined_acl: {:query, "predefinedAcl"}, predefined_default_object_acl: {:query, "predefinedDefaultObjectAcl"}, projection: {:query, "projection"}, user_project: {:query, "userProject"}, body: {:body, nil} }, decode: Googly.CloudStorage.Model.Bucket, opts: opts ) end @doc """ Initiates a long-running Relocate Bucket operation on the specified bucket. ## Parameters * `bucket` (*type:* `String.t()`) - Name of the bucket to be moved. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `body` (*type:* `Googly.CloudStorage.Model.RelocateBucketRequest.t()`) - ## Returns * `{:ok, %Googly.CloudStorage.Model.GoogleLongrunningOperation{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec relocate(String.t(), keyword()) :: {:ok, Googly.CloudStorage.Model.GoogleLongrunningOperation.t()} | {:error, term()} def relocate(bucket, opts \\ []) do Request.run( method: :post, url: "/storage/v1/b/{bucket}/relocate", path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)}, query: [], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, body: {:body, nil} }, decode: Googly.CloudStorage.Model.GoogleLongrunningOperation, opts: opts ) end @doc """ Restores a soft-deleted bucket. ## Parameters * `bucket` (*type:* `String.t()`) - Name of a bucket. * `generation` (*type:* `String.t()`) - Generation of a bucket. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `projection` (*type:* `String.t()`) - Set of properties to return. Defaults to full. * `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets. ## Returns * `{:ok, %Googly.CloudStorage.Model.Bucket{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec restore(String.t(), String.t(), keyword()) :: {:ok, Googly.CloudStorage.Model.Bucket.t()} | {:error, term()} def restore(bucket, generation, opts \\ []) do Request.run( method: :post, url: "/storage/v1/b/{bucket}/restore", path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)}, query: [{"generation", generation}], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, projection: {:query, "projection"}, user_project: {:query, "userProject"} }, decode: Googly.CloudStorage.Model.Bucket, opts: opts ) end @doc """ Updates an IAM policy for the specified bucket. ## Parameters * `bucket` (*type:* `String.t()`) - Name of a bucket. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets. * `body` (*type:* `Googly.CloudStorage.Model.Policy.t()`) - ## Returns * `{:ok, %Googly.CloudStorage.Model.Policy{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec set_iam_policy(String.t(), keyword()) :: {:ok, Googly.CloudStorage.Model.Policy.t()} | {:error, term()} def set_iam_policy(bucket, opts \\ []) do Request.run( method: :put, url: "/storage/v1/b/{bucket}/iam", path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)}, query: [], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, user_project: {:query, "userProject"}, body: {:body, nil} }, decode: Googly.CloudStorage.Model.Policy, opts: opts ) end @doc """ Tests a set of permissions on the given bucket to see which, if any, are held by the caller. ## Parameters * `bucket` (*type:* `String.t()`) - Name of a bucket. * `permissions` (*type:* `list(String.t())`) - Permissions to test. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets. ## Returns * `{:ok, %Googly.CloudStorage.Model.TestIamPermissionsResponse{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec test_iam_permissions(String.t(), list(String.t()), keyword()) :: {:ok, Googly.CloudStorage.Model.TestIamPermissionsResponse.t()} | {:error, term()} def test_iam_permissions(bucket, permissions, opts \\ []) do Request.run( method: :get, url: "/storage/v1/b/{bucket}/iam/testPermissions", path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)}, query: [{"permissions", permissions}], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, user_project: {:query, "userProject"} }, decode: Googly.CloudStorage.Model.TestIamPermissionsResponse, opts: opts ) end @doc """ Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. ## Parameters * `bucket` (*type:* `String.t()`) - Name of a bucket. * `opts` (*type:* `keyword()`) - Query and call options (`:token`, plus any of the below) * `alt` (*type:* `String.t()`) - Data format for the response. * `fields` (*type:* `String.t()`) - Selector specifying which fields to include in a partial response. * `key` (*type:* `String.t()`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. * `oauth_token` (*type:* `String.t()`) - OAuth 2.0 token for the current user. * `pretty_print` (*type:* `boolean()`) - Returns response with indentations and line breaks. * `quota_user` (*type:* `String.t()`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. * `upload_type` (*type:* `String.t()`) - Upload protocol for media (e.g. "media", "multipart", "resumable"). * `user_ip` (*type:* `String.t()`) - Deprecated. Please use quotaUser instead. * `if_metageneration_match` (*type:* `String.t()`) - Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value. * `if_metageneration_not_match` (*type:* `String.t()`) - Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value. * `predefined_acl` (*type:* `String.t()`) - Apply a predefined set of access controls to this bucket. * `predefined_default_object_acl` (*type:* `String.t()`) - Apply a predefined set of default object access controls to this bucket. * `projection` (*type:* `String.t()`) - Set of properties to return. Defaults to full. * `user_project` (*type:* `String.t()`) - The project to be billed for this request. Required for Requester Pays buckets. * `body` (*type:* `Googly.CloudStorage.Model.Bucket.t()`) - ## Returns * `{:ok, %Googly.CloudStorage.Model.Bucket{}}` on success * `{:error, %Googly.CloudStorage.Error{}}` on failure """ @spec update(String.t(), keyword()) :: {:ok, Googly.CloudStorage.Model.Bucket.t()} | {:error, term()} def update(bucket, opts \\ []) do Request.run( method: :put, url: "/storage/v1/b/{bucket}", path_params: %{"bucket" => URI.encode(bucket, &URI.char_unreserved?/1)}, query: [], params: %{ alt: {:query, "alt"}, fields: {:query, "fields"}, key: {:query, "key"}, oauth_token: {:query, "oauth_token"}, pretty_print: {:query, "prettyPrint"}, quota_user: {:query, "quotaUser"}, upload_type: {:query, "uploadType"}, user_ip: {:query, "userIp"}, if_metageneration_match: {:query, "ifMetagenerationMatch"}, if_metageneration_not_match: {:query, "ifMetagenerationNotMatch"}, predefined_acl: {:query, "predefinedAcl"}, predefined_default_object_acl: {:query, "predefinedDefaultObjectAcl"}, projection: {:query, "projection"}, user_project: {:query, "userProject"}, body: {:body, nil} }, decode: Googly.CloudStorage.Model.Bucket, opts: opts ) end end