-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding support for inspector runs, targets, templates (#712)
- Loading branch information
Showing
3 changed files
with
147 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package resources | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/inspector" | ||
) | ||
|
||
type InspectorAssessmentRun struct { | ||
svc *inspector.Inspector | ||
arn string | ||
} | ||
|
||
func init() { | ||
register("InspectorAssessmentRun", ListInspectorAssessmentRuns) | ||
} | ||
|
||
func ListInspectorAssessmentRuns(sess *session.Session) ([]Resource, error) { | ||
svc := inspector.New(sess) | ||
|
||
resp, err := svc.ListAssessmentRuns(nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
resources := make([]Resource, 0) | ||
for _, out := range resp.AssessmentRunArns { | ||
resources = append(resources, &InspectorAssessmentRun{ | ||
svc: svc, | ||
arn: *out, | ||
}) | ||
} | ||
|
||
return resources, nil | ||
} | ||
|
||
func (e *InspectorAssessmentRun) Remove() error { | ||
_, err := e.svc.DeleteAssessmentRun(&inspector.DeleteAssessmentRunInput{ | ||
AssessmentRunArn: &e.arn, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (e *InspectorAssessmentRun) String() string { | ||
return e.arn | ||
} |
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,49 @@ | ||
package resources | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/inspector" | ||
) | ||
|
||
type InspectorAssessmentTarget struct { | ||
svc *inspector.Inspector | ||
arn string | ||
} | ||
|
||
func init() { | ||
register("InspectorAssessmentTarget", ListInspectorAssessmentTargets) | ||
} | ||
|
||
func ListInspectorAssessmentTargets(sess *session.Session) ([]Resource, error) { | ||
svc := inspector.New(sess) | ||
|
||
resp, err := svc.ListAssessmentTargets(nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
resources := make([]Resource, 0) | ||
for _, out := range resp.AssessmentTargetArns { | ||
resources = append(resources, &InspectorAssessmentTarget{ | ||
svc: svc, | ||
arn: *out, | ||
}) | ||
} | ||
|
||
return resources, nil | ||
} | ||
|
||
func (e *InspectorAssessmentTarget) Remove() error { | ||
_, err := e.svc.DeleteAssessmentTarget(&inspector.DeleteAssessmentTargetInput{ | ||
AssessmentTargetArn: &e.arn, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (e *InspectorAssessmentTarget) String() string { | ||
return e.arn | ||
} |
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,49 @@ | ||
package resources | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/inspector" | ||
) | ||
|
||
type InspectorAssessmentTemplate struct { | ||
svc *inspector.Inspector | ||
arn string | ||
} | ||
|
||
func init() { | ||
register("InspectorAssessmentTemplate", ListInspectorAssessmentTemplates) | ||
} | ||
|
||
func ListInspectorAssessmentTemplates(sess *session.Session) ([]Resource, error) { | ||
svc := inspector.New(sess) | ||
|
||
resp, err := svc.ListAssessmentTemplates(nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
resources := make([]Resource, 0) | ||
for _, out := range resp.AssessmentTemplateArns { | ||
resources = append(resources, &InspectorAssessmentTemplate{ | ||
svc: svc, | ||
arn: *out, | ||
}) | ||
} | ||
|
||
return resources, nil | ||
} | ||
|
||
func (e *InspectorAssessmentTemplate) Remove() error { | ||
_, err := e.svc.DeleteAssessmentTemplate(&inspector.DeleteAssessmentTemplateInput{ | ||
AssessmentTemplateArn: &e.arn, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (e *InspectorAssessmentTemplate) String() string { | ||
return e.arn | ||
} |