Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
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
3 changes: 2 additions & 1 deletion aliases
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ alias aws-account-id='~/.bash-my-aws/bin/bma aws-account-id'
alias aws-accounts='~/.bash-my-aws/bin/bma aws-accounts'
alias aws-panopticon='~/.bash-my-aws/bin/bma aws-panopticon'
alias bucket-acls='~/.bash-my-aws/bin/bma bucket-acls'
alias bucket-objects='~/.bash-my-aws/bin/bma bucket-objects'
alias bucket-remove='~/.bash-my-aws/bin/bma bucket-remove'
alias bucket-remove-force='~/.bash-my-aws/bin/bma bucket-remove-force'
alias buckets='~/.bash-my-aws/bin/bma buckets'
Expand Down Expand Up @@ -168,4 +169,4 @@ function region() {
else
AWS_DEFAULT_REGION="$inputs";
fi
}
}
1 change: 1 addition & 0 deletions bash_completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ complete -F _bma_aws-accounts_completion aws-account-cost-explorer
complete -F _bma_aws-accounts_completion aws-account-cost-recommendations
complete -F _bma_aws-accounts_completion aws-accounts
complete -F _bma_buckets_completion bucket-acls
complete -F _bma_buckets_completion bucket-objects
complete -F _bma_buckets_completion bucket-remove
complete -F _bma_buckets_completion bucket-remove-force
complete -F _bma_buckets_completion buckets
Expand Down
21 changes: 21 additions & 0 deletions lib/s3-functions
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,27 @@ bucket-acls() {
done
}

bucket-objects() {
# List of S3 Bucket Objects.
#
# $ bucket-objects example-bucket
# object-key last-modified storage-class owner-display-name etag size
# another-object-key last-modified storage-class owner-display-name etag size
#
local buckets=$(skim-stdin "$@")
[[ -z "$buckets" ]] && __bma_usage "bucket [bucket]" && return 1

local bucket
for bucket in $buckets; do
aws s3api list-objects \
--bucket "$bucket" \
--output text \
--query "Contents[].[Key, LastModified, StorageClass, Owner.DisplayName, ETag, Size]"
done
}

bucket-remove() {

Expand Down