123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499 |
- // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
- package cloudwatchlogs_test
- import (
- "bytes"
- "fmt"
- "time"
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/service/cloudwatchlogs"
- )
- var _ time.Duration
- var _ bytes.Buffer
- func ExampleCloudWatchLogs_CreateLogGroup() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.CreateLogGroupInput{
- LogGroupName: aws.String("LogGroupName"), // Required
- }
- resp, err := svc.CreateLogGroup(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 ExampleCloudWatchLogs_CreateLogStream() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.CreateLogStreamInput{
- LogGroupName: aws.String("LogGroupName"), // Required
- LogStreamName: aws.String("LogStreamName"), // Required
- }
- resp, err := svc.CreateLogStream(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 ExampleCloudWatchLogs_DeleteDestination() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.DeleteDestinationInput{
- DestinationName: aws.String("DestinationName"), // Required
- }
- resp, err := svc.DeleteDestination(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 ExampleCloudWatchLogs_DeleteLogGroup() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.DeleteLogGroupInput{
- LogGroupName: aws.String("LogGroupName"), // Required
- }
- resp, err := svc.DeleteLogGroup(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 ExampleCloudWatchLogs_DeleteLogStream() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.DeleteLogStreamInput{
- LogGroupName: aws.String("LogGroupName"), // Required
- LogStreamName: aws.String("LogStreamName"), // Required
- }
- resp, err := svc.DeleteLogStream(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 ExampleCloudWatchLogs_DeleteMetricFilter() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.DeleteMetricFilterInput{
- FilterName: aws.String("FilterName"), // Required
- LogGroupName: aws.String("LogGroupName"), // Required
- }
- resp, err := svc.DeleteMetricFilter(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 ExampleCloudWatchLogs_DeleteRetentionPolicy() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.DeleteRetentionPolicyInput{
- LogGroupName: aws.String("LogGroupName"), // Required
- }
- resp, err := svc.DeleteRetentionPolicy(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 ExampleCloudWatchLogs_DeleteSubscriptionFilter() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.DeleteSubscriptionFilterInput{
- FilterName: aws.String("FilterName"), // Required
- LogGroupName: aws.String("LogGroupName"), // Required
- }
- resp, err := svc.DeleteSubscriptionFilter(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 ExampleCloudWatchLogs_DescribeDestinations() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.DescribeDestinationsInput{
- DestinationNamePrefix: aws.String("DestinationName"),
- Limit: aws.Int64(1),
- NextToken: aws.String("NextToken"),
- }
- resp, err := svc.DescribeDestinations(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 ExampleCloudWatchLogs_DescribeLogGroups() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.DescribeLogGroupsInput{
- Limit: aws.Int64(1),
- LogGroupNamePrefix: aws.String("LogGroupName"),
- NextToken: aws.String("NextToken"),
- }
- resp, err := svc.DescribeLogGroups(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 ExampleCloudWatchLogs_DescribeLogStreams() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.DescribeLogStreamsInput{
- LogGroupName: aws.String("LogGroupName"), // Required
- Descending: aws.Bool(true),
- Limit: aws.Int64(1),
- LogStreamNamePrefix: aws.String("LogStreamName"),
- NextToken: aws.String("NextToken"),
- OrderBy: aws.String("OrderBy"),
- }
- resp, err := svc.DescribeLogStreams(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 ExampleCloudWatchLogs_DescribeMetricFilters() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.DescribeMetricFiltersInput{
- LogGroupName: aws.String("LogGroupName"), // Required
- FilterNamePrefix: aws.String("FilterName"),
- Limit: aws.Int64(1),
- NextToken: aws.String("NextToken"),
- }
- resp, err := svc.DescribeMetricFilters(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 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 {
- // 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 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 {
- // 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 ExampleCloudWatchLogs_GetLogEvents() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.GetLogEventsInput{
- LogGroupName: aws.String("LogGroupName"), // Required
- LogStreamName: aws.String("LogStreamName"), // Required
- EndTime: aws.Int64(1),
- Limit: aws.Int64(1),
- NextToken: aws.String("NextToken"),
- StartFromHead: aws.Bool(true),
- StartTime: aws.Int64(1),
- }
- resp, err := svc.GetLogEvents(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 ExampleCloudWatchLogs_PutDestination() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.PutDestinationInput{
- DestinationName: aws.String("DestinationName"), // Required
- RoleArn: aws.String("RoleArn"), // Required
- TargetArn: aws.String("TargetArn"), // Required
- }
- resp, err := svc.PutDestination(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 ExampleCloudWatchLogs_PutDestinationPolicy() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.PutDestinationPolicyInput{
- AccessPolicy: aws.String("AccessPolicy"), // Required
- DestinationName: aws.String("DestinationName"), // Required
- }
- resp, err := svc.PutDestinationPolicy(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 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 {
- // 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 ExampleCloudWatchLogs_PutMetricFilter() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.PutMetricFilterInput{
- FilterName: aws.String("FilterName"), // Required
- FilterPattern: aws.String("FilterPattern"), // Required
- LogGroupName: aws.String("LogGroupName"), // Required
- MetricTransformations: []*cloudwatchlogs.MetricTransformation{ // Required
- { // Required
- MetricName: aws.String("MetricName"), // Required
- MetricNamespace: aws.String("MetricNamespace"), // Required
- MetricValue: aws.String("MetricValue"), // Required
- },
- // More values...
- },
- }
- resp, err := svc.PutMetricFilter(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 ExampleCloudWatchLogs_PutRetentionPolicy() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.PutRetentionPolicyInput{
- LogGroupName: aws.String("LogGroupName"), // Required
- RetentionInDays: aws.Int64(1), // Required
- }
- resp, err := svc.PutRetentionPolicy(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 ExampleCloudWatchLogs_PutSubscriptionFilter() {
- svc := cloudwatchlogs.New(nil)
- params := &cloudwatchlogs.PutSubscriptionFilterInput{
- DestinationArn: aws.String("DestinationArn"), // Required
- FilterName: aws.String("FilterName"), // Required
- FilterPattern: aws.String("FilterPattern"), // Required
- LogGroupName: aws.String("LogGroupName"), // Required
- RoleArn: aws.String("RoleArn"),
- }
- resp, err := svc.PutSubscriptionFilter(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 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 {
- // 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)
- }
|