Skip to content

Add IoT functions #270

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions aliases
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ alias instance-userdata='~/.bash-my-aws/bin/bma instance-userdata'
alias instance-volumes='~/.bash-my-aws/bin/bma instance-volumes'
alias instance-vpc='~/.bash-my-aws/bin/bma instance-vpc'
alias instances='~/.bash-my-aws/bin/bma instances'
alias iot-cert='~/.bash-my-aws/bin/bma iot-cert'
alias iot-certs='~/.bash-my-aws/bin/bma iot-certs'
alias keypair-create='~/.bash-my-aws/bin/bma keypair-create'
alias keypair-delete='~/.bash-my-aws/bin/bma keypair-delete'
alias keypairs='~/.bash-my-aws/bin/bma keypairs'
Expand All @@ -111,6 +113,10 @@ alias launch-configuration-asgs='~/.bash-my-aws/bin/bma launch-configuration-asg
alias launch-configurations='~/.bash-my-aws/bin/bma launch-configurations'
alias log-groups='~/.bash-my-aws/bin/bma log-groups'
alias pcxs='~/.bash-my-aws/bin/bma pcxs'
alias policies='~/.bash-my-aws/bin/bma policies'
alias policy='~/.bash-my-aws/bin/bma policy'
alias policy-document='~/.bash-my-aws/bin/bma policy-document'
alias principal-policies='~/.bash-my-aws/bin/bma principal-policies'
alias rds-db-clusters='~/.bash-my-aws/bin/bma rds-db-clusters'
alias rds-db-instances='~/.bash-my-aws/bin/bma rds-db-instances'
alias region-each='~/.bash-my-aws/bin/bma region-each'
Expand Down Expand Up @@ -143,6 +149,8 @@ alias stack-validate='~/.bash-my-aws/bin/bma stack-validate'
alias stacks='~/.bash-my-aws/bin/bma stacks'
alias sts-assume-role='~/.bash-my-aws/bin/bma sts-assume-role'
alias subnets='~/.bash-my-aws/bin/bma subnets'
alias thing-principals='~/.bash-my-aws/bin/bma thing-principals'
alias things='~/.bash-my-aws/bin/bma things'
alias vpc-az-count='~/.bash-my-aws/bin/bma vpc-az-count'
alias vpc-azs='~/.bash-my-aws/bin/bma vpc-azs'
alias vpc-default-delete='~/.bash-my-aws/bin/bma vpc-default-delete'
Expand Down
8 changes: 8 additions & 0 deletions bash_completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ _bma_stacks_completion() {
fi
return 0
}
_bma_things_completion() {
local command="$1"
local word="$2"
local options=$(bma things | awk '{ print $1 }')
COMPREPLY=( $(compgen -W "${options}" -- ${word}) )
return 0
}
_bma_vpcs_completion() {
local command="$1"
local word="$2"
Expand Down Expand Up @@ -201,6 +208,7 @@ complete -F _bma_stacks_completion stack-tail
complete -F _bma_stacks_completion stack-template
complete -F _bma_stacks_completion stack-update
complete -F _bma_stacks_completion stacks
complete -F _bma_stacks_completion things
complete -F _bma_vpcs_completion vpc-az-count
complete -F _bma_vpcs_completion vpc-azs
complete -F _bma_vpcs_completion vpc-endpoints
Expand Down
86 changes: 86 additions & 0 deletions docs/command-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,92 @@ Deregister AMI(s)
USAGE: image-deregister image_id [image_id]


## iot-commands

### iot-cert

List IoT Certificate details

$ iot-cert
example-cert ACTIVE 1550174600.356 1550174600.402 1550174490.0 1593374490.0
another-cert INACTIVE 1550174600.356 1550174600.402 1550174490.0 1593374490.0

### iot-certs

List IoT Certificates

$ iot-certs
example-cert ACTIVE
another-cert INACTIVE

*Optionally provide a filter string for a `| grep` effect with tighter columisation:*

$ iot-certs INACTIVE
another-cert INACTIVE

### policies

List IoT Policies

$ policies
example-policy
another-policy

### policy

List IoT Policy

$ policy
example-policy 1 1559925941.924 1559925941.924
another-policy 3 1559925941.924 1559925941.924

### policy-document

Displays an IoT Policy Document

USAGE: policy-document policy-name [policy-name]
$ iot-certs | principal-policies | policy-document
example-policy
{
"Version": "2012-10-17",
"Statement": [
...
}
another-policy
{
"Version": "2012-10-17",
"Statement": [
...
}

### principal-policies

List IoT policies attached to principal

USAGE: principal-policies target [target-arn]

$ things | thing-principals | principal-policies
example-policy
another-policy

*Note that the target may refer to an IoT Thing Group or certficate.*


### thing-principals

List cetrificates for IoT Thing

$ thing-principals
arn:aws:iot:::cert/certificateId

### things

List IoT Things

$ things
example-thing type
another-thing type

## keypair-commands


Expand Down
8 changes: 8 additions & 0 deletions functions
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ instance-userdata
instance-volumes
instance-vpc
instances
iot-cert
iot-certs
keypair-create
keypair-delete
keypairs
Expand All @@ -109,6 +111,10 @@ launch-configuration-asgs
launch-configurations
log-groups
pcxs
policies
policiy
policiy-document
principal-policies
rds-db-clusters
rds-db-instances
region
Expand Down Expand Up @@ -142,6 +148,8 @@ stack-validate
stacks
sts-assume-role
subnets
thing-principals
things
vpc-az-count
vpc-azs
vpc-default-delete
Expand Down
Loading