| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- // 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/aws/session"
- "github.com/aws/aws-sdk-go/service/cloudtrail"
- )
- var _ time.Duration
- var _ bytes.Buffer
- func ExampleCloudTrail_AddTags() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- params := &cloudtrail.AddTagsInput{
- ResourceId: aws.String("String"), // Required
- TagsList: []*cloudtrail.Tag{
- { // Required
- Key: aws.String("String"), // Required
- Value: aws.String("String"),
- },
- // More values...
- },
- }
- resp, err := svc.AddTags(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_CreateTrail() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- 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)
- }
- func ExampleCloudTrail_DeleteTrail() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- 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() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- 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)
- }
- func ExampleCloudTrail_GetTrailStatus() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- 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_ListPublicKeys() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- 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)
- }
- func ExampleCloudTrail_ListTags() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- 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)
- }
- func ExampleCloudTrail_LookupEvents() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- 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_RemoveTags() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- 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)
- }
- func ExampleCloudTrail_StartLogging() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- 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() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- 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() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := cloudtrail.New(sess)
- params := &cloudtrail.UpdateTrailInput{
- Name: 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"),
- 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)
- }
|