Packages

Google Cloud Storage JSON API client library. Stores and retrieves potentially large, immutable data objects.

Current section

Files

Jump to
googly_cloud_storage lib googly cloud_storage folders.ex
Raw

lib/googly/cloud_storage/folders.ex

# NOTE: This file is auto generated by googly. Do not edit it manually.
defmodule Googly.CloudStorage.Folders do
@moduledoc """
Endpoints for the `Folders` resource.
"""
alias Googly.CloudStorage.Request
@doc """
Permanently deletes a folder. Only applicable to buckets with hierarchical namespace enabled.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket in which the folder resides.
* `folder` (*type:* `String.t()`) - Name of a folder.
* `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 folder if its metageneration matches this value.
* `if_metageneration_not_match` (*type:* `String.t()`) - If set, only deletes the folder if its metageneration does not match this value.
## Returns
* `{:ok, Req.Response.t()}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec delete(String.t(), String.t(), keyword()) :: {:ok, Req.Response.t()} | {:error, term()}
def delete(bucket, folder, opts \\ []) do
Request.run(
method: :delete,
url: "/storage/v1/b/{bucket}/folders/{folder}",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"folder" => URI.encode(folder, &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"}
},
decode: nil,
opts: opts
)
end
@doc """
Deletes a folder recursively. Only applicable to buckets with hierarchical namespace enabled.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket in which the folder resides.
* `folder` (*type:* `String.t()`) - Name of a folder.
* `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 folder if its metageneration matches this value.
* `if_metageneration_not_match` (*type:* `String.t()`) - If set, only deletes the folder if its metageneration does not match this value.
## Returns
* `{:ok, %Googly.CloudStorage.Model.GoogleLongrunningOperation{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec delete_recursive(String.t(), String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.GoogleLongrunningOperation.t()} | {:error, term()}
def delete_recursive(bucket, folder, opts \\ []) do
Request.run(
method: :post,
url: "/storage/v1/b/{bucket}/folders/{folder}/deleteRecursive",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"folder" => URI.encode(folder, &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"}
},
decode: Googly.CloudStorage.Model.GoogleLongrunningOperation,
opts: opts
)
end
@doc """
Returns metadata for the specified folder. Only applicable to buckets with hierarchical namespace enabled.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket in which the folder resides.
* `folder` (*type:* `String.t()`) - Name of a folder.
* `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 folder metadata conditional on whether the folder's current metageneration matches the given value.
* `if_metageneration_not_match` (*type:* `String.t()`) - Makes the return of the folder metadata conditional on whether the folder's current metageneration does not match the given value.
## Returns
* `{:ok, %Googly.CloudStorage.Model.Folder{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec get(String.t(), String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.Folder.t()} | {:error, term()}
def get(bucket, folder, opts \\ []) do
Request.run(
method: :get,
url: "/storage/v1/b/{bucket}/folders/{folder}",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"folder" => URI.encode(folder, &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"}
},
decode: Googly.CloudStorage.Model.Folder,
opts: opts
)
end
@doc """
Creates a new folder. Only applicable to buckets with hierarchical namespace enabled.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket in which the folder resides.
* `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.
* `recursive` (*type:* `boolean()`) - If true, any parent folder which doesn't exist will be created automatically.
* `body` (*type:* `Googly.CloudStorage.Model.Folder.t()`) -
## Returns
* `{:ok, %Googly.CloudStorage.Model.Folder{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec insert(String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.Folder.t()} | {:error, term()}
def insert(bucket, opts \\ []) do
Request.run(
method: :post,
url: "/storage/v1/b/{bucket}/folders",
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"},
recursive: {:query, "recursive"},
body: {:body, nil}
},
decode: Googly.CloudStorage.Model.Folder,
opts: opts
)
end
@doc """
Retrieves a list of folders matching the criteria. Only applicable to buckets with hierarchical namespace enabled.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket in which to look for folders.
* `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.
* `delimiter` (*type:* `String.t()`) - Returns results in a directory-like mode. The only supported value is '/'. If set, items will only contain folders that either exactly match the prefix, or are one level below the prefix.
* `end_offset` (*type:* `String.t()`) - Filter results to folders whose names are lexicographically before endOffset. If startOffset is also set, the folders listed will have names between startOffset (inclusive) and endOffset (exclusive).
* `page_size` (*type:* `integer()`) - Maximum number of items to return in a single page of responses.
* `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 folders whose paths begin with this prefix. If set, the value must either be an empty string or end with a '/'.
* `start_offset` (*type:* `String.t()`) - Filter results to folders whose names are lexicographically equal to or after startOffset. If endOffset is also set, the folders listed will have names between startOffset (inclusive) and endOffset (exclusive).
## Returns
* `{:ok, %Googly.CloudStorage.Model.Folders{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec list(String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.Folders.t()} | {:error, term()}
def list(bucket, opts \\ []) do
Request.run(
method: :get,
url: "/storage/v1/b/{bucket}/folders",
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"},
delimiter: {:query, "delimiter"},
end_offset: {:query, "endOffset"},
page_size: {:query, "pageSize"},
page_token: {:query, "pageToken"},
prefix: {:query, "prefix"},
start_offset: {:query, "startOffset"}
},
decode: Googly.CloudStorage.Model.Folders,
opts: opts
)
end
@doc """
Renames a source folder to a destination folder. Only applicable to buckets with hierarchical namespace enabled.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket in which the folders are in.
* `source_folder` (*type:* `String.t()`) - Name of the source folder.
* `destination_folder` (*type:* `String.t()`) - Name of the destination folder.
* `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_source_metageneration_match` (*type:* `String.t()`) - Makes the operation conditional on whether the source object's current metageneration matches the given value.
* `if_source_metageneration_not_match` (*type:* `String.t()`) - Makes the operation conditional on whether the source object's current metageneration does not match the given value.
## Returns
* `{:ok, %Googly.CloudStorage.Model.GoogleLongrunningOperation{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec rename(String.t(), String.t(), String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.GoogleLongrunningOperation.t()} | {:error, term()}
def rename(bucket, source_folder, destination_folder, opts \\ []) do
Request.run(
method: :post,
url: "/storage/v1/b/{bucket}/folders/{sourceFolder}/renameTo/folders/{destinationFolder}",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"sourceFolder" => URI.encode(source_folder, &URI.char_unreserved?/1),
"destinationFolder" => URI.encode(destination_folder, &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_source_metageneration_match: {:query, "ifSourceMetagenerationMatch"},
if_source_metageneration_not_match: {:query, "ifSourceMetagenerationNotMatch"}
},
decode: Googly.CloudStorage.Model.GoogleLongrunningOperation,
opts: opts
)
end
end