func ExampleCloudTrail_DescribeTrails() { svc := cloudtrail.New(nil) params := &cloudtrail.DescribeTrailsInput{ TrailNameList: []*string{ aws.String("String"), // Required // More values... }, } resp, err := svc.DescribeTrails(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS Error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, The SDK should alwsy return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleCloudTrail_UpdateTrail() { svc := cloudtrail.New(nil) params := &cloudtrail.UpdateTrailInput{ Name: aws.String("String"), // Required CloudWatchLogsLogGroupARN: aws.String("String"), CloudWatchLogsRoleARN: aws.String("String"), IncludeGlobalServiceEvents: aws.Boolean(true), S3BucketName: aws.String("String"), S3KeyPrefix: aws.String("String"), SNSTopicName: aws.String("String"), } resp, err := svc.UpdateTrail(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS Error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, The SDK should alwsy return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleCloudTrail_LookupEvents() { svc := cloudtrail.New(nil) params := &cloudtrail.LookupEventsInput{ EndTime: aws.Time(time.Now()), LookupAttributes: []*cloudtrail.LookupAttribute{ &cloudtrail.LookupAttribute{ // Required AttributeKey: aws.String("LookupAttributeKey"), // Required AttributeValue: aws.String("String"), // Required }, // More values... }, MaxResults: aws.Long(1), NextToken: aws.String("NextToken"), StartTime: aws.Time(time.Now()), } resp, err := svc.LookupEvents(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS Error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, The SDK should alwsy return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func TestInterface(t *testing.T) { assert.Implements(t, (*cloudtrailiface.CloudTrailAPI)(nil), cloudtrail.New(nil)) }
func init() { Before("@cloudtrail", func() { World["client"] = cloudtrail.New(nil) }) }