func ExampleCloudWatchLogs_DeleteDestination() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.DeleteDestinationInput{ DestinationName: aws.String("DestinationName"), // Required } resp, err := svc.DeleteDestination(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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCloudWatchLogs_TestMetricFilter() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.TestMetricFilterInput{ FilterPattern: aws.String("FilterPattern"), // Required LogEventMessages: []*string{ // Required aws.String("EventMessage"), // Required // More values... }, } resp, err := svc.TestMetricFilter(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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCloudWatchLogs_PutLogEvents() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.PutLogEventsInput{ LogEvents: []*cloudwatchlogs.InputLogEvent{ // Required { // Required Message: aws.String("EventMessage"), // Required Timestamp: aws.Int64(1), // Required }, // More values... }, LogGroupName: aws.String("LogGroupName"), // Required LogStreamName: aws.String("LogStreamName"), // Required SequenceToken: aws.String("SequenceToken"), } resp, err := svc.PutLogEvents(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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCloudWatchLogs_DescribeSubscriptionFilters() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.DescribeSubscriptionFiltersInput{ LogGroupName: aws.String("LogGroupName"), // Required FilterNamePrefix: aws.String("FilterName"), Limit: aws.Int64(1), NextToken: aws.String("NextToken"), } resp, err := svc.DescribeSubscriptionFilters(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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCloudWatchLogs_FilterLogEvents() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.FilterLogEventsInput{ LogGroupName: aws.String("LogGroupName"), // Required EndTime: aws.Int64(1), FilterPattern: aws.String("FilterPattern"), Interleaved: aws.Bool(true), Limit: aws.Int64(1), LogStreamNames: []*string{ aws.String("LogStreamName"), // Required // More values... }, NextToken: aws.String("NextToken"), StartTime: aws.Int64(1), } resp, err := svc.FilterLogEvents(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 always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func TestInterface(t *testing.T) { assert.Implements(t, (*cloudwatchlogsiface.CloudWatchLogsAPI)(nil), cloudwatchlogs.New(nil)) }