-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aed8456
commit 791a6b7
Showing
10 changed files
with
137 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package service | ||
|
||
import ( | ||
"github.com/deepfence/ThreatMapper/deepfence_utils/log" | ||
"github.com/deepfence/cloud-scanner/query_resource" | ||
"github.com/deepfence/cloud-scanner/util" | ||
) | ||
|
||
// FetchCloudResources Fetch cloud resources from all accounts | ||
func (c *ComplianceScanService) FetchCloudResources() { | ||
log.Info().Msg("Querying cloud resources") | ||
|
||
var accountsToRefresh []util.AccountsToRefresh | ||
if c.config.IsOrganizationDeployment { | ||
for _, monitoredAccount := range c.GetOrganizationAccounts() { | ||
accountsToRefresh = append(accountsToRefresh, util.AccountsToRefresh{ | ||
AccountID: monitoredAccount.AccountID, | ||
NodeID: monitoredAccount.NodeID, | ||
}) | ||
} | ||
} else { | ||
accountsToRefresh = []util.AccountsToRefresh{ | ||
{ | ||
AccountID: c.config.AccountID, | ||
NodeID: c.config.NodeID, | ||
}, | ||
} | ||
} | ||
c.FetchCloudAccountResources(accountsToRefresh, true) | ||
log.Info().Msg("Querying cloud resources complete") | ||
} | ||
|
||
// FetchCloudAccountResources Fetch cloud resources from selected accounts and resource types | ||
func (c *ComplianceScanService) FetchCloudAccountResources(accountsToRefresh []util.AccountsToRefresh, completeRefresh bool) { | ||
errorsCollected := query_resource.QueryAndRegisterResources(c.config, accountsToRefresh, completeRefresh) | ||
if len(errorsCollected) > 0 { | ||
log.Error().Msgf("Error in sending resources, errors: %+v", errorsCollected) | ||
} | ||
} |
Oops, something went wrong.