Googly.CloudStorage.Folders (googly_cloud_storage v0.1.0)

Copy Markdown View Source

Endpoints for the Folders resource.

Summary

Functions

Permanently deletes a folder. Only applicable to buckets with hierarchical namespace enabled.

Deletes a folder recursively. Only applicable to buckets with hierarchical namespace enabled.

Returns metadata for the specified folder. Only applicable to buckets with hierarchical namespace enabled.

Creates a new folder. Only applicable to buckets with hierarchical namespace enabled.

Retrieves a list of folders matching the criteria. Only applicable to buckets with hierarchical namespace enabled.

Renames a source folder to a destination folder. Only applicable to buckets with hierarchical namespace enabled.

Functions

delete(bucket, folder, opts \\ [])

@spec delete(String.t(), String.t(), keyword()) ::
  {:ok, Req.Response.t()} | {:error, term()}

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

delete_recursive(bucket, folder, opts \\ [])

@spec delete_recursive(String.t(), String.t(), keyword()) ::
  {:ok, Googly.CloudStorage.Model.GoogleLongrunningOperation.t()}
  | {:error, term()}

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

get(bucket, folder, opts \\ [])

@spec get(String.t(), String.t(), keyword()) ::
  {:ok, Googly.CloudStorage.Model.Folder.t()} | {:error, term()}

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

insert(bucket, opts \\ [])

@spec insert(
  String.t(),
  keyword()
) :: {:ok, Googly.CloudStorage.Model.Folder.t()} | {:error, term()}

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

list(bucket, opts \\ [])

@spec list(
  String.t(),
  keyword()
) :: {:ok, Googly.CloudStorage.Model.Folders.t()} | {:error, term()}

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

rename(bucket, source_folder, destination_folder, opts \\ [])

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