Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added egs for groups fxns; also reexporting magrittr pipe so its avai… #82

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand

S3method(print,sixtyfour_client)
export("%>%")
export(as_policy_arn)
export(aws_billing)
export(aws_billing_raw)
Expand Down
40 changes: 24 additions & 16 deletions R/groups.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ group_list_tidy <- function(x) {
#' if username is non-NULL, otherwise passed on to `list_users`
#' @return A tibble with information about groups
#' @family groups
#' @examples \dontrun{
#' @examplesIf aws_has_creds()
#' aws_groups()
#' aws_groups(username = aws_user_current())
#' }
aws_groups <- function(username = NULL, ...) {
if (is.null(username)) {
paginate_aws_marker("list_groups", "Groups", ...) %>%
Expand All @@ -48,9 +47,13 @@ aws_groups <- function(username = NULL, ...) {
#' @details see docs <https://www.paws-r-sdk.com/docs/iam_get_group/>
#' @autoglobal
#' @family groups
#' @examples \dontrun{
#' aws_group(name = "users")
#' }
#' @examplesIf aws_has_creds()
#' # create a group
#' aws_group_create("testing")
#' # get the group
#' aws_group(name = "testing")
#' # cleanup
#' aws_group_delete(name = "testing")
aws_group <- function(name) {
x <- con_iam()$get_group(name)
list(
Expand All @@ -63,18 +66,21 @@ aws_group <- function(name) {

#' Check if a group exists
#'
#' @importFrom purrr safely
#' @export
#' @param name (character) the group name
#' @return a single boolean
#' @details uses `aws_group` internally. see docs
#' <https://www.paws-r-sdk.com/docs/iam_get_group/>
#' @family groups
#' @examples \dontrun{
#' aws_group_exists(name = "users")
#' aws_group_exists(name = "apples")
#' }
#' @examplesIf aws_has_creds()
#' aws_group_create("apples")
#' aws_group_exists("apples")
#' aws_group_exists("doesnotexist")
#' # cleanup
#' aws_group_delete("apples")
aws_group_exists <- function(name) {
check_aws_group <- purrr::safely(aws_group, otherwise = FALSE)
check_aws_group <- safely(aws_group, otherwise = FALSE)
is.null(check_aws_group(name)$error)
}

Expand All @@ -88,9 +94,11 @@ aws_group_exists <- function(name) {
#' @details See <https://www.paws-r-sdk.com/docs/iam_create_group/>
#' docs for details on the parameters
#' @family groups
#' @examples \dontrun{
#' aws_group_create("testgroup")
#' }
#' @examplesIf aws_has_creds()
#' aws_group_create("testingagroup")
#' aws_group("testingagroup")
#' # cleanup
#' aws_group_delete("testingagroup")
aws_group_create <- function(name, path = NULL) {
con_iam()$create_group(Path = path, GroupName = name) %>%
group_list_tidy()
Expand All @@ -104,9 +112,9 @@ aws_group_create <- function(name, path = NULL) {
#' @details See <https://www.paws-r-sdk.com/docs/iam_delete_group/>
#' docs for more details
#' @family groups
#' @examples \dontrun{
#' aws_group_delete(name = "testgroup")
#' }
#' @examplesIf aws_has_creds()
#' aws_group_create("somegroup")
#' aws_group_delete("somegroup")
aws_group_delete <- function(name) {
con_iam()$delete_group(name)
}
3 changes: 3 additions & 0 deletions R/reexport-magrittr.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#' @importFrom magrittr %>%
#' @export
magrittr::`%>%`
11 changes: 8 additions & 3 deletions man/aws_group.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions man/aws_group_create.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/aws_group_delete.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions man/aws_group_exists.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/aws_groups.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/reexports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/sixtyfour-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading