polemos/main.go

42 lines
1.0 KiB
Go
Raw Normal View History

2023-03-14 15:12:28 +01:00
package main
import (
"fmt"
"os"
uuid "github.com/nu7hatch/gouuid"
2023-03-14 15:12:28 +01:00
"github.com/thefeli73/polemos/mtd_aws"
"github.com/thefeli73/polemos/state"
2023-03-14 15:12:28 +01:00
)
func main() {
fmt.Println("Starting Polemos")
config, err := state.Load_conf("config.yaml")
if err != nil {
fmt.Println("Error loading config:", err)
os.Exit(1)
}
//aws_config := mtd_aws.New_config(config.AWS.Region)
//mtd_aws.Instance_info(aws_config, config.AWS.InstanceID)
//mtd_aws.Instances(config.AWS.Region)
u, _ := uuid.NewV4() //blank is to send errors to the void
_=u
//fmt.Println(u)
for _, region := range config.AWS.Regions {
fmt.Println("Listing instances in region:", region)
2023-03-20 15:43:14 +01:00
aws_config := mtd_aws.New_config(region, config.AWS.Credentials_path)
instances, err := mtd_aws.Instances(aws_config)
if err != nil {
fmt.Println("Error listing instances:", err)
continue
}
for _, instance := range instances {
mtd_aws.Instance_info(aws_config, *instance.InstanceId)
}
}
2023-03-14 15:12:28 +01:00
}