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 managed_folders.ex
Raw

lib/googly/cloud_storage/managed_folders.ex

# NOTE: This file is auto generated by googly. Do not edit it manually.
defmodule Googly.CloudStorage.ManagedFolders do
@moduledoc """
Endpoints for the `ManagedFolders` resource.
"""
alias Googly.CloudStorage.Request
@doc """
Permanently deletes a managed folder.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket containing the managed folder.
* `managed_folder` (*type:* `String.t()`) - The managed folder name/path.
* `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.
* `allow_non_empty` (*type:* `boolean()`) - Allows the deletion of a managed folder even if it is not empty. A managed folder is empty if there are no objects or managed folders that it applies to. Callers must have storage.managedFolders.setIamPolicy permission.
* `if_metageneration_match` (*type:* `String.t()`) - If set, only deletes the managed folder if its metageneration matches this value.
* `if_metageneration_not_match` (*type:* `String.t()`) - If set, only deletes the managed 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, managed_folder, opts \\ []) do
Request.run(
method: :delete,
url: "/storage/v1/b/{bucket}/managedFolders/{managedFolder}",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"managedFolder" => URI.encode(managed_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"},
allow_non_empty: {:query, "allowNonEmpty"},
if_metageneration_match: {:query, "ifMetagenerationMatch"},
if_metageneration_not_match: {:query, "ifMetagenerationNotMatch"}
},
decode: nil,
opts: opts
)
end
@doc """
Returns metadata of the specified managed folder.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket containing the managed folder.
* `managed_folder` (*type:* `String.t()`) - The managed folder name/path.
* `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 managed folder metadata conditional on whether the managed folder's current metageneration matches the given value.
* `if_metageneration_not_match` (*type:* `String.t()`) - Makes the return of the managed folder metadata conditional on whether the managed folder's current metageneration does not match the given value.
## Returns
* `{:ok, %Googly.CloudStorage.Model.ManagedFolder{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec get(String.t(), String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.ManagedFolder.t()} | {:error, term()}
def get(bucket, managed_folder, opts \\ []) do
Request.run(
method: :get,
url: "/storage/v1/b/{bucket}/managedFolders/{managedFolder}",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"managedFolder" => URI.encode(managed_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.ManagedFolder,
opts: opts
)
end
@doc """
Returns an IAM policy for the specified managed folder.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket containing the managed folder.
* `managed_folder` (*type:* `String.t()`) - The managed folder name/path.
* `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(), String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.Policy.t()} | {:error, term()}
def get_iam_policy(bucket, managed_folder, opts \\ []) do
Request.run(
method: :get,
url: "/storage/v1/b/{bucket}/managedFolders/{managedFolder}/iam",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"managedFolder" => URI.encode(managed_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"},
options_requested_policy_version: {:query, "optionsRequestedPolicyVersion"},
user_project: {:query, "userProject"}
},
decode: Googly.CloudStorage.Model.Policy,
opts: opts
)
end
@doc """
Creates a new managed folder.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket containing the managed 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.
* `body` (*type:* `Googly.CloudStorage.Model.ManagedFolder.t()`) -
## Returns
* `{:ok, %Googly.CloudStorage.Model.ManagedFolder{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec insert(String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.ManagedFolder.t()} | {:error, term()}
def insert(bucket, opts \\ []) do
Request.run(
method: :post,
url: "/storage/v1/b/{bucket}/managedFolders",
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.ManagedFolder,
opts: opts
)
end
@doc """
Lists managed folders in the given bucket.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket containing the managed 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.
* `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()`) - The managed folder name/path prefix to filter the output list of results.
## Returns
* `{:ok, %Googly.CloudStorage.Model.ManagedFolders{}}` on success
* `{:error, %Googly.CloudStorage.Error{}}` on failure
"""
@spec list(String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.ManagedFolders.t()} | {:error, term()}
def list(bucket, opts \\ []) do
Request.run(
method: :get,
url: "/storage/v1/b/{bucket}/managedFolders",
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"},
page_size: {:query, "pageSize"},
page_token: {:query, "pageToken"},
prefix: {:query, "prefix"}
},
decode: Googly.CloudStorage.Model.ManagedFolders,
opts: opts
)
end
@doc """
Updates an IAM policy for the specified managed folder.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket containing the managed folder.
* `managed_folder` (*type:* `String.t()`) - The managed folder name/path.
* `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(), String.t(), keyword()) ::
{:ok, Googly.CloudStorage.Model.Policy.t()} | {:error, term()}
def set_iam_policy(bucket, managed_folder, opts \\ []) do
Request.run(
method: :put,
url: "/storage/v1/b/{bucket}/managedFolders/{managedFolder}/iam",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"managedFolder" => URI.encode(managed_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"},
user_project: {:query, "userProject"},
body: {:body, nil}
},
decode: Googly.CloudStorage.Model.Policy,
opts: opts
)
end
@doc """
Tests a set of permissions on the given managed folder to see which, if any, are held by the caller.
## Parameters
* `bucket` (*type:* `String.t()`) - Name of the bucket containing the managed folder.
* `managed_folder` (*type:* `String.t()`) - The managed folder name/path.
* `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(), String.t(), list(String.t()), keyword()) ::
{:ok, Googly.CloudStorage.Model.TestIamPermissionsResponse.t()} | {:error, term()}
def test_iam_permissions(bucket, managed_folder, permissions, opts \\ []) do
Request.run(
method: :get,
url: "/storage/v1/b/{bucket}/managedFolders/{managedFolder}/iam/testPermissions",
path_params: %{
"bucket" => URI.encode(bucket, &URI.char_unreserved?/1),
"managedFolder" => URI.encode(managed_folder, &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
end