#!/bin/bash
STACK=aws-scheduler
PROFILE=$1
REGION=$2

echo
echo \*\*\* Step 1 of 2: Creating periods and schedules in case they don\'t already exist. Ignore errors.
scheduler-cli create-period --name "weekdays" --begintime 08:00 --endtime 23:59 --weekdays mon-fri --stack $STACK --region $REGION --profile-name $PROFILE
scheduler-cli create-period --name "business-hours" --begintime 07:30 --endtime 23:00 --weekdays mon-fri --stack $STACK --region $REGION --profile-name $PROFILE
scheduler-cli create-period --name "extended" --begintime 08:00 --endtime 23:59 --weekdays mon-fri --stack $STACK --region $REGION --profile-name $PROFILE
scheduler-cli create-period --name "saturday" --begintime 12:00 --endtime 18:00 --weekdays sat  --stack $STACK --region $REGION --profile-name $PROFILE
scheduler-cli create-schedule --name MSOC --periods business-hours --timezone "US/Eastern" --stack $STACK --region $REGION --profile-name $PROFILE
#scheduler-cli create-schedule --enforced=true --name non-prod --periods weekdays --timezone "US/Eastern" --stack $STACK --region $REGION --profile-name $PROFILE
#scheduler-cli create-schedule --enforced=true --name non-prod-extended --periods extended --timezone "US/Eastern" --stack $STACK --region $REGION --profile-name $PROFILE

echo
echo \*\*\* Step 2 of 2:  Updating periods and schedules to our standards
scheduler-cli update-period --name "weekdays" --begintime 08:00 --endtime 23:59 --weekdays mon-fri --stack $STACK --region $REGION --profile-name $PROFILE
scheduler-cli update-period --name "business-hours" --begintime 07:30 --endtime 23:00 --weekdays mon-fri --stack $STACK --region $REGION --profile-name $PROFILE
scheduler-cli update-period --name "extended" --begintime 08:00 --endtime 23:59 --weekdays mon-fri --stack $STACK --region $REGION --profile-name $PROFILE
scheduler-cli update-period --name "saturday" --begintime 12:00 --endtime 18:00 --weekdays sat  --stack $STACK --region $REGION --profile-name $PROFILE
scheduler-cli update-schedule --name MSOC --periods business-hours --timezone "US/Eastern" --stack $STACK --region $REGION --profile-name $PROFILE
#scheduler-cli update-schedule --enforced=true --name non-prod --periods weekdays --timezone "US/Eastern" --stack $STACK --region $REGION --profile-name $PROFILE
#scheduler-cli update-schedule --enforced=true --name non-prod-extended --periods extended --timezone "US/Eastern" --stack $STACK --region $REGION --profile-name $PROFILE


