Close httplib2 connections.
delete(bucket, folder, ifMetagenerationMatch=None, ifMetagenerationNotMatch=None)
Permanently deletes a folder. Only applicable to buckets with hierarchical namespace enabled.
get(bucket, folder, ifMetagenerationMatch=None, ifMetagenerationNotMatch=None)
Returns metadata for the specified folder. Only applicable to buckets with hierarchical namespace enabled.
insert(bucket, body=None, recursive=None)
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.
Retrieves the next page of results.
Renames a source folder to a destination folder. Only applicable to buckets with hierarchical namespace enabled.
close()
Close httplib2 connections.
delete(bucket, folder, ifMetagenerationMatch=None, ifMetagenerationNotMatch=None)
Permanently deletes a folder. Only applicable to buckets with hierarchical namespace enabled. Args: bucket: string, Name of the bucket in which the folder resides. (required) folder: string, Name of a folder. (required) ifMetagenerationMatch: string, If set, only deletes the folder if its metageneration matches this value. ifMetagenerationNotMatch: string, If set, only deletes the folder if its metageneration does not match this value.
get(bucket, folder, ifMetagenerationMatch=None, ifMetagenerationNotMatch=None)
Returns metadata for the specified folder. Only applicable to buckets with hierarchical namespace enabled. Args: bucket: string, Name of the bucket in which the folder resides. (required) folder: string, Name of a folder. (required) ifMetagenerationMatch: string, Makes the return of the folder metadata conditional on whether the folder's current metageneration matches the given value. ifMetagenerationNotMatch: string, Makes the return of the folder metadata conditional on whether the folder's current metageneration does not match the given value. Returns: An object of the form: { # A folder. Only available in buckets with hierarchical namespace enabled. "bucket": "A String", # The name of the bucket containing this folder. "createTime": "A String", # The creation time of the folder in RFC 3339 format. "id": "A String", # The ID of the folder, including the bucket name, folder name. "kind": "storage#folder", # The kind of item this is. For folders, this is always storage#folder. "metageneration": "A String", # The version of the metadata for this folder. Used for preconditions and for detecting changes in metadata. "name": "A String", # The name of the folder. Required if not specified by URL parameter. "pendingRenameInfo": { # Only present if the folder is part of an ongoing rename folder operation. Contains information which can be used to query the operation status. "operationId": "A String", # The ID of the rename folder operation. }, "selfLink": "A String", # The link to this folder. "updateTime": "A String", # The modification time of the folder metadata in RFC 3339 format. }
insert(bucket, body=None, recursive=None)
Creates a new folder. Only applicable to buckets with hierarchical namespace enabled. Args: bucket: string, Name of the bucket in which the folder resides. (required) body: object, The request body. The object takes the form of: { # A folder. Only available in buckets with hierarchical namespace enabled. "bucket": "A String", # The name of the bucket containing this folder. "createTime": "A String", # The creation time of the folder in RFC 3339 format. "id": "A String", # The ID of the folder, including the bucket name, folder name. "kind": "storage#folder", # The kind of item this is. For folders, this is always storage#folder. "metageneration": "A String", # The version of the metadata for this folder. Used for preconditions and for detecting changes in metadata. "name": "A String", # The name of the folder. Required if not specified by URL parameter. "pendingRenameInfo": { # Only present if the folder is part of an ongoing rename folder operation. Contains information which can be used to query the operation status. "operationId": "A String", # The ID of the rename folder operation. }, "selfLink": "A String", # The link to this folder. "updateTime": "A String", # The modification time of the folder metadata in RFC 3339 format. } recursive: boolean, If true, any parent folder which doesn’t exist will be created automatically. Returns: An object of the form: { # A folder. Only available in buckets with hierarchical namespace enabled. "bucket": "A String", # The name of the bucket containing this folder. "createTime": "A String", # The creation time of the folder in RFC 3339 format. "id": "A String", # The ID of the folder, including the bucket name, folder name. "kind": "storage#folder", # The kind of item this is. For folders, this is always storage#folder. "metageneration": "A String", # The version of the metadata for this folder. Used for preconditions and for detecting changes in metadata. "name": "A String", # The name of the folder. Required if not specified by URL parameter. "pendingRenameInfo": { # Only present if the folder is part of an ongoing rename folder operation. Contains information which can be used to query the operation status. "operationId": "A String", # The ID of the rename folder operation. }, "selfLink": "A String", # The link to this folder. "updateTime": "A String", # The modification time of the folder metadata in RFC 3339 format. }
list(bucket, delimiter=None, endOffset=None, pageSize=None, pageToken=None, prefix=None, startOffset=None)
Retrieves a list of folders matching the criteria. Only applicable to buckets with hierarchical namespace enabled. Args: bucket: string, Name of the bucket in which to look for folders. (required) delimiter: string, 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. endOffset: string, 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). pageSize: integer, Maximum number of items to return in a single page of responses. pageToken: string, A previously-returned page token representing part of the larger set of results to view. prefix: string, Filter results to folders whose paths begin with this prefix. If set, the value must either be an empty string or end with a '/'. startOffset: string, 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: An object of the form: { # A list of folders. "items": [ # The list of items. { # A folder. Only available in buckets with hierarchical namespace enabled. "bucket": "A String", # The name of the bucket containing this folder. "createTime": "A String", # The creation time of the folder in RFC 3339 format. "id": "A String", # The ID of the folder, including the bucket name, folder name. "kind": "storage#folder", # The kind of item this is. For folders, this is always storage#folder. "metageneration": "A String", # The version of the metadata for this folder. Used for preconditions and for detecting changes in metadata. "name": "A String", # The name of the folder. Required if not specified by URL parameter. "pendingRenameInfo": { # Only present if the folder is part of an ongoing rename folder operation. Contains information which can be used to query the operation status. "operationId": "A String", # The ID of the rename folder operation. }, "selfLink": "A String", # The link to this folder. "updateTime": "A String", # The modification time of the folder metadata in RFC 3339 format. }, ], "kind": "storage#folders", # The kind of item this is. For lists of folders, this is always storage#folders. "nextPageToken": "A String", # The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results. }
list_next()
Retrieves the next page of results. Args: previous_request: The request for the previous page. (required) previous_response: The response from the request for the previous page. (required) Returns: A request object that you can call 'execute()' on to request the next page. Returns None if there are no more items in the collection.
rename(bucket, sourceFolder, destinationFolder, ifSourceMetagenerationMatch=None, ifSourceMetagenerationNotMatch=None)
Renames a source folder to a destination folder. Only applicable to buckets with hierarchical namespace enabled. Args: bucket: string, Name of the bucket in which the folders are in. (required) sourceFolder: string, Name of the source folder. (required) destinationFolder: string, Name of the destination folder. (required) ifSourceMetagenerationMatch: string, Makes the operation conditional on whether the source object's current metageneration matches the given value. ifSourceMetagenerationNotMatch: string, Makes the operation conditional on whether the source object's current metageneration does not match the given value. Returns: An object of the form: { # This resource represents a long-running operation that is the result of a network API call. "done": True or False, # If the value is "false", it means the operation is still in progress. If "true", the operation is completed, and either "error" or "response" is available. "error": { # The "Status" type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each "Status" message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). # The error result of the operation in case of failure or cancellation. "code": 42, # The status code, which should be an enum value of google.rpc.Code. "details": [ # A list of messages that carry the error details. There is a common set of message types for APIs to use. { "a_key": "", # Properties of the object. Contains field @type with type URL. }, ], "message": "A String", # A developer-facing error message, which should be in English. }, "kind": "storage#operation", # The kind of item this is. For operations, this is always storage#operation. "metadata": { # Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. "a_key": "", # Properties of the object. Contains field @type with type URL. }, "name": "A String", # The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the "name" should be a resource name ending with "operations/{operationId}". "response": { # The normal response of the operation in case of success. If the original method returns no data on success, such as "Delete", the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type "XxxResponse", where "Xxx" is the original method name. For example, if the original method name is "TakeSnapshot()", the inferred response type is "TakeSnapshotResponse". "a_key": "", # Properties of the object. Contains field @type with type URL. }, "selfLink": "A String", # The link to this long running operation. }