#!/bin/bash
###############################################################
#                                                             #                                   
#   Feature :-  Scripts for AWS metadata instance Category     #
#   Developer :- Abhishek Sharma                              #                                    
#   Modified Date :- 31st May 2023                            #                                 
#                                                             #                                    
###############################################################

# Function to check if a keyword is present in the instance metadata
# Source the .bashrc file to load environment variables
#source ~/.bashrc
CUR_DIR=$( cd "$(dirname "$0")" ; pwd -P )
# Determine the current environment based on the presence of keywords
if [[ "$2" == "AWSEC2" ]]; then
        bash $CUR_DIR/awsec2metadataresolve.sh "$1"

elif [[ "$2" == "AWSECS" ]]; then
        bash $CUR_DIR/awsecsmetadataresolve.sh "$1"

elif [[ "$2" == "AWSEKS" ]]; then
        bash $CUR_DIR/awseksmetadataresolve.sh "$1"

elif [[ "$2" == "AWSLAMBDA" ]]; then
        bash $CUR_DIR/awslambdametadataresolve.sh "$1"
else
        exit
fi

