-
Notifications
You must be signed in to change notification settings - Fork 3
/
mc_anonymous.R
45 lines (40 loc) · 1.46 KB
/
mc_anonymous.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#' Set anonymous access policy
#'
#' This function uses the `mc` command to set the anonymous access policy for
#' a specified target.
#'
#' @param target Character string specifying the target cloud storage
#' bucket or object
#' @param policy Character string specifying the anonymous access policy.
#' Must be one of "download", "upload", "public" (upload and download),
#' or "private".
#' @inheritParams mc
#' @inherit mc return
#'
#' @examplesIf interactive()
#' # create a test bucket on the 'play' server
#' mc_mb("play/minioclient-test")
#'
#' # Set anonymous access policy to download
#' mc_anonymous_set("play/minioclient-test/file.txt", policy = "download")
#'
#' # Set anonymous access policy to upload
#' mc_anonymous_set("play/minioclient-test/directory", policy = "upload")
#'
#' # Set anonymous access policy to public
#' mc_anonymous_set("play/minioclient-test/file.txt", policy = "public")
#'
#' # Set anonymous access policy to private (default policy for new buckets)
#' mc_anonymous_set("play/minioclient-test/directory", policy = "private")
#'
#' mc_rb("play/minioclient-test")
#' @aliases mc_policy_set
#' @export
mc_anonymous_set <- function(target,
policy = c("download", "upload",
"public", "private"),
verbose = interactive()) {
policy <- match.arg(policy)
mc(paste("anonymous set", policy, target), verbose = verbose)
}
mc_policy_set <- mc_anonymous_set