AzureStor (version 3.4.0)

get_storage_metadata: Get/set user-defined metadata for a storage object

Description

Get/set user-defined metadata for a storage object

Usage

get_storage_metadata(object, ...)

# S3 method for blob_container get_storage_metadata(object, blob, ...)

# S3 method for file_share get_storage_metadata(object, file, isdir, ...)

# S3 method for adls_filesystem get_storage_metadata(object, file, ...)

set_storage_metadata(object, ...)

# S3 method for blob_container set_storage_metadata(object, blob, ..., keep_existing = TRUE)

# S3 method for file_share set_storage_metadata(object, file, isdir, ..., keep_existing = TRUE)

# S3 method for adls_filesystem set_storage_metadata(object, file, ..., keep_existing = TRUE)

Arguments

object

A blob container, file share or ADLS filesystem object.

...

For the metadata setters, name-value pairs to set as metadata for a blob or file.

blob, file

Optionally the name of an individual blob, file or directory within a container.

isdir

For the file share method, whether the file argument is a file or directory. If omitted, get_storage_metadata will auto-detect the type; however this can be slow, so supply this argument if possible.

keep_existing

For the metadata setters, whether to retain existing metadata information.

Value

get_storage_metadata returns a named list of metadata properties. If the blob or file argument is present, the properties will be for the blob/file specified. If this argument is omitted, the properties will be for the container itself.

set_storage_metadata returns the same list after setting the object's metadata, invisibly.

Details

These methods let you get and set user-defined properties (metadata) for storage objects.

See Also

blob_container, file_share, adls_filesystem

get_storage_properties for standard properties

Examples

Run this code
# NOT RUN {
fs <- storage_container("https://mystorage.dfs.core.windows.net/myshare", key="access_key")
create_storage_dir("newdir")
storage_upload(share, "iris.csv", "newdir/iris.csv")

set_storage_metadata(fs, "newdir/iris.csv", name1="value1")
# will be list(name1="value1")
get_storage_metadata(fs, "newdir/iris.csv")

set_storage_metadata(fs, "newdir/iris.csv", name2="value2")
# will be list(name1="value1", name2="value2")
get_storage_metadata(fs, "newdir/iris.csv")

set_storage_metadata(fs, "newdir/iris.csv", name3="value3", keep_existing=FALSE)
# will be list(name3="value3")
get_storage_metadata(fs, "newdir/iris.csv")

# deleting all metadata
set_storage_metadata(fs, "newdir/iris.csv", keep_existing=FALSE)

# }

Run the code above in your browser using DataLab