-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from flanksource/moshloop2
Improve AWS support
- Loading branch information
Showing
41 changed files
with
1,899 additions
and
576 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,49 @@ | ||
package v1 | ||
|
||
import ( | ||
"strings" | ||
"time" | ||
) | ||
|
||
// AWS ... | ||
type AWS struct { | ||
*AWSConnection | ||
PatchStates bool `json:"patch_states,omitempty"` | ||
PatchDetails bool `json:"patch_details,omitempty"` | ||
Inventory bool `json:"inventory,omitempty"` | ||
Compliance bool `json:"compliance,omitempty"` | ||
TrustedAdvisorCheck bool `json:"trusted_advisor_check,omitempty"` | ||
PatchStates bool `json:"patch_states,omitempty"` | ||
PatchDetails bool `json:"patch_details,omitempty"` | ||
Inventory bool `json:"inventory,omitempty"` | ||
Compliance bool `json:"compliance,omitempty"` | ||
CloudTrail CloudTrail `json:"cloudtrail,omitempty"` | ||
TrustedAdvisorCheck bool `json:"trusted_advisor_check,omitempty"` | ||
Include []string `json:"include,omitempty"` | ||
Exclude []string `json:"exclude,omitempty"` | ||
BaseScraper `json:",inline"` | ||
} | ||
|
||
type CloudTrail struct { | ||
Exclude []string `json:"exclude,omitempty"` | ||
MaxAge *time.Duration `json:"max_age,omitempty"` | ||
} | ||
|
||
func (aws AWS) Includes(resource string) bool { | ||
if len(aws.Include) == 0 { | ||
return true | ||
} | ||
for _, include := range aws.Include { | ||
if strings.EqualFold(include, resource) { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
func (aws AWS) Excludes(resource string) bool { | ||
if len(aws.Exclude) == 0 { | ||
return false | ||
} | ||
for _, exclude := range aws.Exclude { | ||
if strings.EqualFold(exclude, resource) { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
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 |
---|---|---|
@@ -1,9 +1,25 @@ | ||
package v1 | ||
|
||
import "net/url" | ||
|
||
// File ... | ||
type File struct { | ||
ID string `json:"id,omitempty"` | ||
Type string `json:"type,omitempty"` | ||
URL string `json:"url,omitempty"` | ||
Paths []string `json:"paths,omitempty"` | ||
BaseScraper `json:",inline"` | ||
URL string `json:"url,omitempty"` | ||
Paths []string `json:"paths,omitempty"` | ||
Ignore []string `json:"ignore,omitempty"` | ||
} | ||
|
||
func (f File) RedactedString() string { | ||
if f.URL == "" { | ||
return f.URL | ||
} | ||
|
||
url, err := url.Parse(f.URL) | ||
if err != nil { | ||
return f.URL | ||
} | ||
|
||
return url.Redacted() | ||
|
||
} |
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
Oops, something went wrong.