Skip to content

Commit

Permalink
feat(global): remove all AWS references (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
corrieriluca authored Apr 7, 2023
1 parent e4d328d commit d559814
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 50 deletions.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/padok-team/yatas
go 1.19

require (
github.com/aws/aws-sdk-go-v2 v1.16.16
github.com/fatih/color v1.13.0
github.com/google/go-github/v35 v35.3.0
github.com/hashicorp/go-hclog v1.4.0
Expand All @@ -14,7 +13,6 @@ require (
)

require (
github.com/aws/smithy-go v1.13.3 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
Expand Down
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
github.com/aws/aws-sdk-go-v2 v1.16.16 h1:M1fj4FE2lB4NzRb9Y0xdWsn2P0+2UHVxwKyOa4YJNjk=
github.com/aws/aws-sdk-go-v2 v1.16.16/go.mod h1:SwiyXi/1zTUZ6KIAmLK5V5ll8SiURNUYOqTerZPaF9k=
github.com/aws/smithy-go v1.13.3 h1:l7LYxGuzK6/K+NzJ2mC+VvLUbae0sL3bXU//04MkmnA=
github.com/aws/smithy-go v1.13.3/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -16,7 +12,6 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v35 v35.3.0 h1:fU+WBzuukn0VssbayTT+Zo3/ESKX9JYWjbZTLOTEyho=
github.com/google/go-github/v35 v35.3.0/go.mod h1:yWB7uCcVWaUbUP74Aq3whuMySRMatyRmq5U9FTNlbio=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
Expand All @@ -29,8 +24,6 @@ github.com/hashicorp/go-plugin v1.4.9/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHG
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
Expand Down Expand Up @@ -88,6 +81,5 @@ google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
9 changes: 0 additions & 9 deletions plugins/commons/account.go

This file was deleted.

6 changes: 1 addition & 5 deletions plugins/commons/checkConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@ package commons

import (
"sync"

"github.com/aws/aws-sdk-go-v2/aws"
)

// CheckConfig is a struct that contains all the information needed to run a check.
type CheckConfig struct {
Wg *sync.WaitGroup // Wait group to wait for all the checks to be done
ConfigAWS aws.Config // AWS config
Queue chan Check // Queue to add the results to
ConfigYatas *Config // Yatas config
}

// Init the check config struct. Particularly useful in the categories. It allows to pass the config to the checks and allows
// them to be run in parallel by adding the results to the queue.
func (c *CheckConfig) Init(s aws.Config, config *Config) {
func (c *CheckConfig) Init(config *Config) {
c.Wg = &sync.WaitGroup{}
c.ConfigAWS = s
c.Queue = make(chan Check, 10)
c.ConfigYatas = config
}
1 change: 0 additions & 1 deletion plugins/commons/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

type Config struct {
Plugins []Plugin `yaml:"plugins"`
AWS []AWS_Account `yaml:"aws"`
Ignore []Ignore `yaml:"ignore"`
PluginConfig []map[string]interface{} `yaml:"pluginsConfiguration"`
Tests []Tests `yaml:"tests"`
Expand Down
39 changes: 14 additions & 25 deletions plugins/commons/yatas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ import (
"fmt"
"sync"
"testing"

"github.com/aws/aws-sdk-go-v2/aws"
)

func TestConfig_CheckExclude(t *testing.T) {
type fields struct {
Plugins []Plugin
AWS []AWS_Account
Ignore []Ignore
}
type args struct {
Expand Down Expand Up @@ -56,7 +53,6 @@ func TestConfig_CheckExclude(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
c := &Config{
Plugins: tt.fields.Plugins,
AWS: tt.fields.AWS,
Ignore: tt.fields.Ignore,
}
if got := c.CheckExclude(tt.args.id); got != tt.want {
Expand All @@ -69,7 +65,6 @@ func TestConfig_CheckExclude(t *testing.T) {
func TestConfig_CheckInclude(t *testing.T) {
type fields struct {
Plugins []Plugin
AWS []AWS_Account
Ignore []Ignore
PluginConfig interface{}
}
Expand Down Expand Up @@ -117,7 +112,6 @@ func TestConfig_CheckInclude(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
c := &Config{
Plugins: tt.fields.Plugins,
AWS: tt.fields.AWS,
Ignore: tt.fields.Ignore,
}
if got := c.CheckInclude(tt.args.id); got != tt.want {
Expand Down Expand Up @@ -159,12 +153,10 @@ func TestParseConfig(t *testing.T) {
func TestCheckConfig_Init(t *testing.T) {
type fields struct {
Wg *sync.WaitGroup
ConfigAWS aws.Config
Queue chan Check
ConfigYatas *Config
}
type args struct {
s aws.Config
config *Config
}
tests := []struct {
Expand All @@ -175,19 +167,21 @@ func TestCheckConfig_Init(t *testing.T) {
{
name: "check config",
fields: fields{
Wg: &sync.WaitGroup{},
ConfigAWS: aws.Config{},
Queue: make(chan Check),
ConfigYatas: &Config{},
Wg: &sync.WaitGroup{},
Queue: make(chan Check),
ConfigYatas: &Config{
Ignore: []Ignore{
{
ID: "test",
},
},
},
},
args: args{
s: aws.Config{
Region: "eu-west-1",
},
config: &Config{
AWS: []AWS_Account{
Ignore: []Ignore{
{
Name: "test",
ID: "test",
},
},
},
Expand All @@ -198,18 +192,13 @@ func TestCheckConfig_Init(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
c := &CheckConfig{
Wg: tt.fields.Wg,
ConfigAWS: tt.fields.ConfigAWS,
Queue: tt.fields.Queue,
ConfigYatas: tt.fields.ConfigYatas,
}
c.Init(tt.args.s, tt.args.config)
if c.ConfigAWS.Region != tt.args.s.Region {
t.Errorf("CheckConfig.Init() ConfigAWS.Region = %v, want %v", c.ConfigAWS.Region, tt.args.s.Region)
c.Init(tt.args.config)
if c.ConfigYatas.Ignore[0].ID != tt.args.config.Ignore[0].ID {
t.Errorf("CheckConfig.Init() ConfigYatas.Ignore[0].ID = %v, want %v", c.ConfigYatas.Ignore[0].ID, tt.args.config.Ignore[0].ID)
}
if c.ConfigYatas.AWS[0].Name != tt.args.config.AWS[0].Name {
t.Errorf("CheckConfig.Init() ConfigYatas.AWS[0].Name = %v, want %v", c.ConfigYatas.AWS[0].Name, tt.args.config.AWS[0].Name)
}

})
}
}

0 comments on commit d559814

Please # to comment.