Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion backend/app/aws_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (s *Session) CreateAWSIntegration(ctx context.Context, input CreateAWSInteg
{
today := time.Now().Truncate(24 * time.Hour)
for i := 0; i < 7; i++ {
if err := s.app.queueAWSIntegrationReportGeneration(ctx, queueAWSIntegrationReportGenerationInput{
if err := s.app.doReconAndQueueAWSIntegrationReportGeneration(ctx, doReconAndQueueAWSIntegrationReportGenerationInput{
Integration: integration,
StartTime: today.Add(-time.Duration(i) * 24 * time.Hour),
Duration: 24 * time.Hour,
Expand Down Expand Up @@ -320,6 +320,7 @@ type PutAWSIntegrationReconInput struct {
TeamId model.Id
Time time.Time
Accounts []PutAWSIntegrationReconAccountInput
CanManageSCPs bool
}

type PutAWSIntegrationReconAccountInput struct {
Expand All @@ -333,6 +334,7 @@ func (a *App) PutAWSIntegrationRecon(ctx context.Context, input PutAWSIntegratio
TeamId: input.TeamId,
Time: input.Time,
ExpirationTime: input.Time.Add(3 * 24 * time.Hour),
CanManageSCPs: input.CanManageSCPs,
Accounts: make([]model.AWSIntegrationAccountRecon, len(input.Accounts)),
}
for i, account := range input.Accounts {
Expand Down
9 changes: 5 additions & 4 deletions backend/app/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (a *App) QueueTeamReportGeneration(ctx context.Context, input QueueTeamRepo
return fmt.Errorf("failed to get aws integrations: %w", err)
}
for _, integration := range integrations {
if err := a.queueAWSIntegrationReportGeneration(ctx, queueAWSIntegrationReportGenerationInput{
if err := a.doReconAndQueueAWSIntegrationReportGeneration(ctx, doReconAndQueueAWSIntegrationReportGenerationInput{
Integration: integration,
StartTime: input.StartTime,
Duration: input.Duration,
Expand Down Expand Up @@ -111,7 +111,7 @@ func (s *Session) QueueAWSIntegrationReportGeneration(ctx context.Context, input
} else if integration == nil {
return NotFoundError("No such AWS integration.")
}
return s.SanitizedError(s.app.queueAWSIntegrationReportGeneration(ctx, queueAWSIntegrationReportGenerationInput{
return s.SanitizedError(s.app.doReconAndQueueAWSIntegrationReportGeneration(ctx, doReconAndQueueAWSIntegrationReportGenerationInput{
Integration: integration,
StartTime: input.StartTime,
Duration: input.Duration,
Expand All @@ -120,7 +120,7 @@ func (s *Session) QueueAWSIntegrationReportGeneration(ctx context.Context, input
}))
}

type queueAWSIntegrationReportGenerationInput struct {
type doReconAndQueueAWSIntegrationReportGenerationInput struct {
Integration *model.AWSIntegration
StartTime time.Time
Duration time.Duration
Expand All @@ -132,7 +132,7 @@ type queueAWSIntegrationReportGenerationInput struct {
ReconOnly bool
}

func (a *App) queueAWSIntegrationReportGeneration(ctx context.Context, input queueAWSIntegrationReportGenerationInput) error {
func (a *App) doReconAndQueueAWSIntegrationReportGeneration(ctx context.Context, input doReconAndQueueAWSIntegrationReportGenerationInput) error {
creds, err := a.assumeAWSIntegrationRole(ctx, input.Integration)
if err != nil {
return fmt.Errorf("failed to assume role: %w", err)
Expand Down Expand Up @@ -233,6 +233,7 @@ func (a *App) queueAWSIntegrationReportGeneration(ctx context.Context, input que
TeamId: input.Integration.TeamId,
Time: time.Now(),
Accounts: accountRecons,
CanManageSCPs: input.Integration.ManageSCPs,
}); err != nil {
return fmt.Errorf("failed to put aws integration recon: %w", err)
}
Expand Down
Loading