Skip to contents

This function simply constructs a string, then checks that the ARN is valid using get_policy

Usage

as_policy_arn(name, local = FALSE, path = NULL)

Arguments

name

(character) a policy name or arn

local

(logical) if TRUE use your AWS account for your own managed policies. If FALSE, AWS managed policies

path

(character) if not NULL, we add the path into the ARN before the name value

Value

a policy ARN (character)

Examples

if (FALSE) { # \dontrun{
as_policy_arn("ReadOnlyAccess")
as_policy_arn("arn:aws:iam::aws:policy/ReadOnlyAccess")
as_policy_arn("AmazonRDSDataFullAccess")
# as_policy_arn("Blarp")
# as_policy_arn(letters)
# as_policy_arn(5)
as_policy_arn("MyTestPolicy", local = TRUE)
# returns an arn - and if given an arn returns self
as_policy_arn("MyTestPolicy", local = TRUE) %>%
  as_policy_arn()
# path = Job function
as_policy_arn("Billing", path = "job-function")
# path = Service role
as_policy_arn("AWSCostAndUsageReportAutomationPolicy",
  path = "service-role"
)
} # }