Upgrade AWS SDK to the latest version

This commit is contained in:
Andrey Smirnov
2017-09-28 17:57:05 +03:00
parent 9a767b7631
commit 182c21e38c
1096 changed files with 309697 additions and 132612 deletions
File diff suppressed because it is too large Load Diff
@@ -1,4 +1,4 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package cloudwatchlogsiface provides an interface to enable mocking the Amazon CloudWatch Logs service client
// for testing your code.
@@ -21,12 +21,12 @@ import (
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the the SDK's request pipeline.
// to inject custom request handlers into the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Amazon CloudWatch Logs.
// func myFunc(svc cloudwatchlogsiface.CloudWatchLogsAPI) bool {
// // Make svc.CancelExportTask request
// // Make svc.AssociateKmsKey request
// }
//
// func main() {
@@ -42,7 +42,7 @@ import (
// type mockCloudWatchLogsClient struct {
// cloudwatchlogsiface.CloudWatchLogsAPI
// }
// func (m *mockCloudWatchLogsClient) CancelExportTask(input *cloudwatchlogs.CancelExportTaskInput) (*cloudwatchlogs.CancelExportTaskOutput, error) {
// func (m *mockCloudWatchLogsClient) AssociateKmsKey(input *cloudwatchlogs.AssociateKmsKeyInput) (*cloudwatchlogs.AssociateKmsKeyOutput, error) {
// // mock response/functionality
// }
//
@@ -60,6 +60,10 @@ import (
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type CloudWatchLogsAPI interface {
AssociateKmsKey(*cloudwatchlogs.AssociateKmsKeyInput) (*cloudwatchlogs.AssociateKmsKeyOutput, error)
AssociateKmsKeyWithContext(aws.Context, *cloudwatchlogs.AssociateKmsKeyInput, ...request.Option) (*cloudwatchlogs.AssociateKmsKeyOutput, error)
AssociateKmsKeyRequest(*cloudwatchlogs.AssociateKmsKeyInput) (*request.Request, *cloudwatchlogs.AssociateKmsKeyOutput)
CancelExportTask(*cloudwatchlogs.CancelExportTaskInput) (*cloudwatchlogs.CancelExportTaskOutput, error)
CancelExportTaskWithContext(aws.Context, *cloudwatchlogs.CancelExportTaskInput, ...request.Option) (*cloudwatchlogs.CancelExportTaskOutput, error)
CancelExportTaskRequest(*cloudwatchlogs.CancelExportTaskInput) (*request.Request, *cloudwatchlogs.CancelExportTaskOutput)
@@ -92,6 +96,10 @@ type CloudWatchLogsAPI interface {
DeleteMetricFilterWithContext(aws.Context, *cloudwatchlogs.DeleteMetricFilterInput, ...request.Option) (*cloudwatchlogs.DeleteMetricFilterOutput, error)
DeleteMetricFilterRequest(*cloudwatchlogs.DeleteMetricFilterInput) (*request.Request, *cloudwatchlogs.DeleteMetricFilterOutput)
DeleteResourcePolicy(*cloudwatchlogs.DeleteResourcePolicyInput) (*cloudwatchlogs.DeleteResourcePolicyOutput, error)
DeleteResourcePolicyWithContext(aws.Context, *cloudwatchlogs.DeleteResourcePolicyInput, ...request.Option) (*cloudwatchlogs.DeleteResourcePolicyOutput, error)
DeleteResourcePolicyRequest(*cloudwatchlogs.DeleteResourcePolicyInput) (*request.Request, *cloudwatchlogs.DeleteResourcePolicyOutput)
DeleteRetentionPolicy(*cloudwatchlogs.DeleteRetentionPolicyInput) (*cloudwatchlogs.DeleteRetentionPolicyOutput, error)
DeleteRetentionPolicyWithContext(aws.Context, *cloudwatchlogs.DeleteRetentionPolicyInput, ...request.Option) (*cloudwatchlogs.DeleteRetentionPolicyOutput, error)
DeleteRetentionPolicyRequest(*cloudwatchlogs.DeleteRetentionPolicyInput) (*request.Request, *cloudwatchlogs.DeleteRetentionPolicyOutput)
@@ -132,6 +140,10 @@ type CloudWatchLogsAPI interface {
DescribeMetricFiltersPages(*cloudwatchlogs.DescribeMetricFiltersInput, func(*cloudwatchlogs.DescribeMetricFiltersOutput, bool) bool) error
DescribeMetricFiltersPagesWithContext(aws.Context, *cloudwatchlogs.DescribeMetricFiltersInput, func(*cloudwatchlogs.DescribeMetricFiltersOutput, bool) bool, ...request.Option) error
DescribeResourcePolicies(*cloudwatchlogs.DescribeResourcePoliciesInput) (*cloudwatchlogs.DescribeResourcePoliciesOutput, error)
DescribeResourcePoliciesWithContext(aws.Context, *cloudwatchlogs.DescribeResourcePoliciesInput, ...request.Option) (*cloudwatchlogs.DescribeResourcePoliciesOutput, error)
DescribeResourcePoliciesRequest(*cloudwatchlogs.DescribeResourcePoliciesInput) (*request.Request, *cloudwatchlogs.DescribeResourcePoliciesOutput)
DescribeSubscriptionFilters(*cloudwatchlogs.DescribeSubscriptionFiltersInput) (*cloudwatchlogs.DescribeSubscriptionFiltersOutput, error)
DescribeSubscriptionFiltersWithContext(aws.Context, *cloudwatchlogs.DescribeSubscriptionFiltersInput, ...request.Option) (*cloudwatchlogs.DescribeSubscriptionFiltersOutput, error)
DescribeSubscriptionFiltersRequest(*cloudwatchlogs.DescribeSubscriptionFiltersInput) (*request.Request, *cloudwatchlogs.DescribeSubscriptionFiltersOutput)
@@ -139,6 +151,10 @@ type CloudWatchLogsAPI interface {
DescribeSubscriptionFiltersPages(*cloudwatchlogs.DescribeSubscriptionFiltersInput, func(*cloudwatchlogs.DescribeSubscriptionFiltersOutput, bool) bool) error
DescribeSubscriptionFiltersPagesWithContext(aws.Context, *cloudwatchlogs.DescribeSubscriptionFiltersInput, func(*cloudwatchlogs.DescribeSubscriptionFiltersOutput, bool) bool, ...request.Option) error
DisassociateKmsKey(*cloudwatchlogs.DisassociateKmsKeyInput) (*cloudwatchlogs.DisassociateKmsKeyOutput, error)
DisassociateKmsKeyWithContext(aws.Context, *cloudwatchlogs.DisassociateKmsKeyInput, ...request.Option) (*cloudwatchlogs.DisassociateKmsKeyOutput, error)
DisassociateKmsKeyRequest(*cloudwatchlogs.DisassociateKmsKeyInput) (*request.Request, *cloudwatchlogs.DisassociateKmsKeyOutput)
FilterLogEvents(*cloudwatchlogs.FilterLogEventsInput) (*cloudwatchlogs.FilterLogEventsOutput, error)
FilterLogEventsWithContext(aws.Context, *cloudwatchlogs.FilterLogEventsInput, ...request.Option) (*cloudwatchlogs.FilterLogEventsOutput, error)
FilterLogEventsRequest(*cloudwatchlogs.FilterLogEventsInput) (*request.Request, *cloudwatchlogs.FilterLogEventsOutput)
@@ -173,6 +189,10 @@ type CloudWatchLogsAPI interface {
PutMetricFilterWithContext(aws.Context, *cloudwatchlogs.PutMetricFilterInput, ...request.Option) (*cloudwatchlogs.PutMetricFilterOutput, error)
PutMetricFilterRequest(*cloudwatchlogs.PutMetricFilterInput) (*request.Request, *cloudwatchlogs.PutMetricFilterOutput)
PutResourcePolicy(*cloudwatchlogs.PutResourcePolicyInput) (*cloudwatchlogs.PutResourcePolicyOutput, error)
PutResourcePolicyWithContext(aws.Context, *cloudwatchlogs.PutResourcePolicyInput, ...request.Option) (*cloudwatchlogs.PutResourcePolicyOutput, error)
PutResourcePolicyRequest(*cloudwatchlogs.PutResourcePolicyInput) (*request.Request, *cloudwatchlogs.PutResourcePolicyOutput)
PutRetentionPolicy(*cloudwatchlogs.PutRetentionPolicyInput) (*cloudwatchlogs.PutRetentionPolicyOutput, error)
PutRetentionPolicyWithContext(aws.Context, *cloudwatchlogs.PutRetentionPolicyInput, ...request.Option) (*cloudwatchlogs.PutRetentionPolicyOutput, error)
PutRetentionPolicyRequest(*cloudwatchlogs.PutRetentionPolicyInput) (*request.Request, *cloudwatchlogs.PutRetentionPolicyOutput)
+57
View File
@@ -0,0 +1,57 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package cloudwatchlogs provides the client and types for making API
// requests to Amazon CloudWatch Logs.
//
// You can use Amazon CloudWatch Logs to monitor, store, and access your log
// files from Amazon EC2 instances, AWS CloudTrail, or other sources. You can
// then retrieve the associated log data from CloudWatch Logs using the CloudWatch
// console, CloudWatch Logs commands in the AWS CLI, CloudWatch Logs API, or
// CloudWatch Logs SDK.
//
// You can use CloudWatch Logs to:
//
// * Monitor logs from EC2 instances in real-time: You can use CloudWatch
// Logs to monitor applications and systems using log data. For example,
// CloudWatch Logs can track the number of errors that occur in your application
// logs and send you a notification whenever the rate of errors exceeds a
// threshold that you specify. CloudWatch Logs uses your log data for monitoring;
// so, no code changes are required. For example, you can monitor application
// logs for specific literal terms (such as "NullReferenceException") or
// count the number of occurrences of a literal term at a particular position
// in log data (such as "404" status codes in an Apache access log). When
// the term you are searching for is found, CloudWatch Logs reports the data
// to a CloudWatch metric that you specify.
//
// * Monitor AWS CloudTrail logged events: You can create alarms in CloudWatch
// and receive notifications of particular API activity as captured by CloudTrail
// and use the notification to perform troubleshooting.
//
// * Archive log data: You can use CloudWatch Logs to store your log data
// in highly durable storage. You can change the log retention setting so
// that any log events older than this setting are automatically deleted.
// The CloudWatch Logs agent makes it easy to quickly send both rotated and
// non-rotated log data off of a host and into the log service. You can then
// access the raw log data when you need it.
//
// See https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28 for more information on this service.
//
// See cloudwatchlogs package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatchlogs/
//
// Using the Client
//
// To Amazon CloudWatch Logs with the SDK use the New function to create
// a new service client. With that client you can make API requests to the service.
// These clients are safe to use concurrently.
//
// See the SDK's documentation for more information on how to use the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws.Config documentation for more information on configuring SDK clients.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon CloudWatch Logs client CloudWatchLogs for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatchlogs/#New
package cloudwatchlogs
+1 -1
View File
@@ -1,4 +1,4 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package cloudwatchlogs
@@ -1,695 +0,0 @@
// 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/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCloudWatchLogs_CancelExportTask() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
params := &cloudwatchlogs.CancelExportTaskInput{
TaskId: aws.String("ExportTaskId"), // Required
}
resp, err := svc.CancelExportTask(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_CreateExportTask() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
params := &cloudwatchlogs.CreateExportTaskInput{
Destination: aws.String("ExportDestinationBucket"), // Required
From: aws.Int64(1), // Required
LogGroupName: aws.String("LogGroupName"), // Required
To: aws.Int64(1), // Required
DestinationPrefix: aws.String("ExportDestinationPrefix"),
LogStreamNamePrefix: aws.String("LogStreamName"),
TaskName: aws.String("ExportTaskName"),
}
resp, err := svc.CreateExportTask(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_CreateLogGroup() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
params := &cloudwatchlogs.CreateLogGroupInput{
LogGroupName: aws.String("LogGroupName"), // Required
Tags: map[string]*string{
"Key": aws.String("TagValue"), // Required
// More values...
},
}
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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_DescribeExportTasks() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
params := &cloudwatchlogs.DescribeExportTasksInput{
Limit: aws.Int64(1),
NextToken: aws.String("NextToken"),
StatusCode: aws.String("ExportTaskStatusCode"),
TaskId: aws.String("ExportTaskId"),
}
resp, err := svc.DescribeExportTasks(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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
params := &cloudwatchlogs.DescribeMetricFiltersInput{
FilterNamePrefix: aws.String("FilterName"),
Limit: aws.Int64(1),
LogGroupName: aws.String("LogGroupName"),
MetricName: aws.String("MetricName"),
MetricNamespace: aws.String("MetricNamespace"),
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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_ListTagsLogGroup() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
params := &cloudwatchlogs.ListTagsLogGroupInput{
LogGroupName: aws.String("LogGroupName"), // Required
}
resp, err := svc.ListTagsLogGroup(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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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
DefaultValue: aws.Float64(1.0),
},
// 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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
params := &cloudwatchlogs.PutSubscriptionFilterInput{
DestinationArn: aws.String("DestinationArn"), // Required
FilterName: aws.String("FilterName"), // Required
FilterPattern: aws.String("FilterPattern"), // Required
LogGroupName: aws.String("LogGroupName"), // Required
Distribution: aws.String("Distribution"),
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_TagLogGroup() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
params := &cloudwatchlogs.TagLogGroupInput{
LogGroupName: aws.String("LogGroupName"), // Required
Tags: map[string]*string{ // Required
"Key": aws.String("TagValue"), // Required
// More values...
},
}
resp, err := svc.TagLogGroup(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() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
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)
}
func ExampleCloudWatchLogs_UntagLogGroup() {
sess := session.Must(session.NewSession())
svc := cloudwatchlogs.New(sess)
params := &cloudwatchlogs.UntagLogGroupInput{
LogGroupName: aws.String("LogGroupName"), // Required
Tags: []*string{ // Required
aws.String("TagKey"), // Required
// More values...
},
}
resp, err := svc.UntagLogGroup(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)
}
+6 -33
View File
@@ -1,4 +1,4 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package cloudwatchlogs
@@ -11,39 +11,12 @@ import (
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// You can use Amazon CloudWatch Logs to monitor, store, and access your log
// files from EC2 instances, Amazon CloudTrail, or other sources. You can then
// retrieve the associated log data from CloudWatch Logs using the Amazon CloudWatch
// console, the CloudWatch Logs commands in the AWS CLI, the CloudWatch Logs
// API, or the CloudWatch Logs SDK.
// CloudWatchLogs provides the API operation methods for making requests to
// Amazon CloudWatch Logs. See this package's package overview docs
// for details on the service.
//
// You can use CloudWatch Logs to:
//
// * Monitor Logs from Amazon EC2 Instances in Real-time: You can use CloudWatch
// Logs to monitor applications and systems using log data. For example,
// CloudWatch Logs can track the number of errors that occur in your application
// logs and send you a notification whenever the rate of errors exceeds a
// threshold you specify. CloudWatch Logs uses your log data for monitoring;
// so, no code changes are required. For example, you can monitor application
// logs for specific literal terms (such as "NullReferenceException") or
// count the number of occurrences of a literal term at a particular position
// in log data (such as "404" status codes in an Apache access log). When
// the term you are searching for is found, CloudWatch Logs reports the data
// to a Amazon CloudWatch metric that you specify.
//
// * Monitor Amazon CloudTrail Logged Events: You can create alarms in Amazon
// CloudWatch and receive notifications of particular API activity as captured
// by CloudTrail and use the notification to perform troubleshooting.
//
// * Archive Log Data: You can use CloudWatch Logs to store your log data
// in highly durable storage. You can change the log retention setting so
// that any log events older than this setting are automatically deleted.
// The CloudWatch Logs agent makes it easy to quickly send both rotated and
// non-rotated log data off of a host and into the log service. You can then
// access the raw log data when you need it.
// The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28
// CloudWatchLogs methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type CloudWatchLogs struct {
*client.Client
}