Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8daf59a
#SOS-15
Jackafive753 May 28, 2021
35a3f71
#SOS-22
Jackafive753 May 29, 2021
5866b6e
#SOS-15
Jackafive753 May 31, 2021
839ae2f
#SOS-23 Add getAccounts + save account information in event_status
daniebrill Jun 4, 2021
6cd0a85
#SOS-23 Use querylimit in aggregation + add error handling for type a…
daniebrill Jun 5, 2021
f8e931b
#SOS-23 Fix existing tests + code format
daniebrill Jun 8, 2021
259ccf7
#SOS-23 Modify GetAccounts for specific execution ID
daniebrill Jun 8, 2021
45db9b4
#SOS-23 Fit MockStorage to modified interface StorageDescriber
daniebrill Jun 8, 2021
2f3c15c
#SOS-23 Add tests in interpolation_test.go and server_test.go
daniebrill Jun 8, 2021
1fd641a
#SOS-20
Jackafive753 Jun 9, 2021
9c157f2
#SOS-23 Add test for elasticsearch GetAccounts
daniebrill Jun 9, 2021
0f68ad2
#SOS-16
Jackafive753 Jun 10, 2021
2b48f30
Merge remote-tracking branch 'origin/feature_multi_account_selection'…
Jackafive753 Jun 10, 2021
bf4c57d
#SOS18 Add multiaccount selection functionality to tables
daniebrill Jun 11, 2021
ecbe7ef
#SOS-16
Jackafive753 Jun 11, 2021
5a7065e
Merge remote-tracking branch 'origin/feature_multi_account_selection'…
Jackafive753 Jun 11, 2021
5ea12e5
#SOS-18
Jackafive753 Jun 14, 2021
2f99548
#SOS-18
daniebrill Jun 14, 2021
2c3e562
Merge pull request #1 from evoila/feature_multi_account_selection
Jackafive753 Jun 16, 2021
8416b89
#SOS-31
florianbieser Jun 16, 2021
6f82820
#SOS-33
Jackafive753 Jun 28, 2021
4df494c
fix warnings: unused statements
Jackafive753 Jul 2, 2021
ab6405e
# SOS-57
Jackafive753 Jul 23, 2021
f8adc70
set account to filters if an account specific Chart is clicked
Jackafive753 Jul 28, 2021
70541c7
Merge pull request #1 from daniebrill/feature/multi_account_selection
daniebrill Aug 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
#SOS-15
/collector/structs.go
+ AccountSpecifiedFiels struct to save AccountId and AccountName

/collector/aws/common/structs.go
+ add Method getAccountName()

/collector/aws/detector.go
+ save in DetectorManager the accountName from config file

/collector/resources/*
+ save AccountSpecifiedFields with values in detectedStructs
  • Loading branch information
Jackafive753 committed May 28, 2021
commit 8daf59aeb0e077c17dfa3bb64972ee025d880d3b
1 change: 1 addition & 0 deletions collector/aws/common/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type AWSManager interface {
GetCloudWatchClient() *cloudwatch.CloudwatchManager
GetPricingClient() *pricing.PricingManager
GetRegion() string
GetAccountName() string
GetSession() (*session.Session, *aws.Config)
GetAccountIdentity() *sts.GetCallerIdentityOutput
SetGlobal(resourceName collector.ResourceIdentifier)
Expand Down
17 changes: 16 additions & 1 deletion collector/aws/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type DetectorDescriptor interface {
GetCloudWatchClient() *cloudwatch.CloudwatchManager
GetPricingClient() *pricing.PricingManager
GetRegion() string
GetAccountName() string
GetSession() (*session.Session, *awsClient.Config)
GetAccountIdentity() *sts.GetCallerIdentityOutput
}
Expand All @@ -38,12 +39,20 @@ type DetectorManager struct {
session *session.Session
awsConfig *awsClient.Config
accountIdentity *sts.GetCallerIdentityOutput
accountName string
region string
global map[string]struct{}
}

// NewDetectorManager create new instance of detector manager
func NewDetectorManager(awsAuth AuthDescriptor, collector collector.CollectorDescriber, account config.AWSAccount, stsManager *STSManager, global map[string]struct{}, region string) *DetectorManager {
func NewDetectorManager(
awsAuth AuthDescriptor,
collector collector.CollectorDescriber,
account config.AWSAccount,
stsManager *STSManager,
global map[string]struct{},
region string,
) *DetectorManager {

priceSession, _ := awsAuth.Login(defaultRegionPrice)
pricingManager := pricing.NewPricingManager(awsPricing.New(priceSession), defaultRegionPrice)
Expand All @@ -60,6 +69,7 @@ func NewDetectorManager(awsAuth AuthDescriptor, collector collector.CollectorDes
session: regionSession,
awsConfig: regionConfig,
accountIdentity: callerIdentityOutput,
accountName: account.Name,
global: global,
}
}
Expand Down Expand Up @@ -89,6 +99,11 @@ func (dm *DetectorManager) GetRegion() string {
return dm.region
}

// GetAccountName returns the account name
func (dm *DetectorManager) GetAccountName() string {
return dm.accountName
}

// GetSession return the aws session
func (dm *DetectorManager) GetSession() (*session.Session, *awsClient.Config) {
return dm.session, dm.awsConfig
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/apigateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type DetectedAPIGateway struct {
Name string
LaunchTime time.Time
Tag map[string]string
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -147,6 +148,10 @@ func (ag *APIGatewayManager) Detect(metrics []config.MetricConfig) (interface{},
Name: *api.Name,
LaunchTime: *api.CreatedDate,
Tag: tagsData,
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *ag.awsManager.GetAccountIdentity().Account,
AccountName: ag.awsManager.GetAccountName(),
},
}

ag.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/docdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type DetectedDocumentDB struct {
MultiAZ bool
Engine string
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -162,6 +163,10 @@ func (dd *DocumentDBManager) Detect(metrics []config.MetricConfig) (interface{},
PricePerMonth: price * collector.TotalMonthHours,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *dd.awsManager.GetAccountIdentity().Account,
AccountName: dd.awsManager.GetAccountName(),
},
}

dd.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type DetectedAWSDynamoDB struct {
Metric string
Name string
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -199,6 +200,10 @@ func (dd *DynamoDBManager) Detect(metrics []config.MetricConfig) (interface{}, e
PricePerMonth: pricePerMonth,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *dd.awsManager.GetAccountIdentity().Account,
AccountName: dd.awsManager.GetAccountName(),
},
}

dd.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type DetectedEC2 struct {
Name string
InstanceType string
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -164,6 +165,10 @@ func (ec *EC2Manager) Detect(metrics []config.MetricConfig) (interface{}, error)
PricePerMonth: price * collector.TotalMonthHours,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *ec.awsManager.GetAccountIdentity().Account,
AccountName: ec.awsManager.GetAccountName(),
},
}

ec.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/ec2volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type DetectedAWSEC2Volume struct {
Size int64
PricePerMonth float64
Tag map[string]string
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -124,6 +125,10 @@ func (ev *EC2VolumeManager) Detect(metrics []config.MetricConfig) (interface{},
Size: volumeSize,
PricePerMonth: ev.getCalculatedPrice(vol, price),
Tag: tagsData,
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *ev.awsManager.GetAccountIdentity().Account,
AccountName: ev.awsManager.GetAccountName(),
},
}

ev.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/elasticache.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type DetectedElasticache struct {
CacheNodeType string
CacheNodes int
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -163,6 +164,10 @@ func (ec *ElasticacheManager) Detect(metrics []config.MetricConfig) (interface{}
PricePerMonth: price * collector.TotalMonthHours,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *ec.awsManager.GetAccountIdentity().Account,
AccountName: ec.awsManager.GetAccountName(),
},
}

ec.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/elasticips.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type DetectedElasticIP struct {
PricePerHour float64
PricePerMonth float64
Tag map[string]string
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -115,6 +116,10 @@ func (ei *ElasticIPManager) Detect(metrics []config.MetricConfig) (interface{},
PricePerHour: price,
PricePerMonth: price * collector.TotalMonthHours,
Tag: tagsData,
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *ei.awsManager.GetAccountIdentity().Account,
AccountName: ei.awsManager.GetAccountName(),
},
}

ei.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type DetectedElasticSearch struct {
InstanceType string
InstanceCount int64
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

// elasticSearchVolumeType will hold the available volume types for ESCluster EBS
Expand Down Expand Up @@ -220,6 +221,10 @@ func (esm *ElasticSearchManager) Detect(metrics []config.MetricConfig) (interfac
PricePerMonth: hourlyClusterPrice * collector.TotalMonthHours,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *esm.awsManager.GetAccountIdentity().Account,
AccountName: esm.awsManager.GetAccountName(),
},
}

esm.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type DetectedELB struct {
Metric string
Region string
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -176,6 +177,10 @@ func (el *ELBManager) Detect(metrics []config.MetricConfig) (interface{}, error)
PricePerMonth: price * collector.TotalMonthHours,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *el.awsManager.GetAccountIdentity().Account,
AccountName: el.awsManager.GetAccountName(),
},
}

el.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/elbv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type DetectedELBV2 struct {
Region string
Type string
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

// loadBalancerConfig defines loadbalancer's configuration of metrics and pricing
Expand Down Expand Up @@ -219,6 +220,10 @@ func (el *ELBV2Manager) Detect(metrics []config.MetricConfig) (interface{}, erro
PricePerMonth: price * collector.TotalMonthHours,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *el.awsManager.GetAccountIdentity().Account,
AccountName: el.awsManager.GetAccountName(),
},
}

el.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type DetectedAWSLastActivity struct {
AccessKey string
LastUsedDate time.Time
LastActivity string
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -133,6 +134,10 @@ func (im *IAMManager) Detect(metrics []config.MetricConfig) (interface{}, error)
AccessKey: *accessKeyData.AccessKeyId,
LastUsedDate: lastUsedDate,
LastActivity: lastActivity,
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *im.awsManager.GetAccountIdentity().Account,
AccountName: im.awsManager.GetAccountName(),
},
}

im.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/kinesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type DetectedKinesis struct {
Metric string
Region string
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -193,6 +194,10 @@ func (km *KinesisManager) Detect(metrics []config.MetricConfig) (interface{}, er
PricePerMonth: totalShardsPerHourPrice * collector.TotalMonthHours,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *km.awsManager.GetAccountIdentity().Account,
AccountName: km.awsManager.GetAccountName(),
},
}

km.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/lambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type DetectedAWSLambda struct {
ResourceID string
Name string
Tag map[string]string
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -149,6 +150,10 @@ func (lm *LambdaManager) Detect(metrics []config.MetricConfig) (interface{}, err
ResourceID: *fun.FunctionArn,
Name: *fun.FunctionName,
Tag: tagsData,
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *lm.awsManager.GetAccountIdentity().Account,
AccountName: lm.awsManager.GetAccountName(),
},
}

lm.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/natgateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type DetectedNATGateway struct {
SubnetID string
VPCID string
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -178,6 +179,10 @@ func (ngw *NatGatewayManager) Detect(metrics []config.MetricConfig) (interface{}
PricePerMonth: price * collector.TotalMonthHours,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *ngw.awsManager.GetAccountIdentity().Account,
AccountName: ngw.awsManager.GetAccountName(),
},
}

ngw.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/neptune.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type DetectedAWSNeptune struct {
MultiAZ bool
Engine string
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -163,6 +164,10 @@ func (np *NeptuneManager) Detect(metrics []config.MetricConfig) (interface{}, er
PricePerMonth: price * collector.TotalMonthHours,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *np.awsManager.GetAccountIdentity().Account,
AccountName: np.awsManager.GetAccountName(),
},
}

np.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type DetectedAWSRDS struct {
MultiAZ bool
Engine string
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

// RDSVolumeType will hold the available volume types for RDS types
Expand Down Expand Up @@ -206,6 +207,10 @@ func (r *RDSManager) Detect(metrics []config.MetricConfig) (interface{}, error)
PricePerMonth: totalHourlyPrice * collector.TotalMonthHours,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *r.awsManager.GetAccountIdentity().Account,
AccountName: r.awsManager.GetAccountName(),
},
}

r.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
5 changes: 5 additions & 0 deletions collector/aws/resources/redshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type DetectedRedShift struct {
NodeType string
NumberOfNodes int64
collector.PriceDetectedFields
collector.AccountSpecifiedFields
}

func init() {
Expand Down Expand Up @@ -159,6 +160,10 @@ func (rdm *RedShiftManager) Detect(metrics []config.MetricConfig) (interface{},
PricePerMonth: clusterPrice * collector.TotalMonthHours,
Tag: tagsData,
},
AccountSpecifiedFields: collector.AccountSpecifiedFields{
AccountID: *rdm.awsManager.GetAccountIdentity().Account,
AccountName: rdm.awsManager.GetAccountName(),
},
}

rdm.awsManager.GetCollector().AddResource(collector.EventCollector{
Expand Down
6 changes: 6 additions & 0 deletions collector/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ type PriceDetectedFields struct {
Tag map[string]string
}

// AccountSpecifiedFields describe account data of an resource
type AccountSpecifiedFields struct {
AccountID string
AccountName string
}

// EventCollector collector event data structure
type EventCollector struct {
EventType string
Expand Down