Skip to content

Commit

Permalink
fix #26 add Tags field to output tibbles for aws_users and aws_user
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Jan 10, 2024
1 parent e90045e commit f3f1dd9
Show file tree
Hide file tree
Showing 5 changed files with 487 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: sixtyfour
Title: Humane Interface to AWS
Version: 0.0.0.96
Version: 0.0.0.97
Authors@R: c(
person("Sean", "Kross", role = "aut"),
person("Scott", "Chamberlain", role = c("aut", "cre"), email = "sachamber@fredhutch.org")
Expand Down
8 changes: 6 additions & 2 deletions R/users.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
user_list_tidy <- function(x) {
vars <- c(
"UserName", "UserId", "Path", "Arn", "CreateDate",
"PasswordLastUsed"
"PasswordLastUsed", "Tags"
)
tidy_generator(vars)(x) %>%
mutate(PasswordLastUsed = as_datetime(PasswordLastUsed))
Expand All @@ -24,7 +24,11 @@ user_list_tidy <- function(x) {
#' aws_users()
#' }
aws_users <- function(...) {
paginate_aws(env64$iam$list_users, "Users") %>% user_list_tidy()
# paginate_aws(env64$iam$list_users, "Users") %>% user_list_tidy()

Check warning on line 27 in R/users.R

View workflow job for this annotation

GitHub Actions / lint

file=R/users.R,line=27,col=5,[commented_code_linter] Commented code should be removed.
users <- paginate_aws(env64$iam$list_users, "Users") %>% user_list_tidy()
purrr::map(users$UserName, env64$iam$get_user) %>%
purrr::map(purrr::pluck, "User") %>%
user_list_tidy()
}

#' Get a user
Expand Down
182 changes: 182 additions & 0 deletions tests/fixtures/aws_user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
http_interactions:
- request:
method: post
uri: https://iam.amazonaws.com/
body:
encoding: ''
string: Action=GetUser&Version=2010-05-08
headers:
User-Agent: paws/0.6.1 (R4.3.2; darwin20; aarch64)
Accept: application/xml
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Content-Length: '33'
X-Amz-Date: 20240110T001222Z
Authorization: redacted
response:
status:
status_code: 200
category: Success
reason: OK
message: 'Success: (200) OK'
headers:
x-amzn-requestid: 151b96a5-6327-447d-8c6c-7fa22fff8b88
content-type: text/xml
content-length: '657'
date: Wed, 10 Jan 2024 00:12:22 GMT
body:
encoding: ''
file: no
string: |
<GetUserResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
<GetUserResult>
<User>
<Path>/</Path>
<PasswordLastUsed>2024-01-09T23:05:09Z</PasswordLastUsed>
<UserName>scott</UserName>
<Arn>arn:aws:iam::744061095407:user/scott</Arn>
<UserId>AIDA22PL7JXXTBKY6TYQA</UserId>
<CreateDate>2023-12-13T19:29:24Z</CreateDate>
<Tags>
<member>
<Value>test</Value>
<Key>AKIA22PL7JXXRTCUK3NI</Key>
</member>
</Tags>
</User>
</GetUserResult>
<ResponseMetadata>
<RequestId>151b96a5-6327-447d-8c6c-7fa22fff8b88</RequestId>
</ResponseMetadata>
</GetUserResponse>
recorded_at: 2024-01-10 00:12:23 GMT
recorded_with: vcr/1.2.2.91, webmockr/0.9.0
- request:
method: post
uri: https://iam.amazonaws.com/
body:
encoding: ''
string: Action=ListUserPolicies&UserName=scott&Version=2010-05-08
headers:
User-Agent: paws/0.6.1 (R4.3.2; darwin20; aarch64)
Accept: application/xml
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Content-Length: '57'
X-Amz-Date: 20240110T001222Z
Authorization: redacted
response:
status:
status_code: 200
category: Success
reason: OK
message: 'Success: (200) OK'
headers:
x-amzn-requestid: 4fcb1fa8-a182-459e-8c36-19c2ea666742
content-type: text/xml
content-length: '323'
date: Wed, 10 Jan 2024 00:12:22 GMT
body:
encoding: ''
file: no
string: |
<ListUserPoliciesResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
<ListUserPoliciesResult>
<IsTruncated>false</IsTruncated>
<PolicyNames/>
</ListUserPoliciesResult>
<ResponseMetadata>
<RequestId>4fcb1fa8-a182-459e-8c36-19c2ea666742</RequestId>
</ResponseMetadata>
</ListUserPoliciesResponse>
recorded_at: 2024-01-10 00:12:23 GMT
recorded_with: vcr/1.2.2.91, webmockr/0.9.0
- request:
method: post
uri: https://iam.amazonaws.com/
body:
encoding: ''
string: Action=ListAttachedUserPolicies&UserName=scott&Version=2010-05-08
headers:
User-Agent: paws/0.6.1 (R4.3.2; darwin20; aarch64)
Accept: application/xml
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Content-Length: '65'
X-Amz-Date: 20240110T001222Z
Authorization: redacted
response:
status:
status_code: 200
category: Success
reason: OK
message: 'Success: (200) OK'
headers:
x-amzn-requestid: 02790990-5f7d-4749-a01b-a3e7e05890ec
content-type: text/xml
content-length: '546'
date: Wed, 10 Jan 2024 00:12:22 GMT
body:
encoding: ''
file: no
string: |
<ListAttachedUserPoliciesResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
<ListAttachedUserPoliciesResult>
<IsTruncated>false</IsTruncated>
<AttachedPolicies>
<member>
<PolicyArn>arn:aws:iam::aws:policy/IAMUserChangePassword</PolicyArn>
<PolicyName>IAMUserChangePassword</PolicyName>
</member>
</AttachedPolicies>
</ListAttachedUserPoliciesResult>
<ResponseMetadata>
<RequestId>02790990-5f7d-4749-a01b-a3e7e05890ec</RequestId>
</ResponseMetadata>
</ListAttachedUserPoliciesResponse>
recorded_at: 2024-01-10 00:12:23 GMT
recorded_with: vcr/1.2.2.91, webmockr/0.9.0
- request:
method: post
uri: https://iam.amazonaws.com/
body:
encoding: ''
string: Action=ListGroupsForUser&UserName=scott&Version=2010-05-08
headers:
User-Agent: paws/0.6.1 (R4.3.2; darwin20; aarch64)
Accept: application/xml
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Content-Length: '58'
X-Amz-Date: 20240110T001223Z
Authorization: redacted
response:
status:
status_code: 200
category: Success
reason: OK
message: 'Success: (200) OK'
headers:
x-amzn-requestid: 064103d6-0cd1-4341-8738-0e84bc9e5ae1
content-type: text/xml
content-length: '586'
date: Wed, 10 Jan 2024 00:12:22 GMT
body:
encoding: ''
file: no
string: |
<ListGroupsForUserResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
<ListGroupsForUserResult>
<IsTruncated>false</IsTruncated>
<Groups>
<member>
<Path>/</Path>
<GroupName>admin</GroupName>
<GroupId>AGPA22PL7JXXRD3VIP2YG</GroupId>
<Arn>arn:aws:iam::744061095407:group/admin</Arn>
<CreateDate>2023-12-13T18:51:28Z</CreateDate>
</member>
</Groups>
</ListGroupsForUserResult>
<ResponseMetadata>
<RequestId>064103d6-0cd1-4341-8738-0e84bc9e5ae1</RequestId>
</ResponseMetadata>
</ListGroupsForUserResponse>
recorded_at: 2024-01-10 00:12:23 GMT
recorded_with: vcr/1.2.2.91, webmockr/0.9.0
Loading

0 comments on commit f3f1dd9

Please sign in to comment.