Ejemplo n.º 1
0
func ExampleCloudTrail_CreateTrail() {
	svc := cloudtrail.New(session.New())

	params := &cloudtrail.CreateTrailInput{
		Name:                       aws.String("String"), // Required
		S3BucketName:               aws.String("String"), // Required
		CloudWatchLogsLogGroupArn:  aws.String("String"),
		CloudWatchLogsRoleArn:      aws.String("String"),
		EnableLogFileValidation:    aws.Bool(true),
		IncludeGlobalServiceEvents: aws.Bool(true),
		IsMultiRegionTrail:         aws.Bool(true),
		KmsKeyId:                   aws.String("String"),
		S3KeyPrefix:                aws.String("String"),
		SnsTopicName:               aws.String("String"),
	}
	resp, err := svc.CreateTrail(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)
}
Ejemplo n.º 2
0
func ExampleCloudTrail_RemoveTags() {
	svc := cloudtrail.New(session.New())

	params := &cloudtrail.RemoveTagsInput{
		ResourceId: aws.String("String"), // Required
		TagsList: []*cloudtrail.Tag{
			{ // Required
				Key:   aws.String("String"), // Required
				Value: aws.String("String"),
			},
			// More values...
		},
	}
	resp, err := svc.RemoveTags(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)
}
Ejemplo n.º 3
0
func ExampleCloudTrail_LookupEvents() {
	svc := cloudtrail.New(session.New())

	params := &cloudtrail.LookupEventsInput{
		EndTime: aws.Time(time.Now()),
		LookupAttributes: []*cloudtrail.LookupAttribute{
			{ // Required
				AttributeKey:   aws.String("LookupAttributeKey"), // Required
				AttributeValue: aws.String("String"),             // Required
			},
			// More values...
		},
		MaxResults: aws.Int64(1),
		NextToken:  aws.String("NextToken"),
		StartTime:  aws.Time(time.Now()),
	}
	resp, err := svc.LookupEvents(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)
}
Ejemplo n.º 4
0
func ExampleCloudTrail_DeleteTrail() {
	svc := cloudtrail.New(session.New())

	params := &cloudtrail.DeleteTrailInput{
		Name: aws.String("String"), // Required
	}
	resp, err := svc.DeleteTrail(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)
}
Ejemplo n.º 5
0
func ExampleCloudTrail_ListPublicKeys() {
	svc := cloudtrail.New(session.New())

	params := &cloudtrail.ListPublicKeysInput{
		EndTime:   aws.Time(time.Now()),
		NextToken: aws.String("String"),
		StartTime: aws.Time(time.Now()),
	}
	resp, err := svc.ListPublicKeys(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)
}
Ejemplo n.º 6
0
func ExampleCloudTrail_DescribeTrails() {
	svc := cloudtrail.New(session.New())

	params := &cloudtrail.DescribeTrailsInput{
		IncludeShadowTrails: aws.Bool(true),
		TrailNameList: []*string{
			aws.String("String"), // Required
			// More values...
		},
	}
	resp, err := svc.DescribeTrails(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)
}
Ejemplo n.º 7
0
func ExampleCloudTrail_ListTags() {
	svc := cloudtrail.New(session.New())

	params := &cloudtrail.ListTagsInput{
		ResourceIdList: []*string{ // Required
			aws.String("String"), // Required
			// More values...
		},
		NextToken: aws.String("String"),
	}
	resp, err := svc.ListTags(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)
}
Ejemplo n.º 8
0
func init() {
	Before("@cloudtrail", func() {
		World["client"] = cloudtrail.New(smoke.Session)
	})
}