File tree Expand file tree Collapse file tree 7 files changed +72
-1
lines changed Expand file tree Collapse file tree 7 files changed +72
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ alias aws-account-cost-explorer='~/.bash-my-aws/bin/bma aws-account-cost-explore
3535alias aws-account-cost-recommendations='~/.bash-my-aws/bin/bma aws-account-cost-recommendations'
3636alias aws-account-each='~/.bash-my-aws/bin/bma aws-account-each'
3737alias aws-account-id='~/.bash-my-aws/bin/bma aws-account-id'
38+ alias aws-accounts='~/.bash-my-aws/bin/bma aws-accounts'
3839alias aws-panopticon='~/.bash-my-aws/bin/bma aws-panopticon'
3940alias bucket-acls='~/.bash-my-aws/bin/bma bucket-acls'
4041alias bucket-remove='~/.bash-my-aws/bin/bma bucket-remove'
Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ _bma_asgs_completion() {
66 COMPREPLY=($( compgen -W " ${options} " -- ${word} ) )
77 return 0
88}
9+ _bma_aws-accounts_completion () {
10+ local command=" $1 "
11+ local word=" $2 "
12+ local options=$( bma aws-accounts | awk ' { print $1 }' )
13+ COMPREPLY=($( compgen -W " ${options} " -- ${word} ) )
14+ return 0
15+ }
916_bma_buckets_completion () {
1017 local command=" $1 "
1118 local word=" $2 "
@@ -127,6 +134,9 @@ complete -F _bma_asgs_completion asg-scaling-activities
127134complete -F _bma_asgs_completion asg-stack
128135complete -F _bma_asgs_completion asg-suspend
129136complete -F _bma_asgs_completion asgs
137+ complete -F _bma_aws-accounts_completion aws-account-cost-explorer
138+ complete -F _bma_aws-accounts_completion aws-account-cost-recommendations
139+ complete -F _bma_aws-accounts_completion aws-accounts
130140complete -F _bma_buckets_completion bucket-acls
131141complete -F _bma_buckets_completion bucket-remove
132142complete -F _bma_buckets_completion bucket-remove-force
Original file line number Diff line number Diff line change @@ -29,6 +29,20 @@ the most interest to readers.
2929## aws-account-commands
3030
3131
32+ ### aws-accounts
33+
34+ List AWS Accounts in an [ Organization] ( https://aws.amazon.com/organizations/ )
35+
36+ $ aws-accounts
37+ 089834043791 ACTIVE INVITED 1488257653.638 mike-aws@bailey.net.au
38+ 812094344564 ACTIVE CREATED 1537922950.972 mike-bash-my-aws@bailey.net.au
39+ 001721147249 ACTIVE INVITED 1548752330.723 mike@bailey.net.au
40+ 867077406134 ACTIVE CREATED 1557910982.885 mike-deleteme@bailey.net.au
41+ 892345420873 ACTIVE CREATED 1557911243.358 mike-delete@bailey.net.au
42+
43+ * Optionally provide a filter string for a ` | grep ` effect with tighter columisation:*
44+
45+
3246### aws-account-alias
3347
3448Retrieve AWS Account Alias for current account
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ aws-account-cost-explorer
3333aws-account-cost-recommendations
3434aws-account-each
3535aws-account-id
36+ aws-accounts
3637aws-panopticon
3738bucket-acls
3839bucket-remove
Original file line number Diff line number Diff line change 66# authenticated to or the Account IDs provided to them.
77
88
9+ aws-accounts () {
10+
11+ # List AWS Accounts in an [Organization](https://aws.amazon.com/organizations/)
12+ #
13+ # $ aws-accounts
14+ # 089834043791 ACTIVE INVITED 1488257653.638 mike-aws@bailey.net.au
15+ # 812094344564 ACTIVE CREATED 1537922950.972 mike-bash-my-aws@bailey.net.au
16+ # 001721147249 ACTIVE INVITED 1548752330.723 mike@bailey.net.au
17+ # 867077406134 ACTIVE CREATED 1557910982.885 mike-deleteme@bailey.net.au
18+ # 892345420873 ACTIVE CREATED 1557911243.358 mike-delete@bailey.net.au
19+ #
20+ # *Optionally provide a filter string for a `| grep` effect with tighter columisation:*
21+
22+ local account_ids=$( skim-stdin)
23+ local filters=$( __bma_read_filters " $@ " )
24+
25+ aws organizations list-accounts \
26+ --output text \
27+ --query "
28+ Accounts[${account_ids: +?contains(['${account_ids// /"','"}'], Id)} ].[
29+ Id,
30+ Status,
31+ JoinedMethod,
32+ JoinedTimestamp,
33+ Email
34+ ]" |
35+ grep -E -- " $filters " |
36+ LC_ALL=C sort -b -k 4 |
37+ column -s$' \t ' -t
38+
39+ }
40+
41+
942aws-account-alias () {
1043
1144 # Retrieve AWS Account Alias for current account
Original file line number Diff line number Diff line change 2121
2222cat " ${bma_path} /scripts/completions/bma-completion"
2323
24+
25+
2426# dont add auto_completions for these functions
2527funcs_no_completion=(
2628 asg-desired-size-set
2729 asg-max-size-set
2830 asg-min-size-set
31+ aws-account-alias
32+ aws-account-each
33+ aws-account-id
2934 keypair-create
3035 region-each
3136 regions
32- stack-validate
3337 stack-create
3438 stack-tag
3539 stack-tag-apply
3640 stack-tag-delete
41+ stack-validate
3742 vpc-default-delete
3843 vpc-dhcp-options-ntp
3944 vpc-endpoint-services
Original file line number Diff line number Diff line change 1+ _bma_aws-accounts_completion() {
2+ local command="$1"
3+ local word="$2"
4+ local options=$(bma aws-accounts | awk '{ print $1 }')
5+ COMPREPLY=($(compgen -W "${options}" -- ${word}))
6+ return 0
7+ }
You can’t perform that action at this time.
0 commit comments