AzureStor (version 3.4.0)

do_container_op: Carry out operations on a storage account container or endpoint

Description

Carry out operations on a storage account container or endpoint

Usage

do_container_op(container, operation = "", options = list(),
  headers = list(), http_verb = "GET", ...)

call_storage_endpoint(endpoint, path, options = list(), headers = list(), body = NULL, ..., http_verb = c("GET", "DELETE", "PUT", "POST", "HEAD", "PATCH"), http_status_handler = c("stop", "warn", "message", "pass"), timeout = getOption("azure_storage_timeout"), progress = NULL, return_headers = (http_verb == "HEAD"))

Arguments

container, endpoint

For do_container_op, a storage container object (inheriting from storage_container). For call_storage_endpoint, a storage endpoint object (inheriting from storage_endpoint).

operation

The container operation to perform, which will form part of the URL path.

options

A named list giving the query parameters for the operation.

headers

A named list giving any additional HTTP headers to send to the host. Note that AzureStor will handle authentication details, so you don't have to specify these here.

http_verb

The HTTP verb as a string, one of GET, DELETE, PUT, POST, HEAD or PATCH.

...

Any additional arguments to pass to httr::VERB.

path

The path component of the endpoint call.

body

The request body for a PUT/POST/PATCH call.

http_status_handler

The R handler for the HTTP status code of the response. "stop", "warn" or "message" will call the corresponding handlers in httr, while "pass" ignores the status code. The latter is primarily useful for debugging purposes.

timeout

Optionally, the number of seconds to wait for a result. If the timeout interval elapses before the storage service has finished processing the operation, it returns an error. The default timeout is taken from the system option azure_storage_timeout; if this is NULL it means to use the service default.

progress

Used by the file transfer functions, to display a progress bar.

return_headers

Whether to return the (parsed) response headers, rather than the body. Ignored if http_status_handler="pass".

Value

Based on the http_status_handler and return_headers arguments. If http_status_handler is "pass", the entire response is returned without modification.

If http_status_handler is one of "stop", "warn" or "message", the status code of the response is checked, and if an error is not thrown, the parsed headers or body of the response is returned. An exception is if the response was written to disk, as part of a file download; in this case, the return value is NULL.

Details

These functions form the low-level interface between R and the storage API. do_container_op constructs a path from the operation and the container name, and passes it and the other arguments to call_storage_endpoint.

See Also

blob_endpoint, file_endpoint, adls_endpoint

blob_container, file_share, adls_filesystem

httr::GET, httr::PUT, httr::POST, httr::PATCH, httr::HEAD, httr::DELETE

Examples

Run this code
# NOT RUN {
# get the metadata for a blob
bl_endp <- blob_endpoint("storage_acct_url", key="key")
cont <- storage_container(bl_endp, "containername")
do_container_op(cont, "filename.txt", options=list(comp="metadata"), http_verb="HEAD")

# }

Run the code above in your browser using DataLab