123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
- package cloudtrail_test
- import (
- "bytes"
- "fmt"
- "time"
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/service/cloudtrail"
- )
- var _ time.Duration
- var _ bytes.Buffer
- func ExampleCloudTrail_CreateTrail() {
- svc := cloudtrail.New(nil)
- params := &cloudtrail.CreateTrailInput{
- Name: aws.String("String"), // Required
- S3BucketName: aws.String("String"), // Required
- CloudWatchLogsLogGroupArn: aws.String("String"),
- CloudWatchLogsRoleArn: aws.String("String"),
- IncludeGlobalServiceEvents: aws.Bool(true),
- 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)
- }
- func ExampleCloudTrail_DeleteTrail() {
- svc := cloudtrail.New(nil)
- 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)
- }
- 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 {
- // 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 ExampleCloudTrail_GetTrailStatus() {
- svc := cloudtrail.New(nil)
- params := &cloudtrail.GetTrailStatusInput{
- Name: aws.String("String"), // Required
- }
- resp, err := svc.GetTrailStatus(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 ExampleCloudTrail_LookupEvents() {
- svc := cloudtrail.New(nil)
- 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)
- }
- func ExampleCloudTrail_StartLogging() {
- svc := cloudtrail.New(nil)
- params := &cloudtrail.StartLoggingInput{
- Name: aws.String("String"), // Required
- }
- resp, err := svc.StartLogging(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 ExampleCloudTrail_StopLogging() {
- svc := cloudtrail.New(nil)
- params := &cloudtrail.StopLoggingInput{
- Name: aws.String("String"), // Required
- }
- resp, err := svc.StopLogging(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 ExampleCloudTrail_UpdateTrail() {
- svc := cloudtrail.New(nil)
- params := &cloudtrail.UpdateTrailInput{
- Name: aws.String("String"), // Required
- CloudWatchLogsLogGroupArn: aws.String("String"),
- CloudWatchLogsRoleArn: aws.String("String"),
- IncludeGlobalServiceEvents: aws.Bool(true),
- S3BucketName: aws.String("String"),
- S3KeyPrefix: aws.String("String"),
- SnsTopicName: aws.String("String"),
- }
- resp, err := svc.UpdateTrail(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)
- }
|