AzureStor (version 3.4.0)

blob_container: Operations on a blob endpoint

Description

Get, list, create, or delete blob containers.

Usage

blob_container(endpoint, ...)

# S3 method for character blob_container(endpoint, key = NULL, token = NULL, sas = NULL, api_version = getOption("azure_storage_api_version"), ...)

# S3 method for blob_endpoint blob_container(endpoint, name, ...)

# S3 method for blob_container print(x, ...)

list_blob_containers(endpoint, ...)

# S3 method for character list_blob_containers(endpoint, key = NULL, token = NULL, sas = NULL, api_version = getOption("azure_storage_api_version"), ...)

# S3 method for blob_endpoint list_blob_containers(endpoint, ...)

create_blob_container(endpoint, ...)

# S3 method for character create_blob_container(endpoint, key = NULL, token = NULL, sas = NULL, api_version = getOption("azure_storage_api_version"), ...)

# S3 method for blob_container create_blob_container(endpoint, ...)

# S3 method for blob_endpoint create_blob_container(endpoint, name, public_access = c("none", "blob", "container"), ...)

delete_blob_container(endpoint, ...)

# S3 method for character delete_blob_container(endpoint, key = NULL, token = NULL, sas = NULL, api_version = getOption("azure_storage_api_version"), ...)

# S3 method for blob_container delete_blob_container(endpoint, ...)

# S3 method for blob_endpoint delete_blob_container(endpoint, name, confirm = TRUE, lease = NULL, ...)

Arguments

endpoint

Either a blob endpoint object as created by storage_endpoint, or a character string giving the URL of the endpoint.

...

Further arguments passed to lower-level functions.

key, token, sas

If an endpoint object is not supplied, authentication credentials: either an access key, an Azure Active Directory (AAD) token, or a SAS, in that order of priority. If no authentication credentials are provided, only public (anonymous) access to the share is possible.

api_version

If an endpoint object is not supplied, the storage API version to use when interacting with the host. Currently defaults to "2019-07-07".

name

The name of the blob container to get, create, or delete.

x

For the print method, a blob container object.

public_access

For creating a container, the level of public access to allow.

confirm

For deleting a container, whether to ask for confirmation.

lease

For deleting a leased container, the lease ID.

Value

For blob_container and create_blob_container, an S3 object representing an existing or created container respectively.

For list_blob_containers, a list of such objects.

Details

You can call these functions in a couple of ways: by passing the full URL of the share, or by passing the endpoint object and the name of the container as a string.

If authenticating via AAD, you can supply the token either as a string, or as an object of class AzureToken, created via AzureRMR::get_azure_token. The latter is the recommended way of doing it, as it allows for automatic refreshing of expired tokens.

See Also

storage_endpoint, az_storage, storage_container

Examples

Run this code
# NOT RUN {
endp <- blob_endpoint("https://mystorage.blob.core.windows.net/", key="access_key")

# list containers
list_blob_containers(endp)

# get, create, and delete a container
blob_container(endp, "mycontainer")
create_blob_container(endp, "newcontainer")
delete_blob_container(endp, "newcontainer")

# alternative way to do the same
blob_container("https://mystorage.blob.core.windows.net/mycontainer", key="access_key")
create_blob_container("https://mystorage.blob.core.windows.net/newcontainer", key="access_key")
delete_blob_container("https://mystorage.blob.core.windows.net/newcontainer", key="access_key")

# authenticating via AAD
token <- AzureRMR::get_azure_token(resource="https://storage.azure.com/",
    tenant="myaadtenant",
    app="myappid",
    password="mypassword")
blob_container("https://mystorage.blob.core.windows.net/mycontainer", token=token)

# }

Run the code above in your browser using DataLab