Switch to using the dep tool and update all the dependencies

This commit is contained in:
Nick Craig-Wood 2017-05-11 15:39:54 +01:00
parent 5135ff73cb
commit 98c2d2c41b
5321 changed files with 4483201 additions and 5922 deletions

8010
vendor/github.com/aws/aws-sdk-go/service/inspector/api.go generated vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,82 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package inspector provides the client and types for making API
// requests to Amazon Inspector.
//
// Amazon Inspector enables you to analyze the behavior of your AWS resources
// and to identify potential security issues. For more information, see Amazon
// Inspector User Guide (http://docs.aws.amazon.com/inspector/latest/userguide/inspector_introduction.html).
//
// See https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16 for more information on this service.
//
// See inspector package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/inspector/
//
// Using the Client
//
// To use the client for Amazon Inspector you will first need
// to create a new instance of it.
//
// When creating a client for an AWS service you'll first need to have a Session
// already created. The Session provides configuration that can be shared
// between multiple service clients. Additional configuration can be applied to
// the Session and service's client when they are constructed. The aws package's
// Config type contains several fields such as Region for the AWS Region the
// client should make API requests too. The optional Config value can be provided
// as the variadic argument for Sessions and client creation.
//
// Once the service's client is created you can use it to make API requests the
// AWS service. These clients are safe to use concurrently.
//
// // Create a session to share configuration, and load external configuration.
// sess := session.Must(session.NewSession())
//
// // Create the service's client with the session.
// svc := inspector.New(sess)
//
// See the SDK's documentation for more information on how to use service clients.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws package's Config type for more information on configuration options.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon Inspector client Inspector for more
// information on creating the service's client.
// https://docs.aws.amazon.com/sdk-for-go/api/service/inspector/#New
//
// Once the client is created you can make an API request to the service.
// Each API method takes a input parameter, and returns the service response
// and an error.
//
// The API method will document which error codes the service can be returned
// by the operation if the service models the API operation's errors. These
// errors will also be available as const strings prefixed with "ErrCode".
//
// result, err := svc.AddAttributesToFindings(params)
// if err != nil {
// // Cast err to awserr.Error to handle specific error codes.
// aerr, ok := err.(awserr.Error)
// if ok && aerr.Code() == <error code to check for> {
// // Specific error code handling
// }
// return err
// }
//
// fmt.Println("AddAttributesToFindings result:")
// fmt.Println(result)
//
// Using the Client with Context
//
// The service's client also provides methods to make API requests with a Context
// value. This allows you to control the timeout, and cancellation of pending
// requests. These methods also take request Option as variadic parameter to apply
// additional configuration to the API request.
//
// ctx := context.Background()
//
// result, err := svc.AddAttributesToFindingsWithContext(ctx, params)
//
// See the request package documentation for more information on using Context pattern
// with the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/request/
package inspector

View file

@ -0,0 +1,60 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package inspector
const (
// ErrCodeAccessDeniedException for service response error code
// "AccessDeniedException".
//
// You do not have required permissions to access the requested resource.
ErrCodeAccessDeniedException = "AccessDeniedException"
// ErrCodeAgentsAlreadyRunningAssessmentException for service response error code
// "AgentsAlreadyRunningAssessmentException".
//
// You started an assessment run, but one of the instances is already participating
// in another assessment run.
ErrCodeAgentsAlreadyRunningAssessmentException = "AgentsAlreadyRunningAssessmentException"
// ErrCodeAssessmentRunInProgressException for service response error code
// "AssessmentRunInProgressException".
//
// You cannot perform a specified action if an assessment run is currently in
// progress.
ErrCodeAssessmentRunInProgressException = "AssessmentRunInProgressException"
// ErrCodeInternalException for service response error code
// "InternalException".
//
// Internal server error.
ErrCodeInternalException = "InternalException"
// ErrCodeInvalidCrossAccountRoleException for service response error code
// "InvalidCrossAccountRoleException".
//
// Amazon Inspector cannot assume the cross-account role that it needs to list
// your EC2 instances during the assessment run.
ErrCodeInvalidCrossAccountRoleException = "InvalidCrossAccountRoleException"
// ErrCodeInvalidInputException for service response error code
// "InvalidInputException".
//
// The request was rejected because an invalid or out-of-range value was supplied
// for an input parameter.
ErrCodeInvalidInputException = "InvalidInputException"
// ErrCodeLimitExceededException for service response error code
// "LimitExceededException".
//
// The request was rejected because it attempted to create resources beyond
// the current AWS account limits. The error code describes the limit exceeded.
ErrCodeLimitExceededException = "LimitExceededException"
// ErrCodeNoSuchEntityException for service response error code
// "NoSuchEntityException".
//
// The request was rejected because it referenced an entity that does not exist.
// The error code describes the entity.
ErrCodeNoSuchEntityException = "NoSuchEntityException"
)

View file

@ -0,0 +1,871 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package inspector_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/inspector"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleInspector_AddAttributesToFindings() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.AddAttributesToFindingsInput{
Attributes: []*inspector.Attribute{ // Required
{ // Required
Key: aws.String("AttributeKey"), // Required
Value: aws.String("AttributeValue"),
},
// More values...
},
FindingArns: []*string{ // Required
aws.String("Arn"), // Required
// More values...
},
}
resp, err := svc.AddAttributesToFindings(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_CreateAssessmentTarget() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.CreateAssessmentTargetInput{
AssessmentTargetName: aws.String("AssessmentTargetName"), // Required
ResourceGroupArn: aws.String("Arn"), // Required
}
resp, err := svc.CreateAssessmentTarget(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_CreateAssessmentTemplate() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.CreateAssessmentTemplateInput{
AssessmentTargetArn: aws.String("Arn"), // Required
AssessmentTemplateName: aws.String("AssessmentTemplateName"), // Required
DurationInSeconds: aws.Int64(1), // Required
RulesPackageArns: []*string{ // Required
aws.String("Arn"), // Required
// More values...
},
UserAttributesForFindings: []*inspector.Attribute{
{ // Required
Key: aws.String("AttributeKey"), // Required
Value: aws.String("AttributeValue"),
},
// More values...
},
}
resp, err := svc.CreateAssessmentTemplate(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_CreateResourceGroup() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.CreateResourceGroupInput{
ResourceGroupTags: []*inspector.ResourceGroupTag{ // Required
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"),
},
// More values...
},
}
resp, err := svc.CreateResourceGroup(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_DeleteAssessmentRun() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.DeleteAssessmentRunInput{
AssessmentRunArn: aws.String("Arn"), // Required
}
resp, err := svc.DeleteAssessmentRun(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_DeleteAssessmentTarget() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.DeleteAssessmentTargetInput{
AssessmentTargetArn: aws.String("Arn"), // Required
}
resp, err := svc.DeleteAssessmentTarget(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_DeleteAssessmentTemplate() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.DeleteAssessmentTemplateInput{
AssessmentTemplateArn: aws.String("Arn"), // Required
}
resp, err := svc.DeleteAssessmentTemplate(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_DescribeAssessmentRuns() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.DescribeAssessmentRunsInput{
AssessmentRunArns: []*string{ // Required
aws.String("Arn"), // Required
// More values...
},
}
resp, err := svc.DescribeAssessmentRuns(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_DescribeAssessmentTargets() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.DescribeAssessmentTargetsInput{
AssessmentTargetArns: []*string{ // Required
aws.String("Arn"), // Required
// More values...
},
}
resp, err := svc.DescribeAssessmentTargets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_DescribeAssessmentTemplates() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.DescribeAssessmentTemplatesInput{
AssessmentTemplateArns: []*string{ // Required
aws.String("Arn"), // Required
// More values...
},
}
resp, err := svc.DescribeAssessmentTemplates(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_DescribeCrossAccountAccessRole() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
var params *inspector.DescribeCrossAccountAccessRoleInput
resp, err := svc.DescribeCrossAccountAccessRole(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_DescribeFindings() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.DescribeFindingsInput{
FindingArns: []*string{ // Required
aws.String("Arn"), // Required
// More values...
},
Locale: aws.String("Locale"),
}
resp, err := svc.DescribeFindings(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_DescribeResourceGroups() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.DescribeResourceGroupsInput{
ResourceGroupArns: []*string{ // Required
aws.String("Arn"), // Required
// More values...
},
}
resp, err := svc.DescribeResourceGroups(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_DescribeRulesPackages() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.DescribeRulesPackagesInput{
RulesPackageArns: []*string{ // Required
aws.String("Arn"), // Required
// More values...
},
Locale: aws.String("Locale"),
}
resp, err := svc.DescribeRulesPackages(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_GetTelemetryMetadata() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.GetTelemetryMetadataInput{
AssessmentRunArn: aws.String("Arn"), // Required
}
resp, err := svc.GetTelemetryMetadata(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_ListAssessmentRunAgents() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.ListAssessmentRunAgentsInput{
AssessmentRunArn: aws.String("Arn"), // Required
Filter: &inspector.AgentFilter{
AgentHealthCodes: []*string{ // Required
aws.String("AgentHealthCode"), // Required
// More values...
},
AgentHealths: []*string{ // Required
aws.String("AgentHealth"), // Required
// More values...
},
},
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListAssessmentRunAgents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_ListAssessmentRuns() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.ListAssessmentRunsInput{
AssessmentTemplateArns: []*string{
aws.String("Arn"), // Required
// More values...
},
Filter: &inspector.AssessmentRunFilter{
CompletionTimeRange: &inspector.TimestampRange{
BeginDate: aws.Time(time.Now()),
EndDate: aws.Time(time.Now()),
},
DurationRange: &inspector.DurationRange{
MaxSeconds: aws.Int64(1),
MinSeconds: aws.Int64(1),
},
NamePattern: aws.String("NamePattern"),
RulesPackageArns: []*string{
aws.String("Arn"), // Required
// More values...
},
StartTimeRange: &inspector.TimestampRange{
BeginDate: aws.Time(time.Now()),
EndDate: aws.Time(time.Now()),
},
StateChangeTimeRange: &inspector.TimestampRange{
BeginDate: aws.Time(time.Now()),
EndDate: aws.Time(time.Now()),
},
States: []*string{
aws.String("AssessmentRunState"), // Required
// More values...
},
},
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListAssessmentRuns(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_ListAssessmentTargets() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.ListAssessmentTargetsInput{
Filter: &inspector.AssessmentTargetFilter{
AssessmentTargetNamePattern: aws.String("NamePattern"),
},
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListAssessmentTargets(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_ListAssessmentTemplates() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.ListAssessmentTemplatesInput{
AssessmentTargetArns: []*string{
aws.String("Arn"), // Required
// More values...
},
Filter: &inspector.AssessmentTemplateFilter{
DurationRange: &inspector.DurationRange{
MaxSeconds: aws.Int64(1),
MinSeconds: aws.Int64(1),
},
NamePattern: aws.String("NamePattern"),
RulesPackageArns: []*string{
aws.String("Arn"), // Required
// More values...
},
},
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListAssessmentTemplates(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_ListEventSubscriptions() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.ListEventSubscriptionsInput{
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationToken"),
ResourceArn: aws.String("Arn"),
}
resp, err := svc.ListEventSubscriptions(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_ListFindings() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.ListFindingsInput{
AssessmentRunArns: []*string{
aws.String("Arn"), // Required
// More values...
},
Filter: &inspector.FindingFilter{
AgentIds: []*string{
aws.String("AgentId"), // Required
// More values...
},
Attributes: []*inspector.Attribute{
{ // Required
Key: aws.String("AttributeKey"), // Required
Value: aws.String("AttributeValue"),
},
// More values...
},
AutoScalingGroups: []*string{
aws.String("AutoScalingGroup"), // Required
// More values...
},
CreationTimeRange: &inspector.TimestampRange{
BeginDate: aws.Time(time.Now()),
EndDate: aws.Time(time.Now()),
},
RuleNames: []*string{
aws.String("RuleName"), // Required
// More values...
},
RulesPackageArns: []*string{
aws.String("Arn"), // Required
// More values...
},
Severities: []*string{
aws.String("Severity"), // Required
// More values...
},
UserAttributes: []*inspector.Attribute{
{ // Required
Key: aws.String("AttributeKey"), // Required
Value: aws.String("AttributeValue"),
},
// More values...
},
},
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListFindings(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_ListRulesPackages() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.ListRulesPackagesInput{
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListRulesPackages(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_ListTagsForResource() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.ListTagsForResourceInput{
ResourceArn: aws.String("Arn"), // Required
}
resp, err := svc.ListTagsForResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_PreviewAgents() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.PreviewAgentsInput{
PreviewAgentsArn: aws.String("Arn"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.PreviewAgents(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_RegisterCrossAccountAccessRole() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.RegisterCrossAccountAccessRoleInput{
RoleArn: aws.String("Arn"), // Required
}
resp, err := svc.RegisterCrossAccountAccessRole(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_RemoveAttributesFromFindings() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.RemoveAttributesFromFindingsInput{
AttributeKeys: []*string{ // Required
aws.String("AttributeKey"), // Required
// More values...
},
FindingArns: []*string{ // Required
aws.String("Arn"), // Required
// More values...
},
}
resp, err := svc.RemoveAttributesFromFindings(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_SetTagsForResource() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.SetTagsForResourceInput{
ResourceArn: aws.String("Arn"), // Required
Tags: []*inspector.Tag{
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"),
},
// More values...
},
}
resp, err := svc.SetTagsForResource(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_StartAssessmentRun() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.StartAssessmentRunInput{
AssessmentTemplateArn: aws.String("Arn"), // Required
AssessmentRunName: aws.String("AssessmentRunName"),
}
resp, err := svc.StartAssessmentRun(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_StopAssessmentRun() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.StopAssessmentRunInput{
AssessmentRunArn: aws.String("Arn"), // Required
}
resp, err := svc.StopAssessmentRun(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_SubscribeToEvent() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.SubscribeToEventInput{
Event: aws.String("Event"), // Required
ResourceArn: aws.String("Arn"), // Required
TopicArn: aws.String("Arn"), // Required
}
resp, err := svc.SubscribeToEvent(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_UnsubscribeFromEvent() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.UnsubscribeFromEventInput{
Event: aws.String("Event"), // Required
ResourceArn: aws.String("Arn"), // Required
TopicArn: aws.String("Arn"), // Required
}
resp, err := svc.UnsubscribeFromEvent(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleInspector_UpdateAssessmentTarget() {
sess := session.Must(session.NewSession())
svc := inspector.New(sess)
params := &inspector.UpdateAssessmentTargetInput{
AssessmentTargetArn: aws.String("Arn"), // Required
AssessmentTargetName: aws.String("AssessmentTargetName"), // Required
ResourceGroupArn: aws.String("Arn"), // Required
}
resp, err := svc.UpdateAssessmentTarget(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}

View file

@ -0,0 +1,192 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package inspectoriface provides an interface to enable mocking the Amazon Inspector service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package inspectoriface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/inspector"
)
// InspectorAPI provides an interface to enable mocking the
// inspector.Inspector service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Amazon Inspector.
// func myFunc(svc inspectoriface.InspectorAPI) bool {
// // Make svc.AddAttributesToFindings request
// }
//
// func main() {
// sess := session.New()
// svc := inspector.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockInspectorClient struct {
// inspectoriface.InspectorAPI
// }
// func (m *mockInspectorClient) AddAttributesToFindings(input *inspector.AddAttributesToFindingsInput) (*inspector.AddAttributesToFindingsOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockInspectorClient{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type InspectorAPI interface {
AddAttributesToFindings(*inspector.AddAttributesToFindingsInput) (*inspector.AddAttributesToFindingsOutput, error)
AddAttributesToFindingsWithContext(aws.Context, *inspector.AddAttributesToFindingsInput, ...request.Option) (*inspector.AddAttributesToFindingsOutput, error)
AddAttributesToFindingsRequest(*inspector.AddAttributesToFindingsInput) (*request.Request, *inspector.AddAttributesToFindingsOutput)
CreateAssessmentTarget(*inspector.CreateAssessmentTargetInput) (*inspector.CreateAssessmentTargetOutput, error)
CreateAssessmentTargetWithContext(aws.Context, *inspector.CreateAssessmentTargetInput, ...request.Option) (*inspector.CreateAssessmentTargetOutput, error)
CreateAssessmentTargetRequest(*inspector.CreateAssessmentTargetInput) (*request.Request, *inspector.CreateAssessmentTargetOutput)
CreateAssessmentTemplate(*inspector.CreateAssessmentTemplateInput) (*inspector.CreateAssessmentTemplateOutput, error)
CreateAssessmentTemplateWithContext(aws.Context, *inspector.CreateAssessmentTemplateInput, ...request.Option) (*inspector.CreateAssessmentTemplateOutput, error)
CreateAssessmentTemplateRequest(*inspector.CreateAssessmentTemplateInput) (*request.Request, *inspector.CreateAssessmentTemplateOutput)
CreateResourceGroup(*inspector.CreateResourceGroupInput) (*inspector.CreateResourceGroupOutput, error)
CreateResourceGroupWithContext(aws.Context, *inspector.CreateResourceGroupInput, ...request.Option) (*inspector.CreateResourceGroupOutput, error)
CreateResourceGroupRequest(*inspector.CreateResourceGroupInput) (*request.Request, *inspector.CreateResourceGroupOutput)
DeleteAssessmentRun(*inspector.DeleteAssessmentRunInput) (*inspector.DeleteAssessmentRunOutput, error)
DeleteAssessmentRunWithContext(aws.Context, *inspector.DeleteAssessmentRunInput, ...request.Option) (*inspector.DeleteAssessmentRunOutput, error)
DeleteAssessmentRunRequest(*inspector.DeleteAssessmentRunInput) (*request.Request, *inspector.DeleteAssessmentRunOutput)
DeleteAssessmentTarget(*inspector.DeleteAssessmentTargetInput) (*inspector.DeleteAssessmentTargetOutput, error)
DeleteAssessmentTargetWithContext(aws.Context, *inspector.DeleteAssessmentTargetInput, ...request.Option) (*inspector.DeleteAssessmentTargetOutput, error)
DeleteAssessmentTargetRequest(*inspector.DeleteAssessmentTargetInput) (*request.Request, *inspector.DeleteAssessmentTargetOutput)
DeleteAssessmentTemplate(*inspector.DeleteAssessmentTemplateInput) (*inspector.DeleteAssessmentTemplateOutput, error)
DeleteAssessmentTemplateWithContext(aws.Context, *inspector.DeleteAssessmentTemplateInput, ...request.Option) (*inspector.DeleteAssessmentTemplateOutput, error)
DeleteAssessmentTemplateRequest(*inspector.DeleteAssessmentTemplateInput) (*request.Request, *inspector.DeleteAssessmentTemplateOutput)
DescribeAssessmentRuns(*inspector.DescribeAssessmentRunsInput) (*inspector.DescribeAssessmentRunsOutput, error)
DescribeAssessmentRunsWithContext(aws.Context, *inspector.DescribeAssessmentRunsInput, ...request.Option) (*inspector.DescribeAssessmentRunsOutput, error)
DescribeAssessmentRunsRequest(*inspector.DescribeAssessmentRunsInput) (*request.Request, *inspector.DescribeAssessmentRunsOutput)
DescribeAssessmentTargets(*inspector.DescribeAssessmentTargetsInput) (*inspector.DescribeAssessmentTargetsOutput, error)
DescribeAssessmentTargetsWithContext(aws.Context, *inspector.DescribeAssessmentTargetsInput, ...request.Option) (*inspector.DescribeAssessmentTargetsOutput, error)
DescribeAssessmentTargetsRequest(*inspector.DescribeAssessmentTargetsInput) (*request.Request, *inspector.DescribeAssessmentTargetsOutput)
DescribeAssessmentTemplates(*inspector.DescribeAssessmentTemplatesInput) (*inspector.DescribeAssessmentTemplatesOutput, error)
DescribeAssessmentTemplatesWithContext(aws.Context, *inspector.DescribeAssessmentTemplatesInput, ...request.Option) (*inspector.DescribeAssessmentTemplatesOutput, error)
DescribeAssessmentTemplatesRequest(*inspector.DescribeAssessmentTemplatesInput) (*request.Request, *inspector.DescribeAssessmentTemplatesOutput)
DescribeCrossAccountAccessRole(*inspector.DescribeCrossAccountAccessRoleInput) (*inspector.DescribeCrossAccountAccessRoleOutput, error)
DescribeCrossAccountAccessRoleWithContext(aws.Context, *inspector.DescribeCrossAccountAccessRoleInput, ...request.Option) (*inspector.DescribeCrossAccountAccessRoleOutput, error)
DescribeCrossAccountAccessRoleRequest(*inspector.DescribeCrossAccountAccessRoleInput) (*request.Request, *inspector.DescribeCrossAccountAccessRoleOutput)
DescribeFindings(*inspector.DescribeFindingsInput) (*inspector.DescribeFindingsOutput, error)
DescribeFindingsWithContext(aws.Context, *inspector.DescribeFindingsInput, ...request.Option) (*inspector.DescribeFindingsOutput, error)
DescribeFindingsRequest(*inspector.DescribeFindingsInput) (*request.Request, *inspector.DescribeFindingsOutput)
DescribeResourceGroups(*inspector.DescribeResourceGroupsInput) (*inspector.DescribeResourceGroupsOutput, error)
DescribeResourceGroupsWithContext(aws.Context, *inspector.DescribeResourceGroupsInput, ...request.Option) (*inspector.DescribeResourceGroupsOutput, error)
DescribeResourceGroupsRequest(*inspector.DescribeResourceGroupsInput) (*request.Request, *inspector.DescribeResourceGroupsOutput)
DescribeRulesPackages(*inspector.DescribeRulesPackagesInput) (*inspector.DescribeRulesPackagesOutput, error)
DescribeRulesPackagesWithContext(aws.Context, *inspector.DescribeRulesPackagesInput, ...request.Option) (*inspector.DescribeRulesPackagesOutput, error)
DescribeRulesPackagesRequest(*inspector.DescribeRulesPackagesInput) (*request.Request, *inspector.DescribeRulesPackagesOutput)
GetTelemetryMetadata(*inspector.GetTelemetryMetadataInput) (*inspector.GetTelemetryMetadataOutput, error)
GetTelemetryMetadataWithContext(aws.Context, *inspector.GetTelemetryMetadataInput, ...request.Option) (*inspector.GetTelemetryMetadataOutput, error)
GetTelemetryMetadataRequest(*inspector.GetTelemetryMetadataInput) (*request.Request, *inspector.GetTelemetryMetadataOutput)
ListAssessmentRunAgents(*inspector.ListAssessmentRunAgentsInput) (*inspector.ListAssessmentRunAgentsOutput, error)
ListAssessmentRunAgentsWithContext(aws.Context, *inspector.ListAssessmentRunAgentsInput, ...request.Option) (*inspector.ListAssessmentRunAgentsOutput, error)
ListAssessmentRunAgentsRequest(*inspector.ListAssessmentRunAgentsInput) (*request.Request, *inspector.ListAssessmentRunAgentsOutput)
ListAssessmentRuns(*inspector.ListAssessmentRunsInput) (*inspector.ListAssessmentRunsOutput, error)
ListAssessmentRunsWithContext(aws.Context, *inspector.ListAssessmentRunsInput, ...request.Option) (*inspector.ListAssessmentRunsOutput, error)
ListAssessmentRunsRequest(*inspector.ListAssessmentRunsInput) (*request.Request, *inspector.ListAssessmentRunsOutput)
ListAssessmentTargets(*inspector.ListAssessmentTargetsInput) (*inspector.ListAssessmentTargetsOutput, error)
ListAssessmentTargetsWithContext(aws.Context, *inspector.ListAssessmentTargetsInput, ...request.Option) (*inspector.ListAssessmentTargetsOutput, error)
ListAssessmentTargetsRequest(*inspector.ListAssessmentTargetsInput) (*request.Request, *inspector.ListAssessmentTargetsOutput)
ListAssessmentTemplates(*inspector.ListAssessmentTemplatesInput) (*inspector.ListAssessmentTemplatesOutput, error)
ListAssessmentTemplatesWithContext(aws.Context, *inspector.ListAssessmentTemplatesInput, ...request.Option) (*inspector.ListAssessmentTemplatesOutput, error)
ListAssessmentTemplatesRequest(*inspector.ListAssessmentTemplatesInput) (*request.Request, *inspector.ListAssessmentTemplatesOutput)
ListEventSubscriptions(*inspector.ListEventSubscriptionsInput) (*inspector.ListEventSubscriptionsOutput, error)
ListEventSubscriptionsWithContext(aws.Context, *inspector.ListEventSubscriptionsInput, ...request.Option) (*inspector.ListEventSubscriptionsOutput, error)
ListEventSubscriptionsRequest(*inspector.ListEventSubscriptionsInput) (*request.Request, *inspector.ListEventSubscriptionsOutput)
ListFindings(*inspector.ListFindingsInput) (*inspector.ListFindingsOutput, error)
ListFindingsWithContext(aws.Context, *inspector.ListFindingsInput, ...request.Option) (*inspector.ListFindingsOutput, error)
ListFindingsRequest(*inspector.ListFindingsInput) (*request.Request, *inspector.ListFindingsOutput)
ListRulesPackages(*inspector.ListRulesPackagesInput) (*inspector.ListRulesPackagesOutput, error)
ListRulesPackagesWithContext(aws.Context, *inspector.ListRulesPackagesInput, ...request.Option) (*inspector.ListRulesPackagesOutput, error)
ListRulesPackagesRequest(*inspector.ListRulesPackagesInput) (*request.Request, *inspector.ListRulesPackagesOutput)
ListTagsForResource(*inspector.ListTagsForResourceInput) (*inspector.ListTagsForResourceOutput, error)
ListTagsForResourceWithContext(aws.Context, *inspector.ListTagsForResourceInput, ...request.Option) (*inspector.ListTagsForResourceOutput, error)
ListTagsForResourceRequest(*inspector.ListTagsForResourceInput) (*request.Request, *inspector.ListTagsForResourceOutput)
PreviewAgents(*inspector.PreviewAgentsInput) (*inspector.PreviewAgentsOutput, error)
PreviewAgentsWithContext(aws.Context, *inspector.PreviewAgentsInput, ...request.Option) (*inspector.PreviewAgentsOutput, error)
PreviewAgentsRequest(*inspector.PreviewAgentsInput) (*request.Request, *inspector.PreviewAgentsOutput)
RegisterCrossAccountAccessRole(*inspector.RegisterCrossAccountAccessRoleInput) (*inspector.RegisterCrossAccountAccessRoleOutput, error)
RegisterCrossAccountAccessRoleWithContext(aws.Context, *inspector.RegisterCrossAccountAccessRoleInput, ...request.Option) (*inspector.RegisterCrossAccountAccessRoleOutput, error)
RegisterCrossAccountAccessRoleRequest(*inspector.RegisterCrossAccountAccessRoleInput) (*request.Request, *inspector.RegisterCrossAccountAccessRoleOutput)
RemoveAttributesFromFindings(*inspector.RemoveAttributesFromFindingsInput) (*inspector.RemoveAttributesFromFindingsOutput, error)
RemoveAttributesFromFindingsWithContext(aws.Context, *inspector.RemoveAttributesFromFindingsInput, ...request.Option) (*inspector.RemoveAttributesFromFindingsOutput, error)
RemoveAttributesFromFindingsRequest(*inspector.RemoveAttributesFromFindingsInput) (*request.Request, *inspector.RemoveAttributesFromFindingsOutput)
SetTagsForResource(*inspector.SetTagsForResourceInput) (*inspector.SetTagsForResourceOutput, error)
SetTagsForResourceWithContext(aws.Context, *inspector.SetTagsForResourceInput, ...request.Option) (*inspector.SetTagsForResourceOutput, error)
SetTagsForResourceRequest(*inspector.SetTagsForResourceInput) (*request.Request, *inspector.SetTagsForResourceOutput)
StartAssessmentRun(*inspector.StartAssessmentRunInput) (*inspector.StartAssessmentRunOutput, error)
StartAssessmentRunWithContext(aws.Context, *inspector.StartAssessmentRunInput, ...request.Option) (*inspector.StartAssessmentRunOutput, error)
StartAssessmentRunRequest(*inspector.StartAssessmentRunInput) (*request.Request, *inspector.StartAssessmentRunOutput)
StopAssessmentRun(*inspector.StopAssessmentRunInput) (*inspector.StopAssessmentRunOutput, error)
StopAssessmentRunWithContext(aws.Context, *inspector.StopAssessmentRunInput, ...request.Option) (*inspector.StopAssessmentRunOutput, error)
StopAssessmentRunRequest(*inspector.StopAssessmentRunInput) (*request.Request, *inspector.StopAssessmentRunOutput)
SubscribeToEvent(*inspector.SubscribeToEventInput) (*inspector.SubscribeToEventOutput, error)
SubscribeToEventWithContext(aws.Context, *inspector.SubscribeToEventInput, ...request.Option) (*inspector.SubscribeToEventOutput, error)
SubscribeToEventRequest(*inspector.SubscribeToEventInput) (*request.Request, *inspector.SubscribeToEventOutput)
UnsubscribeFromEvent(*inspector.UnsubscribeFromEventInput) (*inspector.UnsubscribeFromEventOutput, error)
UnsubscribeFromEventWithContext(aws.Context, *inspector.UnsubscribeFromEventInput, ...request.Option) (*inspector.UnsubscribeFromEventOutput, error)
UnsubscribeFromEventRequest(*inspector.UnsubscribeFromEventInput) (*request.Request, *inspector.UnsubscribeFromEventOutput)
UpdateAssessmentTarget(*inspector.UpdateAssessmentTargetInput) (*inspector.UpdateAssessmentTargetOutput, error)
UpdateAssessmentTargetWithContext(aws.Context, *inspector.UpdateAssessmentTargetInput, ...request.Option) (*inspector.UpdateAssessmentTargetOutput, error)
UpdateAssessmentTargetRequest(*inspector.UpdateAssessmentTargetInput) (*request.Request, *inspector.UpdateAssessmentTargetOutput)
}
var _ InspectorAPI = (*inspector.Inspector)(nil)

View file

@ -0,0 +1,95 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package inspector
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// Inspector provides the API operation methods for making requests to
// Amazon Inspector. See this package's package overview docs
// for details on the service.
//
// Inspector methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type Inspector struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "inspector" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the Inspector client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a Inspector client from just a session.
// svc := inspector.New(mySession)
//
// // Create a Inspector client with additional configuration
// svc := inspector.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *Inspector {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *Inspector {
svc := &Inspector{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2016-02-16",
JSONVersion: "1.1",
TargetPrefix: "InspectorService",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a Inspector operation and runs any
// custom request initialization.
func (c *Inspector) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}