Skip to content

Commit

Permalink
execute aws command from the root level
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroTochigi committed Feb 8, 2024
1 parent 852f911 commit f2d7fdb
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 40 deletions.
27 changes: 27 additions & 0 deletions main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

manageConfigPath=$(pwd)

usage() {
echo "Usage: $0 credential [command]"
echo "Commands:"
echo " aws - Execute an AWS command"
exit 1
}

# Check if at least one argument is provided
if [ $# -eq 0 ]; then
usage
fi

# Execute the appropriate command
case "$1" in
aws)
source $manageConfigPath/src/aws/load.sh
driver "${@:2}"
;;
*)
echo "Error: Invalid command."
usage
;;
esac
51 changes: 27 additions & 24 deletions src/aws/driver.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
source load.sh

awsUsage() {
echo "Usage: $0 credential [command]"
Expand All @@ -10,27 +9,31 @@ awsUsage() {
exit 1
}

# Check if at least one argument is provided
if [ $# -eq 0 ]; then
awsUsage
fi
function driver() {

# Execute the appropriate command
case "$1" in
init)
init "${@:2}"
;;
delete)
delete "${@:2}"
;;
stop)
stop "${@:2}"
;;
restart)
restart "${@:2}"
;;
*)
echo "Error: Invalid command."
authUsage
;;
esac
# Check if at least one argument is provided
if [ $# -eq 0 ]; then
awsUsage
fi

# Execute the appropriate command
case "$1" in
init)
init "${@:2}"
;;
delete)
delete "${@:2}"
;;
stop)
stop "${@:2}"
;;
restart)
restart "${@:2}"
;;
*)
echo "Error: Invalid command."
authUsage
;;
esac

}
32 changes: 16 additions & 16 deletions src/aws/load.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/bin/bash
manageConfigPath=$(pwd)
source $manageConfigPath/dependencies/config.sh
source $manageConfigPath/dependencies/utilitiyFunction.sh
source $manageConfigPath/dependencies/isBalloonNameValid.sh
source $manageConfigPath/dependencies/jsonOperations.sh
source $manageConfigPath/dependencies/configOperations.sh
source $manageConfigPath/dependencies/configFunctions.sh
source $manageConfigPath/dependencies/getLatestIpAddress.sh
source $manageConfigPath/dependencies/securitygroupFunction.sh
source $manageConfigPath/dependencies/manageConfig.sh
source $manageConfigPath/dependencies/sshtunnelFunction.sh
source $manageConfigPath/dependencies/reverseShell.sh
source $manageConfigPath/src/aws/dependencies/config.sh
source $manageConfigPath/src/aws/dependencies/utilitiyFunction.sh
source $manageConfigPath/src/aws/dependencies/isBalloonNameValid.sh
source $manageConfigPath/src/aws/dependencies/jsonOperations.sh
source $manageConfigPath/src/aws/dependencies/configOperations.sh
source $manageConfigPath/src/aws/dependencies/configFunctions.sh
source $manageConfigPath/src/aws/dependencies/getLatestIpAddress.sh
source $manageConfigPath/src/aws/dependencies/securitygroupFunction.sh
source $manageConfigPath/src/aws/dependencies/manageConfig.sh
source $manageConfigPath/src/aws/dependencies/sshtunnelFunction.sh
source $manageConfigPath/src/aws/dependencies/reverseShell.sh

source $manageConfigPath/init.sh
source $manageConfigPath/delete.sh
source $manageConfigPath/stop.sh
source $manageConfigPath/restart.sh
source $manageConfigPath/src/aws/init.sh
source $manageConfigPath/src/aws/delete.sh
source $manageConfigPath/src/aws/stop.sh
source $manageConfigPath/src/aws/restart.sh
source $manageConfigPath/src/aws/driver.sh

0 comments on commit f2d7fdb

Please sign in to comment.