diff --git a/extension/agenthealth/handler/stats/agent/agent.go b/extension/agenthealth/handler/stats/agent/agent.go index 1c3b0dc348..83237d54e6 100644 --- a/extension/agenthealth/handler/stats/agent/agent.go +++ b/extension/agenthealth/handler/stats/agent/agent.go @@ -29,6 +29,7 @@ type Stats struct { RunningInContainer *int `json:"ric,omitempty"` RegionType *string `json:"rt,omitempty"` Mode *string `json:"m,omitempty"` + EntityRejected *int `json:"ent,omitempty"` } // Merge the other Stats into the current. If the field is not nil, @@ -76,6 +77,9 @@ func (s *Stats) Merge(other Stats) { if other.Mode != nil { s.Mode = other.Mode } + if other.EntityRejected != nil { + s.EntityRejected = other.EntityRejected + } } func (s *Stats) Marshal() (string, error) { diff --git a/extension/agenthealth/handler/stats/client/client.go b/extension/agenthealth/handler/stats/client/client.go index 188ef6b207..04ca7771f3 100644 --- a/extension/agenthealth/handler/stats/client/client.go +++ b/extension/agenthealth/handler/stats/client/client.go @@ -4,6 +4,7 @@ package client import ( + "bytes" "context" "io" "net/http" @@ -23,6 +24,10 @@ const ( cacheSize = 1000 ) +var ( + rejectedEntityInfo = []byte("\"rejectedEntityInfo\"") +) + type Stats interface { awsmiddleware.RequestHandler awsmiddleware.ResponseHandler @@ -108,6 +113,9 @@ func (csh *clientStatsHandler) HandleResponse(ctx context.Context, r *http.Respo } latency := time.Since(recorder.start) stats.LatencyMillis = aws.Int64(latency.Milliseconds()) + if rejectedEntityInfoExists(r) { + stats.EntityRejected = aws.Int(1) + } csh.statsByOperation.Store(operation, stats) } @@ -122,3 +130,22 @@ func (csh *clientStatsHandler) Stats(operation string) agent.Stats { } return stats } + +// rejectedEntityInfoExists checks if the response body +// contains element rejectedEntityInfo +func rejectedEntityInfoExists(r *http.Response) bool { + // Example body for rejectedEntityInfo would be: + // {"rejectedEntityInfo":{"errorType":"InvalidAttributes"}} + if r == nil || r.Body == nil { + return false + } + bodyBytes, err := io.ReadAll(r.Body) + r.Body.Close() + // Reset the response body stream since it can only be read once. Not doing this results in duplicate requests. + // See https://stackoverflow.com/questions/33532374/in-go-how-can-i-reuse-a-readcloser + r.Body = io.NopCloser(bytes.NewReader(bodyBytes)) + if err != nil { + return false + } + return bytes.Contains(bodyBytes, rejectedEntityInfo) +} diff --git a/extension/agenthealth/handler/stats/client/client_test.go b/extension/agenthealth/handler/stats/client/client_test.go index 35ac023e0e..3641ada9aa 100644 --- a/extension/agenthealth/handler/stats/client/client_test.go +++ b/extension/agenthealth/handler/stats/client/client_test.go @@ -6,6 +6,7 @@ package client import ( "bytes" "context" + "io" "net/http" "testing" "time" @@ -37,11 +38,16 @@ func TestHandle(t *testing.T) { assert.Nil(t, got.PayloadBytes) assert.Nil(t, got.StatusCode) time.Sleep(time.Millisecond) - handler.HandleResponse(ctx, &http.Response{StatusCode: http.StatusOK}) + handler.HandleResponse(ctx, &http.Response{ + StatusCode: http.StatusOK, + Body: io.NopCloser(bytes.NewBufferString(`{"rejectedEntityInfo":{"errorType":"InvalidAttributes"}}`)), + }) got = handler.Stats(operation) assert.NotNil(t, got.LatencyMillis) assert.NotNil(t, got.PayloadBytes) assert.NotNil(t, got.StatusCode) + assert.NotNil(t, got.EntityRejected) + assert.Equal(t, 1, *got.EntityRejected) assert.Equal(t, http.StatusOK, *got.StatusCode) assert.Equal(t, 20, *got.PayloadBytes) assert.GreaterOrEqual(t, *got.LatencyMillis, int64(1)) @@ -65,3 +71,16 @@ func TestHandle(t *testing.T) { assert.NotNil(t, got.PayloadBytes) assert.Equal(t, 29, *got.PayloadBytes) } + +func BenchmarkRejectedEntityInfoExists(b *testing.B) { + body := `{"rejectedEntityInfo":{"errorType":"InvalidAttributes"}}` + resp := &http.Response{ + Body: io.NopCloser(bytes.NewBufferString(body)), + } + + for n := 0; n < b.N; n++ { + rejectedEntityInfoExists(resp) + // Reset the body for the next iteration + resp.Body = io.NopCloser(bytes.NewBufferString(body)) + } +} diff --git a/extension/entitystore/config.go b/extension/entitystore/config.go new file mode 100644 index 0000000000..47c588a98e --- /dev/null +++ b/extension/entitystore/config.go @@ -0,0 +1,19 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "go.opentelemetry.io/collector/component" +) + +type Config struct { + Mode string `mapstructure:"mode"` + KubernetesMode string `mapstructure:"kubernetes_mode,omitempty"` + Region string `mapstructure:"region"` + Profile string `mapstructure:"profile,omitempty"` + RoleARN string `mapstructure:"role_arn,omitempty"` + Filename string `mapstructure:"shared_credential_file,omitempty"` +} + +var _ component.Config = (*Config)(nil) diff --git a/extension/entitystore/config_test.go b/extension/entitystore/config_test.go new file mode 100644 index 0000000000..fac7a6683f --- /dev/null +++ b/extension/entitystore/config_test.go @@ -0,0 +1,18 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/confmap" +) + +func TestUnmarshalDefaultConfig(t *testing.T) { + factory := NewFactory() + cfg := factory.CreateDefaultConfig() + assert.NoError(t, confmap.New().Unmarshal(cfg)) + assert.Equal(t, factory.CreateDefaultConfig(), cfg) +} diff --git a/extension/entitystore/ec2Info.go b/extension/entitystore/ec2Info.go new file mode 100644 index 0000000000..8309c209b5 --- /dev/null +++ b/extension/entitystore/ec2Info.go @@ -0,0 +1,163 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "context" + "errors" + "strings" + "sync" + "time" + + "go.uber.org/zap" + + "github.com/aws/amazon-cloudwatch-agent/internal/ec2metadataprovider" + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/ec2tagger" +) + +const ( + // InstanceId character maximum length is 19. + // See https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_Instance.html. + instanceIdSizeMax = 19 + + // AutoScalingGroup character maximum length is 255. + // See https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_AutoScalingGroup.html. + autoScalingGroupSizeMax = 255 +) + +type EC2Info struct { + InstanceID string + AccountID string + AutoScalingGroup string + + // region is used while making call to describeTags Ec2 API for AutoScalingGroup + Region string + + metadataProvider ec2metadataprovider.MetadataProvider + logger *zap.Logger + done chan struct{} + mutex sync.RWMutex +} + +func (ei *EC2Info) initEc2Info() { + ei.logger.Debug("Initializing EC2Info") + if err := ei.setInstanceIDAccountID(); err != nil { + return + } + if err := ei.setAutoScalingGroup(); err != nil { + return + } + ei.logger.Debug("Finished initializing EC2Info") +} + +func (ei *EC2Info) GetInstanceID() string { + ei.mutex.RLock() + defer ei.mutex.RUnlock() + return ei.InstanceID +} + +func (ei *EC2Info) GetAccountID() string { + ei.mutex.RLock() + defer ei.mutex.RUnlock() + return ei.AccountID +} + +func (ei *EC2Info) GetAutoScalingGroup() string { + ei.mutex.RLock() + defer ei.mutex.RUnlock() + return ei.AutoScalingGroup +} + +func (ei *EC2Info) setInstanceIDAccountID() error { + for { + metadataDoc, err := ei.metadataProvider.Get(context.Background()) + if err != nil { + ei.logger.Warn("Failed to get Instance ID / Account ID through metadata provider", zap.Error(err)) + wait := time.NewTimer(1 * time.Minute) + select { + case <-ei.done: + wait.Stop() + return errors.New("shutdown signal received") + case <-wait.C: + continue + } + } + ei.logger.Debug("Successfully retrieved Instance ID and Account ID") + ei.mutex.Lock() + ei.InstanceID = metadataDoc.InstanceID + if idLength := len(ei.InstanceID); idLength > instanceIdSizeMax { + ei.logger.Warn("InstanceId length exceeds characters limit and will be ignored", zap.Int("length", idLength), zap.Int("character limit", instanceIdSizeMax)) + ei.InstanceID = "" + } + ei.AccountID = metadataDoc.AccountID + ei.mutex.Unlock() + return nil + } +} + +func (ei *EC2Info) setAutoScalingGroup() error { + retry := 0 + for { + var waitDuration time.Duration + if retry < len(ec2tagger.BackoffSleepArray) { + waitDuration = ec2tagger.BackoffSleepArray[retry] + } else { + waitDuration = ec2tagger.BackoffSleepArray[len(ec2tagger.BackoffSleepArray)-1] + } + + wait := time.NewTimer(waitDuration) + select { + case <-ei.done: + wait.Stop() + return errors.New("shutdown signal received") + case <-wait.C: + } + + if retry > 0 { + ei.logger.Debug("Initial retrieval of tags and volumes", zap.Int("retry", retry)) + } + + if err := ei.retrieveAsgName(); err != nil { + ei.logger.Warn("Unable to fetch instance tags with imds", zap.Int("retry", retry), zap.Error(err)) + } else { + ei.logger.Debug("Retrieval of auto-scaling group tags succeeded") + return nil + } + + retry++ + } + +} + +func (ei *EC2Info) retrieveAsgName() error { + tags, err := ei.metadataProvider.InstanceTags(context.Background()) + if err != nil { + ei.logger.Debug("Failed to get tags through metadata provider", zap.Error(err)) + return err + } else if strings.Contains(tags, ec2tagger.Ec2InstanceTagKeyASG) { + asg, err := ei.metadataProvider.InstanceTagValue(context.Background(), ec2tagger.Ec2InstanceTagKeyASG) + if err != nil { + ei.logger.Error("Failed to get AutoScalingGroup through metadata provider", zap.Error(err)) + } else { + ei.logger.Debug("AutoScalingGroup retrieved through IMDS") + ei.mutex.Lock() + ei.AutoScalingGroup = asg + if asgLength := len(ei.AutoScalingGroup); asgLength > autoScalingGroupSizeMax { + ei.logger.Warn("AutoScalingGroup length exceeds characters limit and will be ignored", zap.Int("length", asgLength), zap.Int("character limit", autoScalingGroupSizeMax)) + ei.AutoScalingGroup = "" + } + ei.mutex.Unlock() + } + } + return nil +} + +func newEC2Info(metadataProvider ec2metadataprovider.MetadataProvider, done chan struct{}, region string, logger *zap.Logger) *EC2Info { + return &EC2Info{ + metadataProvider: metadataProvider, + done: done, + Region: region, + logger: logger, + } +} diff --git a/extension/entitystore/ec2Info_test.go b/extension/entitystore/ec2Info_test.go new file mode 100644 index 0000000000..21fc8d148c --- /dev/null +++ b/extension/entitystore/ec2Info_test.go @@ -0,0 +1,207 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "bytes" + "log" + "strings" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/stretchr/testify/assert" + "go.uber.org/zap" + + "github.com/aws/amazon-cloudwatch-agent/internal/ec2metadataprovider" +) + +var mockedInstanceIdentityDoc = &ec2metadata.EC2InstanceIdentityDocument{ + InstanceID: "i-01d2417c27a396e44", + AccountID: "874389809020", + Region: "us-east-1", + InstanceType: "m5ad.large", + ImageID: "ami-09edd32d9b0990d49", +} + +var mockedInstanceIdentityDocWithLargeInstanceId = &ec2metadata.EC2InstanceIdentityDocument{ + InstanceID: "i-01d2417c27a396e44394824728", + AccountID: "874389809020", + Region: "us-east-1", + InstanceType: "m5ad.large", + ImageID: "ami-09edd32d9b0990d49", +} + +var ( + tagVal3 = "ASG-1" +) + +func TestSetInstanceIDAccountID(t *testing.T) { + type args struct { + metadataProvider ec2metadataprovider.MetadataProvider + } + tests := []struct { + name string + args args + wantErr bool + want EC2Info + }{ + { + name: "happy path", + args: args{ + metadataProvider: &mockMetadataProvider{InstanceIdentityDocument: mockedInstanceIdentityDoc}, + }, + wantErr: false, + want: EC2Info{ + InstanceID: mockedInstanceIdentityDoc.InstanceID, + AccountID: mockedInstanceIdentityDoc.AccountID, + }, + }, + { + name: "InstanceId too large", + args: args{ + metadataProvider: &mockMetadataProvider{InstanceIdentityDocument: mockedInstanceIdentityDocWithLargeInstanceId}, + }, + wantErr: false, + want: EC2Info{ + InstanceID: "", + AccountID: mockedInstanceIdentityDocWithLargeInstanceId.AccountID, + }, + }, + } + for _, tt := range tests { + logger, _ := zap.NewDevelopment() + t.Run(tt.name, func(t *testing.T) { + ei := &EC2Info{ + metadataProvider: tt.args.metadataProvider, + logger: logger, + } + if err := ei.setInstanceIDAccountID(); (err != nil) != tt.wantErr { + t.Errorf("setInstanceIDAccountID() error = %v, wantErr %v", err, tt.wantErr) + } + assert.Equal(t, tt.want.InstanceID, ei.GetInstanceID()) + assert.Equal(t, tt.want.AccountID, ei.GetAccountID()) + }) + } +} + +func TestRetrieveASGName(t *testing.T) { + type args struct { + metadataProvider ec2metadataprovider.MetadataProvider + } + tests := []struct { + name string + args args + wantErr bool + want EC2Info + }{ + { + name: "happy path", + args: args{ + metadataProvider: &mockMetadataProvider{InstanceIdentityDocument: mockedInstanceIdentityDoc, Tags: map[string]string{"aws:autoscaling:groupName": tagVal3}}, + }, + wantErr: false, + want: EC2Info{ + AutoScalingGroup: tagVal3, + }, + }, + { + name: "happy path with multiple tags", + args: args{ + metadataProvider: &mockMetadataProvider{ + InstanceIdentityDocument: mockedInstanceIdentityDoc, + Tags: map[string]string{ + "aws:autoscaling:groupName": tagVal3, + "env": "test-env", + "name": "test-name", + }}, + }, + + wantErr: false, + want: EC2Info{ + AutoScalingGroup: tagVal3, + }, + }, + { + name: "AutoScalingGroup too large", + args: args{ + metadataProvider: &mockMetadataProvider{ + InstanceIdentityDocument: mockedInstanceIdentityDoc, + Tags: map[string]string{ + "aws:autoscaling:groupName": strings.Repeat("a", 256), + "env": "test-env", + "name": "test-name", + }}, + }, + + wantErr: false, + want: EC2Info{ + AutoScalingGroup: "", + }, + }, + { + name: "Success IMDS tags call but no ASG", + args: args{ + metadataProvider: &mockMetadataProvider{InstanceIdentityDocument: mockedInstanceIdentityDoc, Tags: map[string]string{"name": tagVal3}}, + }, + wantErr: false, + want: EC2Info{ + AutoScalingGroup: "", + }, + }, + } + for _, tt := range tests { + logger, _ := zap.NewDevelopment() + t.Run(tt.name, func(t *testing.T) { + ei := &EC2Info{metadataProvider: tt.args.metadataProvider, logger: logger} + if err := ei.retrieveAsgName(); (err != nil) != tt.wantErr { + t.Errorf("retrieveAsgName() error = %v, wantErr %v", err, tt.wantErr) + } + assert.Equal(t, tt.want.AutoScalingGroup, ei.GetAutoScalingGroup()) + }) + } +} + +func TestLogMessageDoesNotIncludeResourceInfo(t *testing.T) { + type args struct { + metadataProvider ec2metadataprovider.MetadataProvider + } + tests := []struct { + name string + args args + want EC2Info + }{ + { + name: "AutoScalingGroupWithInstanceTags", + args: args{ + metadataProvider: &mockMetadataProvider{InstanceIdentityDocument: mockedInstanceIdentityDoc, Tags: map[string]string{"aws:autoscaling:groupName": tagVal3}}, + }, + want: EC2Info{ + InstanceID: mockedInstanceIdentityDoc.InstanceID, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Create a buffer to capture the logger output + var buf bytes.Buffer + + logger := CreateTestLogger(&buf) + done := make(chan struct{}) + + ei := &EC2Info{ + metadataProvider: tt.args.metadataProvider, + logger: logger, + done: done, + } + go ei.initEc2Info() + time.Sleep(3 * time.Second) + + logOutput := buf.String() + log.Println(logOutput) + assert.NotContains(t, logOutput, ei.GetInstanceID()) + assert.NotContains(t, logOutput, ei.GetAutoScalingGroup()) + }) + } +} diff --git a/extension/entitystore/eksInfo.go b/extension/entitystore/eksInfo.go new file mode 100644 index 0000000000..9b6786d744 --- /dev/null +++ b/extension/entitystore/eksInfo.go @@ -0,0 +1,55 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "time" + + "github.com/jellydator/ttlcache/v3" + "go.uber.org/zap" +) + +const ( + ttlDuration = 5 * time.Minute + + // Agent server extension is mainly opened for FluentBit to + // consume data and FluentBit only caches 256 pods in memory + // so we will follow the same pattern + maxPodAssociationMapCapacity = 256 +) + +type ServiceEnvironment struct { + ServiceName string + Environment string + ServiceNameSource string +} + +type eksInfo struct { + logger *zap.Logger + podToServiceEnvMap *ttlcache.Cache[string, ServiceEnvironment] +} + +func newEKSInfo(logger *zap.Logger) *eksInfo { + return &eksInfo{ + logger: logger, + podToServiceEnvMap: ttlcache.New[string, ServiceEnvironment]( + ttlcache.WithTTL[string, ServiceEnvironment](ttlDuration), + ttlcache.WithCapacity[string, ServiceEnvironment](maxPodAssociationMapCapacity), + ), + } +} + +func (eks *eksInfo) AddPodServiceEnvironmentMapping(podName string, serviceName string, environmentName string, serviceNameSource string) { + if eks.podToServiceEnvMap != nil { + eks.podToServiceEnvMap.Set(podName, ServiceEnvironment{ + ServiceName: serviceName, + Environment: environmentName, + ServiceNameSource: serviceNameSource, + }, ttlcache.DefaultTTL) + } +} + +func (eks *eksInfo) GetPodServiceEnvironmentMapping() *ttlcache.Cache[string, ServiceEnvironment] { + return eks.podToServiceEnvMap +} diff --git a/extension/entitystore/eksInfo_test.go b/extension/entitystore/eksInfo_test.go new file mode 100644 index 0000000000..c5644a77e3 --- /dev/null +++ b/extension/entitystore/eksInfo_test.go @@ -0,0 +1,192 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "strconv" + "testing" + "time" + + "github.com/jellydator/ttlcache/v3" + "github.com/stretchr/testify/assert" + "go.uber.org/zap" +) + +func TestAddPodServiceEnvironmentMapping(t *testing.T) { + tests := []struct { + name string + want *ttlcache.Cache[string, ServiceEnvironment] + podName string + service string + env string + serviceNameSource string + mapNil bool + }{ + { + name: "AddPodWithServiceMapping", + want: setupTTLCacheForTesting(map[string]ServiceEnvironment{ + "test-pod": { + ServiceName: "test-service", + }, + }, ttlDuration), + podName: "test-pod", + service: "test-service", + }, + { + name: "AddPodWithServiceEnvMapping", + want: setupTTLCacheForTesting(map[string]ServiceEnvironment{ + "test-pod": { + ServiceName: "test-service", + Environment: "test-env", + }, + }, ttlDuration), + podName: "test-pod", + service: "test-service", + env: "test-env", + }, + { + name: "AddPodWithServiceEnvMapping", + want: setupTTLCacheForTesting(map[string]ServiceEnvironment{ + "test-pod": { + ServiceName: "test-service", + Environment: "test-env", + ServiceNameSource: ServiceNameSourceInstrumentation, + }, + }, ttlDuration), + podName: "test-pod", + service: "test-service", + env: "test-env", + serviceNameSource: "Instrumentation", + }, + { + name: "AddWhenPodToServiceMapIsNil", + mapNil: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + logger, _ := zap.NewDevelopment() + ei := newEKSInfo(logger) + if tt.mapNil { + ei.podToServiceEnvMap = nil + } + ei.AddPodServiceEnvironmentMapping(tt.podName, tt.service, tt.env, tt.serviceNameSource) + if tt.mapNil { + assert.Nil(t, ei.podToServiceEnvMap) + } else { + for pod, se := range tt.want.Items() { + assert.Equal(t, se.Value(), ei.GetPodServiceEnvironmentMapping().Get(pod).Value()) + } + assert.Equal(t, tt.want.Len(), ei.GetPodServiceEnvironmentMapping().Len()) + } + }) + } +} + +func TestAddPodServiceEnvironmentMapping_TtlRefresh(t *testing.T) { + logger, _ := zap.NewDevelopment() + ei := newEKSInfo(logger) + + //adds new pod to service environment mapping + ei.AddPodServiceEnvironmentMapping("test-pod", "test-service", "test-environment", "Instrumentation") + assert.Equal(t, 1, ei.podToServiceEnvMap.Len()) + expiration := ei.podToServiceEnvMap.Get("test-pod").ExpiresAt() + + //sleep for 1 second to simulate ttl refresh + time.Sleep(1 * time.Second) + + // simulate adding the same pod to service environment mapping + ei.AddPodServiceEnvironmentMapping("test-pod", "test-service", "test-environment", "Instrumentation") + newExpiration := ei.podToServiceEnvMap.Get("test-pod").ExpiresAt() + + // assert that the expiration time is updated + assert.True(t, newExpiration.After(expiration)) + assert.Equal(t, 1, ei.podToServiceEnvMap.Len()) +} + +func TestAddPodServiceEnvironmentMapping_MaxCapacity(t *testing.T) { + logger := zap.NewNop() + ei := newEKSInfo(logger) + + //adds new pod to service environment mapping + for i := 0; i < 300; i++ { + ei.AddPodServiceEnvironmentMapping("test-pod-"+strconv.Itoa(i), "test-service", "test-environment", "Instrumentation") + } + assert.Equal(t, maxPodAssociationMapCapacity, ei.podToServiceEnvMap.Len()) + itemIndex := 299 + ei.podToServiceEnvMap.Range(func(item *ttlcache.Item[string, ServiceEnvironment]) bool { + // Check if the item's value equals the target string + assert.Equal(t, item.Key(), "test-pod-"+strconv.Itoa(itemIndex)) + itemIndex-- + return true + }) +} + +func TestGetPodServiceEnvironmentMapping(t *testing.T) { + tests := []struct { + name string + want *ttlcache.Cache[string, ServiceEnvironment] + addMap bool + }{ + { + name: "GetPodWithServiceEnvMapping", + want: setupTTLCacheForTesting(map[string]ServiceEnvironment{ + "test-pod": { + ServiceName: "test-service", + Environment: "test-env", + ServiceNameSource: "test-service-name-source", + }, + }, ttlDuration), + addMap: true, + }, + { + name: "GetWhenPodToServiceMapIsEmpty", + want: setupTTLCacheForTesting(map[string]ServiceEnvironment{}, ttlDuration), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + logger, _ := zap.NewDevelopment() + ei := newEKSInfo(logger) + if tt.addMap { + ei.AddPodServiceEnvironmentMapping("test-pod", "test-service", "test-env", "test-service-name-source") + } + for pod, se := range tt.want.Items() { + assert.Equal(t, se.Value(), ei.GetPodServiceEnvironmentMapping().Get(pod).Value()) + } + assert.Equal(t, tt.want.Len(), ei.GetPodServiceEnvironmentMapping().Len()) + }) + } +} + +func TestTTLServicePodEnvironmentMapping(t *testing.T) { + logger, _ := zap.NewDevelopment() + ei := newEKSInfo(logger) + + ei.podToServiceEnvMap = setupTTLCacheForTesting(map[string]ServiceEnvironment{ + "pod": { + ServiceName: "service", + Environment: "environment", + }, + }, time.Microsecond) + assert.Equal(t, 1, ei.podToServiceEnvMap.Len()) + + //starting the ttl cache like we do in code. This will automatically evict expired pods. + go ei.podToServiceEnvMap.Start() + defer ei.podToServiceEnvMap.Stop() + + //sleep for 1 second to simulate ttl refresh + time.Sleep(1 * time.Second) + + //stops the ttl cache. + assert.Equal(t, 0, ei.podToServiceEnvMap.Len()) +} + +func setupTTLCacheForTesting(podToServiceMap map[string]ServiceEnvironment, ttlDuration time.Duration) *ttlcache.Cache[string, ServiceEnvironment] { + cache := ttlcache.New[string, ServiceEnvironment](ttlcache.WithTTL[string, ServiceEnvironment](ttlDuration)) + for pod, serviceEnv := range podToServiceMap { + cache.Set(pod, serviceEnv, ttlcache.DefaultTTL) + } + return cache +} diff --git a/extension/entitystore/extension.go b/extension/entitystore/extension.go new file mode 100644 index 0000000000..bd27012a3c --- /dev/null +++ b/extension/entitystore/extension.go @@ -0,0 +1,252 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "context" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/service/ec2" + "github.com/aws/aws-sdk-go/service/ec2/ec2iface" + "github.com/jellydator/ttlcache/v3" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/extension" + "go.uber.org/zap" + + configaws "github.com/aws/amazon-cloudwatch-agent/cfg/aws" + "github.com/aws/amazon-cloudwatch-agent/internal/ec2metadataprovider" + "github.com/aws/amazon-cloudwatch-agent/internal/retryer" + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity/entityattributes" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatchlogs" + "github.com/aws/amazon-cloudwatch-agent/translator/config" +) + +const ( + Service = "Service" + InstanceIDKey = "EC2.InstanceId" + ASGKey = "EC2.AutoScalingGroup" + ServiceNameSourceKey = "AWS.ServiceNameSource" + PlatformType = "PlatformType" + EC2PlatForm = "AWS::EC2" + podTerminationCheckInterval = 5 * time.Minute +) + +type ec2ProviderType func(string, *configaws.CredentialConfig) ec2iface.EC2API + +type serviceProviderInterface interface { + startServiceProvider() + addEntryForLogFile(LogFileGlob, ServiceAttribute) + addEntryForLogGroup(LogGroupName, ServiceAttribute) + logFileServiceAttribute(LogFileGlob, LogGroupName) ServiceAttribute + getServiceNameAndSource() (string, string) +} + +type EntityStore struct { + logger *zap.Logger + config *Config + done chan struct{} + + // mode should be EC2, ECS, EKS, and K8S + mode string + + kubernetesMode string + + // ec2Info stores information about EC2 instances such as instance ID and + // auto scaling groups + ec2Info EC2Info + + // eksInfo stores information about EKS such as pod to service Env map + eksInfo *eksInfo + + // serviceprovider stores information about possible service names + // that we can attach to the entity + serviceprovider serviceProviderInterface + + // nativeCredential stores the credential config for agent's native + // component such as LogAgent + nativeCredential client.ConfigProvider + + metadataprovider ec2metadataprovider.MetadataProvider + + podTerminationCheckInterval time.Duration +} + +var _ extension.Extension = (*EntityStore)(nil) + +func (e *EntityStore) Start(ctx context.Context, host component.Host) error { + // Get IMDS client and EC2 API client which requires region for authentication + // These will be passed down to any object that requires access to IMDS or EC2 + // API client so we have single source of truth for credential + e.done = make(chan struct{}) + e.metadataprovider = getMetaDataProvider() + e.mode = e.config.Mode + e.kubernetesMode = e.config.KubernetesMode + e.podTerminationCheckInterval = podTerminationCheckInterval + ec2CredentialConfig := &configaws.CredentialConfig{ + Profile: e.config.Profile, + Filename: e.config.Filename, + } + e.serviceprovider = newServiceProvider(e.mode, e.config.Region, &e.ec2Info, e.metadataprovider, getEC2Provider, ec2CredentialConfig, e.done, e.logger) + switch e.mode { + case config.ModeEC2: + e.ec2Info = *newEC2Info(e.metadataprovider, e.done, e.config.Region, e.logger) + go e.ec2Info.initEc2Info() + go e.serviceprovider.startServiceProvider() + } + if e.kubernetesMode != "" { + e.eksInfo = newEKSInfo(e.logger) + // Starting the ttl cache will automatically evict all expired pods from the map + go e.StartPodToServiceEnvironmentMappingTtlCache() + } + return nil +} + +func (e *EntityStore) Shutdown(_ context.Context) error { + close(e.done) + if e.eksInfo != nil && e.eksInfo.podToServiceEnvMap != nil { + e.eksInfo.podToServiceEnvMap.Stop() + } + e.logger.Info("Pod to Service Environment Mapping TTL Cache stopped") + return nil +} + +func (e *EntityStore) Mode() string { + return e.mode +} + +func (e *EntityStore) KubernetesMode() string { + return e.kubernetesMode +} + +func (e *EntityStore) EKSInfo() *eksInfo { + return e.eksInfo +} + +func (e *EntityStore) EC2Info() EC2Info { + return e.ec2Info +} + +func (e *EntityStore) SetNativeCredential(client client.ConfigProvider) { + e.nativeCredential = client +} + +func (e *EntityStore) NativeCredentialExists() bool { + return e.nativeCredential != nil +} + +// CreateLogFileEntity creates the entity for log events that are being uploaded from a log file in the environment. +func (e *EntityStore) CreateLogFileEntity(logFileGlob LogFileGlob, logGroupName LogGroupName) *cloudwatchlogs.Entity { + serviceAttr := e.serviceprovider.logFileServiceAttribute(logFileGlob, logGroupName) + + keyAttributes := e.createServiceKeyAttributes(serviceAttr) + attributeMap := e.createAttributeMap() + addNonEmptyToMap(attributeMap, ServiceNameSourceKey, serviceAttr.ServiceNameSource) + if _, ok := keyAttributes[entityattributes.AwsAccountId]; !ok { + return nil + } + return &cloudwatchlogs.Entity{ + KeyAttributes: keyAttributes, + Attributes: attributeMap, + } +} + +// GetMetricServiceNameAndSource gets the service name source for service metrics if not customer provided +func (e *EntityStore) GetMetricServiceNameAndSource() (string, string) { + return e.serviceprovider.getServiceNameAndSource() +} + +// GetServiceMetricAttributesMap creates the attribute map for service metrics. This will be expanded upon in a later PR'S, +// but for now is just covering the EC2 attributes for service metrics. +func (e *EntityStore) GetServiceMetricAttributesMap() map[string]*string { + return e.createAttributeMap() +} + +// AddServiceAttrEntryForLogFile adds an entry to the entity store for the provided file glob -> (serviceName, environmentName) key-value pair +func (e *EntityStore) AddServiceAttrEntryForLogFile(fileGlob LogFileGlob, serviceName string, environmentName string) { + if e.serviceprovider != nil { + e.serviceprovider.addEntryForLogFile(fileGlob, ServiceAttribute{ + ServiceName: serviceName, + ServiceNameSource: ServiceNameSourceUserConfiguration, + Environment: environmentName, + }) + } +} + +// AddServiceAttrEntryForLogGroup adds an entry to the entity store for the provided log group nme -> (serviceName, environmentName) key-value pair +func (e *EntityStore) AddServiceAttrEntryForLogGroup(logGroupName LogGroupName, serviceName string, environmentName string) { + e.serviceprovider.addEntryForLogGroup(logGroupName, ServiceAttribute{ + ServiceName: serviceName, + ServiceNameSource: ServiceNameSourceInstrumentation, + Environment: environmentName, + }) +} + +func (e *EntityStore) AddPodServiceEnvironmentMapping(podName string, serviceName string, environmentName string, serviceNameSource string) { + if e.eksInfo != nil { + e.eksInfo.AddPodServiceEnvironmentMapping(podName, serviceName, environmentName, serviceNameSource) + } +} + +func (e *EntityStore) StartPodToServiceEnvironmentMappingTtlCache() { + if e.eksInfo != nil { + e.eksInfo.podToServiceEnvMap.Start() + } +} + +func (e *EntityStore) GetPodServiceEnvironmentMapping() *ttlcache.Cache[string, ServiceEnvironment] { + if e.eksInfo != nil { + return e.eksInfo.GetPodServiceEnvironmentMapping() + } + return ttlcache.New[string, ServiceEnvironment]( + ttlcache.WithTTL[string, ServiceEnvironment](ttlDuration), + ) +} + +func (e *EntityStore) createAttributeMap() map[string]*string { + attributeMap := make(map[string]*string) + + if e.mode == config.ModeEC2 { + addNonEmptyToMap(attributeMap, InstanceIDKey, e.ec2Info.GetInstanceID()) + addNonEmptyToMap(attributeMap, ASGKey, e.ec2Info.GetAutoScalingGroup()) + } + switch e.mode { + case config.ModeEC2: + attributeMap[PlatformType] = aws.String(EC2PlatForm) + } + return attributeMap +} + +// createServiceKeyAttribute creates KeyAttributes for Service entities +func (e *EntityStore) createServiceKeyAttributes(serviceAttr ServiceAttribute) map[string]*string { + serviceKeyAttr := map[string]*string{ + entityattributes.EntityType: aws.String(Service), + } + addNonEmptyToMap(serviceKeyAttr, entityattributes.ServiceName, serviceAttr.ServiceName) + addNonEmptyToMap(serviceKeyAttr, entityattributes.DeploymentEnvironment, serviceAttr.Environment) + addNonEmptyToMap(serviceKeyAttr, entityattributes.AwsAccountId, e.ec2Info.GetAccountID()) + return serviceKeyAttr +} + +var getMetaDataProvider = func() ec2metadataprovider.MetadataProvider { + mdCredentialConfig := &configaws.CredentialConfig{} + return ec2metadataprovider.NewMetadataProvider(mdCredentialConfig.Credentials(), retryer.GetDefaultRetryNumber()) +} + +var getEC2Provider = func(region string, ec2CredentialConfig *configaws.CredentialConfig) ec2iface.EC2API { + ec2CredentialConfig.Region = region + return ec2.New( + ec2CredentialConfig.Credentials(), + &aws.Config{ + LogLevel: configaws.SDKLogLevel(), + Logger: configaws.SDKLogger{}, + }) +} + +func addNonEmptyToMap(m map[string]*string, key, value string) { + if value != "" { + m[key] = aws.String(value) + } +} diff --git a/extension/entitystore/extension_test.go b/extension/entitystore/extension_test.go new file mode 100644 index 0000000000..fea148847a --- /dev/null +++ b/extension/entitystore/extension_test.go @@ -0,0 +1,602 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "bytes" + "context" + "errors" + "log" + "reflect" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/jellydator/ttlcache/v3" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + + "github.com/aws/amazon-cloudwatch-agent/internal/ec2metadataprovider" + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity/entityattributes" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatchlogs" + "github.com/aws/amazon-cloudwatch-agent/translator/config" +) + +type mockServiceProvider struct { + mock.Mock +} + +// This helper function creates a test logger +// so that it can send the log messages into a +// temporary buffer for pattern matching +func CreateTestLogger(buf *bytes.Buffer) *zap.Logger { + writer := zapcore.AddSync(buf) + + // Create a custom zapcore.Core that writes to the buffer + encoder := zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()) + core := zapcore.NewCore(encoder, writer, zapcore.DebugLevel) + logger := zap.New(core) + return logger +} + +func (s *mockServiceProvider) startServiceProvider() {} + +func (s *mockServiceProvider) addEntryForLogGroup(logGroupName LogGroupName, serviceAttr ServiceAttribute) { + s.Called(logGroupName, serviceAttr) +} + +func (s *mockServiceProvider) addEntryForLogFile(logFileGlob LogFileGlob, serviceAttr ServiceAttribute) { + s.Called(logFileGlob, serviceAttr) +} + +func (s *mockServiceProvider) logFileServiceAttribute(glob LogFileGlob, name LogGroupName) ServiceAttribute { + args := s.Called(glob, name) + return args.Get(0).(ServiceAttribute) +} + +func (s *mockServiceProvider) getServiceNameAndSource() (string, string) { + return "test-service-name", "UserConfiguration" +} + +type mockMetadataProvider struct { + InstanceIdentityDocument *ec2metadata.EC2InstanceIdentityDocument + Tags map[string]string + InstanceTagError bool +} + +func mockMetadataProviderFunc() ec2metadataprovider.MetadataProvider { + return &mockMetadataProvider{ + Tags: map[string]string{ + "aws:autoscaling:groupName": "ASG-1", + }, + InstanceIdentityDocument: &ec2metadata.EC2InstanceIdentityDocument{ + InstanceID: "i-123456789", + }, + } +} + +func mockMetadataProviderWithAccountId(accountId string) *mockMetadataProvider { + return &mockMetadataProvider{ + InstanceIdentityDocument: &ec2metadata.EC2InstanceIdentityDocument{ + AccountID: accountId, + }, + } +} + +func (m *mockMetadataProvider) Get(ctx context.Context) (ec2metadata.EC2InstanceIdentityDocument, error) { + if m.InstanceIdentityDocument != nil { + return *m.InstanceIdentityDocument, nil + } + return ec2metadata.EC2InstanceIdentityDocument{}, errors.New("No instance identity document") +} + +func (m *mockMetadataProvider) Hostname(ctx context.Context) (string, error) { + return "MockHostName", nil +} + +func (m *mockMetadataProvider) InstanceID(ctx context.Context) (string, error) { + return "MockInstanceID", nil +} + +func (m *mockMetadataProvider) InstanceProfileIAMRole() (string, error) { + return "arn:aws:iam::123456789:instance-profile/TestRole", nil +} + +func (m *mockMetadataProvider) InstanceTags(ctx context.Context) (string, error) { + if m.InstanceTagError { + return "", errors.New("an error occurred for instance tag retrieval") + } + var tagsString string + for key, val := range m.Tags { + tagsString += key + "=" + val + "," + } + return tagsString, nil +} + +func (m *mockMetadataProvider) InstanceTagValue(ctx context.Context, tagKey string) (string, error) { + tag, ok := m.Tags[tagKey] + if !ok { + return "", errors.New("tag not found") + } + return tag, nil +} + +func TestEntityStore_EC2Info(t *testing.T) { + tests := []struct { + name string + ec2InfoInput EC2Info + want EC2Info + }{ + { + name: "happypath", + ec2InfoInput: EC2Info{ + InstanceID: "i-1234567890", + AutoScalingGroup: "test-asg", + }, + want: EC2Info{ + InstanceID: "i-1234567890", + AutoScalingGroup: "test-asg", + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := &EntityStore{ + ec2Info: tt.ec2InfoInput, + } + if got := e.EC2Info(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("EC2Info() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestEntityStore_Mode(t *testing.T) { + tests := []struct { + name string + modeInput string + want string + }{ + {name: "happypath", modeInput: "EC2", want: "EC2"}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := &EntityStore{ + mode: tt.modeInput, + } + if got := e.Mode(); got != tt.want { + t.Errorf("Mode() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestEntityStore_KubernetesMode(t *testing.T) { + tests := []struct { + name string + k8sModeInput string + want string + }{ + {name: "modeEKS", k8sModeInput: config.ModeEKS, want: config.ModeEKS}, + {name: "modeK8sEc2", k8sModeInput: config.ModeK8sEC2, want: config.ModeK8sEC2}, + {name: "modeK8sOnPrem", k8sModeInput: config.ModeK8sOnPrem, want: config.ModeK8sOnPrem}, + {name: "modeNotSet", want: ""}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := &EntityStore{} + e.kubernetesMode = tt.k8sModeInput + if got := e.KubernetesMode(); got != tt.want { + t.Errorf("Kubernetes Mode() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestEntityStore_createAttributeMaps(t *testing.T) { + type fields struct { + ec2Info EC2Info + mode string + } + tests := []struct { + name string + fields fields + want map[string]*string + }{ + { + name: "HappyPath", + fields: fields{ + ec2Info: EC2Info{ + InstanceID: "i-123456789", + AutoScalingGroup: "test-asg", + }, + mode: config.ModeEC2, + }, + want: map[string]*string{ + ASGKey: aws.String("test-asg"), + InstanceIDKey: aws.String("i-123456789"), + PlatformType: aws.String(EC2PlatForm), + }, + }, + { + name: "HappyPath_AsgMissing", + fields: fields{ + ec2Info: EC2Info{ + InstanceID: "i-123456789", + }, + mode: config.ModeEC2, + }, + want: map[string]*string{ + InstanceIDKey: aws.String("i-123456789"), + PlatformType: aws.String(EC2PlatForm), + }, + }, + { + name: "HappyPath_InstanceIdAndAsgMissing", + fields: fields{ + mode: config.ModeEC2, + }, + want: map[string]*string{ + PlatformType: aws.String(EC2PlatForm), + }, + }, + { + name: "NonEC2", + fields: fields{ + ec2Info: EC2Info{ + InstanceID: "i-123456789", + AutoScalingGroup: "test-asg", + }, + mode: config.ModeOnPrem, + }, + want: map[string]*string{}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := &EntityStore{ + ec2Info: tt.fields.ec2Info, + mode: tt.fields.mode, + } + assert.Equalf(t, dereferenceMap(tt.want), dereferenceMap(e.createAttributeMap()), "createAttributeMap()") + }) + } +} + +func TestEntityStore_createServiceKeyAttributes(t *testing.T) { + tests := []struct { + name string + serviceAttr ServiceAttribute + want map[string]*string + }{ + { + name: "NameAndEnvironmentSet", + serviceAttr: ServiceAttribute{ServiceName: "test-service", Environment: "test-environment"}, + want: map[string]*string{ + entityattributes.DeploymentEnvironment: aws.String("test-environment"), + entityattributes.ServiceName: aws.String("test-service"), + entityattributes.EntityType: aws.String(Service), + }, + }, + { + name: "OnlyNameSet", + serviceAttr: ServiceAttribute{ServiceName: "test-service"}, + want: map[string]*string{ + entityattributes.ServiceName: aws.String("test-service"), + entityattributes.EntityType: aws.String(Service), + }, + }, + { + name: "OnlyEnvironmentSet", + serviceAttr: ServiceAttribute{Environment: "test-environment"}, + want: map[string]*string{ + entityattributes.DeploymentEnvironment: aws.String("test-environment"), + entityattributes.EntityType: aws.String(Service), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := &EntityStore{} + assert.Equalf(t, dereferenceMap(tt.want), dereferenceMap(e.createServiceKeyAttributes(tt.serviceAttr)), "createServiceKeyAttributes()") + }) + } +} + +func TestEntityStore_createLogFileRID(t *testing.T) { + instanceId := "i-abcd1234" + accountId := "123456789012" + glob := LogFileGlob("glob") + group := LogGroupName("group") + serviceAttr := ServiceAttribute{ + ServiceName: "test-service", + ServiceNameSource: ServiceNameSourceUserConfiguration, + Environment: "test-environment", + } + sp := new(mockServiceProvider) + sp.On("logFileServiceAttribute", glob, group).Return(serviceAttr) + e := EntityStore{ + mode: config.ModeEC2, + ec2Info: EC2Info{InstanceID: instanceId, AccountID: accountId}, + serviceprovider: sp, + nativeCredential: &session.Session{}, + } + + entity := e.CreateLogFileEntity(glob, group) + + expectedEntity := cloudwatchlogs.Entity{ + KeyAttributes: map[string]*string{ + entityattributes.DeploymentEnvironment: aws.String("test-environment"), + entityattributes.ServiceName: aws.String("test-service"), + entityattributes.EntityType: aws.String(Service), + entityattributes.AwsAccountId: aws.String(accountId), + }, + Attributes: map[string]*string{ + InstanceIDKey: aws.String(instanceId), + ServiceNameSourceKey: aws.String(ServiceNameSourceUserConfiguration), + PlatformType: aws.String(EC2PlatForm), + }, + } + assert.Equal(t, dereferenceMap(expectedEntity.KeyAttributes), dereferenceMap(entity.KeyAttributes)) + assert.Equal(t, dereferenceMap(expectedEntity.Attributes), dereferenceMap(entity.Attributes)) +} + +func dereferenceMap(input map[string]*string) map[string]string { + result := make(map[string]string) + for k, v := range input { + if v != nil { + result[k] = *v + } else { + result[k] = "" + } + } + return result +} + +func TestEntityStore_addServiceAttrEntryForLogFile(t *testing.T) { + sp := new(mockServiceProvider) + e := EntityStore{serviceprovider: sp} + + key := LogFileGlob("/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log") + serviceAttr := ServiceAttribute{ + ServiceName: "test", + ServiceNameSource: ServiceNameSourceUserConfiguration, + Environment: "ec2:test", + } + sp.On("addEntryForLogFile", key, serviceAttr).Return() + e.AddServiceAttrEntryForLogFile(key, "test", "ec2:test") + + sp.AssertExpectations(t) +} + +func TestEntityStore_addServiceAttrEntryForLogGroup(t *testing.T) { + sp := new(mockServiceProvider) + e := EntityStore{serviceprovider: sp} + + key := LogGroupName("TestLogGroup") + serviceAttr := ServiceAttribute{ + ServiceName: "test", + ServiceNameSource: ServiceNameSourceInstrumentation, + Environment: "ec2:test", + } + sp.On("addEntryForLogGroup", key, serviceAttr).Return() + e.AddServiceAttrEntryForLogGroup(key, "test", "ec2:test") + + sp.AssertExpectations(t) +} + +func TestEntityStore_AddAndGetPodServiceEnvironmentMapping(t *testing.T) { + logger, _ := zap.NewProduction() + tests := []struct { + name string + want *ttlcache.Cache[string, ServiceEnvironment] + eks *eksInfo + }{ + { + name: "HappyPath", + want: setupTTLCacheForTesting(map[string]ServiceEnvironment{ + "pod1": { + ServiceName: "service1", + Environment: "env1", + ServiceNameSource: ServiceNameSourceK8sWorkload, + }, + }, ttlDuration), + eks: newEKSInfo(logger), + }, + { + name: "Empty EKS Info", + want: setupTTLCacheForTesting(map[string]ServiceEnvironment{}, ttlDuration), + eks: nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := EntityStore{eksInfo: tt.eks} + e.AddPodServiceEnvironmentMapping("pod1", "service1", "env1", ServiceNameSourceK8sWorkload) + for pod, se := range tt.want.Items() { + assert.Equal(t, se.Value(), e.GetPodServiceEnvironmentMapping().Get(pod).Value()) + } + assert.Equal(t, tt.want.Len(), e.GetPodServiceEnvironmentMapping().Len()) + }) + } +} + +func TestEntityStore_ClearTerminatedPodsFromServiceMap(t *testing.T) { + logger, _ := zap.NewProduction() + tests := []struct { + name string + podToServiceMap *ttlcache.Cache[string, ServiceEnvironment] + want *ttlcache.Cache[string, ServiceEnvironment] + eks *eksInfo + }{ + { + name: "HappyPath_NoClear", + podToServiceMap: setupTTLCacheForTesting(map[string]ServiceEnvironment{ + "pod1": { + ServiceName: "service1", + Environment: "env1", + }, + }, ttlDuration), + want: setupTTLCacheForTesting(map[string]ServiceEnvironment{ + "pod1": { + ServiceName: "service1", + Environment: "env1", + }, + }, ttlDuration), + eks: newEKSInfo(logger), + }, + { + name: "HappyPath_Clear", + podToServiceMap: setupTTLCacheForTesting(map[string]ServiceEnvironment{ + "pod1": { + ServiceName: "service1", + Environment: "env1", + }, + }, time.Nanosecond), + want: setupTTLCacheForTesting(map[string]ServiceEnvironment{}, time.Nanosecond), + eks: newEKSInfo(logger), + }, + { + name: "Empty EKS Info", + want: setupTTLCacheForTesting(map[string]ServiceEnvironment{}, ttlDuration), + eks: nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := EntityStore{eksInfo: tt.eks} + if tt.eks != nil { + e.eksInfo.podToServiceEnvMap = tt.podToServiceMap + go e.eksInfo.podToServiceEnvMap.Start() + } + //sleep for 1 second to allow the cache to update + time.Sleep(1 * time.Second) + for pod, se := range tt.want.Items() { + assert.Equal(t, se.Value(), e.GetPodServiceEnvironmentMapping().Get(pod).Value()) + } + if tt.eks != nil { + e.eksInfo.podToServiceEnvMap.Stop() + } + assert.Equal(t, tt.want.Len(), e.GetPodServiceEnvironmentMapping().Len()) + }) + } +} + +func TestEntityStore_StartPodToServiceEnvironmentMappingTtlCache(t *testing.T) { + e := EntityStore{eksInfo: newEKSInfo(zap.NewExample())} + e.done = make(chan struct{}) + e.eksInfo.podToServiceEnvMap = setupTTLCacheForTesting(map[string]ServiceEnvironment{}, time.Microsecond) + + go e.StartPodToServiceEnvironmentMappingTtlCache() + assert.Equal(t, 0, e.GetPodServiceEnvironmentMapping().Len()) + e.AddPodServiceEnvironmentMapping("pod", "service", "env", "Instrumentation") + assert.Equal(t, 1, e.GetPodServiceEnvironmentMapping().Len()) + + // sleep for 1 second to allow the cache to update + time.Sleep(time.Second) + + //cache should be cleared + assert.Equal(t, 0, e.GetPodServiceEnvironmentMapping().Len()) + +} + +func TestEntityStore_StopPodToServiceEnvironmentMappingTtlCache(t *testing.T) { + e := EntityStore{eksInfo: newEKSInfo(zap.NewExample())} + e.done = make(chan struct{}) + e.eksInfo.podToServiceEnvMap = setupTTLCacheForTesting(map[string]ServiceEnvironment{}, time.Second) + e.logger = zap.NewNop() + + go e.StartPodToServiceEnvironmentMappingTtlCache() + assert.Equal(t, 0, e.GetPodServiceEnvironmentMapping().Len()) + e.AddPodServiceEnvironmentMapping("pod", "service", "env", "Instrumentation") + assert.Equal(t, 1, e.GetPodServiceEnvironmentMapping().Len()) + + time.Sleep(time.Millisecond) + assert.NoError(t, e.Shutdown(nil)) + //cache should be cleared + time.Sleep(time.Second) + assert.Equal(t, 1, e.GetPodServiceEnvironmentMapping().Len()) +} + +func TestEntityStore_GetMetricServiceNameSource(t *testing.T) { + instanceId := "i-abcd1234" + accountId := "123456789012" + sp := new(mockServiceProvider) + e := EntityStore{ + mode: config.ModeEC2, + ec2Info: EC2Info{InstanceID: instanceId}, + serviceprovider: sp, + metadataprovider: mockMetadataProviderWithAccountId(accountId), + nativeCredential: &session.Session{}, + } + + serviceName, serviceNameSource := e.GetMetricServiceNameAndSource() + + assert.Equal(t, "test-service-name", serviceName) + assert.Equal(t, "UserConfiguration", serviceNameSource) +} + +func TestEntityStore_LogMessageDoesNotIncludeResourceInfo(t *testing.T) { + type args struct { + metadataProvider ec2metadataprovider.MetadataProvider + mode string + kubernetesMode string + } + tests := []struct { + name string + args args + }{ + { + name: "AutoScalingGroupWithInstanceTagsEC2", + args: args{ + mode: config.ModeEC2, + }, + }, + { + name: "AutoScalingGroupWithInstanceTagsEKS", + args: args{ + kubernetesMode: config.ModeEKS, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Create a buffer to capture the logger output + var buf bytes.Buffer + + logger := CreateTestLogger(&buf) + done := make(chan struct{}) + config := &Config{ + Mode: tt.args.mode, + KubernetesMode: tt.args.kubernetesMode, + } + getMetaDataProvider = mockMetadataProviderFunc + es := &EntityStore{ + logger: logger, + done: done, + metadataprovider: tt.args.metadataProvider, + config: config, + } + go es.Start(nil, nil) + time.Sleep(2 * time.Second) + + logOutput := buf.String() + log.Println(logOutput) + assertIfNonEmpty(t, logOutput, es.ec2Info.GetInstanceID()) + assertIfNonEmpty(t, logOutput, es.ec2Info.GetAutoScalingGroup()) + assertIfNonEmpty(t, logOutput, es.ec2Info.GetAccountID()) + + }) + } +} + +func assertIfNonEmpty(t *testing.T, message string, pattern string) { + if pattern != "" { + assert.NotContains(t, message, pattern) + } +} diff --git a/extension/entitystore/factory.go b/extension/entitystore/factory.go new file mode 100644 index 0000000000..10e2e20913 --- /dev/null +++ b/extension/entitystore/factory.go @@ -0,0 +1,41 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "context" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/extension" +) + +var ( + TypeStr, _ = component.NewType("entitystore") + entityStore *EntityStore +) + +func GetEntityStore() *EntityStore { + return entityStore +} + +func NewFactory() extension.Factory { + return extension.NewFactory( + TypeStr, + createDefaultConfig, + createExtension, + component.StabilityLevelAlpha, + ) +} + +func createDefaultConfig() component.Config { + return &Config{} +} + +func createExtension(_ context.Context, settings extension.CreateSettings, cfg component.Config) (extension.Extension, error) { + entityStore = &EntityStore{ + logger: settings.Logger, + config: cfg.(*Config), + } + return entityStore, nil +} diff --git a/extension/entitystore/factory_test.go b/extension/entitystore/factory_test.go new file mode 100644 index 0000000000..f0bd0305b5 --- /dev/null +++ b/extension/entitystore/factory_test.go @@ -0,0 +1,26 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/extension/extensiontest" +) + +func TestCreateDefaultConfig(t *testing.T) { + cfg := NewFactory().CreateDefaultConfig() + assert.Equal(t, &Config{}, cfg) + assert.NoError(t, componenttest.CheckConfigStruct(cfg)) +} + +func TestCreateExtension(t *testing.T) { + cfg := &Config{} + got, err := NewFactory().CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + assert.NoError(t, err) + assert.NotNil(t, got) +} diff --git a/extension/entitystore/retryer.go b/extension/entitystore/retryer.go new file mode 100644 index 0000000000..cefa06d374 --- /dev/null +++ b/extension/entitystore/retryer.go @@ -0,0 +1,103 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "math/rand" + "time" + + "github.com/aws/aws-sdk-go/aws/awserr" + "go.uber.org/zap" +) + +const ( + RequestLimitExceeded = "RequestLimitExceeded" + infRetry = -1 +) + +var ( + retryableErrorMap = map[string]bool{ + "RequestLimitExceeded": true, + } +) + +type Retryer struct { + oneTime bool + retryAnyError bool + successRetryMin int + successRetryMax int + backoffArray []time.Duration + maxRetry int + done chan struct{} + logger *zap.Logger +} + +func NewRetryer(onetime bool, retryAnyError bool, successRetryMin int, successRetryMax int, backoffArray []time.Duration, maxRetry int, done chan struct{}, logger *zap.Logger) *Retryer { + return &Retryer{ + oneTime: onetime, + retryAnyError: retryAnyError, + successRetryMin: successRetryMin, + successRetryMax: successRetryMax, + backoffArray: backoffArray, + maxRetry: maxRetry, + done: done, + logger: logger, + } +} + +func (r *Retryer) refreshLoop(updateFunc func() error) int { + // Offset retry by 1 so we can start with 1 minute wait time + // instead of immediately retrying + retry := 1 + for { + if r.maxRetry != -1 && retry > r.maxRetry { + return retry + } + err := updateFunc() + if err == nil && r.oneTime { + return retry + } else if awsErr, ok := err.(awserr.Error); ok && !r.retryAnyError && !retryableErrorMap[awsErr.Code()] { + return retry + } + + waitDuration := calculateWaitTime(retry-1, err, r.successRetryMin, r.successRetryMax, r.backoffArray) + wait := time.NewTimer(waitDuration) + select { + case <-r.done: + r.logger.Debug("Shutting down retryer") + wait.Stop() + return retry + case <-wait.C: + } + + if retry > 1 { + r.logger.Debug("attribute retrieval retry count", zap.Int("retry", retry-1)) + } + + if err != nil { + retry++ + r.logger.Debug("there was an error when retrieving service attribute.", zap.Error(err)) + } else { + retry = 1 + } + + } + return retry +} + +// calculateWaitTime returns different time based on whether if +// a function call was returned with error. If returned with error, +// follow exponential backoff wait time, otherwise, refresh with jitter +func calculateWaitTime(retry int, err error, successRetryMin int, successRetryMax int, backoffArray []time.Duration) time.Duration { + var waitDuration time.Duration + if err == nil { + return time.Duration(rand.Intn(successRetryMax-successRetryMin)+successRetryMin) * time.Second + } + if retry < len(backoffArray) { + waitDuration = backoffArray[retry] + } else { + waitDuration = backoffArray[len(backoffArray)-1] + } + return waitDuration +} diff --git a/extension/entitystore/retryer_test.go b/extension/entitystore/retryer_test.go new file mode 100644 index 0000000000..9c8c88951e --- /dev/null +++ b/extension/entitystore/retryer_test.go @@ -0,0 +1,57 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/stretchr/testify/assert" + "go.uber.org/zap" + + "github.com/aws/amazon-cloudwatch-agent/internal/ec2metadataprovider" + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/ec2tagger" +) + +func TestRetryer_refreshLoop(t *testing.T) { + type fields struct { + metadataProvider ec2metadataprovider.MetadataProvider + iamRole string + oneTime bool + } + tests := []struct { + name string + fields fields + wantIamRole string + }{ + { + name: "HappyPath_CorrectRefresh", + fields: fields{ + metadataProvider: &mockMetadataProvider{ + InstanceIdentityDocument: &ec2metadata.EC2InstanceIdentityDocument{ + InstanceID: "i-123456789"}, + }, + iamRole: "original-role", + }, + wantIamRole: "TestRole", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + logger, _ := zap.NewDevelopment() + done := make(chan struct{}) + s := &serviceprovider{ + metadataProvider: tt.fields.metadataProvider, + iamRole: tt.fields.iamRole, + done: done, + } + unlimitedRetryer := NewRetryer(tt.fields.oneTime, true, defaultJitterMin, defaultJitterMax, ec2tagger.BackoffSleepArray, infRetry, s.done, logger) + go unlimitedRetryer.refreshLoop(s.scrapeIAMRole) + time.Sleep(time.Second) + close(done) + assert.Equal(t, tt.wantIamRole, s.GetIAMRole()) + }) + } +} diff --git a/extension/entitystore/serviceprovider.go b/extension/entitystore/serviceprovider.go new file mode 100644 index 0000000000..41942028cd --- /dev/null +++ b/extension/entitystore/serviceprovider.go @@ -0,0 +1,281 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "context" + "fmt" + "strings" + "sync" + + "github.com/aws/aws-sdk-go/aws/arn" + "go.uber.org/zap" + + configaws "github.com/aws/amazon-cloudwatch-agent/cfg/aws" + "github.com/aws/amazon-cloudwatch-agent/internal/ec2metadataprovider" + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/ec2tagger" + "github.com/aws/amazon-cloudwatch-agent/translator/config" +) + +const ( + INSTANCE_PROFILE = "instance-profile/" + SERVICE = "service" + APPLICATION = "application" + APP = "app" + + // Matches the default value from OTel + // https://opentelemetry.io/docs/languages/sdk-configuration/general/#otel_service_name + ServiceNameUnknown = "unknown_service" + + ServiceNameSourceClientIamRole = "ClientIamRole" + ServiceNameSourceInstrumentation = "Instrumentation" + ServiceNameSourceResourceTags = "ResourceTags" + ServiceNameSourceUnknown = "Unknown" + ServiceNameSourceUserConfiguration = "UserConfiguration" + ServiceNameSourceK8sWorkload = "K8sWorkload" + + describeTagsJitterMax = 3600 + describeTagsJitterMin = 3000 + defaultJitterMin = 480 + defaultJitterMax = 600 + maxRetry = 3 +) + +var ( + //priorityMap is ranking in how we prioritize which IMDS tag determines the service name + priorityMap = []string{SERVICE, APPLICATION, APP} +) + +type ServiceAttribute struct { + ServiceName string + ServiceNameSource string + Environment string +} + +type LogGroupName string +type LogFileGlob string + +type serviceprovider struct { + mode string + ec2Info *EC2Info + metadataProvider ec2metadataprovider.MetadataProvider + iamRole string + imdsServiceName string + region string + done chan struct{} + logger *zap.Logger + mutex sync.RWMutex + // logFiles stores the service attributes that were configured for log files in CloudWatch Agent configuration. + // Example: + // "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log": {ServiceName: "cloudwatch-agent"} + logFiles map[LogFileGlob]ServiceAttribute + + // logGroups stores the associations between log groups and service attributes that were observed from incoming + // telemetry. Example: + // "MyLogGroup": {ServiceName: "MyInstrumentedService"} + logGroups map[LogGroupName]ServiceAttribute +} + +func (s *serviceprovider) startServiceProvider() { + unlimitedRetryer := NewRetryer(false, true, defaultJitterMin, defaultJitterMax, ec2tagger.BackoffSleepArray, infRetry, s.done, s.logger) + limitedRetryer := NewRetryer(false, true, describeTagsJitterMin, describeTagsJitterMax, ec2tagger.ThrottleBackOffArray, maxRetry, s.done, s.logger) + go unlimitedRetryer.refreshLoop(s.scrapeIAMRole) + go limitedRetryer.refreshLoop(s.scrapeImdsServiceName) +} + +func (s *serviceprovider) GetIAMRole() string { + s.mutex.RLock() + defer s.mutex.RUnlock() + return s.iamRole +} + +func (s *serviceprovider) GetIMDSServiceName() string { + s.mutex.RLock() + defer s.mutex.RUnlock() + return s.imdsServiceName +} + +// addEntryForLogFile adds an association between a log file glob and a service attribute, as configured in the +// CloudWatch Agent config. +func (s *serviceprovider) addEntryForLogFile(logFileGlob LogFileGlob, serviceAttr ServiceAttribute) { + s.logFiles[logFileGlob] = serviceAttr +} + +// addEntryForLogGroup adds an association between a log group name and a service attribute, as observed from incoming +// telemetry received by CloudWatch Agent. +func (s *serviceprovider) addEntryForLogGroup(logGroupName LogGroupName, serviceAttr ServiceAttribute) { + s.logGroups[logGroupName] = serviceAttr +} + +type serviceAttributeProvider func() ServiceAttribute + +// mergeServiceAttributes takes in a list of functions that create ServiceAttributes, in descending priority order +// (highest priority first), and proceeds down the list until we have obtained both a ServiceName and an +// EnvironmentName. +func mergeServiceAttributes(providers []serviceAttributeProvider) ServiceAttribute { + ret := ServiceAttribute{} + + for _, provider := range providers { + serviceAttr := provider() + + if ret.ServiceName == "" { + ret.ServiceName = serviceAttr.ServiceName + ret.ServiceNameSource = serviceAttr.ServiceNameSource + } + if ret.Environment == "" { + ret.Environment = serviceAttr.Environment + } + + if ret.ServiceName != "" && ret.Environment != "" { + return ret + } + } + + return ret +} + +// logFileServiceAttribute function gets the relevant service attributes +// service name is retrieved based on the following priority chain +// 1. Incoming telemetry attributes +// 2. CWA config +// 3. instance tags - The tags attached to the EC2 instance. Only scrape for tag with the following key: service, application, app +// 4. IAM Role - The IAM role name retrieved through IMDS(Instance Metadata Service) +func (s *serviceprovider) logFileServiceAttribute(logFile LogFileGlob, logGroup LogGroupName) ServiceAttribute { + return mergeServiceAttributes([]serviceAttributeProvider{ + func() ServiceAttribute { return s.serviceAttributeForLogGroup(logGroup) }, + func() ServiceAttribute { return s.serviceAttributeForLogFile(logFile) }, + s.serviceAttributeFromImdsTags, + s.serviceAttributeFromIamRole, + s.serviceAttributeFromAsg, + s.serviceAttributeFallback, + }) +} + +func (s *serviceprovider) getServiceNameAndSource() (string, string) { + sa := mergeServiceAttributes([]serviceAttributeProvider{ + s.serviceAttributeFromImdsTags, + s.serviceAttributeFromIamRole, + s.serviceAttributeFallback, + }) + return sa.ServiceName, sa.ServiceNameSource +} + +func (s *serviceprovider) serviceAttributeForLogGroup(logGroup LogGroupName) ServiceAttribute { + if logGroup == "" { + return ServiceAttribute{} + } + + return s.logGroups[logGroup] +} + +func (s *serviceprovider) serviceAttributeForLogFile(logFile LogFileGlob) ServiceAttribute { + if logFile == "" { + return ServiceAttribute{} + } + + return s.logFiles[logFile] +} + +func (s *serviceprovider) serviceAttributeFromImdsTags() ServiceAttribute { + if s.GetIMDSServiceName() == "" { + return ServiceAttribute{} + } + + return ServiceAttribute{ + ServiceName: s.GetIMDSServiceName(), + ServiceNameSource: ServiceNameSourceResourceTags, + } +} + +func (s *serviceprovider) serviceAttributeFromIamRole() ServiceAttribute { + if s.GetIAMRole() == "" { + return ServiceAttribute{} + } + + return ServiceAttribute{ + ServiceName: s.GetIAMRole(), + ServiceNameSource: ServiceNameSourceClientIamRole, + } +} + +func (s *serviceprovider) serviceAttributeFromAsg() ServiceAttribute { + if s.ec2Info == nil || s.ec2Info.GetAutoScalingGroup() == "" { + return ServiceAttribute{} + } + + return ServiceAttribute{ + Environment: "ec2:" + s.ec2Info.GetAutoScalingGroup(), + } +} + +func (s *serviceprovider) serviceAttributeFallback() ServiceAttribute { + attr := ServiceAttribute{ + ServiceName: ServiceNameUnknown, + ServiceNameSource: ServiceNameSourceUnknown, + } + if s.mode == config.ModeEC2 { + attr.Environment = "ec2:default" + } + + return attr +} + +func (s *serviceprovider) scrapeIAMRole() error { + iamRole, err := s.metadataProvider.InstanceProfileIAMRole() + if err != nil { + return err + } + iamRoleArn, err := arn.Parse(iamRole) + if err != nil { + return err + } + iamRoleResource := iamRoleArn.Resource + if strings.HasPrefix(iamRoleResource, INSTANCE_PROFILE) { + roleName := strings.TrimPrefix(iamRoleResource, INSTANCE_PROFILE) + s.mutex.Lock() + s.iamRole = roleName + s.mutex.Unlock() + } else { + return fmt.Errorf("IAM Role resource does not follow the expected pattern. Should be instance-profile/") + } + return nil +} +func (s *serviceprovider) scrapeImdsServiceName() error { + tags, err := s.metadataProvider.InstanceTags(context.Background()) + if err != nil { + s.logger.Debug("Failed to get tags through metadata provider", zap.Error(err)) + return err + } + // This will check whether the tags contains SERVICE, APPLICATION, APP, in that order. + for _, value := range priorityMap { + if strings.Contains(tags, value) { + serviceName, err := s.metadataProvider.InstanceTagValue(context.Background(), value) + if err != nil { + continue + } else { + s.mutex.Lock() + s.imdsServiceName = serviceName + s.mutex.Unlock() + } + break + } + } + if s.GetIMDSServiceName() == "" { + s.logger.Debug("Service name not found through IMDS") + } + return nil +} + +func newServiceProvider(mode string, region string, ec2Info *EC2Info, metadataProvider ec2metadataprovider.MetadataProvider, providerType ec2ProviderType, ec2Credential *configaws.CredentialConfig, done chan struct{}, logger *zap.Logger) serviceProviderInterface { + return &serviceprovider{ + mode: mode, + region: region, + ec2Info: ec2Info, + metadataProvider: metadataProvider, + done: done, + logger: logger, + logFiles: make(map[LogFileGlob]ServiceAttribute), + logGroups: make(map[LogGroupName]ServiceAttribute), + } +} diff --git a/extension/entitystore/serviceprovider_test.go b/extension/entitystore/serviceprovider_test.go new file mode 100644 index 0000000000..011a522c96 --- /dev/null +++ b/extension/entitystore/serviceprovider_test.go @@ -0,0 +1,312 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/stretchr/testify/assert" + "go.uber.org/zap" + + "github.com/aws/amazon-cloudwatch-agent/internal/ec2metadataprovider" + "github.com/aws/amazon-cloudwatch-agent/translator/config" +) + +func Test_serviceprovider_startServiceProvider(t *testing.T) { + tests := []struct { + name string + metadataProvider ec2metadataprovider.MetadataProvider + wantIAM string + wantTag string + }{ + { + name: "HappyPath_AllServiceNames", + metadataProvider: &mockMetadataProvider{ + InstanceIdentityDocument: &ec2metadata.EC2InstanceIdentityDocument{ + InstanceID: "i-123456789"}, + Tags: map[string]string{"service": "test-service"}, + }, + wantIAM: "TestRole", + wantTag: "test-service", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + done := make(chan struct{}) + logger, _ := zap.NewDevelopment() + s := serviceprovider{ + metadataProvider: tt.metadataProvider, + done: done, + logger: logger, + } + go s.startServiceProvider() + time.Sleep(3 * time.Second) + close(done) + assert.Equal(t, tt.wantIAM, s.GetIAMRole()) + assert.Equal(t, tt.wantTag, s.GetIMDSServiceName()) + }) + } +} + +func Test_serviceprovider_addEntryForLogFile(t *testing.T) { + s := &serviceprovider{ + logFiles: make(map[LogFileGlob]ServiceAttribute), + } + glob := LogFileGlob("glob") + serviceAttr := ServiceAttribute{ServiceName: "test-service"} + + s.addEntryForLogFile(glob, serviceAttr) + + actual := s.logFiles[glob] + assert.Equal(t, serviceAttr, actual) +} + +func Test_serviceprovider_addEntryForLogGroup(t *testing.T) { + s := &serviceprovider{ + logGroups: make(map[LogGroupName]ServiceAttribute), + } + group := LogGroupName("group") + serviceAttr := ServiceAttribute{ServiceName: "test-service"} + + s.addEntryForLogGroup(group, serviceAttr) + + actual := s.logGroups[group] + assert.Equal(t, serviceAttr, actual) +} + +func Test_serviceprovider_mergeServiceAttributes(t *testing.T) { + onlySvc1 := func() ServiceAttribute { + return ServiceAttribute{ServiceName: "service1", ServiceNameSource: "source1"} + } + onlySvc2 := func() ServiceAttribute { + return ServiceAttribute{ServiceName: "service2", ServiceNameSource: "source2"} + } + onlyEnv1 := func() ServiceAttribute { return ServiceAttribute{Environment: "environment1"} } + onlyEnv2 := func() ServiceAttribute { return ServiceAttribute{Environment: "environment2"} } + both2 := func() ServiceAttribute { + return ServiceAttribute{ServiceName: "service2", ServiceNameSource: "source2", Environment: "environment2"} + } + both3 := func() ServiceAttribute { + return ServiceAttribute{ServiceName: "service3", ServiceNameSource: "source3", Environment: "environment3"} + } + empty := func() ServiceAttribute { return ServiceAttribute{} } + + tests := []struct { + name string + providers []serviceAttributeProvider + want ServiceAttribute + }{ + { + name: "RespectServicePriority", + providers: []serviceAttributeProvider{onlySvc1, onlySvc2}, + want: ServiceAttribute{ServiceName: "service1", ServiceNameSource: "source1"}, + }, + { + name: "RespectEnvironmentPriority", + providers: []serviceAttributeProvider{onlyEnv1, onlyEnv2}, + want: ServiceAttribute{Environment: "environment1"}, + }, + { + name: "CombineServiceAndEnvironment", + providers: []serviceAttributeProvider{onlySvc1, both2, both3}, + want: ServiceAttribute{ServiceName: "service1", ServiceNameSource: "source1", Environment: "environment2"}, + }, + { + name: "CombineEnvironmentAndService", + providers: []serviceAttributeProvider{onlyEnv1, both2, both3}, + want: ServiceAttribute{ServiceName: "service2", ServiceNameSource: "source2", Environment: "environment1"}, + }, + { + name: "EmptyList", + providers: []serviceAttributeProvider{}, + want: ServiceAttribute{}, + }, + { + name: "EmptyProvider", + providers: []serviceAttributeProvider{empty}, + want: ServiceAttribute{}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert.Equalf(t, tt.want, mergeServiceAttributes(tt.providers), "mergeServiceAttributes()") + }) + } +} + +func Test_serviceprovider_serviceAttributeForLogGroup(t *testing.T) { + s := &serviceprovider{logGroups: map[LogGroupName]ServiceAttribute{"group": {ServiceName: "test-service"}}} + assert.Equal(t, ServiceAttribute{}, s.serviceAttributeForLogGroup("")) + assert.Equal(t, ServiceAttribute{}, s.serviceAttributeForLogGroup("othergroup")) + assert.Equal(t, ServiceAttribute{ServiceName: "test-service"}, s.serviceAttributeForLogGroup("group")) +} + +func Test_serviceprovider_serviceAttributeForLogFile(t *testing.T) { + s := &serviceprovider{logFiles: map[LogFileGlob]ServiceAttribute{"glob": {ServiceName: "test-service"}}} + assert.Equal(t, ServiceAttribute{}, s.serviceAttributeForLogFile("")) + assert.Equal(t, ServiceAttribute{}, s.serviceAttributeForLogFile("otherglob")) + assert.Equal(t, ServiceAttribute{ServiceName: "test-service"}, s.serviceAttributeForLogFile("glob")) +} + +func Test_serviceprovider_serviceAttributeFromEc2Tags(t *testing.T) { + s := &serviceprovider{} + assert.Equal(t, ServiceAttribute{}, s.serviceAttributeFromImdsTags()) + + s = &serviceprovider{imdsServiceName: "test-service"} + assert.Equal(t, ServiceAttribute{ServiceName: "test-service", ServiceNameSource: ServiceNameSourceResourceTags}, s.serviceAttributeFromImdsTags()) +} + +func Test_serviceprovider_serviceAttributeFromIamRole(t *testing.T) { + s := &serviceprovider{} + assert.Equal(t, ServiceAttribute{}, s.serviceAttributeFromIamRole()) + + s = &serviceprovider{iamRole: "test-service"} + assert.Equal(t, ServiceAttribute{ServiceName: "test-service", ServiceNameSource: ServiceNameSourceClientIamRole}, s.serviceAttributeFromIamRole()) +} + +func Test_serviceprovider_serviceAttributeFromAsg(t *testing.T) { + s := &serviceprovider{} + assert.Equal(t, ServiceAttribute{}, s.serviceAttributeFromAsg()) + + s = &serviceprovider{ec2Info: &EC2Info{}} + assert.Equal(t, ServiceAttribute{}, s.serviceAttributeFromAsg()) + + s = &serviceprovider{ec2Info: &EC2Info{AutoScalingGroup: "test-asg"}} + assert.Equal(t, ServiceAttribute{Environment: "ec2:test-asg"}, s.serviceAttributeFromAsg()) +} + +func Test_serviceprovider_serviceAttributeFallback(t *testing.T) { + s := &serviceprovider{} + assert.Equal(t, ServiceAttribute{ServiceName: ServiceNameUnknown, ServiceNameSource: ServiceNameSourceUnknown}, s.serviceAttributeFallback()) + + s = &serviceprovider{mode: config.ModeEC2} + assert.Equal(t, ServiceAttribute{ServiceName: ServiceNameUnknown, ServiceNameSource: ServiceNameSourceUnknown, Environment: "ec2:default"}, s.serviceAttributeFallback()) +} + +func Test_serviceprovider_logFileServiceAttribute(t *testing.T) { + s := &serviceprovider{ + mode: config.ModeEC2, + logGroups: make(map[LogGroupName]ServiceAttribute), + logFiles: make(map[LogFileGlob]ServiceAttribute), + } + + // Start with no known source for service attributes, then set values from the bottom of the priority list upward. + // This way we test the priority order - if we set the highest priority source first (log groups), then we wouldn't + // be able to test that lower priority sources should be used if necessary. + + assert.Equal(t, ServiceAttribute{ServiceName: ServiceNameUnknown, ServiceNameSource: ServiceNameSourceUnknown, Environment: "ec2:default"}, s.logFileServiceAttribute("glob", "group")) + + s.ec2Info = &EC2Info{AutoScalingGroup: "test-asg"} + assert.Equal(t, ServiceAttribute{ServiceName: ServiceNameUnknown, ServiceNameSource: ServiceNameSourceUnknown, Environment: "ec2:test-asg"}, s.logFileServiceAttribute("glob", "group")) + + s.iamRole = "test-role" + assert.Equal(t, ServiceAttribute{ServiceName: "test-role", ServiceNameSource: ServiceNameSourceClientIamRole, Environment: "ec2:test-asg"}, s.logFileServiceAttribute("glob", "group")) + + s.imdsServiceName = "test-service-from-tags" + assert.Equal(t, ServiceAttribute{ServiceName: "test-service-from-tags", ServiceNameSource: ServiceNameSourceResourceTags, Environment: "ec2:test-asg"}, s.logFileServiceAttribute("glob", "group")) + + s.logFiles["glob"] = ServiceAttribute{ServiceName: "test-service-from-logfile", ServiceNameSource: ServiceNameSourceUserConfiguration} + assert.Equal(t, ServiceAttribute{ServiceName: "test-service-from-logfile", ServiceNameSource: ServiceNameSourceUserConfiguration, Environment: "ec2:test-asg"}, s.logFileServiceAttribute("glob", "group")) + + s.logGroups["group"] = ServiceAttribute{ServiceName: "test-service-from-loggroup", ServiceNameSource: ServiceNameSourceInstrumentation} + assert.Equal(t, ServiceAttribute{ServiceName: "test-service-from-loggroup", ServiceNameSource: ServiceNameSourceInstrumentation, Environment: "ec2:test-asg"}, s.logFileServiceAttribute("glob", "group")) +} + +func Test_serviceprovider_getServiceNameSource(t *testing.T) { + s := &serviceprovider{ + mode: config.ModeEC2, + logGroups: make(map[LogGroupName]ServiceAttribute), + logFiles: make(map[LogFileGlob]ServiceAttribute), + } + + serviceName, serviceNameSource := s.getServiceNameAndSource() + assert.Equal(t, ServiceNameUnknown, serviceName) + assert.Equal(t, ServiceNameSourceUnknown, serviceNameSource) + + s.iamRole = "test-role" + serviceName, serviceNameSource = s.getServiceNameAndSource() + assert.Equal(t, s.GetIAMRole(), serviceName) + assert.Equal(t, ServiceNameSourceClientIamRole, serviceNameSource) + + s.imdsServiceName = "test-service-from-tags" + serviceName, serviceNameSource = s.getServiceNameAndSource() + assert.Equal(t, s.GetIMDSServiceName(), serviceName) + assert.Equal(t, ServiceNameSourceResourceTags, serviceNameSource) + +} + +func Test_serviceprovider_getIAMRole(t *testing.T) { + tests := []struct { + name string + metadataProvider ec2metadataprovider.MetadataProvider + want string + }{ + { + name: "Happypath_MockMetadata", + metadataProvider: &mockMetadataProvider{}, + want: "TestRole", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + s := serviceprovider{ + metadataProvider: tt.metadataProvider, + } + s.scrapeIAMRole() + assert.Equal(t, tt.want, s.GetIAMRole()) + }) + } +} + +func Test_serviceprovider_getImdsServiceName(t *testing.T) { + + tests := []struct { + name string + metadataProvider ec2metadataprovider.MetadataProvider + wantTagServiceName string + }{ + { + name: "HappyPath_ServiceExists", + metadataProvider: &mockMetadataProvider{InstanceIdentityDocument: mockedInstanceIdentityDoc, Tags: map[string]string{"service": "test-service"}}, + wantTagServiceName: "test-service", + }, + { + name: "HappyPath_ApplicationExists", + metadataProvider: &mockMetadataProvider{InstanceIdentityDocument: mockedInstanceIdentityDoc, Tags: map[string]string{"application": "test-application"}}, + wantTagServiceName: "test-application", + }, + { + name: "HappyPath_AppExists", + metadataProvider: &mockMetadataProvider{InstanceIdentityDocument: mockedInstanceIdentityDoc, Tags: map[string]string{"app": "test-app"}}, + wantTagServiceName: "test-app", + }, + { + name: "HappyPath_PreferServiceOverApplication", + metadataProvider: &mockMetadataProvider{InstanceIdentityDocument: mockedInstanceIdentityDoc, Tags: map[string]string{"service": "test-service", "application": "test-application"}}, + wantTagServiceName: "test-service", + }, + { + name: "HappyPath_PreferApplicationOverApp", + metadataProvider: &mockMetadataProvider{InstanceIdentityDocument: mockedInstanceIdentityDoc, Tags: map[string]string{"application": "test-application", "app": "test-app"}}, + wantTagServiceName: "test-application", + }, + { + name: "HappyPath_PreferServiceOverApplicationAndApp", + metadataProvider: &mockMetadataProvider{InstanceIdentityDocument: mockedInstanceIdentityDoc, Tags: map[string]string{"service": "test-service", "application": "test-application", "app": "test-app"}}, + wantTagServiceName: "test-service", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + s := &serviceprovider{ + logger: zap.NewExample(), + metadataProvider: tt.metadataProvider, + } + s.scrapeImdsServiceName() + assert.Equal(t, tt.wantTagServiceName, s.GetIMDSServiceName()) + }) + } +} diff --git a/extension/server/config.go b/extension/server/config.go new file mode 100644 index 0000000000..a6d145d283 --- /dev/null +++ b/extension/server/config.go @@ -0,0 +1,17 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package server + +import ( + "go.opentelemetry.io/collector/component" +) + +type Config struct { + ListenAddress string `mapstructure:"listen_addr"` + TLSCAPath string `mapstructure:"tls_ca_path, omitempty"` + TLSCertPath string `mapstructure:"tls_cert_path, omitempty"` + TLSKeyPath string `mapstructure:"tls_key_path, omitempty"` +} + +var _ component.Config = (*Config)(nil) diff --git a/extension/server/config_test.go b/extension/server/config_test.go new file mode 100644 index 0000000000..e9862d2f6a --- /dev/null +++ b/extension/server/config_test.go @@ -0,0 +1,18 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package server + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/confmap" +) + +func TestUnmarshalDefaultConfig(t *testing.T) { + factory := NewFactory() + cfg := factory.CreateDefaultConfig() + assert.NoError(t, confmap.New().Unmarshal(cfg)) + assert.Equal(t, factory.CreateDefaultConfig(), cfg) +} diff --git a/extension/server/extension.go b/extension/server/extension.go new file mode 100644 index 0000000000..4a34b6602f --- /dev/null +++ b/extension/server/extension.go @@ -0,0 +1,163 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package server + +import ( + "context" + "crypto/tls" + "net/http" + "time" + + "github.com/gin-gonic/gin" + "github.com/jellydator/ttlcache/v3" + jsoniter "github.com/json-iterator/go" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/extension" + "go.uber.org/zap" + + "github.com/aws/amazon-cloudwatch-agent/extension/entitystore" + tlsInternal "github.com/aws/amazon-cloudwatch-agent/internal/tls" +) + +type Server struct { + logger *zap.Logger + config *Config + jsonMarshaller jsoniter.API + httpsServer *http.Server + ctx context.Context + watcher *tlsInternal.CertWatcher +} + +var _ extension.Extension = (*Server)(nil) + +func (s *Server) setRouter(router *gin.Engine) { + router.Use(gin.Recovery()) + //disabling the gin default behavior of encoding/decoding the request path + router.UseRawPath = true + router.UnescapePathValues = false + router.GET("/kubernetes/pod-to-service-env-map", s.k8sPodToServiceMapHandler) +} + +func NewServer(logger *zap.Logger, config *Config) *Server { + s := &Server{ + logger: logger, + config: config, + jsonMarshaller: jsoniter.ConfigCompatibleWithStandardLibrary, + ctx: context.Background(), + } + gin.SetMode(gin.ReleaseMode) + + // Initialize a new cert watcher with cert/key pair + watcher, err := tlsInternal.NewCertWatcher(config.TLSCertPath, config.TLSKeyPath, config.TLSCAPath, logger) + if err != nil { + s.logger.Error("failed to initialize cert watcher", zap.Error(err)) + return s + } + + s.watcher = watcher + + watcher.RegisterCallback(func() { + s.logger.Debug("Calling registered callback, reloading TLS server") + if err := s.reloadServer(watcher.GetTLSConfig()); err != nil { + s.logger.Error("Failed to reload TLS server", zap.Error(err)) + } + }) + + // Start goroutine with certwatcher running fsnotify against supplied certdir + go func() { + if err := watcher.Start(s.ctx); err != nil { + s.logger.Error("failed to start cert watcher", zap.Error(err)) + return + } + }() + + httpsRouter := gin.New() + s.setRouter(httpsRouter) + + s.httpsServer = &http.Server{Addr: config.ListenAddress, Handler: httpsRouter, ReadHeaderTimeout: 90 * time.Second, TLSConfig: watcher.GetTLSConfig()} + + return s +} + +func (s *Server) Start(context.Context, component.Host) error { + if s.httpsServer != nil { + s.logger.Debug("Starting HTTPS server...") + go func() { + err := s.httpsServer.ListenAndServeTLS("", "") + if err != nil { + s.logger.Error("failed to serve and listen", zap.Error(err)) + } + }() + } + return nil +} + +func (s *Server) Shutdown(ctx context.Context) error { + s.ctx.Done() + if s.httpsServer != nil { + s.logger.Debug("Shutting down HTTPS server...") + return s.httpsServer.Shutdown(ctx) + } + return nil +} + +func (s *Server) reloadServer(config *tls.Config) error { + s.logger.Debug("Reloading TLS Server...") + // close the current server + if s.httpsServer != nil { + // closing the server gracefully + if err := s.httpsServer.Close(); err != nil { + s.logger.Error("Failed to shutdown HTTPS server", zap.Error(err)) + } + } + // Create a new HTTP server with the new router and updated TLS config + httpsRouter := gin.New() + s.setRouter(httpsRouter) + s.httpsServer = &http.Server{ + Addr: s.config.ListenAddress, + Handler: httpsRouter, + TLSConfig: config, + ReadHeaderTimeout: 90 * time.Second, + } + + go func() { + err := s.httpsServer.ListenAndServeTLS("", "") + if err != nil { + s.logger.Error("failed to serve and listen", zap.Error(err)) + } + }() + return nil +} + +func (s *Server) k8sPodToServiceMapHandler(c *gin.Context) { + podServiceEnvironmentMap := convertTtlCacheToMap(getPodServiceEnvironmentMapping()) + s.jsonHandler(c.Writer, podServiceEnvironmentMap) +} + +// Added this for testing purpose +var getPodServiceEnvironmentMapping = func() *ttlcache.Cache[string, entitystore.ServiceEnvironment] { + es := entitystore.GetEntityStore() + if es != nil && es.GetPodServiceEnvironmentMapping() != nil { + return es.GetPodServiceEnvironmentMapping() + } + return ttlcache.New[string, entitystore.ServiceEnvironment]( + ttlcache.WithTTL[string, entitystore.ServiceEnvironment](time.Hour * 1), + ) +} + +func (s *Server) jsonHandler(w http.ResponseWriter, data interface{}) { + w.Header().Set("Content-Type", "application/json") + err := s.jsonMarshaller.NewEncoder(w).Encode(data) + if err != nil { + s.logger.Error("failed to encode data for http response", zap.Error(err)) + } +} + +func convertTtlCacheToMap(cache *ttlcache.Cache[string, entitystore.ServiceEnvironment]) map[string]entitystore.ServiceEnvironment { + m := make(map[string]entitystore.ServiceEnvironment) + for pod, se := range cache.Items() { + m[pod] = se.Value() + } + return m +} diff --git a/extension/server/extension_test.go b/extension/server/extension_test.go new file mode 100644 index 0000000000..02145cf0fa --- /dev/null +++ b/extension/server/extension_test.go @@ -0,0 +1,419 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package server + +import ( + "bytes" + "context" + "crypto/tls" + "encoding/json" + "net/http" + "net/http/httptest" + "testing" + "time" + + "github.com/gin-gonic/gin" + "github.com/jellydator/ttlcache/v3" + "github.com/stretchr/testify/assert" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + + "github.com/aws/amazon-cloudwatch-agent/extension/entitystore" +) + +type mockEntityStore struct { + podToServiceEnvironmentMap *ttlcache.Cache[string, entitystore.ServiceEnvironment] +} + +// This helper function creates a test logger +// so that it can send the log messages into a +// temporary buffer for pattern matching +func CreateTestLogger(buf *bytes.Buffer) *zap.Logger { + writer := zapcore.AddSync(buf) + + // Create a custom zapcore.Core that writes to the buffer + encoder := zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()) + core := zapcore.NewCore(encoder, writer, zapcore.DebugLevel) + logger := zap.New(core) + return logger +} + +func newMockEntityStore() *mockEntityStore { + return &mockEntityStore{ + podToServiceEnvironmentMap: ttlcache.New[string, entitystore.ServiceEnvironment]( + ttlcache.WithTTL[string, entitystore.ServiceEnvironment](time.Hour), + ), + } +} + +func (es *mockEntityStore) AddPodServiceEnvironmentMapping(podName string, service string, env string, serviceSource string) { + es.podToServiceEnvironmentMap.Set(podName, entitystore.ServiceEnvironment{ + ServiceName: service, + Environment: env, + ServiceNameSource: serviceSource, + }, time.Hour) +} + +func (es *mockEntityStore) GetPodServiceEnvironmentMapping() *ttlcache.Cache[string, entitystore.ServiceEnvironment] { + return es.podToServiceEnvironmentMap +} + +func newMockGetPodServiceEnvironmentMapping(es *mockEntityStore) func() *ttlcache.Cache[string, entitystore.ServiceEnvironment] { + return func() *ttlcache.Cache[string, entitystore.ServiceEnvironment] { + return es.podToServiceEnvironmentMap + } +} + +type mockServerConfig struct { + TLSCert string + TLSKey string + TLSAllowedCACerts []string +} + +func newMockTLSConfig(c *mockServerConfig) func() (*tls.Config, error) { + return func() (*tls.Config, error) { + if c.TLSCert == "" && c.TLSKey == "" && len(c.TLSAllowedCACerts) == 0 { + return nil, nil + } + // Mock implementation for testing purposes + return &tls.Config{ + ClientAuth: tls.RequireAndVerifyClientCert, + MinVersion: tls.VersionTLS12, + }, nil + } +} + +func TestNewServer(t *testing.T) { + logger, _ := zap.NewProduction() + tests := []struct { + name string + want *Server + config *Config + isTLS bool + }{ + { + name: "Should load valid HTTPS server", + want: &Server{ + logger: logger, + }, + config: &Config{ + TLSCertPath: "./testdata/example-server-cert.pem", + TLSKeyPath: "./testdata/example-server-key.pem", + TLSCAPath: "./testdata/example-CA-cert.pem", + ListenAddress: ":8080", + }, + isTLS: true, + }, + { + name: "should load server with empty HTTPS server as certs are empty", + want: &Server{ + logger: logger, + }, + config: &Config{ + ListenAddress: ":8080", + }, + isTLS: false, + }, + { + name: "should load server with empty HTTPS server as CA cert is not valid", + want: &Server{ + logger: logger, + }, + config: &Config{ + TLSCertPath: "./testdata/example-server-cert.pem", + TLSKeyPath: "./testdata/example-server-key.pem", + TLSCAPath: "./testdata/bad-CA-cert.pem", + ListenAddress: ":8080", + }, + isTLS: false, + }, + { + name: "should load server with empty HTTPS server as server cert is not valid", + want: &Server{ + logger: logger, + }, + config: &Config{ + TLSCertPath: "./testdata/bad-CA-cert.pem", + TLSKeyPath: "./testdata/example-server-key.pem", + TLSCAPath: "./testdata/example-CA-cert.pem", + ListenAddress: ":8080", + }, + isTLS: false, + }, + { + name: "should load server with empty HTTPS server as server key is empty", + want: &Server{ + logger: logger, + }, + config: &Config{ + TLSCertPath: "./testdata/example-server-cert.pem", + TLSKeyPath: "", + TLSCAPath: "./testdata/example-CA-cert.pem", + ListenAddress: ":8080", + }, + isTLS: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + + server := NewServer(logger, tt.config) + assert.NotNil(t, server) + assert.Equal(t, tt.config, server.config) + assert.NotNil(t, server.logger) + if tt.isTLS { + assert.NotNil(t, server.httpsServer) + assert.Equal(t, ":8080", server.httpsServer.Addr) + assert.NotNil(t, server.httpsServer.TLSConfig) + assert.Equal(t, uint16(tls.VersionTLS12), server.httpsServer.TLSConfig.MinVersion) + assert.Equal(t, tls.RequireAndVerifyClientCert, server.httpsServer.TLSConfig.ClientAuth) + assert.NotNil(t, server.httpsServer.Handler) + assert.Equal(t, 90*time.Second, server.httpsServer.ReadHeaderTimeout) + assert.NotNil(t, server.watcher) + assert.Equal(t, server.watcher.GetTLSConfig(), server.httpsServer.TLSConfig) + } else { + assert.Nil(t, server.httpsServer) + } + }) + } + +} + +func TestK8sPodToServiceMapHandler(t *testing.T) { + logger, _ := zap.NewProduction() + config := &Config{ + ListenAddress: ":8080", + } + tests := []struct { + name string + want *ttlcache.Cache[string, entitystore.ServiceEnvironment] + emptyMap bool + }{ + { + name: "HappyPath", + want: setupTTLCacheForTesting(map[string]entitystore.ServiceEnvironment{ + "pod1": { + ServiceName: "service1", + Environment: "env1", + ServiceNameSource: "source1", + }, + "pod2": { + ServiceName: "service2", + Environment: "env2", + ServiceNameSource: "source2", + }, + }), + }, + { + name: "Empty Map", + want: setupTTLCacheForTesting(map[string]entitystore.ServiceEnvironment{}), + emptyMap: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + server := NewServer(logger, config) + es := newMockEntityStore() + getPodServiceEnvironmentMapping = newMockGetPodServiceEnvironmentMapping(es) + if !tt.emptyMap { + es.AddPodServiceEnvironmentMapping("pod1", "service1", "env1", "source1") + es.AddPodServiceEnvironmentMapping("pod2", "service2", "env2", "source2") + } + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + server.k8sPodToServiceMapHandler(c) + + assert.Equal(t, http.StatusOK, w.Code) + + var actualMap map[string]entitystore.ServiceEnvironment + err := json.Unmarshal(w.Body.Bytes(), &actualMap) + assert.NoError(t, err) + actualTtlCache := setupTTLCacheForTesting(actualMap) + for pod, se := range tt.want.Items() { + assert.Equal(t, se.Value(), actualTtlCache.Get(pod).Value()) + } + assert.Equal(t, tt.want.Len(), actualTtlCache.Len()) + }) + } +} + +func TestJSONHandler(t *testing.T) { + + tests := []struct { + name string + expectedData map[string]string + }{ + { + name: "EmptyData", + expectedData: map[string]string{}, + }, + { + name: "NonEmptyData", + expectedData: map[string]string{ + "key1": "value1", + "key2": "value2", + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + logger, _ := zap.NewProduction() + config := &Config{ + ListenAddress: ":8080", + } + server := NewServer(logger, config) + w := httptest.NewRecorder() + server.jsonHandler(w, tt.expectedData) + assert.Equal(t, http.StatusOK, w.Code) + assert.Equal(t, "application/json", w.Header().Get("Content-Type")) + + var actualData map[string]string + err := json.Unmarshal(w.Body.Bytes(), &actualData) + assert.NoError(t, err) + assert.Equal(t, tt.expectedData, actualData) + }) + } +} + +func TestServerStartAndShutdown(t *testing.T) { + logger, _ := zap.NewProduction() + + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + tests := []struct { + name string + config *Config + }{ + { + name: "HTTPSServer", + config: &Config{ + TLSCertPath: "./testdata/example-server-cert.pem", + TLSKeyPath: "./testdata/example-server-key.pem", + TLSCAPath: "./testdata/example-CA-cert.pem", + ListenAddress: ":8080", + }, + }, + { + name: "EmptyHTTPSServer", + config: &Config{ + TLSCertPath: "./testdata/example-server-cert.pem", + TLSKeyPath: "./testdata/example-server-key.pem", + TLSCAPath: "./testdata/bad-CA-cert.pem", + ListenAddress: ":8080", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + server := NewServer(logger, tt.config) + + err := server.Start(ctx, nil) + assert.NoError(t, err) + + time.Sleep(1 * time.Second) + + err = server.Shutdown(ctx) + assert.NoError(t, err) + }) + } +} + +func TestConvertTtlCacheToMap(t *testing.T) { + podToServiceMap := map[string]entitystore.ServiceEnvironment{ + "pod1": { + ServiceName: "service1", + Environment: "env1", + }, + "pod2": { + ServiceName: "service2", + Environment: "env2", + }, + } + ttlcache := setupTTLCacheForTesting(podToServiceMap) + convertedMap := convertTtlCacheToMap(ttlcache) + assert.Equal(t, convertedMap, podToServiceMap) +} + +func setupTTLCacheForTesting(podToServiceMap map[string]entitystore.ServiceEnvironment) *ttlcache.Cache[string, entitystore.ServiceEnvironment] { + cache := ttlcache.New[string, entitystore.ServiceEnvironment](ttlcache.WithTTL[string, entitystore.ServiceEnvironment](time.Minute)) + for pod, serviceEnv := range podToServiceMap { + cache.Set(pod, serviceEnv, ttlcache.DefaultTTL) + } + return cache +} + +func TestServerNoSensitiveInfoInLogs(t *testing.T) { + // Create a buffer to capture log output + var buf bytes.Buffer + logger := CreateTestLogger(&buf) + + config := &Config{ + TLSCertPath: "./testdata/example-server-cert.pem", + TLSKeyPath: "./testdata/example-server-key.pem", + TLSCAPath: "./testdata/example-CA-cert.pem", + ListenAddress: ":8080", + } + + tests := []struct { + name string + setupMockData func(*mockEntityStore) + }{ + { + name: "EmptyPodServiceMap", + setupMockData: func(es *mockEntityStore) {}, + }, + { + name: "PopulatedPodServiceMap", + setupMockData: func(es *mockEntityStore) { + es.AddPodServiceEnvironmentMapping("pod1", "service1", "env1", "source1") + es.AddPodServiceEnvironmentMapping("pod2", "service2", "env2", "source2") + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Clear the buffer before each test + buf.Reset() + + server := NewServer(logger, config) + es := newMockEntityStore() + tt.setupMockData(es) + getPodServiceEnvironmentMapping = newMockGetPodServiceEnvironmentMapping(es) + + w := httptest.NewRecorder() + c, _ := gin.CreateTestContext(w) + server.k8sPodToServiceMapHandler(c) + + // Check logs for sensitive information + logOutput := buf.String() + assertNoSensitiveInfo(t, logOutput, config, es) + }) + } +} + +func assertNoSensitiveInfo(t *testing.T, logOutput string, config *Config, es *mockEntityStore) { + confidentialInfo := []string{ + "-----BEGIN CERTIFICATE-----", + "-----END CERTIFICATE-----", + "-----BEGIN RSA PRIVATE KEY-----", + "-----END RSA PRIVATE KEY-----", + } + + for _, pattern := range confidentialInfo { + assert.NotContains(t, logOutput, pattern) + } + + // Iterate through the pod service environment mapping + podServiceMap := es.GetPodServiceEnvironmentMapping() + for pod, serviceEnv := range podServiceMap.Items() { + assert.NotContains(t, logOutput, pod) + assert.NotContains(t, logOutput, serviceEnv.Value().ServiceName) + assert.NotContains(t, logOutput, serviceEnv.Value().Environment) + assert.NotContains(t, logOutput, serviceEnv.Value().ServiceNameSource) + } +} diff --git a/extension/server/factory.go b/extension/server/factory.go new file mode 100644 index 0000000000..9699366849 --- /dev/null +++ b/extension/server/factory.go @@ -0,0 +1,32 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package server + +import ( + "context" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/extension" +) + +var ( + TypeStr, _ = component.NewType("server") +) + +func NewFactory() extension.Factory { + return extension.NewFactory( + TypeStr, + createDefaultConfig, + createExtension, + component.StabilityLevelAlpha, + ) +} + +func createDefaultConfig() component.Config { + return &Config{} +} + +func createExtension(_ context.Context, settings extension.CreateSettings, cfg component.Config) (extension.Extension, error) { + return NewServer(settings.Logger, cfg.(*Config)), nil +} diff --git a/extension/server/factory_test.go b/extension/server/factory_test.go new file mode 100644 index 0000000000..0d571fd36e --- /dev/null +++ b/extension/server/factory_test.go @@ -0,0 +1,35 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package server + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/extension/extensiontest" +) + +func TestCreateDefaultConfig(t *testing.T) { + cfg := NewFactory().CreateDefaultConfig() + assert.Equal(t, &Config{}, cfg) + assert.NoError(t, componenttest.CheckConfigStruct(cfg)) +} + +func TestCreateExtension(t *testing.T) { + cfg := &Config{} + got, err := NewFactory().CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + assert.NoError(t, err) + assert.NotNil(t, got) +} + +func TestCreateExtensionWithConfig(t *testing.T) { + cfg := &Config{ListenAddress: ":8080", TLSCertPath: "./testdata/example-server-cert.pem", + TLSKeyPath: "./testdata/example-server-key.pem", + TLSCAPath: "./testdata/example-CA-cert.pem"} + got, err := NewFactory().CreateExtension(context.Background(), extensiontest.NewNopCreateSettings(), cfg) + assert.NoError(t, err) + assert.NotNil(t, got) +} diff --git a/extension/server/testdata/bad-CA-cert.pem b/extension/server/testdata/bad-CA-cert.pem new file mode 100644 index 0000000000..3035f111d4 --- /dev/null +++ b/extension/server/testdata/bad-CA-cert.pem @@ -0,0 +1,3 @@ +-----BEGIN CERTIFICATE----- +bad certificate +-----END CERTIFICATE----- \ No newline at end of file diff --git a/extension/server/testdata/example-CA-cert.pem b/extension/server/testdata/example-CA-cert.pem new file mode 100644 index 0000000000..b5c6f1f7db --- /dev/null +++ b/extension/server/testdata/example-CA-cert.pem @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDMTCCAhkCFCi65dSe1JONpNGghyam61+4gTL7MA0GCSqGSIb3DQEBCwUAMFUx +CzAJBgNVBAYTAkFVMRIwEAYDVQQIDAlBdXN0cmFsaWExDzANBgNVBAcMBlN5ZG5l +eTEQMA4GA1UECgwHTG9nei5pbzEPMA0GA1UEAwwGSmFlZ2VyMB4XDTIyMDkxMDAw +MjE0NFoXDTMyMDkwNzAwMjE0NFowVTELMAkGA1UEBhMCQVUxEjAQBgNVBAgMCUF1 +c3RyYWxpYTEPMA0GA1UEBwwGU3lkbmV5MRAwDgYDVQQKDAdMb2d6LmlvMQ8wDQYD +VQQDDAZKYWVnZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDLlEq/ +DF2pkhfSedvAd5h6BXCjpC/mUA6BN3RyMHUjTWr9hhBtaIYv68O12GMVf//ST/Fs +CjRrjOcqrz2QQn3P8UelGRd2vJfcMhJElQ/lnKmZZlAHEOMF8TC7nQfsReLCwcpj +T6bXqvDcfHjDye+45F2rPDpRGLzyysg7pgdINp0Duph0Z16ggrBgz7RVNBmWsYVe +sGD3VOR3hLd8GTDzJ5amRpkq8nfliJ+U3JLGcDG/7Wkuvl/YZZxf21v9f4yYVEZZ +aLAcKsHIUoFRDJtdrBeaPZRJjL/I9B1M6En+Styxb5wJw42h9BXtJd2IeQPp15pP +KfPbkmOj+X+2s9n1AgMBAAEwDQYJKoZIhvcNAQELBQADggEBAJbm7WXgQirWQbaa +E304K8tvdpC2E1ewxTTrUEN8jUONER4KC+epRnsTgkEpVlj7sehiAgSMnbT4E3ve +GjmsUrZiJcKPaf+ogn49Cj0weD99wbJtUNgbH4HiqR1ePOHIRDQ7GD5G0zdFq7oO +Il09eHAbbWM61x04I3XDQ0OwXyeVXIEWJcR1R6wnuNMJm54czbXvn6SrIuoMCvs6 +oSkVm43Q+plk0hlDZnA/KiOxqFRLVHBuX/SgRf5NBg8m7id3fNzIJnWWK+zqoDoZ +ryja7dFIJnLqEXJxJkc5ubT1/j9PDE51WbM5MyPB6lnuQKdZTbDziyKiVXg0au3E +QK5K/Ow= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/extension/server/testdata/example-server-cert.pem b/extension/server/testdata/example-server-cert.pem new file mode 100644 index 0000000000..41d812c5cf --- /dev/null +++ b/extension/server/testdata/example-server-cert.pem @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDUjCCAjqgAwIBAgIUE56RLVss9rH/ojHQlVqysg6vJQUwDQYJKoZIhvcNAQEL +BQAwVTELMAkGA1UEBhMCQVUxEjAQBgNVBAgMCUF1c3RyYWxpYTEPMA0GA1UEBwwG +U3lkbmV5MRAwDgYDVQQKDAdMb2d6LmlvMQ8wDQYDVQQDDAZKYWVnZXIwHhcNMjIw +OTEwMDAyMTQ0WhcNMzIwOTA3MDAyMTQ0WjBVMQswCQYDVQQGEwJBVTESMBAGA1UE +CAwJQXVzdHJhbGlhMQ8wDQYDVQQHDAZTeWRuZXkxEDAOBgNVBAoMB0xvZ3ouaW8x +DzANBgNVBAMMBkphZWdlcjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AN17nlVlHzFoEDnAA7kvrjzuKiZQZ70znDW5TrqtwXqHr5XG0m7rdQlt9xyr3HFg +DbXbkg7wBidqUySWZ7N/cxiqB/oMnfbntapwmBP77Ss8KLLQx17Geb8pryIHrhcE +a/E556epv3WRkoz3j8ph3DY7g+ghQWNtWI3UvBdaIkmPaS+wVfH6hwzpT4rbdVSF +1n7SnMcJccKPEPgqASiEsYZeQgnZUedayKzHRnJeQD3lOPXLHAOIGHajGvyQFMqE +fG9dJfWNVxH/+GxMNul9jsUfJMc99mG/vy3B1WROOl2EiTi8FzfM64lo8SvEs3Db +jcAFItI7BcyM/MJxqYtYFQ0CAwEAAaMaMBgwFgYDVR0RBA8wDYILZXhhbXBsZS5j +b20wDQYJKoZIhvcNAQELBQADggEBAFjZrgLJiezjX2enrh1pJDRrj9NClTKM8Vck +dnpI4OFmViqSyUkyY28PO9omoXUPAbcVuXcGQ/f4PR7tlKmv1lGH/4vGGgmvLjus +Mm0vYZoBos/KPN92RIUkpO1Lvt3es96CFI0k6G0JmstXn4EShQibm1424jTWU3tF +praOAsaTVWO/ukVPbULJ8dWzKoQVTyb/cNQiPiL0IXx7XYc/cqCB2yqzELtMOmIe +kQuyCmUNzK1qQaezxwkMl2P+121QdOvKkxcu7XlAEo0SRNNNkpOkyRqLvC2iou39 +SHxqc/Vbf+Pj9N6oC0twI7KAJELHMi9qhlQsNssxUMjYe7BRYmQ= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/extension/server/testdata/example-server-key.pem b/extension/server/testdata/example-server-key.pem new file mode 100644 index 0000000000..403be1e535 --- /dev/null +++ b/extension/server/testdata/example-server-key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEA3XueVWUfMWgQOcADuS+uPO4qJlBnvTOcNblOuq3BeoevlcbS +but1CW33HKvccWANtduSDvAGJ2pTJJZns39zGKoH+gyd9ue1qnCYE/vtKzwostDH +XsZ5vymvIgeuFwRr8Tnnp6m/dZGSjPePymHcNjuD6CFBY21YjdS8F1oiSY9pL7BV +8fqHDOlPitt1VIXWftKcxwlxwo8Q+CoBKISxhl5CCdlR51rIrMdGcl5APeU49csc +A4gYdqMa/JAUyoR8b10l9Y1XEf/4bEw26X2OxR8kxz32Yb+/LcHVZE46XYSJOLwX +N8zriWjxK8SzcNuNwAUi0jsFzIz8wnGpi1gVDQIDAQABAoIBAQCAE55J74IMRgsr ++hetHR966JbDNTfoN1Ib1x7p4NTDkHc++4xwzAQQAeEmWVPO1CbZhTF/JdnJLTkL +LVamfAsItjqKpIUsZG2vNBEdbU+G8vDuBsFj0w5QN0CpQxuu/8WT51JIqGapDBdd +IUOrWs/HJL9wmtp/LppI2j4ymtK9Cffce8AVTazfHspVF2e05b8GEeBjoMmvpPgw +bvHPLdCVoWPGsYOFUWG9V1eCo2CFtvspsa8CYghpaXg7EOElF73W1gEoEd5SdMx9 +svHeH4bJAzrWoqDrC5kOJUZRip9YjF8WXRudVmSaRPHptwN6qRvF8HWiGrYrdTtJ +j1seb87BAoGBAPUrxCI64EN/6YYNziM49RpORLVrZGLaZQCf0IJkoH3DcsBcrtF8 +hqJC73z75kj1Y+oOzulYPBlhQr+4hvbMSzHwsffi5nepPXSSGK2+D1O5rASou7b3 +Re/OiJNex7IrDAy354PV4B/7iFmgGOVUn+sXIKoprqnor7f3mALAa/yZAoGBAOdE +AMKktCQYIHweKPF0mYDsOnoJ8TEAydxShOan5r5gkVTnZhDHa3fD9eGh19Mfi9qC +cDro5Sq1+8OLoX6Ta/Ju3PNfI2Qn4KLF9CZrEQhrV90HmXluCflZXyL71SB8pGVo +5ybr8UtalUXVPXKi+inK7CXaJBZaboJWnqmaqJCVAoGAdIX0lgA9jldA+gGds4fi +ljoU1dTQxVrfHkjWpOKGlL9Lzrk+LTpuEriVcmWWsZ5PenLHTIgvKDDdtJlTLAE0 +y+uF6jbhKoY5OyokqI7oYfahFyXK8c7cYnla2A/4AWoMNA9D7Zi9CPZXe6Fns7dg +ui8nyzg8V2zL9zep+8TQjiECgYEAm2zTif0BaGSiqGfoomX3qHKa1lwKMiHSiHUZ +Bp9+7yGdas9dhBdSPZqAjJSlpSlFZ6RUYvMU2UCXJJOaBKR1XuhtLE8bTPuT+DFL +5en894iU82JhHf/7Sg5rZuqTERNTtSfsefcGItuNCPLIKlwn/qB3VvUlXbSHIqeu +WFQtx4UCgYEA1FIVEc4BjRE6jH80X7RSSOLJ6PwPglZzM8JEVyiYHAHE65zdORF1 +iCiuI+pRQc3yHkm2gbB+hY5HSrCmyJrJc0tcUd4QoMqOHV8UEGLVwxtr/4DPMsl4 +JIEmzmgvs56TJeKX0YlXnD612zjDWCPV6q+LWlUUzd8qLwk6L1+EFhE= +-----END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/go.mod b/go.mod index 28190ec8c7..5d52962fa3 100644 --- a/go.mod +++ b/go.mod @@ -96,15 +96,20 @@ require ( github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.30.2 github.com/bigkevmcd/go-configparser v0.0.0-20200217161103-d137835d2579 github.com/deckarep/golang-set/v2 v2.3.1 + github.com/fsnotify/fsnotify v1.7.0 + github.com/gin-gonic/gin v1.10.0 github.com/go-kit/log v0.2.1 + github.com/go-playground/validator/v10 v10.20.0 github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31 github.com/gobwas/glob v0.2.3 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 + github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd // indirect github.com/hashicorp/golang-lru v1.0.2 github.com/influxdata/telegraf v0.0.0-00010101000000-000000000000 github.com/influxdata/wlog v0.0.0-20160411224016-7c63b0a71ef8 github.com/jellydator/ttlcache/v3 v3.2.0 + github.com/json-iterator/go v1.1.12 github.com/kardianos/service v1.2.1 // Keep this pinned to v1.2.1. v1.2.2 causes the agent to not register as a service on Windows github.com/knadh/koanf v1.5.0 github.com/knadh/koanf/v2 v2.1.1 @@ -169,6 +174,7 @@ require ( go.opentelemetry.io/collector/consumer v0.103.0 go.opentelemetry.io/collector/exporter v0.103.0 go.opentelemetry.io/collector/exporter/debugexporter v0.103.0 + go.opentelemetry.io/collector/exporter/nopexporter v0.103.0 go.opentelemetry.io/collector/extension v0.103.0 go.opentelemetry.io/collector/extension/ballastextension v0.103.0 go.opentelemetry.io/collector/extension/zpagesextension v0.103.0 @@ -178,6 +184,7 @@ require ( go.opentelemetry.io/collector/processor/batchprocessor v0.103.0 go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.103.0 go.opentelemetry.io/collector/receiver v0.103.0 + go.opentelemetry.io/collector/receiver/nopreceiver v0.103.0 go.opentelemetry.io/collector/receiver/otlpreceiver v0.103.0 go.opentelemetry.io/collector/semconv v0.103.0 go.opentelemetry.io/collector/service v0.103.0 @@ -247,11 +254,15 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect + github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect github.com/caio/go-tdigest v3.1.0+incompatible // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/checkpoint-restore/go-criu/v5 v5.3.0 // indirect github.com/cilium/ebpf v0.11.0 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b // indirect github.com/containerd/cgroups/v3 v3.0.3 // indirect github.com/containerd/console v1.0.3 // indirect @@ -279,7 +290,8 @@ require ( github.com/expr-lang/expr v1.16.9 // indirect github.com/fatih/color v1.16.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -287,9 +299,12 @@ require ( github.com/go-openapi/jsonpointer v0.20.2 // indirect github.com/go-openapi/jsonreference v0.20.4 // indirect github.com/go-openapi/swag v0.22.9 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-resty/resty/v2 v2.12.0 // indirect github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect github.com/go-zookeeper/zk v1.0.3 // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -309,7 +324,6 @@ require ( github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/gosnmp/gosnmp v1.34.0 // indirect - github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/hashicorp/consul/api v1.29.1 // indirect github.com/hashicorp/cronexpr v1.1.2 // indirect @@ -342,13 +356,14 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/jpillora/backoff v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect github.com/karrick/godirwalk v1.17.0 // indirect github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b // indirect github.com/kr/text v0.2.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/leodido/go-syslog/v4 v4.1.0 // indirect + github.com/leodido/go-urn v1.4.0 // indirect github.com/leodido/ragel-machinery v0.0.0-20190525184631-5f46317e436b // indirect github.com/lightstep/go-expohisto v1.0.0 // indirect github.com/linode/linodego v1.33.0 // indirect @@ -407,6 +422,7 @@ require ( github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect github.com/openzipkin/zipkin-go v0.4.3 // indirect github.com/ovh/go-ovh v1.4.3 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/philhofer/fwd v1.1.1 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect @@ -438,6 +454,8 @@ require ( github.com/tinylib/msgp v1.1.6 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect github.com/valyala/fastjson v1.6.4 // indirect github.com/vishvananda/netlink v1.2.1-beta.2 // indirect github.com/vishvananda/netns v0.0.4 // indirect @@ -486,6 +504,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect go.opentelemetry.io/otel/trace v1.27.0 // indirect go.opentelemetry.io/proto/otlp v1.2.0 // indirect + golang.org/x/arch v0.8.0 // indirect golang.org/x/crypto v0.25.0 // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect diff --git a/go.sum b/go.sum index 740e1054e9..161054897d 100644 --- a/go.sum +++ b/go.sum @@ -348,6 +348,10 @@ github.com/bmatcuk/doublestar/v3 v3.0.0 h1:TQtVPlDnAYwcrVNB2JiGuMc++H5qzWZd9PhkN github.com/bmatcuk/doublestar/v3 v3.0.0/go.mod h1:6PcTVMw80pCY1RVuoqu3V++99uQB3vsSYKPTd8AWA0k= github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= +github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= +github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/caio/go-tdigest v3.1.0+incompatible h1:uoVMJ3Q5lXmVLCCqaMGHLBWnbGoN6Lpu7OAUPR60cds= github.com/caio/go-tdigest v3.1.0+incompatible/go.mod h1:sHQM/ubZStBUmF1WbB8FAm8q9GjDajLC5T7ydxE3JHI= github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= @@ -377,6 +381,10 @@ github.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5P github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg= github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -513,11 +521,15 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= -github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew= github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= +github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= github.com/go-asn1-ber/asn1-ber v1.5.1 h1:pDbRAunXzIUXfx4CB2QJFv5IuPiuoW+sWvr/Us009o8= github.com/go-asn1-ber/asn1-ber v1.5.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -564,6 +576,14 @@ github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZC github.com/go-openapi/swag v0.22.9/go.mod h1:3/OXnFfnMAwBD099SwYRk7GD3xOrr1iL7d/XNLXVVwE= github.com/go-ping/ping v0.0.0-20210201095549-52eed920f98c h1:fWdhUpCuoeNIPiQ+pkAmmERYEjhVx5/cbVGK7T99OkI= github.com/go-ping/ping v0.0.0-20210201095549-52eed920f98c/go.mod h1:35JbSyV/BYqHwwRA6Zr1uVDm1637YlNOU61wI797NPI= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-resty/resty/v2 v2.12.0 h1:rsVL8P90LFvkUYq/V5BTVe203WfRIU4gvcf+yfzJzGA= @@ -937,12 +957,14 @@ github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j github.com/klauspost/compress v1.14.4/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/knadh/koanf v1.5.0 h1:q2TSd/3Pyc/5yP9ldIrSdIz26MCcyNQzW0pEAugLPNs= github.com/knadh/koanf v1.5.0/go.mod h1:Hgyjp4y8v44hpZtPzs7JZfRAW5AhN7KfZcwv1RYggDs= github.com/knadh/koanf/v2 v2.1.1 h1:/R8eXqasSTsmDCsAyYj+81Wteg8AqrV9CP6gvsTsOmM= github.com/knadh/koanf/v2 v2.1.1/go.mod h1:4mnTRbZCK+ALuBXHZMjDfG9y714L7TykVnZkXbMU3Es= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b h1:udzkj9S/zlT5X367kqJis0QP7YMxobob6zhzq6Yre00= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -964,6 +986,8 @@ github.com/leesper/go_rng v0.0.0-20190531154944-a612b043e353 h1:X/79QL0b4YJVO5+O github.com/leesper/go_rng v0.0.0-20190531154944-a612b043e353/go.mod h1:N0SVk0uhy+E1PZ3C9ctsPRlvOPAFPkCNlcPBDkt0N3U= github.com/leodido/go-syslog/v4 v4.1.0 h1:Wsl194qyWXr7V6DrGWC3xmxA9Ra6XgWO+toNt2fmCaI= github.com/leodido/go-syslog/v4 v4.1.0/go.mod h1:eJ8rUfDN5OS6dOkCOBYlg2a+hbAg6pJa99QXXgMrd98= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/leodido/ragel-machinery v0.0.0-20190525184631-5f46317e436b h1:11UHH39z1RhZ5dc4y4r/4koJo6IYFgTRMe/LlwRTEw0= github.com/leodido/ragel-machinery v0.0.0-20190525184631-5f46317e436b/go.mod h1:WZxr2/6a/Ar9bMDc2rN/LJrE/hF6bXE4LPyDSIxwAfg= github.com/lightstep/go-expohisto v1.0.0 h1:UPtTS1rGdtehbbAF7o/dhkWLTDI73UifG8LbfQI7cA4= @@ -1258,7 +1282,6 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= -github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/performancecopilot/speed/v4 v4.0.0/go.mod h1:qxrSyuDGrTOWfV+uKRFhfxw6h/4HXRGUiZiufxo49BM= @@ -1432,6 +1455,7 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -1459,8 +1483,12 @@ github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hM github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/twmb/murmur3 v1.1.7 h1:ULWBiM04n/XoN3YMSJ6Z2pHDFLf+MeIVQU71ZPrvbWg= github.com/twmb/murmur3 v1.1.7/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ= github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/vapourismo/knx-go v0.0.0-20211128234507-8198fa17db36 h1:JBj2CqnFwBhI3XsdMNn9MjKvehog+p5QZihotqq0Zuo= @@ -1579,6 +1607,8 @@ go.opentelemetry.io/collector/exporter v0.103.0 h1:g0nF/FAwuA7tTJf5uo1PvlQl7xFqC go.opentelemetry.io/collector/exporter v0.103.0/go.mod h1:PC2OvciPEew2kaA/ZMyxRqfeOW8Wgi0CYR614PEyS/w= go.opentelemetry.io/collector/exporter/debugexporter v0.103.0 h1:jwZHoXvp3vdQ3obtnU+Vav5ChTCUBSC6mvlOZJ8doCU= go.opentelemetry.io/collector/exporter/debugexporter v0.103.0/go.mod h1:kzmBnKxsLNVBRGS8nwu497SvHspzyeiV06+LiPHktto= +go.opentelemetry.io/collector/exporter/nopexporter v0.103.0 h1:QaxkFbHSSYj2RRgkIhB6lDjJHFSGr71WlLk46fG0mAo= +go.opentelemetry.io/collector/exporter/nopexporter v0.103.0/go.mod h1:/wopRTmGS20A2Ihxcuj8M4j4VWMG6AFwmrt0eT6rDNg= go.opentelemetry.io/collector/extension v0.103.0 h1:vTsd+GElvT7qKk9Y9d6UKuuT2Ngx0mai8Q48hkKQMwM= go.opentelemetry.io/collector/extension v0.103.0/go.mod h1:rp2l3xskNKWv0yBCyU69Pv34TnP1QVD1ijr0zSndnsM= go.opentelemetry.io/collector/extension/auth v0.103.0 h1:i7cQl+Ewpve/DIN4rFMg1GiyUPE14LZsYWrJ1RqtP84= @@ -1605,6 +1635,8 @@ go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.103.0 h1:ZwPUL go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.103.0/go.mod h1:BvAZflYYV3/FoHjVDKYfeyx5/bIqJDaeAaf/JtDmc8w= go.opentelemetry.io/collector/receiver v0.103.0 h1:V3JBKkX+7e/NYpDDZVyeu2VQB1/lLFuoJFPfupdCcZs= go.opentelemetry.io/collector/receiver v0.103.0/go.mod h1:Yybv4ynKFdMOYViWWPMmjkugR89FSQN0P37wP6mX6qM= +go.opentelemetry.io/collector/receiver/nopreceiver v0.103.0 h1:GgeYAKOaHWDm+8JVN63y/0elp1uTOF+XqDQfXWm2i1A= +go.opentelemetry.io/collector/receiver/nopreceiver v0.103.0/go.mod h1:Hwoaia7m3+5qVtZyXb5/qSlFFfDP0Wd0F/2yKC/LFiw= go.opentelemetry.io/collector/receiver/otlpreceiver v0.103.0 h1:TycVVl4AWioV6kWeFcCIk2QuKfXOzn88yw989opsMdE= go.opentelemetry.io/collector/receiver/otlpreceiver v0.103.0/go.mod h1:jAbzL5lwOGG93YbcPZ6aFZIZq+tjYQ+BS3vKKT2nRgw= go.opentelemetry.io/collector/semconv v0.103.0 h1:5tlVoZlo9USHAU2Bz4YrEste0Vm5AMufXkYJhAVve1Q= @@ -1667,6 +1699,9 @@ go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= +golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -2198,6 +2233,7 @@ modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/internal/ec2metadataprovider/ec2metadataprovider.go b/internal/ec2metadataprovider/ec2metadataprovider.go new file mode 100644 index 0000000000..48203aef1f --- /dev/null +++ b/internal/ec2metadataprovider/ec2metadataprovider.go @@ -0,0 +1,103 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package ec2metadataprovider + +import ( + "context" + "log" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/ec2metadata" + + configaws "github.com/aws/amazon-cloudwatch-agent/cfg/aws" + "github.com/aws/amazon-cloudwatch-agent/extension/agenthealth/handler/stats/agent" + "github.com/aws/amazon-cloudwatch-agent/internal/retryer" +) + +type MetadataProvider interface { + Get(ctx context.Context) (ec2metadata.EC2InstanceIdentityDocument, error) + Hostname(ctx context.Context) (string, error) + InstanceID(ctx context.Context) (string, error) + InstanceProfileIAMRole() (string, error) + InstanceTags(ctx context.Context) (string, error) + InstanceTagValue(ctx context.Context, tagKey string) (string, error) +} + +type metadataClient struct { + metadataFallbackDisabled *ec2metadata.EC2Metadata + metadataFallbackEnabled *ec2metadata.EC2Metadata +} + +var _ MetadataProvider = (*metadataClient)(nil) + +func NewMetadataProvider(p client.ConfigProvider, retries int) MetadataProvider { + disableFallbackConfig := &aws.Config{ + LogLevel: configaws.SDKLogLevel(), + Logger: configaws.SDKLogger{}, + Retryer: retryer.NewIMDSRetryer(retries), + EC2MetadataEnableFallback: aws.Bool(false), + } + enableFallbackConfig := &aws.Config{ + LogLevel: configaws.SDKLogLevel(), + Logger: configaws.SDKLogger{}, + } + return &metadataClient{ + metadataFallbackDisabled: ec2metadata.New(p, disableFallbackConfig), + metadataFallbackEnabled: ec2metadata.New(p, enableFallbackConfig), + } +} + +func (c *metadataClient) InstanceID(ctx context.Context) (string, error) { + return withMetadataFallbackRetry(ctx, c, func(metadataClient *ec2metadata.EC2Metadata) (string, error) { + return metadataClient.GetMetadataWithContext(ctx, "instance-id") + }) +} + +func (c *metadataClient) Hostname(ctx context.Context) (string, error) { + return withMetadataFallbackRetry(ctx, c, func(metadataClient *ec2metadata.EC2Metadata) (string, error) { + return metadataClient.GetMetadataWithContext(ctx, "hostname") + }) +} + +func (c *metadataClient) InstanceProfileIAMRole() (string, error) { + return withMetadataFallbackRetry(context.Background(), c, func(metadataClient *ec2metadata.EC2Metadata) (string, error) { + iamInfo, err := metadataClient.IAMInfo() + if err != nil { + return "", err + } + return iamInfo.InstanceProfileArn, nil + }) +} + +func (c *metadataClient) InstanceTags(ctx context.Context) (string, error) { + return withMetadataFallbackRetry(ctx, c, func(metadataClient *ec2metadata.EC2Metadata) (string, error) { + return metadataClient.GetMetadataWithContext(ctx, "tags/instance") + }) +} + +func (c *metadataClient) InstanceTagValue(ctx context.Context, tagKey string) (string, error) { + path := "tags/instance/" + tagKey + return withMetadataFallbackRetry(ctx, c, func(metadataClient *ec2metadata.EC2Metadata) (string, error) { + return metadataClient.GetMetadataWithContext(ctx, path) + }) +} + +func (c *metadataClient) Get(ctx context.Context) (ec2metadata.EC2InstanceIdentityDocument, error) { + return withMetadataFallbackRetry(ctx, c, func(metadataClient *ec2metadata.EC2Metadata) (ec2metadata.EC2InstanceIdentityDocument, error) { + return metadataClient.GetInstanceIdentityDocumentWithContext(ctx) + }) +} + +func withMetadataFallbackRetry[T any](ctx context.Context, c *metadataClient, operation func(*ec2metadata.EC2Metadata) (T, error)) (T, error) { + result, err := operation(c.metadataFallbackDisabled) + if err != nil { + log.Printf("D! could not perform operation without imds v1 fallback enable thus enable fallback") + result, err = operation(c.metadataFallbackEnabled) + if err == nil { + agent.UsageFlags().Set(agent.FlagIMDSFallbackSuccess) + } + } + return result, err +} diff --git a/plugins/processors/ec2tagger/ec2metadataprovider_test.go b/internal/ec2metadataprovider/ec2metadataprovider_test.go similarity index 98% rename from plugins/processors/ec2tagger/ec2metadataprovider_test.go rename to internal/ec2metadataprovider/ec2metadataprovider_test.go index 619b7d18e4..5252ce6c1d 100644 --- a/plugins/processors/ec2tagger/ec2metadataprovider_test.go +++ b/internal/ec2metadataprovider/ec2metadataprovider_test.go @@ -1,7 +1,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: MIT -package ec2tagger +package ec2metadataprovider import ( "context" diff --git a/internal/tls/certWatcher.go b/internal/tls/certWatcher.go new file mode 100644 index 0000000000..1016917811 --- /dev/null +++ b/internal/tls/certWatcher.go @@ -0,0 +1,195 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package tls + +import ( + "context" + "crypto/tls" + "errors" + "sync" + "time" + + "github.com/fsnotify/fsnotify" + "go.uber.org/zap" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/wait" +) + +// CertWatcher watches certificate and key files for changes. When either file +// changes, it reads and parses both and calls an optional callback with the new +// certificate. +type CertWatcher struct { + sync.RWMutex + + watcher *fsnotify.Watcher + logger *zap.Logger + currentTLSConfig *tls.Config + + certPath string + keyPath string + caPath string + + // callback is a function to be invoked when the certificate changes. + callback func() +} + +var NewCertWatcherFunc = NewCertWatcher + +// NewCertWatcher returns a new CertWatcher watching the given server certificate and client certificate. +func NewCertWatcher(certPath, keyPath, caPath string, logger *zap.Logger) (*CertWatcher, error) { + if certPath == "" || keyPath == "" || caPath == "" { + return nil, errors.New("cert, key, and ca paths are required") + } + var err error + + cw := &CertWatcher{ + certPath: certPath, + keyPath: keyPath, + caPath: caPath, + logger: logger, + } + + cw.logger.Debug("Creating new certificate watcher with", zap.String("cert", certPath), zap.String("key", keyPath), zap.String("ca", caPath)) + + // Initial read of certificate and key. + if err := cw.ReadTlsConfig(); err != nil { + return nil, err + } + + cw.watcher, err = fsnotify.NewWatcher() + if err != nil { + return nil, err + } + + return cw, nil +} + +// RegisterCallback registers a callback to be invoked when the certificate changes. +func (cw *CertWatcher) RegisterCallback(callback func()) { + cw.callback = callback +} + +// GetTLSConfig fetches the currently loaded tls Config, which may be nil. +func (cw *CertWatcher) GetTLSConfig() *tls.Config { + cw.RLock() + defer cw.RUnlock() + return cw.currentTLSConfig +} + +func (cw *CertWatcher) ReadTlsConfig() error { + cw.logger.Debug("Reading TLS certificate") + serverConfig := &ServerConfig{ + TLSCert: cw.certPath, + TLSKey: cw.keyPath, + TLSAllowedCACerts: []string{cw.caPath}, + } + tlsConfig, err := serverConfig.TLSConfig() + if err != nil { + cw.logger.Error("failed to read certificate", zap.Error(err)) + return err + } + + if tlsConfig != cw.currentTLSConfig { + cw.logger.Debug("TLS certificate changed") + cw.Lock() + cw.currentTLSConfig = tlsConfig + cw.Unlock() + + // If a callback is registered, invoke it with the new certificate. + if cw.callback != nil { + go func() { + cw.logger.Debug("Invoking callback") + cw.callback() + }() + } + } + return nil +} + +// Start starts the watch on the certificate and key files. +func (cw *CertWatcher) Start(ctx context.Context) error { + cw.logger.Debug("Starting certificate watcher") + files := sets.New(cw.certPath, cw.keyPath, cw.caPath) + { + var watchErr error + if err := wait.PollUntilContextTimeout(ctx, 1*time.Second, 10*time.Second, true, func(ctx context.Context) (done bool, err error) { + for f := range files { + if err := cw.watcher.Add(f); err != nil { + watchErr = err + return false, nil //nolint:nilerr // We want to keep trying. + } + } + files.Clear() + return true, nil + }); err != nil { + cw.logger.Error("failed to add watches", zap.Error(err), zap.Error(watchErr)) + return errors.Join(err, watchErr) + } + } + + go cw.Watch() + + cw.logger.Debug("Successfully started certificate watcher") + + // Block until the context is done. + <-ctx.Done() + + return cw.watcher.Close() +} + +// Watch reads events from the watcher's channel and reacts to changes. +func (cw *CertWatcher) Watch() { + for { + select { + case event, ok := <-cw.watcher.Events: + // Channel is closed. + if !ok { + return + } + + cw.handleEvent(event) + + case err, ok := <-cw.watcher.Errors: + // Channel is closed. + if !ok { + return + } + + cw.logger.Error("certificate watch error", zap.Error(err)) + } + + } +} + +func (cw *CertWatcher) handleEvent(event fsnotify.Event) { + // Only care about events which may modify the contents of the file. + if !(isWrite(event) || isRemove(event) || isCreate(event)) { + return + } + + cw.logger.Debug("certificate event", zap.Any("event", event)) + + // If the file was removed, re-add the watch. + if isRemove(event) { + if err := cw.watcher.Add(event.Name); err != nil { + cw.logger.Error("error re-watching file", zap.Error(err)) + } + } + + if err := cw.ReadTlsConfig(); err != nil { + cw.logger.Error("failed to re-read certificate", zap.Error(err)) + } +} + +func isWrite(event fsnotify.Event) bool { + return event.Op.Has(fsnotify.Write) +} + +func isCreate(event fsnotify.Event) bool { + return event.Op.Has(fsnotify.Create) +} + +func isRemove(event fsnotify.Event) bool { + return event.Op.Has(fsnotify.Remove) +} diff --git a/internal/tls/certWatcher_test.go b/internal/tls/certWatcher_test.go new file mode 100644 index 0000000000..eb527324c1 --- /dev/null +++ b/internal/tls/certWatcher_test.go @@ -0,0 +1,239 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package tls + +import ( + "context" + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "math/big" + "net" + "os" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "go.uber.org/zap/zaptest" +) + +const ( + // Set up paths for test certificates + testCertPath = "./testdata/server.crt" + testKeyPath = "./testdata/server.key" + testCAPath = "./testdata/tls-ca.crt" +) + +func createRootCert(caPath string) (*x509.Certificate, *rsa.PrivateKey, error) { + rootKey, err := rsa.GenerateKey(rand.Reader, 4096) + if err != nil { + return nil, nil, err + } + + rootTemplate := x509.Certificate{ + SerialNumber: big.NewInt(1), + Subject: pkix.Name{ + Organization: []string{"Root CA"}, + }, + NotBefore: time.Now(), + NotAfter: time.Now().AddDate(10, 0, 0), // Valid for 10 years + KeyUsage: x509.KeyUsageCertSign | x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + IsCA: true, + } + + rootCertDER, err := x509.CreateCertificate(rand.Reader, &rootTemplate, &rootTemplate, &rootKey.PublicKey, rootKey) + if err != nil { + return nil, nil, err + } + + rootCert, err := x509.ParseCertificate(rootCertDER) + if err != nil { + return nil, nil, err + } + + // Write the root certificate + rootCertOut, err := os.Create(caPath) + if err != nil { + return nil, nil, err + } + defer rootCertOut.Close() + if err := pem.Encode(rootCertOut, &pem.Block{Type: "CERTIFICATE", Bytes: rootCertDER}); err != nil { + return nil, nil, err + } + + return rootCert, rootKey, nil +} + +func writeCerts(certPath, keyPath, caPath, ip string) error { + // Generate root certificate + rootCert, rootKey, err := createRootCert(caPath) + if err != nil { + return err + } + + // Generate key for the actual certificate + priv, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + return err + } + + notBefore := time.Now() + notAfter := notBefore.Add(1 * time.Hour) + + serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) + serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) + if err != nil { + return err + } + + template := x509.Certificate{ + SerialNumber: serialNumber, + Subject: pkix.Name{ + Organization: []string{"Kubernetes"}, + }, + NotBefore: notBefore, + NotAfter: notAfter, + KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageKeyEncipherment, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + } + + template.IPAddresses = append(template.IPAddresses, net.ParseIP(ip)) + + // Create the certificate using the root certificate as the CA + derBytes, err := x509.CreateCertificate(rand.Reader, &template, rootCert, &priv.PublicKey, rootKey) + if err != nil { + return err + } + + // Write the certificate + certOut, err := os.Create(certPath) + if err != nil { + return err + } + defer certOut.Close() + if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil { + return err + } + + // Write the private key + keyOut, err := os.OpenFile(keyPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) + if err != nil { + return err + } + defer keyOut.Close() + privBytes, err := x509.MarshalPKCS8PrivateKey(priv) + if err != nil { + return err + } + if err := pem.Encode(keyOut, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}); err != nil { + return err + } + + return nil +} + +func TestMain(m *testing.M) { + // Setup + err := Init() + if err != nil { + panic(err) + } + + // Run tests + code := m.Run() + + // Teardown (if needed) + // You can add cleanup code here + + // Exit with the test result code + os.Exit(code) +} + +func Init() error { + + // Generate test certificates + err := writeCerts(testCertPath, testKeyPath, testCAPath, "127.0.0.1") + if err != nil { + return err + } + + return nil +} + +func TestNewCertWatcher(t *testing.T) { + // Setup + logger := zaptest.NewLogger(t) + + // Test case: Create a new CertWatcher + cw, err := NewCertWatcher(testCertPath, testKeyPath, testCAPath, logger) + assert.NoError(t, err, "Failed to create CertWatcher") + + // Check if the initial TLS config was loaded correctly + assert.NotNil(t, cw.GetTLSConfig(), "TLS config was not loaded correctly") +} + +func TestRegisterCallback(t *testing.T) { + // Setup + logger := zaptest.NewLogger(t) + + cw, err := NewCertWatcher(testCertPath, testKeyPath, testCAPath, logger) + assert.NoError(t, err, "Failed to create CertWatcher") + + // Test case: Register a callback + callbackCalled := false + callback := func() { + callbackCalled = true + } + cw.RegisterCallback(callback) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + go func() { + err := cw.Start(ctx) + assert.NoError(t, err, "Failed to start CertWatcher") + }() + + // Trigger a certificate change event + _, _, err = createRootCert(testCAPath) + assert.NoError(t, err, "Failed to update root certificate") + + // Wait for the callback to be called + time.Sleep(1 * time.Second) + + assert.True(t, callbackCalled) +} + +func TestWatchCertificateChanges(t *testing.T) { + // Setup + logger := zaptest.NewLogger(t) + + cw, err := NewCertWatcher(testCertPath, testKeyPath, testCAPath, logger) + assert.NoError(t, err, "Failed to create CertWatcher") + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + go func() { + err := cw.Start(ctx) + assert.NoError(t, err, "Failed to start CertWatcher") + }() + + beforeTLSConfig := cw.GetTLSConfig() + + // Trigger a certificate change event + _, _, err = createRootCert(testCAPath) + assert.NoError(t, err, "Failed to update root certificate") + + // Wait for the certificate change to be processed + time.Sleep(2 * time.Second) + + // Check if the TLS config was updated + assert.True(t, beforeTLSConfig != cw.GetTLSConfig(), "TLS config was not updated after certificate change") +} diff --git a/internal/tls/config.go b/internal/tls/config.go index 8d4247c0a4..627d75c3f4 100644 --- a/internal/tls/config.go +++ b/internal/tls/config.go @@ -91,6 +91,7 @@ func (c *ServerConfig) TLSConfig() (*tls.Config, error) { } tlsConfig.ClientCAs = pool tlsConfig.ClientAuth = tls.RequireAndVerifyClientCert + tlsConfig.MinVersion = tls.VersionTLS12 } if c.TLSCert != "" && c.TLSKey != "" { diff --git a/internal/tls/testdata/bad-CA-cert.pem b/internal/tls/testdata/bad-CA-cert.pem new file mode 100644 index 0000000000..3035f111d4 --- /dev/null +++ b/internal/tls/testdata/bad-CA-cert.pem @@ -0,0 +1,3 @@ +-----BEGIN CERTIFICATE----- +bad certificate +-----END CERTIFICATE----- \ No newline at end of file diff --git a/internal/tls/testdata/server.crt b/internal/tls/testdata/server.crt new file mode 100644 index 0000000000..12424f7b27 --- /dev/null +++ b/internal/tls/testdata/server.crt @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEGDCCAgCgAwIBAgIQDfInHXLoKYcZoMZe0q/N9TANBgkqhkiG9w0BAQsFADAS +MRAwDgYDVQQKEwdSb290IENBMB4XDTI0MTAyMjIyMzYzNloXDTI0MTAyMjIzMzYz +NlowFTETMBEGA1UEChMKS3ViZXJuZXRlczCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAP3MeHLv7sragkzD8iOj75YCJvOoys4Iy+EVwZhLAdtx+K89IOJr +6EKknoI0/FZowg5xuz4sE3sK8uQVAjtN0u4Mu6oQm94uSB5RxGvkBV6vn+3JxUdC ++fj+KiTg0x+pEoDxVXSrL3gF2ZtvfNdC05+FCk39pdEPe5tbnh+IPtcXSqWmtWEB +LiHPhSU0HN5JWsfQZ2VkB8rFStQ8CwFG0DW9i6GSVsN1zmmzLQdVPAyP4Uzy8844 +/ceZsmlkIe6uk3BiRRNThUcJKlFJJroCBJ8y7AJA8s3teLWskRLik+0xintked6z +fMaQRgzOSPDc062QTODHB2IkShVZAeLh7OcCAwEAAaNnMGUwDgYDVR0PAQH/BAQD +AgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMBMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgw +FoAUhscCtqKglSlRCx9YNN1D/Xz5MpMwDwYDVR0RBAgwBocEfwAAATANBgkqhkiG +9w0BAQsFAAOCAgEAcxCGmWNtuM9V2yi0SOSLfxlSK7F1OS5qQuLWkZSDB1f+XG82 +PNDwSrV4J42qZcFfKrEt1HtS/Ws6VRlLrSnYArNSyQvNTeNf0q/rX9yO8wRcCM5K +sb8uv27xdawjN6F3z59rpJOf9ldX4ASrRZHzX/ttvvNcUdbCZsF5+h2EhcwNVVUa +Q6vlAW8u4Ik9HXxJ+W2HEdlSYWcCdTK4hDCtJhwqEBua1VdKwSdrlDZJPswAdCzv +CR3Fj4NsmPRDw8uCPIL4hwk5fbffcn3rZrsOXSMTKxvdyP+XBPKWEoIs6cxvdE3o +sG65EZeGpj0vLN+rLEbumkvgCAHACgVxvyDeJnajoA6lPNxfzby+9CmhLZfgaVbE +nVQTj8hkUW1gtvnAP3v1Zbe3QMhlqWqwfwD5MgtdQZQ1IwAojaHwt105amQLxESe +vxAQdabKNkW/HUOjKmxz0XtadCLAwPBhP9/j6rQrDVH62zjHmEOjU/WsJQflgLfh +VJ/oIhLTDdGHhamJabpBr6RroxJVXo+vjfUf5LUc5vw54emx7PWOW4opuL3cE6J/ +URmA9CJX4wBeYyEHHoHFlPD9vV5GxOFQ57UimQK/bNl5jh1zxPPAY0j5OwReJRGH +1mrzt6pfGQeYFHMXbkFA5HU5P7Q5VF0cDCef9s1bxglSiMsEDaLOOyKvJ/w= +-----END CERTIFICATE----- diff --git a/internal/tls/testdata/server.key b/internal/tls/testdata/server.key new file mode 100644 index 0000000000..0efcb40bb3 --- /dev/null +++ b/internal/tls/testdata/server.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQD9zHhy7+7K2oJM +w/Ijo++WAibzqMrOCMvhFcGYSwHbcfivPSDia+hCpJ6CNPxWaMIOcbs+LBN7CvLk +FQI7TdLuDLuqEJveLkgeUcRr5AVer5/tycVHQvn4/iok4NMfqRKA8VV0qy94Bdmb +b3zXQtOfhQpN/aXRD3ubW54fiD7XF0qlprVhAS4hz4UlNBzeSVrH0GdlZAfKxUrU +PAsBRtA1vYuhklbDdc5psy0HVTwMj+FM8vPOOP3HmbJpZCHurpNwYkUTU4VHCSpR +SSa6AgSfMuwCQPLN7Xi1rJES4pPtMYp7ZHnes3zGkEYMzkjw3NOtkEzgxwdiJEoV +WQHi4eznAgMBAAECggEAGv7z1O32jXc+ouG40NewNVmXQRW0NMQ0w4Vn6UYZNXlj +BWjQJaVquCQAhEMUkDBma9jnHM7dZ5obie0+Joa5p/6Mu6M2oSR1IVx7Myq284Jk +1Ys/w7u5ESYf33pWmqiGQlbpSxamXvLoWaM7OT5veilRlkgjqiAmerj9EceRP5mR +aheVE5ctY5oZmdnvA9OcN6B8Oxk59EWEOECs8qAF/ChYfC8pWKOp4U0RILQ/9jXD +lu4p0C2XyadrJReer3whudUADWa/WSxgVCrx85/g/RTKs38KTPy7W4g3bv8KBRhc +bjLzoYTl6esRAi8nMG5Fc/85t07hkVv+j5a1NccxgQKBgQD/y/tdH90C8CrAn9y5 +mgr+1QcqJeJWaBpNf+yBqtLbybl6uLY2OzbZtzllU+TDUVlKZB36t2GnG6EIRUcd +WTHUVq8zEIRtDBa12SZlJ08FrNFyKfBByehEOvMazTxb7rdGbiv5+XztCrcPUn1f +cu30v5nBRjqDxtiAbKccFcZPpwKBgQD+ABUQ0h3aX5qDqzhvSLNuqy+hOZPLsqva +VxsDsIlzzzGwmdf+m2Dn9JR/xJNMPf717LJs8IYIqW4KX/HW0pC3Y8fu/6h4fFM9 +ZpJkM2hjRu0uLxDWLc+AombMavFtkZ1tffKxv6mG7Ud163ulBIt24b701XfhR5UX +RWvWI50gwQKBgQCFa1i9luwJJ0m1VOyk5kML7gMhqcbneL8XYzzx2S7IMuyKpSNt +H++ZGWdXga2Vbq3bDmNQrSvDJLcWgEP6e9ZwwZH6WYgo9KA3036iTiF6fUx1doh5 +WB3M0M6SUTBFZzqzAq3vYYEWhns7A7Se/2w8N1+0HrRQnXu5aHK1RGo+iwKBgEST +hRx7fi/dK/xsl9oDyN4SPdPLlcmjPZ6/cb23RgUMZaAGiThmfu1hLU6pphMpkdKX +yzx6W9Wu2NTYPpT/WK8Ks4olYDjXaCnlrZR8BKz5E0Qq1OLej21ta0+5d+FbNSPA +o2u2EXEqUubVYxaUeYrpPAMiNzGNgAU+avTvvJaBAoGBAKely84irwZicpex79T/ +KYV3VOMYs6wETNSLdKkR9G2WEI4OsEw0qGm9pZXzS6lKOSXxW6fOzwI0/vhnmT4O +hBxeR+PriPFqD80ASXeVeVOEjMXQEjZ8Po+FfUvVu8zMNIPDwJ+hy94FE5kkDBte +vy6FnjMquTvekIsRwo/OOdz3 +-----END PRIVATE KEY----- diff --git a/internal/tls/testdata/tls-ca.crt b/internal/tls/testdata/tls-ca.crt new file mode 100644 index 0000000000..4b861f4f40 --- /dev/null +++ b/internal/tls/testdata/tls-ca.crt @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE----- +MIIE9jCCAt6gAwIBAgIBATANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQKEwdSb290 +IENBMB4XDTI0MTAyMjIyMzYzOFoXDTM0MTAyMjIyMzYzOFowEjEQMA4GA1UEChMH +Um9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJrhBEDtGS+b +WAVvkFJuQAkDbCCToy39eJ+51ZS/wA1yuVde8JvtX95dZC0STNm7GnxfIwH8tOut +gc82vz2Bim2K1N9uzBDu6flGWXpzXZSSuMAj1q8MRhEs1OpfbLuqxMs/TAbGYGqa +6FPlUWCwMZvpiRpV+hGxRIp9OsAYn/oVUvuACXnADEwBUYnGL3c9FYPn+kkjpsfH +vaH5kY8uTpKNIbmerYBCIt7X0QXcLOxk2CdnapKuIjaTML8og1/rMPbRsnGvIebh +FZsA60QnhuNiL6MowdJn17/Stl6Rs7cNV5zq3/WmaiipOoTcrKIMgA5ci23A69Pz +0WRfomoFsstRWHhimGrKrT5ewznEitvnWWxfiblmy21LTTJf6nrf7cD1B7Xlrfq+ +BORuHwSxyTapXw0HKSYPwjiSiijywWInS3QR3b5uvpyFy8rGfXI2PSTpnAsK/nws +38jUO7qPsj3AnwHpgLZe0XpGFqmemSmlPif0VT3Pn6CwsCpnEf7vFNYu+rmVjrqT +sBXv7qJMryXL4MDQcTsrX0+XDVWGlKrhVemPI94go86IuqASx7BldMounk9Pra70 +oRUZXsEbzBMGOyF/U3ZmCyJSryV4S+tkUckb/VInpmex1pkx15Q3EGmpRwTQ4/M/ +hGz0foplN1HGRQsVxuPt58Wj7/EW6BDrAgMBAAGjVzBVMA4GA1UdDwEB/wQEAwIC +hDATBgNVHSUEDDAKBggrBgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW +BBSWf0MJGMR6k7iAcZMQBOIFr+DoGjANBgkqhkiG9w0BAQsFAAOCAgEAHQib14b2 +y1b9Xa+lvvpyho887AF5LJMvcAaFA2qrZTgsct9YAUyP4jwHSMa82F34GF5zWm96 +wKGa2V7rykKPLtL2o0ilfnz3bJndL2MUjgVqK7GzkOGIhhXreG6/4WZ+oNReMzjw +uZ6zWKhUrTKfvt5J70Nzk+aPrwEzOOcb078QfrFvxElrkoyBz5LGF6HVdIVYUO94 +1DW1egaduIZCcmavO/CJ5QvzXMyiHkpuT0SoltvVFskoP9aS0OxnaQIrmNx+vajT +9zd/WMroxBh+z4Y6sQmy6zZF+rAPItgZNHncMt8AJBGUlAhjgtiP37v/+w5zKpOD +nXPKVf9mOPNdIDUBpzWxRXwkE1GI8kFjQsuiBD0RGNj1Db/m9lnxOX2B1vKOHRtg +Q3LQURMd3oNj2L4dnJG4SbfXi6CdxRPPtvAb2TJh8qIsL7WxDRey1uhmQWknYXso +kiQ1VgEBVwOXR3NGqlDboWYma/wDOtbaMSd0dl2m2PP7FXJNakUmrATNdwrWjuto +onSHblkkDI5NvA+xUPXm4n7os3DHl6upvToVRTIDaWDBJLGyWEVw87y8+VPR0l5g +XpYDatVLlgC/Nz3Ggn3vepGPV25d7COORXI1EXfjn2PUx7lEK0MbaPfkqPC43Q1g +qubuxdWE+FRLgfs3Ywv1JckNAec7Jg0FA2w= +-----END CERTIFICATE----- diff --git a/logs/logs.go b/logs/logs.go index 21241c8e71..a497883009 100644 --- a/logs/logs.go +++ b/logs/logs.go @@ -13,6 +13,7 @@ import ( "github.com/influxdata/telegraf/config" "github.com/aws/amazon-cloudwatch-agent/plugins/inputs/logfile/tail" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatchlogs" ) var ErrOutputStopped = errors.New("Output plugin stopped") @@ -39,13 +40,14 @@ type LogSrc interface { Description() string Retention() int Class() string + Entity() *cloudwatchlogs.Entity Stop() } // A LogBackend is able to return a LogDest of a given name. // The same name should always return the same LogDest. type LogBackend interface { - CreateDest(string, string, int, string) LogDest + CreateDest(string, string, int, string, LogSrc) LogDest } // A LogDest represents a final endpoint where log events are published to. @@ -122,7 +124,7 @@ func (l *LogAgent) Run(ctx context.Context) { continue } retention = l.checkRetentionAlreadyAttempted(retention, logGroup) - dest := backend.CreateDest(logGroup, logStream, retention, logGroupClass) + dest := backend.CreateDest(logGroup, logStream, retention, logGroupClass, src) l.destNames[dest] = dname log.Printf("I! [logagent] piping log from %s/%s(%s) to %s with retention %d", logGroup, logStream, description, dname, retention) go l.runSrcToDest(src, dest) diff --git a/plugins/inputs/logfile/fileconfig.go b/plugins/inputs/logfile/fileconfig.go index 00aec4f7e6..1f41abe033 100644 --- a/plugins/inputs/logfile/fileconfig.go +++ b/plugins/inputs/logfile/fileconfig.go @@ -83,6 +83,11 @@ type FileConfig struct { Filters []*LogFilter `toml:"filters"` + //Customer specified service.name + ServiceName string `toml:"service_name"` + //Customer specified deployment.environment + Environment string `toml:"deployment_environment"` + //Time *time.Location Go type timezone info. TimezoneLoc *time.Location //Regexp go type timestampFromLogLine regex diff --git a/plugins/inputs/logfile/logfile.go b/plugins/inputs/logfile/logfile.go index f253262812..1626957ebc 100644 --- a/plugins/inputs/logfile/logfile.go +++ b/plugins/inputs/logfile/logfile.go @@ -16,6 +16,7 @@ import ( "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/plugins/inputs" + "github.com/aws/amazon-cloudwatch-agent/extension/entitystore" "github.com/aws/amazon-cloudwatch-agent/internal/logscommon" "github.com/aws/amazon-cloudwatch-agent/logs" "github.com/aws/amazon-cloudwatch-agent/plugins/inputs/logfile/globpath" @@ -152,9 +153,17 @@ func (t *LogFile) FindLogSrc() []logs.LogSrc { t.cleanUpStoppedTailerSrc() + es := entitystore.GetEntityStore() + // Create a "tailer" for each file for i := range t.FileConfig { fileconfig := &t.FileConfig[i] + + //Add file -> {serviceName, deploymentEnvironment} mapping to entity store + if es != nil { + es.AddServiceAttrEntryForLogFile(entitystore.LogFileGlob(fileconfig.FilePath), fileconfig.ServiceName, fileconfig.Environment) + } + targetFiles, err := t.getTargetFiles(fileconfig) if err != nil { t.Log.Errorf("Failed to find target files for file config %v, with error: %v", fileconfig.FilePath, err) @@ -234,6 +243,7 @@ func (t *LogFile) FindLogSrc() []logs.LogSrc { t.Destination, t.getStateFilePath(filename), fileconfig.LogGroupClass, + fileconfig.FilePath, tailer, fileconfig.AutoRemoval, mlCheck, diff --git a/plugins/inputs/logfile/logfile_test.go b/plugins/inputs/logfile/logfile_test.go index 2c1a2e98dd..b4239cb225 100644 --- a/plugins/inputs/logfile/logfile_test.go +++ b/plugins/inputs/logfile/logfile_test.go @@ -59,7 +59,8 @@ func TestLogs(t *testing.T) { tt := NewLogFile() tt.Log = TestLogger{t} - tt.FileConfig = []FileConfig{{FilePath: tmpfile.Name(), FromBeginning: true}} + filename := tmpfile.Name() + tt.FileConfig = []FileConfig{{FilePath: filename, FromBeginning: true, ServiceName: "test-service-name", Environment: "ec2:test-environment"}} tt.FileConfig[0].init() tt.started = true diff --git a/plugins/inputs/logfile/tailersrc.go b/plugins/inputs/logfile/tailersrc.go index 67dae23a8f..df5b5967f9 100644 --- a/plugins/inputs/logfile/tailersrc.go +++ b/plugins/inputs/logfile/tailersrc.go @@ -13,8 +13,10 @@ import ( "golang.org/x/text/encoding" + "github.com/aws/amazon-cloudwatch-agent/extension/entitystore" "github.com/aws/amazon-cloudwatch-agent/logs" "github.com/aws/amazon-cloudwatch-agent/plugins/inputs/logfile/tail" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatchlogs" ) const ( @@ -60,6 +62,7 @@ type tailerSrc struct { group string stream string class string + fileGlobPath string destination string stateFilePath string tailer *tail.Tail @@ -83,7 +86,7 @@ type tailerSrc struct { var _ logs.LogSrc = (*tailerSrc)(nil) func NewTailerSrc( - group, stream, destination, stateFilePath, logClass string, + group, stream, destination, stateFilePath, logClass, fileGlobPath string, tailer *tail.Tail, autoRemoval bool, isMultilineStartFn func(string) bool, @@ -100,6 +103,7 @@ func NewTailerSrc( destination: destination, stateFilePath: stateFilePath, class: logClass, + fileGlobPath: fileGlobPath, tailer: tailer, autoRemoval: autoRemoval, isMLStart: isMultilineStartFn, @@ -166,6 +170,14 @@ func (ts *tailerSrc) AddCleanUpFn(f func()) { ts.cleanUpFns = append(ts.cleanUpFns, f) } +func (ts *tailerSrc) Entity() *cloudwatchlogs.Entity { + es := entitystore.GetEntityStore() + if es != nil { + return es.CreateLogFileEntity(entitystore.LogFileGlob(ts.fileGlobPath), entitystore.LogGroupName(ts.group)) + } + return nil +} + func (ts *tailerSrc) runTail() { defer ts.cleanUp() t := time.NewTicker(multilineWaitPeriod) diff --git a/plugins/inputs/logfile/tailersrc_test.go b/plugins/inputs/logfile/tailersrc_test.go index 24f2d4a510..23a8ae8ba4 100644 --- a/plugins/inputs/logfile/tailersrc_test.go +++ b/plugins/inputs/logfile/tailersrc_test.go @@ -62,6 +62,7 @@ func TestTailerSrc(t *testing.T) { "groupName", "streamName", "destination", statefile.Name(), util.InfrequentAccessLogGroupClass, + "tailsrctest-*.log", tailer, false, // AutoRemoval regexp.MustCompile("^[\\S]").MatchString, @@ -173,6 +174,7 @@ func TestOffsetDoneCallBack(t *testing.T) { "destination", statefile.Name(), util.InfrequentAccessLogGroupClass, + "tailsrctest-*.log", tailer, false, // AutoRemoval regexp.MustCompile("^[\\S]").MatchString, @@ -391,6 +393,7 @@ func setupTailer(t *testing.T, multiLineFn func(string) bool, maxEventSize int) t.Name(), "destination", util.InfrequentAccessLogGroupClass, + "tailsrctest-*.log", statefile.Name(), tailer, false, // AutoRemoval diff --git a/plugins/inputs/windows_event_log/wineventlog/wineventlog.go b/plugins/inputs/windows_event_log/wineventlog/wineventlog.go index f83ce82b5b..0fdcf7942e 100644 --- a/plugins/inputs/windows_event_log/wineventlog/wineventlog.go +++ b/plugins/inputs/windows_event_log/wineventlog/wineventlog.go @@ -20,6 +20,7 @@ import ( "golang.org/x/sys/windows" "github.com/aws/amazon-cloudwatch-agent/logs" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatchlogs" ) // https://msdn.microsoft.com/en-us/library/windows/desktop/aa385588(v=vs.85).aspx @@ -129,6 +130,10 @@ func (w *windowsEventLog) Stop() { close(w.done) } +func (w *windowsEventLog) Entity() *cloudwatchlogs.Entity { + return nil +} + func (w *windowsEventLog) run() { ticker := time.NewTicker(collectionInterval) defer ticker.Stop() diff --git a/plugins/outputs/cloudwatch/aggregator.go b/plugins/outputs/cloudwatch/aggregator.go index 43c0a253c7..8869035664 100644 --- a/plugins/outputs/cloudwatch/aggregator.go +++ b/plugins/outputs/cloudwatch/aggregator.go @@ -11,9 +11,8 @@ import ( "sync" "time" - "github.com/aws/aws-sdk-go/service/cloudwatch" - "github.com/aws/amazon-cloudwatch-agent/metric/distribution" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatch" ) const ( @@ -29,6 +28,7 @@ type aggregationDatum struct { cloudwatch.MetricDatum aggregationInterval time.Duration distribution distribution.Distribution + entity cloudwatch.Entity } type Aggregator interface { diff --git a/plugins/outputs/cloudwatch/aggregator_test.go b/plugins/outputs/cloudwatch/aggregator_test.go index c41af65677..c504f9c692 100644 --- a/plugins/outputs/cloudwatch/aggregator_test.go +++ b/plugins/outputs/cloudwatch/aggregator_test.go @@ -9,11 +9,11 @@ import ( "testing" "time" - "github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/stretchr/testify/assert" "github.com/aws/amazon-cloudwatch-agent/metric/distribution" "github.com/aws/amazon-cloudwatch-agent/metric/distribution/seh1" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatch" ) var wg sync.WaitGroup diff --git a/plugins/outputs/cloudwatch/cloudwatch.go b/plugins/outputs/cloudwatch/cloudwatch.go index 4cc9a4276d..124ff76d22 100644 --- a/plugins/outputs/cloudwatch/cloudwatch.go +++ b/plugins/outputs/cloudwatch/cloudwatch.go @@ -14,8 +14,6 @@ import ( "github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/service/cloudwatch" - "github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/models" "github.com/influxdata/telegraf/plugins/outputs" @@ -32,6 +30,8 @@ import ( "github.com/aws/amazon-cloudwatch-agent/internal/retryer" "github.com/aws/amazon-cloudwatch-agent/internal/util/collections" "github.com/aws/amazon-cloudwatch-agent/metric/distribution" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatch" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatch/cloudwatchiface" ) const ( @@ -61,7 +61,7 @@ type CloudWatch struct { // 1 telegraf Metric could have many Fields. // Each field corresponds to a MetricDatum. metricChan chan *aggregationDatum - datumBatchChan chan []*cloudwatch.MetricDatum + datumBatchChan chan map[string][]*cloudwatch.MetricDatum metricDatumBatch *MetricDatumBatch shutdownChan chan struct{} retries int @@ -122,7 +122,7 @@ func (c *CloudWatch) Start(_ context.Context, host component.Host) error { func (c *CloudWatch) startRoutines() { setNewDistributionFunc(c.config.MaxValuesPerDatum) c.metricChan = make(chan *aggregationDatum, metricChanBufferSize) - c.datumBatchChan = make(chan []*cloudwatch.MetricDatum, datumBatchChanBufferSize) + c.datumBatchChan = make(chan map[string][]*cloudwatch.MetricDatum, datumBatchChanBufferSize) c.shutdownChan = make(chan struct{}) c.aggregatorShutdownChan = make(chan struct{}) c.aggregator = NewAggregator(c.metricChan, c.aggregatorShutdownChan, &c.aggregatorWaitGroup) @@ -172,11 +172,13 @@ func (c *CloudWatch) pushMetricDatum() { for { select { case metric := <-c.metricChan: - datums := c.BuildMetricDatum(metric) + entity, datums := c.BuildMetricDatum(metric) numberOfPartitions := len(datums) for i := 0; i < numberOfPartitions; i++ { - c.metricDatumBatch.Partition = append(c.metricDatumBatch.Partition, datums[i]) + entityStr := entityToString(entity) + c.metricDatumBatch.Partition[entityStr] = append(c.metricDatumBatch.Partition[entityStr], datums[i]) c.metricDatumBatch.Size += payload(datums[i]) + c.metricDatumBatch.Count++ if c.metricDatumBatch.isFull() { // if batch is full c.datumBatchChan <- c.metricDatumBatch.Partition @@ -198,30 +200,33 @@ func (c *CloudWatch) pushMetricDatum() { type MetricDatumBatch struct { MaxDatumsPerCall int - Partition []*cloudwatch.MetricDatum + Partition map[string][]*cloudwatch.MetricDatum BeginTime time.Time Size int + Count int perRequestConstSize int } func newMetricDatumBatch(maxDatumsPerCall, perRequestConstSize int) *MetricDatumBatch { return &MetricDatumBatch{ MaxDatumsPerCall: maxDatumsPerCall, - Partition: make([]*cloudwatch.MetricDatum, 0, maxDatumsPerCall), + Partition: map[string][]*cloudwatch.MetricDatum{}, BeginTime: time.Now(), Size: perRequestConstSize, + Count: 0, perRequestConstSize: perRequestConstSize, } } func (b *MetricDatumBatch) clear() { - b.Partition = make([]*cloudwatch.MetricDatum, 0, b.MaxDatumsPerCall) + b.Partition = map[string][]*cloudwatch.MetricDatum{} b.BeginTime = time.Now() b.Size = b.perRequestConstSize + b.Count = 0 } func (b *MetricDatumBatch) isFull() bool { - return len(b.Partition) >= b.MaxDatumsPerCall || b.Size >= bottomLinePayloadSizeInBytesToPublish + return b.Count >= b.MaxDatumsPerCall || b.Size >= bottomLinePayloadSizeInBytesToPublish } func (c *CloudWatch) timeToPublish(b *MetricDatumBatch) bool { @@ -334,12 +339,37 @@ func (c *CloudWatch) backoffSleep() { time.Sleep(d) } +func createEntityMetricData(entityToMetrics map[string][]*cloudwatch.MetricDatum) []*cloudwatch.EntityMetricData { + var entityMetricData []*cloudwatch.EntityMetricData + for entityStr, metrics := range entityToMetrics { + if entityStr == "" { + continue + } + entity := stringToEntity(entityStr) + entityMetricData = append(entityMetricData, &cloudwatch.EntityMetricData{ + Entity: &entity, + MetricData: metrics, + }) + } + return entityMetricData +} + func (c *CloudWatch) WriteToCloudWatch(req interface{}) { - datums := req.([]*cloudwatch.MetricDatum) + entityToMetricDatum := req.(map[string][]*cloudwatch.MetricDatum) + + // PMD requires PutMetricData to have MetricData + metricData := entityToMetricDatum[""] + if _, ok := entityToMetricDatum[""]; !ok { + metricData = []*cloudwatch.MetricDatum{} + } + params := &cloudwatch.PutMetricDataInput{ - MetricData: datums, - Namespace: aws.String(c.config.Namespace), + MetricData: metricData, + Namespace: aws.String(c.config.Namespace), + EntityMetricData: createEntityMetricData(entityToMetricDatum), + StrictEntityValidation: aws.Bool(false), } + var err error for i := 0; i < defaultRetryCount; i++ { _, err = c.svc.PutMetricData(params) @@ -375,14 +405,14 @@ func (c *CloudWatch) WriteToCloudWatch(req interface{}) { // BuildMetricDatum may just return the datum as-is. // Or it might expand it into many datums due to dimension aggregation. // There may also be more datums due to resize() on a distribution. -func (c *CloudWatch) BuildMetricDatum(metric *aggregationDatum) []*cloudwatch.MetricDatum { +func (c *CloudWatch) BuildMetricDatum(metric *aggregationDatum) (cloudwatch.Entity, []*cloudwatch.MetricDatum) { var datums []*cloudwatch.MetricDatum var distList []distribution.Distribution if metric.distribution != nil { if metric.distribution.Size() == 0 { log.Printf("E! metric has a distribution with no entries, %s", *metric.MetricName) - return datums + return metric.entity, datums } if metric.distribution.Unit() != "" { metric.SetUnit(metric.distribution.Unit()) @@ -437,7 +467,7 @@ func (c *CloudWatch) BuildMetricDatum(metric *aggregationDatum) []*cloudwatch.Me } } } - return datums + return metric.entity, datums } func (c *CloudWatch) IsDropping(metricName string) bool { diff --git a/plugins/outputs/cloudwatch/cloudwatch_test.go b/plugins/outputs/cloudwatch/cloudwatch_test.go index b3aada3801..0d05a2ee7c 100644 --- a/plugins/outputs/cloudwatch/cloudwatch_test.go +++ b/plugins/outputs/cloudwatch/cloudwatch_test.go @@ -17,8 +17,6 @@ import ( "github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/service/cloudwatch" - "github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/metric" "github.com/stretchr/testify/assert" @@ -29,6 +27,8 @@ import ( "github.com/aws/amazon-cloudwatch-agent/internal/publisher" "github.com/aws/amazon-cloudwatch-agent/metric/distribution" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatch" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatch/cloudwatchiface" ) // Return true if found. @@ -203,13 +203,13 @@ func TestBuildMetricDatumDropUnsupported(t *testing.T) { distribution.MinValue * 1.001, } for _, testCase := range testCases { - got := cw.BuildMetricDatum(&aggregationDatum{ + _, datums := cw.BuildMetricDatum(&aggregationDatum{ MetricDatum: cloudwatch.MetricDatum{ MetricName: aws.String("test"), Value: aws.Float64(testCase), }, }) - assert.Empty(t, got) + assert.Empty(t, datums) } } @@ -333,7 +333,9 @@ func TestIsFlushable(t *testing.T) { Dimensions: BuildDimensions(tags), Timestamp: aws.Time(time.Now()), } - batch.Partition = append(batch.Partition, &datum) + batch.Partition = map[string][]*cloudwatch.MetricDatum{ + "TestEntity": append([]*cloudwatch.MetricDatum{}, &datum), + } assert.False(cw.timeToPublish(batch)) time.Sleep(time.Second + cw.config.ForceFlushInterval) assert.True(cw.timeToPublish(batch)) @@ -351,13 +353,19 @@ func TestIsFull(t *testing.T) { Dimensions: BuildDimensions(tags), Timestamp: aws.Time(time.Now()), } + batch.Partition = map[string][]*cloudwatch.MetricDatum{ + "TestEntity": {}, + } + partition := batch.Partition["TestEntity"] for i := 0; i < 3; { - batch.Partition = append(batch.Partition, &datum) + batch.Partition["TestEntity"] = append(partition, &datum) + batch.Count++ i++ } assert.False(batch.isFull()) for i := 0; i < defaultMaxDatumsPerCall-3; { - batch.Partition = append(batch.Partition, &datum) + batch.Partition["TestEntity"] = append(partition, &datum) + batch.Count++ i++ } assert.True(batch.isFull()) @@ -495,6 +503,7 @@ func TestPublish(t *testing.T) { // 10K metrics in batches of 20... time.Sleep(interval) assert.Equal(t, expectedCalls, len(svc.Calls)) + assert.Equal(t, 0, metrics.ResourceMetrics().At(0).Resource().Attributes().Len()) cw.Shutdown(ctx) } @@ -572,13 +581,122 @@ func TestBackoffRetries(t *testing.T) { // Take 1 item out of the channel and verify it is no longer full. func TestCloudWatch_metricDatumBatchFull(t *testing.T) { c := &CloudWatch{ - datumBatchChan: make(chan []*cloudwatch.MetricDatum, datumBatchChanBufferSize), + datumBatchChan: make(chan map[string][]*cloudwatch.MetricDatum, datumBatchChanBufferSize), } assert.False(t, c.metricDatumBatchFull()) for i := 0; i < datumBatchChanBufferSize; i++ { - c.datumBatchChan <- []*cloudwatch.MetricDatum{} + c.datumBatchChan <- map[string][]*cloudwatch.MetricDatum{} } assert.True(t, c.metricDatumBatchFull()) <-c.datumBatchChan assert.False(t, c.metricDatumBatchFull()) } + +func TestCreateEntityMetricData(t *testing.T) { + svc := new(mockCloudWatchClient) + cw := newCloudWatchClient(svc, time.Second) + entity := cloudwatch.Entity{ + KeyAttributes: map[string]*string{ + "Type": aws.String("Service"), + "Environment": aws.String("Environment"), + "Name": aws.String("MyServiceName"), + "AwsAccountId": aws.String("0123456789012"), + }, + Attributes: map[string]*string{ + "InstanceID": aws.String("i-123456789"), + "Platform": aws.String("AWS::EC2"), + }, + } + metrics := createTestMetrics(1, 1, 1, "s") + assert.Equal(t, 7, metrics.ResourceMetrics().At(0).Resource().Attributes().Len()) + aggregations := ConvertOtelMetrics(metrics) + assert.Equal(t, 0, metrics.ResourceMetrics().At(0).Resource().Attributes().Len()) + entity, metricDatum := cw.BuildMetricDatum(aggregations[0]) + + entityToMetrics := map[string][]*cloudwatch.MetricDatum{ + entityToString(entity): metricDatum, + } + wantedEntityMetricData := []*cloudwatch.EntityMetricData{ + { + Entity: &entity, + MetricData: metricDatum, + }, + } + assert.Equal(t, wantedEntityMetricData, createEntityMetricData(entityToMetrics)) +} + +func TestWriteToCloudWatchEntity(t *testing.T) { + timestampNow := aws.Time(time.Now()) + expectedPMDInput := &cloudwatch.PutMetricDataInput{ + Namespace: aws.String(""), + StrictEntityValidation: aws.Bool(false), + EntityMetricData: []*cloudwatch.EntityMetricData{ + { + Entity: &cloudwatch.Entity{ + Attributes: map[string]*string{}, + KeyAttributes: map[string]*string{ + "Environment": aws.String("Environment"), + "Service": aws.String("Service"), + }, + }, + MetricData: []*cloudwatch.MetricDatum{ + { + MetricName: aws.String("TestMetricWithEntity"), + Value: aws.Float64(1), + Timestamp: timestampNow, + Dimensions: []*cloudwatch.Dimension{ + {Name: aws.String("Class"), Value: aws.String("class")}, + {Name: aws.String("Object"), Value: aws.String("object")}, + }, + }, + }, + }, + }, + MetricData: []*cloudwatch.MetricDatum{ + { + MetricName: aws.String("TestMetricNoEntity"), + Value: aws.Float64(1), + Timestamp: timestampNow, + Dimensions: []*cloudwatch.Dimension{ + {Name: aws.String("Class"), Value: aws.String("class")}, + {Name: aws.String("Object"), Value: aws.String("object")}, + }, + }, + }, + } + + var input *cloudwatch.PutMetricDataInput + svc := new(mockCloudWatchClient) + svc.On("PutMetricData", &cloudwatch.PutMetricDataInput{}).Return(&cloudwatch.PutMetricDataOutput{}, nil) + svc.On("PutMetricData", mock.Anything).Run(func(args mock.Arguments) { + input = args.Get(0).(*cloudwatch.PutMetricDataInput) + }).Return(&cloudwatch.PutMetricDataOutput{}, nil) + + cw := newCloudWatchClient(svc, time.Second) + cw.WriteToCloudWatch(map[string][]*cloudwatch.MetricDatum{ + "": { + { + MetricName: aws.String("TestMetricNoEntity"), + Value: aws.Float64(1), + Timestamp: timestampNow, + Dimensions: []*cloudwatch.Dimension{ + {Name: aws.String("Class"), Value: aws.String("class")}, + {Name: aws.String("Object"), Value: aws.String("object")}, + }, + }, + }, + "|Environment:Environment;Service:Service": { + { + MetricName: aws.String("TestMetricWithEntity"), + Value: aws.Float64(1), + Timestamp: timestampNow, + Dimensions: []*cloudwatch.Dimension{ + {Name: aws.String("Class"), Value: aws.String("class")}, + {Name: aws.String("Object"), Value: aws.String("object")}, + }, + }, + }, + }) + + assert.Equal(t, expectedPMDInput, input) +} diff --git a/plugins/outputs/cloudwatch/convert_otel.go b/plugins/outputs/cloudwatch/convert_otel.go index f9471c309c..a318eaa265 100644 --- a/plugins/outputs/cloudwatch/convert_otel.go +++ b/plugins/outputs/cloudwatch/convert_otel.go @@ -9,12 +9,13 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/cloudwatch" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" cloudwatchutil "github.com/aws/amazon-cloudwatch-agent/internal/cloudwatch" "github.com/aws/amazon-cloudwatch-agent/metric/distribution" + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity/entityattributes" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatch" ) // ConvertOtelDimensions will returns a sorted list of dimensions. @@ -22,6 +23,10 @@ func ConvertOtelDimensions(attributes pcommon.Map) []*cloudwatch.Dimension { // Loop through map, similar to EMF exporter createLabels(). mTags := make(map[string]string, attributes.Len()) attributes.Range(func(k string, v pcommon.Value) bool { + // we don't want to export entity related attributes as dimensions, so we skip these + if strings.HasPrefix(k, entityattributes.AWSEntityPrefix) { + return true + } mTags[k] = v.AsString() return true }) @@ -76,6 +81,7 @@ func ConvertOtelNumberDataPoints( name string, unit string, scale float64, + entity cloudwatch.Entity, ) []*aggregationDatum { // Could make() with attrs.Len() * len(c.RollupDimensions). datums := make([]*aggregationDatum, 0, dataPoints.Len()) @@ -96,6 +102,7 @@ func ConvertOtelNumberDataPoints( StorageResolution: aws.Int64(storageResolution), }, aggregationInterval: aggregationInterval, + entity: entity, } datums = append(datums, &ad) } @@ -109,6 +116,7 @@ func ConvertOtelHistogramDataPoints( name string, unit string, scale float64, + entity cloudwatch.Entity, ) []*aggregationDatum { datums := make([]*aggregationDatum, 0, dataPoints.Len()) for i := 0; i < dataPoints.Len(); i++ { @@ -126,6 +134,7 @@ func ConvertOtelHistogramDataPoints( StorageResolution: aws.Int64(storageResolution), }, aggregationInterval: aggregationInterval, + entity: entity, } // Assume function pointer is valid. ad.distribution = distribution.NewDistribution() @@ -139,7 +148,7 @@ func ConvertOtelHistogramDataPoints( // metric and returns it. Only supports the metric DataTypes that we plan to use. // Intentionally not caching previous values and converting cumulative to delta. // Instead use cumulativetodeltaprocessor which supports monotonic cumulative sums. -func ConvertOtelMetric(m pmetric.Metric) []*aggregationDatum { +func ConvertOtelMetric(m pmetric.Metric, entity cloudwatch.Entity) []*aggregationDatum { name := m.Name() unit, scale, err := cloudwatchutil.ToStandardUnit(m.Unit()) if err != nil { @@ -147,34 +156,68 @@ func ConvertOtelMetric(m pmetric.Metric) []*aggregationDatum { } switch m.Type() { case pmetric.MetricTypeGauge: - return ConvertOtelNumberDataPoints(m.Gauge().DataPoints(), name, unit, scale) + return ConvertOtelNumberDataPoints(m.Gauge().DataPoints(), name, unit, scale, entity) case pmetric.MetricTypeSum: - return ConvertOtelNumberDataPoints(m.Sum().DataPoints(), name, unit, scale) + return ConvertOtelNumberDataPoints(m.Sum().DataPoints(), name, unit, scale, entity) case pmetric.MetricTypeHistogram: - return ConvertOtelHistogramDataPoints(m.Histogram().DataPoints(), name, unit, scale) + return ConvertOtelHistogramDataPoints(m.Histogram().DataPoints(), name, unit, scale, entity) default: log.Printf("E! cloudwatch: Unsupported type, %s", m.Type()) } return []*aggregationDatum{} } -// ConvertOtelMetrics only uses dimensions/attributes on each "datapoint", -// not each "Resource". -// This is acceptable because ResourceToTelemetrySettings defaults to true. func ConvertOtelMetrics(m pmetric.Metrics) []*aggregationDatum { datums := make([]*aggregationDatum, 0, m.DataPointCount()) - // Metrics -> ResourceMetrics -> ScopeMetrics -> MetricSlice -> DataPoints - resourceMetrics := m.ResourceMetrics() - for i := 0; i < resourceMetrics.Len(); i++ { - scopeMetrics := resourceMetrics.At(i).ScopeMetrics() + for i := 0; i < m.ResourceMetrics().Len(); i++ { + entity := fetchEntityFields(m.ResourceMetrics().At(i).Resource().Attributes()) + scopeMetrics := m.ResourceMetrics().At(i).ScopeMetrics() for j := 0; j < scopeMetrics.Len(); j++ { metrics := scopeMetrics.At(j).Metrics() for k := 0; k < metrics.Len(); k++ { metric := metrics.At(k) - newDatums := ConvertOtelMetric(metric) + newDatums := ConvertOtelMetric(metric, entity) datums = append(datums, newDatums...) + } } } return datums } + +func fetchEntityFields(resourceAttributes pcommon.Map) cloudwatch.Entity { + keyAttributesMap := map[string]*string{} + attributeMap := map[string]*string{} + platformType := "" + if platformTypeValue, ok := resourceAttributes.Get(entityattributes.AttributeEntityPlatformType); ok { + platformType = platformTypeValue.Str() + } + processEntityAttributes(entityattributes.GetKeyAttributeEntityShortNameMap(), keyAttributesMap, resourceAttributes) + processEntityAttributes(entityattributes.GetAttributeEntityShortNameMap(platformType), attributeMap, resourceAttributes) + removeEntityFields(resourceAttributes) + if _, ok := keyAttributesMap[entityattributes.AwsAccountId]; !ok { + return cloudwatch.Entity{} + } + return cloudwatch.Entity{ + KeyAttributes: keyAttributesMap, + Attributes: attributeMap, + } +} + +// processEntityAttributes fetches the fields with entity prefix and creates an entity to be sent at the PutMetricData call. +func processEntityAttributes(entityMap map[string]string, targetMap map[string]*string, mutableResourceAttributes pcommon.Map) { + for entityField, shortName := range entityMap { + if val, ok := mutableResourceAttributes.Get(entityField); ok { + if strVal := val.Str(); strVal != "" { + targetMap[shortName] = aws.String(strVal) + } + } + } +} + +// removeEntityFields so that it is not tagged as a dimension, and reduces the size of the PMD payload. +func removeEntityFields(mutableResourceAttributes pcommon.Map) { + mutableResourceAttributes.RemoveIf(func(s string, _ pcommon.Value) bool { + return strings.HasPrefix(s, entityattributes.AWSEntityPrefix) + }) +} diff --git a/plugins/outputs/cloudwatch/convert_otel_test.go b/plugins/outputs/cloudwatch/convert_otel_test.go index 672e89c72f..458d72de3a 100644 --- a/plugins/outputs/cloudwatch/convert_otel_test.go +++ b/plugins/outputs/cloudwatch/convert_otel_test.go @@ -9,12 +9,15 @@ import ( "testing" "time" + "github.com/aws/aws-sdk-go/aws" "github.com/stretchr/testify/assert" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/pmetric" "github.com/aws/amazon-cloudwatch-agent/metric/distribution" "github.com/aws/amazon-cloudwatch-agent/metric/distribution/regular" + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity/entityattributes" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatch" ) const ( @@ -51,6 +54,14 @@ func createTestMetrics( ) pmetric.Metrics { metrics := pmetric.NewMetrics() rm := metrics.ResourceMetrics().AppendEmpty() + rm.Resource().Attributes().PutStr(entityattributes.AttributeEntityType, "Service") + rm.Resource().Attributes().PutStr(entityattributes.AttributeEntityDeploymentEnvironment, "MyEnvironment") + rm.Resource().Attributes().PutStr(entityattributes.AttributeEntityServiceName, "MyServiceName") + rm.Resource().Attributes().PutStr(entityattributes.AttributeEntityInstanceID, "i-123456789") + rm.Resource().Attributes().PutStr(entityattributes.AttributeEntityAwsAccountId, "0123456789012") + rm.Resource().Attributes().PutStr(entityattributes.AttributeEntityAutoScalingGroup, "asg-123") + rm.Resource().Attributes().PutStr(entityattributes.AttributeEntityPlatformType, "AWS::EC2") + sm := rm.ScopeMetrics().AppendEmpty() for i := 0; i < numMetrics; i++ { @@ -210,9 +221,280 @@ func TestConvertOtelMetrics_Dimensions(t *testing.T) { } } +func TestConvertOtelMetrics_Entity(t *testing.T) { + metrics := createTestMetrics(1, 1, 1, "s") + datums := ConvertOtelMetrics(metrics) + expectedEntity := cloudwatch.Entity{ + KeyAttributes: map[string]*string{ + "Type": aws.String("Service"), + "Environment": aws.String("MyEnvironment"), + "Name": aws.String("MyServiceName"), + "AwsAccountId": aws.String("0123456789012"), + }, + Attributes: map[string]*string{ + "EC2.InstanceId": aws.String("i-123456789"), + "PlatformType": aws.String("AWS::EC2"), + "EC2.AutoScalingGroup": aws.String("asg-123"), + }, + } + assert.Equal(t, 1, len(datums)) + assert.Equal(t, expectedEntity, datums[0].entity) + +} + +func TestProcessAndRemoveEntityAttributes(t *testing.T) { + testCases := []struct { + name string + resourceAttributes map[string]any + wantedAttributes map[string]*string + leftoverAttributes map[string]any + }{ + { + name: "key_attributes", + resourceAttributes: map[string]any{ + entityattributes.AttributeEntityServiceName: "my-service", + entityattributes.AttributeEntityDeploymentEnvironment: "my-environment", + }, + wantedAttributes: map[string]*string{ + entityattributes.ServiceName: aws.String("my-service"), + entityattributes.DeploymentEnvironment: aws.String("my-environment"), + }, + leftoverAttributes: make(map[string]any), + }, + { + name: "non-key_attributes", + resourceAttributes: map[string]any{ + entityattributes.AttributeEntityCluster: "my-cluster", + entityattributes.AttributeEntityNamespace: "my-namespace", + entityattributes.AttributeEntityNode: "my-node", + entityattributes.AttributeEntityWorkload: "my-workload", + entityattributes.AttributeEntityPlatformType: "AWS::EKS", + }, + wantedAttributes: map[string]*string{ + entityattributes.EksCluster: aws.String("my-cluster"), + entityattributes.NamespaceField: aws.String("my-namespace"), + entityattributes.Node: aws.String("my-node"), + entityattributes.Workload: aws.String("my-workload"), + entityattributes.Platform: aws.String("AWS::EKS"), + }, + leftoverAttributes: make(map[string]any), + }, + { + name: "key_and_non_key_attributes", + resourceAttributes: map[string]any{ + entityattributes.AttributeEntityServiceName: "my-service", + entityattributes.AttributeEntityDeploymentEnvironment: "my-environment", + entityattributes.AttributeEntityCluster: "my-cluster", + entityattributes.AttributeEntityNamespace: "my-namespace", + entityattributes.AttributeEntityNode: "my-node", + entityattributes.AttributeEntityWorkload: "my-workload", + entityattributes.AttributeEntityPlatformType: "K8s", + }, + wantedAttributes: map[string]*string{ + entityattributes.ServiceName: aws.String("my-service"), + entityattributes.DeploymentEnvironment: aws.String("my-environment"), + entityattributes.K8sCluster: aws.String("my-cluster"), + entityattributes.NamespaceField: aws.String("my-namespace"), + entityattributes.Node: aws.String("my-node"), + entityattributes.Workload: aws.String("my-workload"), + entityattributes.Platform: aws.String("K8s"), + }, + leftoverAttributes: make(map[string]any), + }, + { + name: "key_and_non_key_attributes_plus_extras", + resourceAttributes: map[string]any{ + "extra_attribute": "extra_value", + entityattributes.AttributeEntityServiceName: "my-service", + entityattributes.AttributeEntityDeploymentEnvironment: "my-environment", + entityattributes.AttributeEntityCluster: "my-cluster", + entityattributes.AttributeEntityNamespace: "my-namespace", + entityattributes.AttributeEntityNode: "my-node", + entityattributes.AttributeEntityWorkload: "my-workload", + entityattributes.AttributeEntityPlatformType: "K8s", + }, + wantedAttributes: map[string]*string{ + entityattributes.ServiceName: aws.String("my-service"), + entityattributes.DeploymentEnvironment: aws.String("my-environment"), + entityattributes.K8sCluster: aws.String("my-cluster"), + entityattributes.NamespaceField: aws.String("my-namespace"), + entityattributes.Node: aws.String("my-node"), + entityattributes.Workload: aws.String("my-workload"), + entityattributes.Platform: aws.String("K8s"), + }, + leftoverAttributes: map[string]any{ + "extra_attribute": "extra_value", + }, + }, + { + name: "key_and_non_key_attributes_plus_unsupported_entity_field", + resourceAttributes: map[string]any{ + entityattributes.AWSEntityPrefix + "not.real.values": "unsupported", + entityattributes.AttributeEntityServiceName: "my-service", + entityattributes.AttributeEntityDeploymentEnvironment: "my-environment", + entityattributes.AttributeEntityCluster: "my-cluster", + entityattributes.AttributeEntityNamespace: "my-namespace", + entityattributes.AttributeEntityNode: "my-node", + entityattributes.AttributeEntityWorkload: "my-workload", + entityattributes.AttributeEntityPlatformType: "AWS::EKS", + }, + wantedAttributes: map[string]*string{ + entityattributes.ServiceName: aws.String("my-service"), + entityattributes.DeploymentEnvironment: aws.String("my-environment"), + entityattributes.EksCluster: aws.String("my-cluster"), + entityattributes.NamespaceField: aws.String("my-namespace"), + entityattributes.Node: aws.String("my-node"), + entityattributes.Workload: aws.String("my-workload"), + entityattributes.Platform: aws.String("AWS::EKS"), + }, + leftoverAttributes: map[string]any{}, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + attrs := pcommon.NewMap() + err := attrs.FromRaw(tc.resourceAttributes) + + // resetting fields for current test case + entityAttrMap := []map[string]string{entityattributes.GetKeyAttributeEntityShortNameMap()} + platformType := "" + if platformTypeValue, ok := attrs.Get(entityattributes.AttributeEntityPlatformType); ok { + platformType = platformTypeValue.Str() + } + if platformType != "" { + delete(entityattributes.GetAttributeEntityShortNameMap(platformType), entityattributes.AttributeEntityCluster) + entityAttrMap = append(entityAttrMap, entityattributes.GetAttributeEntityShortNameMap(platformType)) + } + assert.Nil(t, err) + targetMap := make(map[string]*string) + for _, entityMap := range entityAttrMap { + processEntityAttributes(entityMap, targetMap, attrs) + } + removeEntityFields(attrs) + assert.Equal(t, tc.leftoverAttributes, attrs.AsRaw()) + assert.Equal(t, tc.wantedAttributes, targetMap) + }) + } +} + +func TestFetchEntityFields_WithoutAccountID(t *testing.T) { + resourceMetrics := pmetric.NewResourceMetrics() + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityType, "Service") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityDeploymentEnvironment, "my-environment") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityServiceName, "my-service") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityNode, "my-node") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityCluster, "my-cluster") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityNamespace, "my-namespace") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityWorkload, "my-workload") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityPlatformType, "AWS::EKS") + assert.Equal(t, 8, resourceMetrics.Resource().Attributes().Len()) + + expectedEntity := cloudwatch.Entity{ + KeyAttributes: nil, + Attributes: nil, + } + entity := fetchEntityFields(resourceMetrics.Resource().Attributes()) + assert.Equal(t, 0, resourceMetrics.Resource().Attributes().Len()) + assert.Equal(t, expectedEntity, entity) +} + +func TestFetchEntityFields_WithAccountID(t *testing.T) { + resourceMetrics := pmetric.NewResourceMetrics() + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityType, "Service") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityDeploymentEnvironment, "my-environment") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityServiceName, "my-service") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityNode, "my-node") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityCluster, "my-cluster") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityNamespace, "my-namespace") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityWorkload, "my-workload") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityPlatformType, "AWS::EKS") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityAwsAccountId, "123456789") + assert.Equal(t, 9, resourceMetrics.Resource().Attributes().Len()) + + expectedEntity := cloudwatch.Entity{ + KeyAttributes: map[string]*string{ + entityattributes.EntityType: aws.String(entityattributes.Service), + entityattributes.ServiceName: aws.String("my-service"), + entityattributes.DeploymentEnvironment: aws.String("my-environment"), + entityattributes.AwsAccountId: aws.String("123456789"), + }, + Attributes: map[string]*string{ + entityattributes.Node: aws.String("my-node"), + entityattributes.EksCluster: aws.String("my-cluster"), + entityattributes.NamespaceField: aws.String("my-namespace"), + entityattributes.Workload: aws.String("my-workload"), + entityattributes.Platform: aws.String("AWS::EKS"), + }, + } + entity := fetchEntityFields(resourceMetrics.Resource().Attributes()) + assert.Equal(t, 0, resourceMetrics.Resource().Attributes().Len()) + assert.Equal(t, expectedEntity, entity) +} + +func TestFetchEntityFieldsOnK8s(t *testing.T) { + entityMap := entityattributes.GetAttributeEntityShortNameMap("") + delete(entityMap, entityattributes.AttributeEntityCluster) + resourceMetrics := pmetric.NewResourceMetrics() + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityType, "Service") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityDeploymentEnvironment, "my-environment") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityServiceName, "my-service") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityNode, "my-node") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityCluster, "my-cluster") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityNamespace, "my-namespace") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityWorkload, "my-workload") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityPlatformType, "K8s") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityAwsAccountId, "123456789") + assert.Equal(t, 9, resourceMetrics.Resource().Attributes().Len()) + + expectedEntity := cloudwatch.Entity{ + KeyAttributes: map[string]*string{ + entityattributes.EntityType: aws.String(entityattributes.Service), + entityattributes.ServiceName: aws.String("my-service"), + entityattributes.DeploymentEnvironment: aws.String("my-environment"), + entityattributes.AwsAccountId: aws.String("123456789"), + }, + Attributes: map[string]*string{ + entityattributes.Node: aws.String("my-node"), + entityattributes.K8sCluster: aws.String("my-cluster"), + entityattributes.NamespaceField: aws.String("my-namespace"), + entityattributes.Workload: aws.String("my-workload"), + entityattributes.Platform: aws.String("K8s"), + }, + } + entity := fetchEntityFields(resourceMetrics.Resource().Attributes()) + assert.Equal(t, 0, resourceMetrics.Resource().Attributes().Len()) + assert.Equal(t, expectedEntity, entity) +} + +func TestFetchEntityFieldsOnEc2(t *testing.T) { + resourceMetrics := pmetric.NewResourceMetrics() + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityType, "Service") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityDeploymentEnvironment, "my-environment") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityServiceName, "my-service") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityPlatformType, "AWS::EC2") + resourceMetrics.Resource().Attributes().PutStr(entityattributes.AttributeEntityAwsAccountId, "123456789") + assert.Equal(t, 5, resourceMetrics.Resource().Attributes().Len()) + + expectedEntity := cloudwatch.Entity{ + KeyAttributes: map[string]*string{ + entityattributes.EntityType: aws.String(entityattributes.Service), + entityattributes.ServiceName: aws.String("my-service"), + entityattributes.DeploymentEnvironment: aws.String("my-environment"), + entityattributes.AwsAccountId: aws.String("123456789"), + }, + Attributes: map[string]*string{ + entityattributes.Platform: aws.String("AWS::EC2"), + }, + } + entity := fetchEntityFields(resourceMetrics.Resource().Attributes()) + assert.Equal(t, 0, resourceMetrics.Resource().Attributes().Len()) + assert.Equal(t, expectedEntity, entity) +} + func TestInvalidMetric(t *testing.T) { m := pmetric.NewMetric() m.SetName("name") m.SetUnit("unit") - assert.Empty(t, ConvertOtelMetric(m)) + assert.Empty(t, ConvertOtelMetric(m, cloudwatch.Entity{})) } diff --git a/plugins/outputs/cloudwatch/util.go b/plugins/outputs/cloudwatch/util.go index 8ffc81c325..6a2149365c 100644 --- a/plugins/outputs/cloudwatch/util.go +++ b/plugins/outputs/cloudwatch/util.go @@ -4,16 +4,17 @@ package cloudwatch import ( + "fmt" "log" "math/rand" "sort" + "strings" "time" - "github.com/aws/aws-sdk-go/service/cloudwatch" - "github.com/aws/amazon-cloudwatch-agent/metric/distribution" "github.com/aws/amazon-cloudwatch-agent/metric/distribution/regular" "github.com/aws/amazon-cloudwatch-agent/metric/distribution/seh1" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatch" ) const ( @@ -121,3 +122,75 @@ func payload(datum *cloudwatch.MetricDatum) (size int) { return } + +func entityToString(entity cloudwatch.Entity) string { + var attributes, keyAttributes, data string + if entity.Attributes != nil { + attributes = entityAttributesToString(entity.Attributes) + } + if entity.KeyAttributes != nil { + keyAttributes = entityAttributesToString(entity.KeyAttributes) + } + + if attributes != "" || keyAttributes != "" { + data = fmt.Sprintf( + "%s|%s", + attributes, + keyAttributes, + ) + } + return data +} + +// Helper function to convert a map of entityAttributes to a consistent string representation +func entityAttributesToString(m map[string]*string) string { + if m == nil { + return "" + } + pairs := make([]string, 0, len(m)) + for k, v := range m { + if v == nil { + pairs = append(pairs, k+":") + } else { + pairs = append(pairs, k+":"+*v) + } + } + sort.Strings(pairs) // Ensure a consistent order + return strings.Join(pairs, ";") +} + +func stringToEntity(data string) cloudwatch.Entity { + parts := strings.Split(data, "|") + if len(parts) < 2 { + // Handle error: invalid input string + return cloudwatch.Entity{} + } + + entity := cloudwatch.Entity{ + Attributes: make(map[string]*string), + KeyAttributes: make(map[string]*string), + } + + if parts[0] != "" { + entity.Attributes = stringToEntityAttributes(parts[0]) + } + + if parts[1] != "" { + entity.KeyAttributes = stringToEntityAttributes(parts[1]) + } + + return entity +} + +func stringToEntityAttributes(s string) map[string]*string { + result := make(map[string]*string) + pairs := strings.Split(s, ";") + for _, pair := range pairs { + kv := strings.SplitN(pair, ":", 2) + if len(kv) == 2 { + value := kv[1] + result[kv[0]] = &value + } + } + return result +} diff --git a/plugins/outputs/cloudwatch/util_test.go b/plugins/outputs/cloudwatch/util_test.go index 8f022b736c..962f2cf1b2 100644 --- a/plugins/outputs/cloudwatch/util_test.go +++ b/plugins/outputs/cloudwatch/util_test.go @@ -10,12 +10,12 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/stretchr/testify/assert" "github.com/aws/amazon-cloudwatch-agent/metric/distribution" "github.com/aws/amazon-cloudwatch-agent/metric/distribution/regular" "github.com/aws/amazon-cloudwatch-agent/metric/distribution/seh1" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatch" ) func TestPublishJitter(t *testing.T) { @@ -141,3 +141,72 @@ func TestPayload_Min(t *testing.T) { datum.SetTimestamp(time.Now()) assert.Equal(t, 148, payload(datum)) } + +func TestEntityToString_StringToEntity(t *testing.T) { + testCases := []struct { + name string + entity cloudwatch.Entity + entityString string + }{ + { + name: "Full Entity", + entity: cloudwatch.Entity{ + KeyAttributes: map[string]*string{ + "Service": aws.String("Service"), + "Environment": aws.String("Environment"), + }, + Attributes: map[string]*string{ + "InstanceId": aws.String("InstanceId"), + "InstanceType": aws.String("InstanceType"), + }, + }, + entityString: "InstanceId:InstanceId;InstanceType:InstanceType|Environment:Environment;Service:Service", + }, + { + name: "Empty Attributes", + entity: cloudwatch.Entity{ + KeyAttributes: map[string]*string{ + "Service": aws.String("Service"), + "Environment": aws.String("Environment"), + }, + Attributes: map[string]*string{}, + }, + entityString: "|Environment:Environment;Service:Service", + }, + { + name: "Empty Entity", + entity: cloudwatch.Entity{}, + entityString: "", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + assert.Equal(t, tc.entityString, entityToString(tc.entity)) + assert.Equal(t, tc.entity, stringToEntity(tc.entityString)) + }) + } +} + +func TestEntityToString(t *testing.T) { + testCases := []struct { + name string + entity cloudwatch.Entity + entityString string + }{ + { + name: "EmptyEntityMaps", + entity: cloudwatch.Entity{ + KeyAttributes: map[string]*string{}, + Attributes: map[string]*string{}, + }, + entityString: "", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + assert.Equal(t, tc.entityString, entityToString(tc.entity)) + }) + } +} diff --git a/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go b/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go index 7cd89fb4b1..e1b0f4f457 100644 --- a/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go +++ b/plugins/outputs/cloudwatchlogs/cloudwatchlogs.go @@ -14,7 +14,6 @@ import ( "github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/service/cloudwatchlogs" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/plugins/outputs" "go.uber.org/zap" @@ -28,6 +27,7 @@ import ( "github.com/aws/amazon-cloudwatch-agent/internal" "github.com/aws/amazon-cloudwatch-agent/internal/retryer" "github.com/aws/amazon-cloudwatch-agent/logs" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatchlogs" "github.com/aws/amazon-cloudwatch-agent/tool/util" ) @@ -104,7 +104,7 @@ func (c *CloudWatchLogs) Write(metrics []telegraf.Metric) error { return nil } -func (c *CloudWatchLogs) CreateDest(group, stream string, retention int, logGroupClass string) logs.LogDest { +func (c *CloudWatchLogs) CreateDest(group, stream string, retention int, logGroupClass string, logSrc logs.LogSrc) logs.LogDest { if group == "" { group = c.LogGroupName } @@ -121,10 +121,10 @@ func (c *CloudWatchLogs) CreateDest(group, stream string, retention int, logGrou Retention: retention, Class: logGroupClass, } - return c.getDest(t) + return c.getDest(t, logSrc) } -func (c *CloudWatchLogs) getDest(t Target) *cwDest { +func (c *CloudWatchLogs) getDest(t Target, logSrc logs.LogSrc) *cwDest { if cwd, ok := c.cwDests[t]; ok { return cwd } @@ -162,7 +162,7 @@ func (c *CloudWatchLogs) getDest(t Target) *cwDest { c.Log.Info("Configured middleware on AWS client") } } - pusher := NewPusher(t, client, c.ForceFlushInterval.Duration, maxRetryTimeout, c.Log, c.pusherStopChan, &c.pusherWaitGroup) + pusher := NewPusher(c.Region, t, client, c.ForceFlushInterval.Duration, maxRetryTimeout, c.Log, c.pusherStopChan, &c.pusherWaitGroup, logSrc) cwd := &cwDest{pusher: pusher, retryer: logThrottleRetryer} c.cwDests[t] = cwd return cwd @@ -173,7 +173,7 @@ func (c *CloudWatchLogs) writeMetricAsStructuredLog(m telegraf.Metric) { if err != nil { c.Log.Errorf("Failed to find target: %v", err) } - cwd := c.getDest(t) + cwd := c.getDest(t, nil) if cwd == nil { c.Log.Warnf("unable to find log destination, group: %v, stream: %v", t.Group, t.Stream) return diff --git a/plugins/outputs/cloudwatchlogs/cloudwatchlogs_test.go b/plugins/outputs/cloudwatchlogs/cloudwatchlogs_test.go index ad794ac88b..2b4cdf5290 100644 --- a/plugins/outputs/cloudwatchlogs/cloudwatchlogs_test.go +++ b/plugins/outputs/cloudwatchlogs/cloudwatchlogs_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/require" + "github.com/aws/amazon-cloudwatch-agent/logs" "github.com/aws/amazon-cloudwatch-agent/tool/util" ) @@ -20,39 +21,47 @@ func TestCreateDestination(t *testing.T) { cfgLogStream string cfgLogRetention int cfgLogClass string + cfgTailerSrc logs.LogSrc expectedLogGroup string expectedLogStream string expectedLogGroupRetention int expectedLogClass string + expectedTailerSrc logs.LogSrc }{ "WithTomlGroupStream": { cfgLogGroup: "", cfgLogStream: "", cfgLogRetention: -1, cfgLogClass: "", + cfgTailerSrc: nil, expectedLogGroup: "G1", expectedLogStream: "S1", expectedLogGroupRetention: -1, + expectedTailerSrc: nil, }, "WithOverrideGroupStreamStandardLogGroup": { cfgLogGroup: "", cfgLogStream: "", cfgLogRetention: -1, cfgLogClass: util.StandardLogGroupClass, + cfgTailerSrc: nil, expectedLogGroup: "G1", expectedLogStream: "S1", expectedLogGroupRetention: -1, expectedLogClass: util.StandardLogGroupClass, + expectedTailerSrc: nil, }, "WithOverrideGroupStreamInfrequentLogGroup": { cfgLogGroup: "Group5", cfgLogStream: "Stream5", cfgLogRetention: -1, cfgLogClass: util.InfrequentAccessLogGroupClass, + cfgTailerSrc: nil, expectedLogGroup: "Group5", expectedLogStream: "Stream5", expectedLogGroupRetention: -1, expectedLogClass: util.InfrequentAccessLogGroupClass, + expectedTailerSrc: nil, }, } @@ -66,11 +75,12 @@ func TestCreateDestination(t *testing.T) { pusherStopChan: make(chan struct{}), cwDests: make(map[Target]*cwDest), } - dest := c.CreateDest(testCase.cfgLogGroup, testCase.cfgLogStream, testCase.cfgLogRetention, testCase.cfgLogClass).(*cwDest) + dest := c.CreateDest(testCase.cfgLogGroup, testCase.cfgLogStream, testCase.cfgLogRetention, testCase.cfgLogClass, testCase.cfgTailerSrc).(*cwDest) require.Equal(t, testCase.expectedLogGroup, dest.pusher.Group) require.Equal(t, testCase.expectedLogStream, dest.pusher.Stream) require.Equal(t, testCase.expectedLogGroupRetention, dest.pusher.Retention) require.Equal(t, testCase.expectedLogClass, dest.pusher.Class) + require.Equal(t, testCase.expectedTailerSrc, dest.pusher.logSrc) }) } } @@ -83,8 +93,8 @@ func TestDuplicateDestination(t *testing.T) { pusherStopChan: make(chan struct{}), } // Given the same log group, log stream, same retention, and logClass - d1 := c.CreateDest("FILENAME", "", -1, util.InfrequentAccessLogGroupClass) - d2 := c.CreateDest("FILENAME", "", -1, util.InfrequentAccessLogGroupClass) + d1 := c.CreateDest("FILENAME", "", -1, util.InfrequentAccessLogGroupClass, nil) + d2 := c.CreateDest("FILENAME", "", -1, util.InfrequentAccessLogGroupClass, nil) // Then the destination for cloudwatchlogs endpoint would be the same require.Equal(t, d1, d2) diff --git a/plugins/outputs/cloudwatchlogs/pusher.go b/plugins/outputs/cloudwatchlogs/pusher.go index b5f8ad7e97..ff0bb1dd0e 100644 --- a/plugins/outputs/cloudwatchlogs/pusher.go +++ b/plugins/outputs/cloudwatchlogs/pusher.go @@ -11,11 +11,11 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/service/cloudwatchlogs" "github.com/influxdata/telegraf" "github.com/aws/amazon-cloudwatch-agent/logs" "github.com/aws/amazon-cloudwatch-agent/profiler" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatchlogs" ) const ( @@ -43,6 +43,8 @@ type pusher struct { RetryDuration time.Duration Log telegraf.Logger + region string + logSrc logs.LogSrc events []*cloudwatchlogs.InputLogEvent minT, maxT *time.Time doneCallbacks []func() @@ -63,13 +65,15 @@ type pusher struct { wg *sync.WaitGroup } -func NewPusher(target Target, service CloudWatchLogsService, flushTimeout time.Duration, retryDuration time.Duration, logger telegraf.Logger, stop <-chan struct{}, wg *sync.WaitGroup) *pusher { +func NewPusher(region string, target Target, service CloudWatchLogsService, flushTimeout time.Duration, retryDuration time.Duration, logger telegraf.Logger, stop <-chan struct{}, wg *sync.WaitGroup, logSrc logs.LogSrc) *pusher { p := &pusher{ Target: target, Service: service, FlushTimeout: flushTimeout, RetryDuration: retryDuration, Log: logger, + region: region, + logSrc: logSrc, events: make([]*cloudwatchlogs.InputLogEvent, 0, 10), eventsCh: make(chan logs.LogEvent, 100), flushTimer: time.NewTimer(flushTimeout), @@ -218,13 +222,15 @@ func (p *pusher) send() { if p.needSort { sort.Stable(ByTimestamp(p.events)) } - input := &cloudwatchlogs.PutLogEventsInput{ LogEvents: p.events, LogGroupName: &p.Group, LogStreamName: &p.Stream, SequenceToken: p.sequenceToken, } + if p.logSrc != nil { + input.Entity = p.logSrc.Entity() + } startTime := time.Now() diff --git a/plugins/outputs/cloudwatchlogs/pusher_test.go b/plugins/outputs/cloudwatchlogs/pusher_test.go index 32afaa8ac9..fc3957e5cc 100644 --- a/plugins/outputs/cloudwatchlogs/pusher_test.go +++ b/plugins/outputs/cloudwatchlogs/pusher_test.go @@ -17,13 +17,38 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/service/cloudwatchlogs" "github.com/influxdata/telegraf/models" "github.com/stretchr/testify/require" + "github.com/aws/amazon-cloudwatch-agent/logs" + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatchlogs" "github.com/aws/amazon-cloudwatch-agent/tool/util" ) +type mockLogSrc struct { + logs.LogSrc + returnEmpty bool +} + +func (m *mockLogSrc) Entity() *cloudwatchlogs.Entity { + entity := &cloudwatchlogs.Entity{ + Attributes: map[string]*string{ + "PlatformType": aws.String("AWS::EC2"), + "EC2.InstanceId": aws.String("i-123456789"), + "EC2.AutoScalingGroup": aws.String("test-group"), + }, + KeyAttributes: map[string]*string{ + "Name": aws.String("myService"), + "Environment": aws.String("myEnvironment"), + "AwsAccountId": aws.String("123456789"), + }, + } + if m.returnEmpty { + return nil + } + return entity +} + var wg sync.WaitGroup type svcMock struct { @@ -84,10 +109,22 @@ func (e evtMock) Done() { } } -func TestAddSingleEvent(t *testing.T) { +func TestAddSingleEvent_WithAccountId(t *testing.T) { var s svcMock called := false nst := "NEXT_SEQ_TOKEN" + expectedEntity := &cloudwatchlogs.Entity{ + Attributes: map[string]*string{ + "PlatformType": aws.String("AWS::EC2"), + "EC2.InstanceId": aws.String("i-123456789"), + "EC2.AutoScalingGroup": aws.String("test-group"), + }, + KeyAttributes: map[string]*string{ + "Name": aws.String("myService"), + "Environment": aws.String("myEnvironment"), + "AwsAccountId": aws.String("123456789"), + }, + } s.ple = func(in *cloudwatchlogs.PutLogEventsInput) (*cloudwatchlogs.PutLogEventsOutput, error) { called = true @@ -103,13 +140,55 @@ func TestAddSingleEvent(t *testing.T) { if len(in.LogEvents) != 1 || *in.LogEvents[0].Message != "MSG" { t.Errorf("PutLogEvents called with incorrect message, got: '%v'", *in.LogEvents[0].Message) } + require.Equal(t, expectedEntity, in.Entity) + return &cloudwatchlogs.PutLogEventsOutput{ + NextSequenceToken: &nst, + }, nil + } + + stop, p := testPreparation(-1, &s, 1*time.Hour, maxRetryTimeout) + p.AddEvent(evtMock{"MSG", time.Now(), nil}) + require.False(t, called, "PutLogEvents has been called too fast, it should wait until FlushTimeout.") + + p.FlushTimeout = 10 * time.Millisecond + p.resetFlushTimer() + + time.Sleep(3 * time.Second) + require.True(t, called, "PutLogEvents has not been called after FlushTimeout has been reached.") + require.NotNil(t, nst, *p.sequenceToken, "Pusher did not capture the NextSequenceToken") + + close(stop) + wg.Wait() +} + +func TestAddSingleEvent_WithoutAccountId(t *testing.T) { + var s svcMock + called := false + nst := "NEXT_SEQ_TOKEN" + + s.ple = func(in *cloudwatchlogs.PutLogEventsInput) (*cloudwatchlogs.PutLogEventsOutput, error) { + called = true + + if in.SequenceToken != nil { + t.Errorf("PutLogEvents called with wrong sequenceToken, first call should not provide any token") + } + + if *in.LogGroupName != "G" || *in.LogStreamName != "S" { + t.Errorf("PutLogEvents called with wrong group and stream: %v/%v", *in.LogGroupName, *in.LogStreamName) + } + + if len(in.LogEvents) != 1 || *in.LogEvents[0].Message != "MSG" { + t.Errorf("PutLogEvents called with incorrect message, got: '%v'", *in.LogEvents[0].Message) + } + require.Nil(t, in.Entity) return &cloudwatchlogs.PutLogEventsOutput{ NextSequenceToken: &nst, }, nil } stop, p := testPreparation(-1, &s, 1*time.Hour, maxRetryTimeout) + p.logSrc = &mockLogSrc{returnEmpty: true} p.AddEvent(evtMock{"MSG", time.Now(), nil}) require.False(t, called, "PutLogEvents has been called too fast, it should wait until FlushTimeout.") @@ -769,6 +848,7 @@ func TestResendWouldStopAfterExhaustedRetries(t *testing.T) { func testPreparation(retention int, s *svcMock, flushTimeout time.Duration, retryDuration time.Duration) (chan struct{}, *pusher) { stop := make(chan struct{}) - p := NewPusher(Target{"G", "S", util.StandardLogGroupClass, retention}, s, flushTimeout, retryDuration, models.NewLogger("cloudwatchlogs", "test", ""), stop, &wg) + mockLogSrcObj := &mockLogSrc{} + p := NewPusher("us-east-1", Target{"G", "S", util.StandardLogGroupClass, retention}, s, flushTimeout, retryDuration, models.NewLogger("cloudwatchlogs", "test", ""), stop, &wg, mockLogSrcObj) return stop, p } diff --git a/plugins/processors/awsentity/config.go b/plugins/processors/awsentity/config.go new file mode 100644 index 0000000000..54c662a088 --- /dev/null +++ b/plugins/processors/awsentity/config.go @@ -0,0 +1,33 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package awsentity + +import ( + "go.opentelemetry.io/collector/component" +) + +type Config struct { + // ScrapeDatapointAttribute determines if the processor should scrape OTEL datapoint + // attributes for entity related information. This option is mainly used for components + // that emit all attributes to datapoint level instead of resource level. All telegraf + // plugins have this behavior. + ScrapeDatapointAttribute bool `mapstructure:"scrape_datapoint_attribute,omitempty"` + // ClusterName can be used to explicitly provide the Cluster's Name for scenarios where it's not + // possible to auto-detect it using EC2 tags. + ClusterName string `mapstructure:"cluster_name,omitempty"` + // KubernetesMode + KubernetesMode string `mapstructure:"kubernetes_mode,omitempty"` + // Specific Mode agent is running on (i.e. EC2, EKS, ECS etc) + Platform string `mapstructure:"platform,omitempty"` + // EntityType determines the type of entity processing done for + // telemetry. Possible values are Service and Resource + EntityType string `mapstructure:"entity_type,omitempty"` +} + +// Verify Config implements Processor interface. +var _ component.Config = (*Config)(nil) + +func (cfg *Config) Validate() error { + return nil +} diff --git a/plugins/processors/awsentity/config_test.go b/plugins/processors/awsentity/config_test.go new file mode 100644 index 0000000000..7e1b28997c --- /dev/null +++ b/plugins/processors/awsentity/config_test.go @@ -0,0 +1,18 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package awsentity + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/confmap" +) + +func TestUnmarshalDefaultConfig(t *testing.T) { + factory := NewFactory() + cfg := factory.CreateDefaultConfig() + assert.NoError(t, confmap.New().Unmarshal(cfg)) + assert.Equal(t, factory.CreateDefaultConfig(), cfg) +} diff --git a/plugins/processors/awsentity/entityattributes/entityattributes.go b/plugins/processors/awsentity/entityattributes/entityattributes.go new file mode 100644 index 0000000000..9638af83a5 --- /dev/null +++ b/plugins/processors/awsentity/entityattributes/entityattributes.go @@ -0,0 +1,102 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entityattributes + +const ( + + // The following are the possible values for EntityType config options + Resource = "Resource" + Service = "Service" + + AttributeServiceNameSource = "service.name.source" + AttributeDeploymentEnvironmentSource = "deployment.environment.source" + AttributeServiceNameSourceUserConfig = "UserConfiguration" + + // The following are entity related attributes + AWSEntityPrefix = "com.amazonaws.cloudwatch.entity.internal." + AttributeEntityType = AWSEntityPrefix + "type" + AttributeEntityAWSResource = "AWS::Resource" + AttributeEntityResourceType = AWSEntityPrefix + "resource.type" + AttributeEntityEC2InstanceResource = "AWS::EC2::Instance" + AttributeEntityIdentifier = AWSEntityPrefix + "identifier" + AttributeEntityAwsAccountId = AWSEntityPrefix + "aws.account.id" + AttributeEntityServiceName = AWSEntityPrefix + "service.name" + AttributeEntityDeploymentEnvironment = AWSEntityPrefix + "deployment.environment" + AttributeEntityCluster = AWSEntityPrefix + "k8s.cluster.name" + AttributeEntityNamespace = AWSEntityPrefix + "k8s.namespace.name" + AttributeEntityWorkload = AWSEntityPrefix + "k8s.workload.name" + AttributeEntityNode = AWSEntityPrefix + "k8s.node.name" + AttributeEntityServiceNameSource = AWSEntityPrefix + "service.name.source" + AttributeEntityPlatformType = AWSEntityPrefix + "platform.type" + AttributeEntityInstanceID = AWSEntityPrefix + "instance.id" + AttributeEntityAutoScalingGroup = AWSEntityPrefix + "auto.scaling.group" + + // The following are possible platform values + AttributeEntityEC2Platform = "AWS::EC2" + AttributeEntityEKSPlatform = "AWS::EKS" + AttributeEntityK8sPlatform = "K8s" + + // The following Fields are the actual names attached to the Entity requests. + ServiceName = "Name" + DeploymentEnvironment = "Environment" + EntityType = "Type" + ResourceType = "ResourceType" + Identifier = "Identifier" + AwsAccountId = "AwsAccountId" + EksCluster = "EKS.Cluster" + K8sCluster = "K8s.Cluster" + NamespaceField = "K8s.Namespace" + Workload = "K8s.Workload" + Node = "K8s.Node" + ServiceNameSource = "AWS.ServiceNameSource" + Platform = "PlatformType" + InstanceID = "EC2.InstanceId" + AutoscalingGroup = "EC2.AutoScalingGroup" + + // The following are values used for the environment fallbacks required on EC2 + DeploymentEnvironmentFallbackPrefix = "ec2:" + DeploymentEnvironmentDefault = DeploymentEnvironmentFallbackPrefix + "default" +) + +// KeyAttributeEntityToShortNameMap is used to map key attributes from otel to the actual values used in the Entity object +var keyAttributeEntityToShortNameMap = map[string]string{ + AttributeEntityType: EntityType, + AttributeEntityResourceType: ResourceType, + AttributeEntityIdentifier: Identifier, + AttributeEntityAwsAccountId: AwsAccountId, + AttributeEntityServiceName: ServiceName, + AttributeEntityDeploymentEnvironment: DeploymentEnvironment, +} + +// attributeEntityToShortNameMap is used to map attributes from otel to the actual values used in the Entity object +var attributeEntityToShortNameMap = map[string]string{ + AttributeEntityNamespace: NamespaceField, + AttributeEntityWorkload: Workload, + AttributeEntityNode: Node, + AttributeEntityPlatformType: Platform, + AttributeEntityInstanceID: InstanceID, + AttributeEntityAutoScalingGroup: AutoscalingGroup, + AttributeEntityServiceNameSource: ServiceNameSource, +} + +func GetKeyAttributeEntityShortNameMap() map[string]string { + return keyAttributeEntityToShortNameMap +} + +// Cluster attribute prefix could be either EKS or K8s. We set the field once at runtime. +func GetAttributeEntityShortNameMap(platformType string) map[string]string { + if _, ok := attributeEntityToShortNameMap[AttributeEntityCluster]; !ok { + attributeEntityToShortNameMap[AttributeEntityCluster] = clusterType(platformType) + } + return attributeEntityToShortNameMap +} + +func clusterType(platformType string) string { + if platformType == AttributeEntityEKSPlatform { + return EksCluster + } else if platformType == AttributeEntityK8sPlatform { + return K8sCluster + } + return "" +} diff --git a/plugins/processors/awsentity/factory.go b/plugins/processors/awsentity/factory.go new file mode 100644 index 0000000000..32887ffa6a --- /dev/null +++ b/plugins/processors/awsentity/factory.go @@ -0,0 +1,55 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package awsentity + +import ( + "context" + "errors" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/processor" + "go.opentelemetry.io/collector/processor/processorhelper" +) + +const ( + stability = component.StabilityLevelBeta +) + +var ( + TypeStr, _ = component.NewType("awsentity") + processorCapabilities = consumer.Capabilities{MutatesData: false} +) + +func NewFactory() processor.Factory { + return processor.NewFactory( + TypeStr, + createDefaultConfig, + processor.WithMetrics(createMetricsProcessor, stability)) +} + +func createDefaultConfig() component.Config { + return &Config{} +} + +func createMetricsProcessor( + ctx context.Context, + set processor.CreateSettings, + cfg component.Config, + nextConsumer consumer.Metrics, +) (processor.Metrics, error) { + processorConfig, ok := cfg.(*Config) + if !ok { + return nil, errors.New("configuration parsing error") + } + metricsProcessor := newAwsEntityProcessor(processorConfig, set.Logger) + + return processorhelper.NewMetricsProcessor( + ctx, + set, + cfg, + nextConsumer, + metricsProcessor.processMetrics, + processorhelper.WithCapabilities(processorCapabilities)) +} diff --git a/plugins/processors/awsentity/factory_test.go b/plugins/processors/awsentity/factory_test.go new file mode 100644 index 0000000000..a00799bc55 --- /dev/null +++ b/plugins/processors/awsentity/factory_test.go @@ -0,0 +1,45 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package awsentity + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/processor/processortest" +) + +func TestCreateDefaultConfig(t *testing.T) { + factory := NewFactory() + require.NotNil(t, factory) + + cfg := factory.CreateDefaultConfig() + assert.NotNil(t, cfg, "failed to create default config") + assert.NoError(t, componenttest.CheckConfigStruct(cfg)) +} + +func TestCreateProcessor(t *testing.T) { + factory := NewFactory() + require.NotNil(t, factory) + + cfg := factory.CreateDefaultConfig() + setting := processortest.NewNopCreateSettings() + + tProcessor, err := factory.CreateTracesProcessor(context.Background(), setting, cfg, consumertest.NewNop()) + assert.Equal(t, err, component.ErrDataTypeIsNotSupported) + assert.Nil(t, tProcessor) + + mProcessor, err := factory.CreateMetricsProcessor(context.Background(), setting, cfg, consumertest.NewNop()) + assert.NoError(t, err) + assert.NotNil(t, mProcessor) + + lProcessor, err := factory.CreateLogsProcessor(context.Background(), setting, cfg, consumertest.NewNop()) + assert.Equal(t, err, component.ErrDataTypeIsNotSupported) + assert.Nil(t, lProcessor) +} diff --git a/plugins/processors/awsentity/internal/k8sattributescraper/k8sattributescraper.go b/plugins/processors/awsentity/internal/k8sattributescraper/k8sattributescraper.go new file mode 100644 index 0000000000..a563f3da96 --- /dev/null +++ b/plugins/processors/awsentity/internal/k8sattributescraper/k8sattributescraper.go @@ -0,0 +1,86 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package k8sattributescraper + +import ( + "go.opentelemetry.io/collector/pdata/pcommon" + semconv "go.opentelemetry.io/collector/semconv/v1.22.0" +) + +var ( + namespaceAllowlist = []string{ + semconv.AttributeK8SNamespaceName, + } + + // these kubernetes resource attributes are set by the openTelemtry operator + // see the code referecnes from upstream: + // * https://github.com/open-telemetry/opentelemetry-operator/blame/main/pkg/instrumentation/sdk.go#L421 + workloadAllowlist = []string{ + semconv.AttributeK8SDeploymentName, + semconv.AttributeK8SReplicaSetName, + semconv.AttributeK8SStatefulSetName, + semconv.AttributeK8SDaemonSetName, + semconv.AttributeK8SCronJobName, + semconv.AttributeK8SJobName, + semconv.AttributeK8SPodName, + semconv.AttributeK8SContainerName, + } + nodeAllowlist = []string{ + semconv.AttributeK8SNodeName, + } +) + +type K8sAttributeScraper struct { + Cluster string + Namespace string + Workload string + Node string +} + +func NewK8sAttributeScraper(clusterName string) *K8sAttributeScraper { + return &K8sAttributeScraper{ + Cluster: clusterName, + } +} + +func (e *K8sAttributeScraper) Scrape(rm pcommon.Resource) { + resourceAttrs := rm.Attributes() + e.scrapeNamespace(resourceAttrs) + e.scrapeWorkload(resourceAttrs) + e.scrapeNode(resourceAttrs) +} + +func (e *K8sAttributeScraper) scrapeNamespace(p pcommon.Map) { + for _, namespace := range namespaceAllowlist { + if namespaceAttr, ok := p.Get(namespace); ok { + e.Namespace = namespaceAttr.Str() + return + } + } +} + +func (e *K8sAttributeScraper) scrapeWorkload(p pcommon.Map) { + for _, workload := range workloadAllowlist { + if workloadAttr, ok := p.Get(workload); ok { + e.Workload = workloadAttr.Str() + return + } + } + +} + +func (e *K8sAttributeScraper) scrapeNode(p pcommon.Map) { + for _, node := range nodeAllowlist { + if nodeAttr, ok := p.Get(node); ok { + e.Node = nodeAttr.Str() + return + } + } +} + +func (e *K8sAttributeScraper) Reset() { + *e = K8sAttributeScraper{ + Cluster: e.Cluster, + } +} diff --git a/plugins/processors/awsentity/internal/k8sattributescraper/k8sattributescraper_test.go b/plugins/processors/awsentity/internal/k8sattributescraper/k8sattributescraper_test.go new file mode 100644 index 0000000000..81e46b35b3 --- /dev/null +++ b/plugins/processors/awsentity/internal/k8sattributescraper/k8sattributescraper_test.go @@ -0,0 +1,248 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package k8sattributescraper + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pdata/pmetric" + semconv "go.opentelemetry.io/collector/semconv/v1.22.0" +) + +func TestNewK8sAttributeScraper(t *testing.T) { + scraper := NewK8sAttributeScraper("test") + assert.Equal(t, "test", scraper.Cluster) +} + +func Test_k8sattributescraper_Scrape(t *testing.T) { + + tests := []struct { + name string + clusterName string + args pcommon.Resource + want *K8sAttributeScraper + }{ + { + name: "Empty", + clusterName: "", + args: pcommon.NewResource(), + want: &K8sAttributeScraper{}, + }, + { + name: "ClusterOnly", + clusterName: "test-cluster", + args: pcommon.NewResource(), + want: &K8sAttributeScraper{ + Cluster: "test-cluster", + }, + }, + { + name: "AllAppSignalAttributes", + clusterName: "test-cluster", + args: generateResourceMetrics(semconv.AttributeK8SNamespaceName, "test-namespace", semconv.AttributeK8SDeploymentName, "test-workload", semconv.AttributeK8SNodeName, "test-node"), + want: &K8sAttributeScraper{ + Cluster: "test-cluster", + Namespace: "test-namespace", + Workload: "test-workload", + Node: "test-node", + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := NewK8sAttributeScraper(tt.clusterName) + e.Scrape(tt.args) + assert.Equal(t, e, tt.want) + }) + } +} + +func Test_k8sattributescraper_reset(t *testing.T) { + type fields struct { + Cluster string + Namespace string + Workload string + Node string + } + tests := []struct { + name string + fields fields + want *K8sAttributeScraper + }{ + { + name: "Empty", + fields: fields{}, + want: &K8sAttributeScraper{}, + }, + { + name: "ClusterExists", + fields: fields{ + Cluster: "test-cluster", + }, + want: &K8sAttributeScraper{ + Cluster: "test-cluster", + }, + }, + { + name: "MultipleAttributeExists", + fields: fields{ + Cluster: "test-cluster", + Namespace: "test-namespace", + Workload: "test-workload", + Node: "test-node", + }, + want: &K8sAttributeScraper{ + Cluster: "test-cluster", + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := &K8sAttributeScraper{ + Cluster: tt.fields.Cluster, + Namespace: tt.fields.Namespace, + Workload: tt.fields.Workload, + Node: tt.fields.Node, + } + e.Reset() + assert.Equal(t, tt.want, e) + }) + } +} + +func Test_k8sattributescraper_scrapeNamespace(t *testing.T) { + tests := []struct { + name string + args pcommon.Map + want string + }{ + { + name: "Empty", + args: getAttributeMap(map[string]any{"": ""}), + want: "", + }, + { + name: "AppSignalNodeExists", + args: getAttributeMap(map[string]any{semconv.AttributeK8SNamespaceName: "namespace-name"}), + want: "namespace-name", + }, + { + name: "NonmatchingNamespace", + args: getAttributeMap(map[string]any{"namespace": "namespace-name"}), + want: "", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := &K8sAttributeScraper{} + e.scrapeNamespace(tt.args) + assert.Equal(t, tt.want, e.Namespace) + }) + } +} + +func Test_k8sattributescraper_scrapeNode(t *testing.T) { + tests := []struct { + name string + args pcommon.Map + want string + }{ + { + name: "Empty", + args: getAttributeMap(map[string]any{"": ""}), + want: "", + }, + { + name: "AppsignalNodeExists", + args: getAttributeMap(map[string]any{semconv.AttributeK8SNodeName: "node-name"}), + want: "node-name", + }, + { + name: "NonmatchingNode", + args: getAttributeMap(map[string]any{"node": "node-name"}), + want: "", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := &K8sAttributeScraper{} + e.scrapeNode(tt.args) + assert.Equal(t, tt.want, e.Node) + }) + } +} + +func Test_k8sattributescraper_scrapeWorkload(t *testing.T) { + tests := []struct { + name string + args pcommon.Map + want string + }{ + { + name: "Empty", + args: getAttributeMap(map[string]any{"": ""}), + want: "", + }, + { + name: "DeploymentWorkload", + args: getAttributeMap(map[string]any{semconv.AttributeK8SDeploymentName: "test-deployment"}), + want: "test-deployment", + }, + { + name: "DaemonsetWorkload", + args: getAttributeMap(map[string]any{semconv.AttributeK8SDaemonSetName: "test-daemonset"}), + want: "test-daemonset", + }, + { + name: "StatefulSetWorkload", + args: getAttributeMap(map[string]any{semconv.AttributeK8SStatefulSetName: "test-statefulset"}), + want: "test-statefulset", + }, + { + name: "ReplicaSetWorkload", + args: getAttributeMap(map[string]any{semconv.AttributeK8SReplicaSetName: "test-replicaset"}), + want: "test-replicaset", + }, + { + name: "ContainerWorkload", + args: getAttributeMap(map[string]any{semconv.AttributeK8SContainerName: "test-container"}), + want: "test-container", + }, + { + name: "MultipleWorkloads", + args: getAttributeMap(map[string]any{ + semconv.AttributeK8SDeploymentName: "test-deployment", + semconv.AttributeK8SContainerName: "test-container"}), + want: "test-deployment", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + e := &K8sAttributeScraper{} + e.scrapeWorkload(tt.args) + assert.Equal(t, tt.want, e.Workload) + }) + } +} + +func getAttributeMap(attributes map[string]any) pcommon.Map { + attrMap := pcommon.NewMap() + attrMap.FromRaw(attributes) + return attrMap +} + +func generateResourceMetrics(resourceAttrs ...string) pcommon.Resource { + md := pmetric.NewMetrics() + generateResource(md, resourceAttrs...) + return md.ResourceMetrics().At(0).Resource() +} + +func generateResource(md pmetric.Metrics, resourceAttrs ...string) { + attrs := md.ResourceMetrics().AppendEmpty().Resource().Attributes() + for i := 0; i < len(resourceAttrs); i += 2 { + attrs.PutStr(resourceAttrs[i], resourceAttrs[i+1]) + } +} diff --git a/plugins/processors/awsentity/processor.go b/plugins/processors/awsentity/processor.go new file mode 100644 index 0000000000..7492050cf7 --- /dev/null +++ b/plugins/processors/awsentity/processor.go @@ -0,0 +1,413 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package awsentity + +import ( + "context" + "strings" + + "github.com/go-playground/validator/v10" + "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pdata/pmetric" + semconv "go.opentelemetry.io/collector/semconv/v1.22.0" + "go.uber.org/zap" + + "github.com/aws/amazon-cloudwatch-agent/extension/entitystore" + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity/entityattributes" + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity/internal/k8sattributescraper" + "github.com/aws/amazon-cloudwatch-agent/translator/config" +) + +const ( + attributeAwsLogGroupNames = "aws.log.group.names" + attributeDeploymentEnvironment = "deployment.environment" + attributeServiceName = "service.name" + attributeService = "Service" + EMPTY = "" +) + +type scraper interface { + Scrape(rm pcommon.Resource) + Reset() +} + +type EC2ServiceAttributes struct { + InstanceId string `validate:"required"` + AutoScalingGroup string `validate:"omitempty"` + ServiceNameSource string `validate:"omitempty"` +} + +type K8sServiceAttributes struct { + Cluster string `validate:"required"` + Namespace string `validate:"required"` + Workload string `validate:"required"` + Node string `validate:"required"` + InstanceId string `validate:"omitempty"` + ServiceNameSource string `validate:"omitempty"` +} + +// use a single instance of Validate, it caches struct info +var validate = validator.New(validator.WithRequiredStructEnabled()) + +// exposed as a variable for unit testing +var addToEntityStore = func(logGroupName entitystore.LogGroupName, serviceName string, environmentName string) { + es := entitystore.GetEntityStore() + if es == nil { + return + } + es.AddServiceAttrEntryForLogGroup(logGroupName, serviceName, environmentName) +} + +var addPodToServiceEnvironmentMap = func(podName string, serviceName string, environmentName string, serviceNameSource string) { + es := entitystore.GetEntityStore() + if es == nil { + return + } + es.AddPodServiceEnvironmentMapping(podName, serviceName, environmentName, serviceNameSource) +} + +var getEC2InfoFromEntityStore = func() entitystore.EC2Info { + es := entitystore.GetEntityStore() + if es == nil { + return entitystore.EC2Info{} + } + + return es.EC2Info() +} + +var getServiceNameSource = func() (string, string) { + es := entitystore.GetEntityStore() + if es == nil { + return EMPTY, EMPTY + } + return es.GetMetricServiceNameAndSource() +} + +// awsEntityProcessor looks for metrics that have the aws.log.group.names and either the service.name or +// deployment.environment resource attributes set, then adds the association between the log group(s) and the +// service/environment names to the entitystore extension. +type awsEntityProcessor struct { + config *Config + k8sscraper scraper + logger *zap.Logger +} + +func newAwsEntityProcessor(config *Config, logger *zap.Logger) *awsEntityProcessor { + return &awsEntityProcessor{ + config: config, + k8sscraper: k8sattributescraper.NewK8sAttributeScraper(config.ClusterName), + logger: logger, + } +} + +func (p *awsEntityProcessor) processMetrics(_ context.Context, md pmetric.Metrics) (pmetric.Metrics, error) { + // Get the following metric attributes from the EntityStore: PlatformType, EC2.InstanceId, EC2.AutoScalingGroup + + rm := md.ResourceMetrics() + for i := 0; i < rm.Len(); i++ { + var logGroupNames, serviceName, environmentName string + var entityServiceNameSource, entityPlatformType string + var ec2Info entitystore.EC2Info + resourceAttrs := rm.At(i).Resource().Attributes() + switch p.config.EntityType { + case entityattributes.Resource: + if p.config.Platform == config.ModeEC2 { + ec2Info = getEC2InfoFromEntityStore() + if ec2Info.GetInstanceID() != EMPTY { + resourceAttrs.PutStr(entityattributes.AttributeEntityType, entityattributes.AttributeEntityAWSResource) + resourceAttrs.PutStr(entityattributes.AttributeEntityResourceType, entityattributes.AttributeEntityEC2InstanceResource) + resourceAttrs.PutStr(entityattributes.AttributeEntityIdentifier, ec2Info.GetInstanceID()) + } + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityAwsAccountId, ec2Info.GetAccountID()) + } + case entityattributes.Service: + if logGroupNamesAttr, ok := resourceAttrs.Get(attributeAwsLogGroupNames); ok { + logGroupNames = logGroupNamesAttr.Str() + } + if serviceNameAttr, ok := resourceAttrs.Get(attributeServiceName); ok { + serviceName = serviceNameAttr.Str() + } + if environmentNameAttr, ok := resourceAttrs.Get(attributeDeploymentEnvironment); ok { + environmentName = environmentNameAttr.Str() + } + if serviceNameSource, sourceExists := resourceAttrs.Get(entityattributes.AttributeEntityServiceNameSource); sourceExists { + entityServiceNameSource = serviceNameSource.Str() + } + + entityServiceName := getServiceAttributes(resourceAttrs) + entityEnvironmentName := environmentName + if (entityServiceName == EMPTY || entityEnvironmentName == EMPTY) && p.config.ScrapeDatapointAttribute { + entityServiceName, entityEnvironmentName, entityServiceNameSource = p.scrapeServiceAttribute(rm.At(i).ScopeMetrics()) + // If the entityServiceNameSource is empty here, that means it was not configured via instrumentation + // If entityServiceName is a datapoint attribute, that means the service name is coming from the UserConfiguration source + if entityServiceNameSource == entityattributes.AttributeServiceNameSourceUserConfig && entityServiceName != EMPTY { + entityServiceNameSource = entityattributes.AttributeServiceNameSourceUserConfig + } + } + if p.config.KubernetesMode != "" { + p.k8sscraper.Scrape(rm.At(i).Resource()) + if p.config.Platform == config.ModeEC2 { + ec2Info = getEC2InfoFromEntityStore() + } + + if p.config.KubernetesMode == config.ModeEKS { + entityPlatformType = entityattributes.AttributeEntityEKSPlatform + } else { + entityPlatformType = entityattributes.AttributeEntityK8sPlatform + } + + podInfo, ok := p.k8sscraper.(*k8sattributescraper.K8sAttributeScraper) + // Perform fallback mechanism for service and environment name if they + // are empty + if entityServiceName == EMPTY && ok && podInfo != nil && podInfo.Workload != EMPTY { + entityServiceName = podInfo.Workload + entityServiceNameSource = entitystore.ServiceNameSourceK8sWorkload + } + + if entityEnvironmentName == EMPTY && ok && podInfo.Cluster != EMPTY && podInfo.Namespace != EMPTY { + if p.config.KubernetesMode == config.ModeEKS { + entityEnvironmentName = "eks:" + p.config.ClusterName + "/" + podInfo.Namespace + } else if p.config.KubernetesMode == config.ModeK8sEC2 || p.config.KubernetesMode == config.ModeK8sOnPrem { + entityEnvironmentName = "k8s:" + p.config.ClusterName + "/" + podInfo.Namespace + } + } + + // Add service information for a pod to the pod association map + // so that agent can host this information in a server + fullPodName := scrapeK8sPodName(resourceAttrs) + if fullPodName != EMPTY && entityServiceName != EMPTY && entityServiceNameSource != EMPTY { + addPodToServiceEnvironmentMap(fullPodName, entityServiceName, entityEnvironmentName, entityServiceNameSource) + } else if fullPodName != EMPTY && entityServiceName != EMPTY && entityServiceNameSource == EMPTY { + addPodToServiceEnvironmentMap(fullPodName, entityServiceName, entityEnvironmentName, entitystore.ServiceNameSourceUnknown) + } + eksAttributes := K8sServiceAttributes{ + Cluster: podInfo.Cluster, + Namespace: podInfo.Namespace, + Workload: podInfo.Workload, + Node: podInfo.Node, + InstanceId: ec2Info.GetInstanceID(), + ServiceNameSource: entityServiceNameSource, + } + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityType, entityattributes.Service) + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityServiceName, entityServiceName) + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityDeploymentEnvironment, entityEnvironmentName) + + if err := validate.Struct(eksAttributes); err == nil { + resourceAttrs.PutStr(entityattributes.AttributeEntityPlatformType, entityPlatformType) + resourceAttrs.PutStr(entityattributes.AttributeEntityCluster, eksAttributes.Cluster) + resourceAttrs.PutStr(entityattributes.AttributeEntityNamespace, eksAttributes.Namespace) + resourceAttrs.PutStr(entityattributes.AttributeEntityWorkload, eksAttributes.Workload) + resourceAttrs.PutStr(entityattributes.AttributeEntityNode, eksAttributes.Node) + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityInstanceID, ec2Info.GetInstanceID()) + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityAwsAccountId, ec2Info.GetAccountID()) + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityServiceNameSource, entityServiceNameSource) + } + p.k8sscraper.Reset() + } else if p.config.Platform == config.ModeEC2 { + //If entityServiceNameSource is empty, it was not configured via the config. Get the source in descending priority + // 1. Incoming telemetry attributes + // 2. CWA config + // 3. instance tags - The tags attached to the EC2 instance. Only scrape for tag with the following key: service, application, app + // 4. IAM Role - The IAM role name retrieved through IMDS(Instance Metadata Service) + if entityServiceName == EMPTY && entityServiceNameSource == EMPTY { + entityServiceName, entityServiceNameSource = getServiceNameSource() + } else if entityServiceName != EMPTY && entityServiceNameSource == EMPTY { + entityServiceNameSource = entitystore.ServiceNameSourceUnknown + } + + entityPlatformType = entityattributes.AttributeEntityEC2Platform + ec2Info = getEC2InfoFromEntityStore() + + if entityEnvironmentName == EMPTY { + if ec2Info.GetAutoScalingGroup() != EMPTY { + entityEnvironmentName = entityattributes.DeploymentEnvironmentFallbackPrefix + ec2Info.GetAutoScalingGroup() + } else { + entityEnvironmentName = entityattributes.DeploymentEnvironmentDefault + } + } + + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityType, entityattributes.Service) + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityServiceName, entityServiceName) + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityDeploymentEnvironment, entityEnvironmentName) + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityAwsAccountId, ec2Info.GetAccountID()) + + ec2Attributes := EC2ServiceAttributes{ + InstanceId: ec2Info.GetInstanceID(), + AutoScalingGroup: ec2Info.GetAutoScalingGroup(), + ServiceNameSource: entityServiceNameSource, + } + if err := validate.Struct(ec2Attributes); err == nil { + resourceAttrs.PutStr(entityattributes.AttributeEntityPlatformType, entityPlatformType) + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityInstanceID, ec2Attributes.InstanceId) + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityAutoScalingGroup, ec2Attributes.AutoScalingGroup) + AddAttributeIfNonEmpty(resourceAttrs, entityattributes.AttributeEntityServiceNameSource, ec2Attributes.ServiceNameSource) + } + } + if logGroupNames == EMPTY || (serviceName == EMPTY && environmentName == EMPTY) { + continue + } + + logGroupNamesSlice := strings.Split(logGroupNames, "&") + for _, logGroupName := range logGroupNamesSlice { + if logGroupName == EMPTY { + continue + } + addToEntityStore(entitystore.LogGroupName(logGroupName), serviceName, environmentName) + } + } + + } + return md, nil +} + +// scrapeServiceAttribute expands the datapoint attributes and search for +// service name and environment attributes. This is only used for components +// that only emit attributes on datapoint level. +func (p *awsEntityProcessor) scrapeServiceAttribute(scopeMetric pmetric.ScopeMetricsSlice) (string, string, string) { + entityServiceName := EMPTY + entityServiceNameSource := EMPTY + entityEnvironmentName := EMPTY + for j := 0; j < scopeMetric.Len(); j++ { + metric := scopeMetric.At(j).Metrics() + for k := 0; k < metric.Len(); k++ { + if entityServiceName != EMPTY && entityEnvironmentName != EMPTY && entityServiceNameSource != EMPTY { + return entityServiceName, entityEnvironmentName, entityServiceNameSource + } + m := metric.At(k) + switch m.Type() { + case pmetric.MetricTypeGauge: + dps := m.Gauge().DataPoints() + for l := 0; l < dps.Len(); l++ { + dpService := getServiceAttributes(dps.At(l).Attributes()) + if dpService != EMPTY { + entityServiceName = dpService + } + if dpServiceNameSource, ok := dps.At(l).Attributes().Get(entityattributes.AttributeServiceNameSource); ok { + entityServiceNameSource = dpServiceNameSource.Str() + dps.At(l).Attributes().Remove(semconv.AttributeServiceName) + dps.At(l).Attributes().Remove(entityattributes.AttributeServiceNameSource) + } + if dpEnvironment, ok := dps.At(l).Attributes().Get(semconv.AttributeDeploymentEnvironment); ok { + entityEnvironmentName = dpEnvironment.Str() + } + if _, ok := dps.At(l).Attributes().Get(entityattributes.AttributeDeploymentEnvironmentSource); ok { + dps.At(l).Attributes().Remove(semconv.AttributeDeploymentEnvironment) + dps.At(l).Attributes().Remove(entityattributes.AttributeDeploymentEnvironmentSource) + } + + } + case pmetric.MetricTypeSum: + dps := m.Sum().DataPoints() + for l := 0; l < dps.Len(); l++ { + dpService := getServiceAttributes(dps.At(l).Attributes()) + if dpService != EMPTY { + entityServiceName = dpService + } + if dpServiceNameSource, ok := dps.At(l).Attributes().Get(entityattributes.AttributeServiceNameSource); ok { + entityServiceNameSource = dpServiceNameSource.Str() + dps.At(l).Attributes().Remove(semconv.AttributeServiceName) + dps.At(l).Attributes().Remove(entityattributes.AttributeServiceNameSource) + } + if dpEnvironment, ok := dps.At(l).Attributes().Get(semconv.AttributeDeploymentEnvironment); ok { + entityEnvironmentName = dpEnvironment.Str() + } + if _, ok := dps.At(l).Attributes().Get(entityattributes.AttributeDeploymentEnvironmentSource); ok { + dps.At(l).Attributes().Remove(semconv.AttributeDeploymentEnvironment) + dps.At(l).Attributes().Remove(entityattributes.AttributeDeploymentEnvironmentSource) + } + } + case pmetric.MetricTypeHistogram: + dps := m.Histogram().DataPoints() + for l := 0; l < dps.Len(); l++ { + dpService := getServiceAttributes(dps.At(l).Attributes()) + if dpService != EMPTY { + entityServiceName = dpService + } + if dpServiceNameSource, ok := dps.At(l).Attributes().Get(entityattributes.AttributeServiceNameSource); ok { + entityServiceNameSource = dpServiceNameSource.Str() + dps.At(l).Attributes().Remove(semconv.AttributeServiceName) + dps.At(l).Attributes().Remove(entityattributes.AttributeServiceNameSource) + } + if dpEnvironment, ok := dps.At(l).Attributes().Get(semconv.AttributeDeploymentEnvironment); ok { + entityEnvironmentName = dpEnvironment.Str() + } + if _, ok := dps.At(l).Attributes().Get(entityattributes.AttributeDeploymentEnvironmentSource); ok { + dps.At(l).Attributes().Remove(semconv.AttributeDeploymentEnvironment) + dps.At(l).Attributes().Remove(entityattributes.AttributeDeploymentEnvironmentSource) + } + } + case pmetric.MetricTypeExponentialHistogram: + dps := m.ExponentialHistogram().DataPoints() + for l := 0; l < dps.Len(); l++ { + dpService := getServiceAttributes(dps.At(l).Attributes()) + if dpService != EMPTY { + entityServiceName = dpService + } + if dpServiceNameSource, ok := dps.At(l).Attributes().Get(entityattributes.AttributeServiceNameSource); ok { + entityServiceNameSource = dpServiceNameSource.Str() + dps.At(l).Attributes().Remove(semconv.AttributeServiceName) + dps.At(l).Attributes().Remove(entityattributes.AttributeServiceNameSource) + } + if dpEnvironment, ok := dps.At(l).Attributes().Get(semconv.AttributeDeploymentEnvironment); ok { + entityEnvironmentName = dpEnvironment.Str() + } + if _, ok := dps.At(l).Attributes().Get(entityattributes.AttributeDeploymentEnvironmentSource); ok { + dps.At(l).Attributes().Remove(semconv.AttributeDeploymentEnvironment) + dps.At(l).Attributes().Remove(entityattributes.AttributeDeploymentEnvironmentSource) + } + } + case pmetric.MetricTypeSummary: + dps := m.Sum().DataPoints() + for l := 0; l < dps.Len(); l++ { + dpService := getServiceAttributes(dps.At(l).Attributes()) + if dpService != EMPTY { + entityServiceName = dpService + } + if dpServiceNameSource, ok := dps.At(l).Attributes().Get(entityattributes.AttributeServiceNameSource); ok { + entityServiceNameSource = dpServiceNameSource.Str() + dps.At(l).Attributes().Remove(semconv.AttributeServiceName) + dps.At(l).Attributes().Remove(entityattributes.AttributeServiceNameSource) + } + if dpEnvironment, ok := dps.At(l).Attributes().Get(semconv.AttributeDeploymentEnvironment); ok { + entityEnvironmentName = dpEnvironment.Str() + } + if _, ok := dps.At(l).Attributes().Get(entityattributes.AttributeDeploymentEnvironmentSource); ok { + dps.At(l).Attributes().Remove(semconv.AttributeDeploymentEnvironment) + dps.At(l).Attributes().Remove(entityattributes.AttributeDeploymentEnvironmentSource) + } + } + default: + p.logger.Debug("Ignore unknown metric type", zap.String("type", m.Type().String())) + } + + } + } + return entityServiceName, entityEnvironmentName, entityServiceNameSource +} + +// getServiceAttributes prioritize service name retrieval based on +// following attribute priority +// 1. service.name +// 2. Service +// Service is needed because Container Insights mainly uses Service as +// attribute for customer workflows +// https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Container-Insights-metrics-EKS.html +func getServiceAttributes(p pcommon.Map) string { + if serviceName, ok := p.Get(semconv.AttributeServiceName); ok { + return serviceName.Str() + } + if serviceName, ok := p.Get(attributeService); ok { + return serviceName.Str() + } + return EMPTY +} + +// scrapeK8sPodName gets the k8s pod name which is full pod name from the resource attributes +// This is needed to map the pod to the service/environment +func scrapeK8sPodName(p pcommon.Map) string { + if podAttr, ok := p.Get(semconv.AttributeK8SPodName); ok { + return podAttr.Str() + } + return EMPTY +} diff --git a/plugins/processors/awsentity/processor_test.go b/plugins/processors/awsentity/processor_test.go new file mode 100644 index 0000000000..bd263e0a4f --- /dev/null +++ b/plugins/processors/awsentity/processor_test.go @@ -0,0 +1,779 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package awsentity + +import ( + "bytes" + "context" + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pdata/pmetric" + semconv "go.opentelemetry.io/collector/semconv/v1.22.0" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" + + "github.com/aws/amazon-cloudwatch-agent/extension/entitystore" + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity/entityattributes" + "github.com/aws/amazon-cloudwatch-agent/translator/config" +) + +type mockEntityStore struct { + entries []entityStoreEntry + podToServiceEnvironmentMap map[string]entitystore.ServiceEnvironment +} + +type entityStoreEntry struct { + logGroupName entitystore.LogGroupName + serviceName string + environmentName string +} + +func newMockEntityStore() *mockEntityStore { + return &mockEntityStore{ + entries: make([]entityStoreEntry, 0), + podToServiceEnvironmentMap: make(map[string]entitystore.ServiceEnvironment), + } +} + +func newMockAddPodServiceEnvironmentMapping(es *mockEntityStore) func(string, string, string, string) { + return func(podName string, serviceName string, deploymentName string, serviceNameSource string) { + es.podToServiceEnvironmentMap[podName] = entitystore.ServiceEnvironment{ServiceName: serviceName, Environment: deploymentName, ServiceNameSource: serviceNameSource} + } +} + +func newAddToMockEntityStore(rs *mockEntityStore) func(entitystore.LogGroupName, string, string) { + return func(logGroupName entitystore.LogGroupName, serviceName string, environmentName string) { + rs.entries = append(rs.entries, entityStoreEntry{ + logGroupName: logGroupName, + serviceName: serviceName, + environmentName: environmentName, + }) + } +} + +func newMockGetMetricAttributesFromEntityStore() func() map[string]*string { + mockPlatform := "AWS::EC2" + mockInstanceID := "i-123456789" + mockAutoScalingGroup := "auto-scaling" + return func() map[string]*string { + return map[string]*string{ + entitystore.PlatformType: &mockPlatform, + entitystore.InstanceIDKey: &mockInstanceID, + entitystore.ASGKey: &mockAutoScalingGroup, + } + } +} + +func newMockGetServiceNameAndSource(service, source string) func() (string, string) { + return func() (string, string) { + return service, source + } +} + +func newMockGetEC2InfoFromEntityStore(instance, accountId, asg string) func() entitystore.EC2Info { + return func() entitystore.EC2Info { + return entitystore.EC2Info{ + InstanceID: instance, + AccountID: accountId, + AutoScalingGroup: asg, + } + } +} + +// This helper function creates a test logger +// so that it can send the log messages into a +// temporary buffer for pattern matching +func CreateTestLogger(buf *bytes.Buffer) *zap.Logger { + writer := zapcore.AddSync(buf) + + // Create a custom zapcore.Core that writes to the buffer + encoder := zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()) + core := zapcore.NewCore(encoder, writer, zapcore.DebugLevel) + logger := zap.New(core) + return logger +} + +func TestProcessMetricsLogGroupAssociation(t *testing.T) { + logger, _ := zap.NewDevelopment() + p := newAwsEntityProcessor(&Config{ + EntityType: attributeService, + }, logger) + ctx := context.Background() + + // empty metrics, no action + // metrics with no log group names, no action + // metrics with no service/environment, no action + // metrics with log group name and service, add to rs + // metrics with log group name and env, add to rs + // metrics with log group name and both, add to rs + // metrics with two log group names, add both + // metrics with two resourcemetrics, add both + tests := []struct { + name string + metrics pmetric.Metrics + want []entityStoreEntry + }{ + { + name: "EmptyMetrics", + metrics: pmetric.NewMetrics(), + want: []entityStoreEntry{}, + }, + { + name: "NoLogGroupNames", + metrics: generateMetrics(attributeServiceName, "test-service", attributeDeploymentEnvironment, "test-environment"), + want: []entityStoreEntry{}, + }, + { + name: "NoServiceOrEnvironment", + metrics: generateMetrics(attributeAwsLogGroupNames, "test-log-group"), + want: []entityStoreEntry{}, + }, + { + name: "LogGroupNameAndService", + metrics: generateMetrics(attributeAwsLogGroupNames, "test-log-group", attributeServiceName, "test-service"), + want: []entityStoreEntry{{logGroupName: "test-log-group", serviceName: "test-service"}}, + }, + { + name: "LogGroupNameAndEnvironment", + metrics: generateMetrics(attributeAwsLogGroupNames, "test-log-group", attributeDeploymentEnvironment, "test-environment"), + want: []entityStoreEntry{{logGroupName: "test-log-group", environmentName: "test-environment"}}, + }, + { + name: "LogGroupNameAndServiceAndEnvironment", + metrics: generateMetrics(attributeAwsLogGroupNames, "test-log-group", attributeServiceName, "test-service", attributeDeploymentEnvironment, "test-environment"), + want: []entityStoreEntry{{logGroupName: "test-log-group", serviceName: "test-service", environmentName: "test-environment"}}, + }, + { + name: "TwoLogGroupNames", + metrics: generateMetrics(attributeAwsLogGroupNames, "test-log-group1&test-log-group2", attributeServiceName, "test-service"), + want: []entityStoreEntry{ + {logGroupName: "test-log-group1", serviceName: "test-service"}, + {logGroupName: "test-log-group2", serviceName: "test-service"}, + }, + }, + { + name: "EmptyLogGroupNames", + metrics: generateMetrics(attributeAwsLogGroupNames, "&&test-log-group1&&test-log-group2&&", attributeServiceName, "test-service"), + want: []entityStoreEntry{ + {logGroupName: "test-log-group1", serviceName: "test-service"}, + {logGroupName: "test-log-group2", serviceName: "test-service"}, + }, + }, + { + name: "TwoResourceMetrics", + metrics: generateMetricsWithTwoResources(), + want: []entityStoreEntry{ + {logGroupName: "test-log-group1", serviceName: "test-service1"}, + {logGroupName: "test-log-group2", serviceName: "test-service2"}, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + rs := newMockEntityStore() + addToEntityStore = newAddToMockEntityStore(rs) + _, err := p.processMetrics(ctx, tt.metrics) + assert.NoError(t, err) + assert.Equal(t, tt.want, rs.entries) + }) + } +} + +func TestProcessMetricsForAddingPodToServiceMap(t *testing.T) { + logger, _ := zap.NewDevelopment() + p := newAwsEntityProcessor(&Config{ClusterName: "test-cluster", EntityType: attributeService}, logger) + ctx := context.Background() + tests := []struct { + name string + metrics pmetric.Metrics + k8sMode string + want map[string]entitystore.ServiceEnvironment + }{ + { + name: "WithPodNameAndServiceNameNoSource", + metrics: generateMetrics(attributeServiceName, "test-service", semconv.AttributeK8SPodName, "cloudwatch-agent-adhgaf"), + want: map[string]entitystore.ServiceEnvironment{"cloudwatch-agent-adhgaf": {ServiceName: "test-service", ServiceNameSource: entitystore.ServiceNameSourceUnknown}}, + k8sMode: config.ModeEKS, + }, + { + name: "WithPodNameAndServiceNameHasSource", + metrics: generateMetrics(attributeServiceName, "test-service", semconv.AttributeK8SPodName, "cloudwatch-agent-adhgaf", entityattributes.AttributeEntityServiceNameSource, "Instrumentation"), + want: map[string]entitystore.ServiceEnvironment{"cloudwatch-agent-adhgaf": {ServiceName: "test-service", ServiceNameSource: entitystore.ServiceNameSourceInstrumentation}}, + k8sMode: config.ModeEKS, + }, + { + name: "WithPodNameAndServiceNameHasSourceDefaultEnvironmentEKS", + metrics: generateMetrics(attributeServiceName, "test-service", semconv.AttributeK8SPodName, "cloudwatch-agent-adhgaf", semconv.AttributeK8SNamespaceName, "test-namespace", entityattributes.AttributeEntityServiceNameSource, "Instrumentation"), + want: map[string]entitystore.ServiceEnvironment{"cloudwatch-agent-adhgaf": {ServiceName: "test-service", Environment: "eks:test-cluster/test-namespace", ServiceNameSource: entitystore.ServiceNameSourceInstrumentation}}, + k8sMode: config.ModeEKS, + }, + { + name: "WithPodNameAndServiceNameHasSourceDefaultEnvironmentK8SEC2", + metrics: generateMetrics(attributeServiceName, "test-service", semconv.AttributeK8SPodName, "cloudwatch-agent-adhgaf", semconv.AttributeK8SNamespaceName, "test-namespace", entityattributes.AttributeEntityServiceNameSource, "Instrumentation"), + want: map[string]entitystore.ServiceEnvironment{"cloudwatch-agent-adhgaf": {ServiceName: "test-service", Environment: "k8s:test-cluster/test-namespace", ServiceNameSource: entitystore.ServiceNameSourceInstrumentation}}, + k8sMode: config.ModeK8sEC2, + }, + { + name: "WithPodNameAndServiceNameHasSourceDefaultEnvironmentK8SOnPrem", + metrics: generateMetrics(attributeServiceName, "test-service", semconv.AttributeK8SPodName, "cloudwatch-agent-adhgaf", semconv.AttributeK8SNamespaceName, "test-namespace", entityattributes.AttributeEntityServiceNameSource, "Instrumentation"), + want: map[string]entitystore.ServiceEnvironment{"cloudwatch-agent-adhgaf": {ServiceName: "test-service", Environment: "k8s:test-cluster/test-namespace", ServiceNameSource: entitystore.ServiceNameSourceInstrumentation}}, + k8sMode: config.ModeK8sOnPrem, + }, + { + name: "WithPodNameAndServiceEnvironmentNameNoSource", + metrics: generateMetrics(attributeServiceName, "test-service", semconv.AttributeK8SPodName, "cloudwatch-agent-adhgaf", attributeDeploymentEnvironment, "test-deployment"), + want: map[string]entitystore.ServiceEnvironment{"cloudwatch-agent-adhgaf": {ServiceName: "test-service", Environment: "test-deployment", ServiceNameSource: entitystore.ServiceNameSourceUnknown}}, + k8sMode: config.ModeK8sEC2, + }, + { + name: "WithPodNameAndServiceEnvironmentNameHasSource", + metrics: generateMetrics(attributeServiceName, "test-service", semconv.AttributeK8SPodName, "cloudwatch-agent-adhgaf", attributeDeploymentEnvironment, "test-deployment", entityattributes.AttributeEntityServiceNameSource, "Instrumentation"), + want: map[string]entitystore.ServiceEnvironment{"cloudwatch-agent-adhgaf": {ServiceName: "test-service", Environment: "test-deployment", ServiceNameSource: entitystore.ServiceNameSourceInstrumentation}}, + k8sMode: config.ModeK8sEC2, + }, + { + name: "WithPodNameAndAttributeService", + metrics: generateMetrics(attributeService, "test-service", semconv.AttributeK8SPodName, "cloudwatch-agent-adhgaf", entityattributes.AttributeEntityServiceNameSource, "Instrumentation"), + want: map[string]entitystore.ServiceEnvironment{"cloudwatch-agent-adhgaf": {ServiceName: "test-service", ServiceNameSource: entitystore.ServiceNameSourceInstrumentation}}, + k8sMode: config.ModeK8sOnPrem, + }, + { + name: "WithPodNameAndWorkload", + metrics: generateMetrics(attributeServiceName, "cloudwatch-agent-adhgaf", semconv.AttributeK8SPodName, "cloudwatch-agent-adhgaf", entityattributes.AttributeEntityServiceNameSource, "K8sWorkload"), + want: map[string]entitystore.ServiceEnvironment{"cloudwatch-agent-adhgaf": {ServiceName: "cloudwatch-agent-adhgaf", ServiceNameSource: entitystore.ServiceNameSourceK8sWorkload}}, + k8sMode: config.ModeEKS, + }, + { + name: "WithPodNameAndEmptyServiceAndEnvironmentName", + metrics: generateMetrics(semconv.AttributeK8SPodName, "cloudwatch-agent-adhgaf"), + k8sMode: config.ModeEKS, + want: map[string]entitystore.ServiceEnvironment{"cloudwatch-agent-adhgaf": {ServiceName: "cloudwatch-agent-adhgaf", ServiceNameSource: entitystore.ServiceNameSourceK8sWorkload}}, + }, + { + name: "WithEmptyPodName", + metrics: generateMetrics(), + k8sMode: config.ModeEKS, + want: map[string]entitystore.ServiceEnvironment{}, + }, + { + name: "WithEmptyKubernetesMode", + metrics: generateMetrics(semconv.AttributeK8SPodName, "cloudwatch-agent-adhgaf"), + want: map[string]entitystore.ServiceEnvironment{}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + es := newMockEntityStore() + addPodToServiceEnvironmentMap = newMockAddPodServiceEnvironmentMapping(es) + p.config.KubernetesMode = tt.k8sMode + _, err := p.processMetrics(ctx, tt.metrics) + assert.NoError(t, err) + assert.Equal(t, tt.want, es.podToServiceEnvironmentMap) + }) + } +} + +func TestProcessMetricsResourceAttributeScraping(t *testing.T) { + logger, _ := zap.NewDevelopment() + ctx := context.Background() + tests := []struct { + name string + platform string + kubernetesMode string + clusterName string + metrics pmetric.Metrics + mockServiceNameSource func() (string, string) + mockGetEC2InfoFromEntityStore func() entitystore.EC2Info + want map[string]any + }{ + { + name: "EmptyMetrics", + platform: config.ModeEC2, + metrics: pmetric.NewMetrics(), + want: map[string]any{}, + }, + //NOTE 2 SELF: These tests assume that we are on the EC2 platform, so make sure to mock the ServiceNameSource function + { + name: "ResourceAttributeServiceNameOnly", + platform: config.ModeEC2, + metrics: generateMetrics(attributeServiceName, "test-service"), + mockServiceNameSource: newMockGetServiceNameAndSource("test-service-name", "Instrumentation"), + mockGetEC2InfoFromEntityStore: newMockGetEC2InfoFromEntityStore("i-123456789", "0123456789012", ""), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "test-service", + entityattributes.AttributeEntityPlatformType: "AWS::EC2", + entityattributes.AttributeEntityInstanceID: "i-123456789", + entityattributes.AttributeEntityAwsAccountId: "0123456789012", + entityattributes.AttributeEntityServiceNameSource: "Unknown", + entityattributes.AttributeEntityDeploymentEnvironment: "ec2:default", + attributeServiceName: "test-service", + }, + }, + { + name: "ResourceAttributeEnvironmentOnly", + platform: config.ModeEC2, + metrics: generateMetrics(attributeDeploymentEnvironment, "test-environment"), + mockServiceNameSource: newMockGetServiceNameAndSource("unknown_service", "Unknown"), + mockGetEC2InfoFromEntityStore: newMockGetEC2InfoFromEntityStore("i-123456789", "0123456789012", ""), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "unknown_service", + entityattributes.AttributeEntityDeploymentEnvironment: "test-environment", + entityattributes.AttributeEntityPlatformType: "AWS::EC2", + entityattributes.AttributeEntityInstanceID: "i-123456789", + entityattributes.AttributeEntityAwsAccountId: "0123456789012", + entityattributes.AttributeEntityServiceNameSource: "Unknown", + + attributeDeploymentEnvironment: "test-environment", + }, + }, + { + name: "ResourceAttributeServiceNameAndEnvironment", + platform: config.ModeEC2, + metrics: generateMetrics(attributeServiceName, "test-service", attributeDeploymentEnvironment, "test-environment"), + mockServiceNameSource: newMockGetServiceNameAndSource("test-service-name", "Instrumentation"), + mockGetEC2InfoFromEntityStore: newMockGetEC2InfoFromEntityStore("i-123456789", "0123456789012", "test-auto-scaling"), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "test-service", + entityattributes.AttributeEntityDeploymentEnvironment: "test-environment", + attributeServiceName: "test-service", + attributeDeploymentEnvironment: "test-environment", + entityattributes.AttributeEntityServiceNameSource: "Unknown", + entityattributes.AttributeEntityPlatformType: "AWS::EC2", + entityattributes.AttributeEntityInstanceID: "i-123456789", + entityattributes.AttributeEntityAwsAccountId: "0123456789012", + entityattributes.AttributeEntityAutoScalingGroup: "test-auto-scaling", + }, + }, + { + name: "ResourceAttributeWorkloadFallback", + kubernetesMode: config.ModeEKS, + clusterName: "test-cluster", + metrics: generateMetrics(semconv.AttributeK8SNamespaceName, "test-namespace", semconv.AttributeK8SDeploymentName, "test-workload", semconv.AttributeK8SNodeName, "test-node"), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "test-workload", + entityattributes.AttributeEntityDeploymentEnvironment: "eks:test-cluster/test-namespace", + entityattributes.AttributeEntityCluster: "test-cluster", + entityattributes.AttributeEntityNamespace: "test-namespace", + entityattributes.AttributeEntityNode: "test-node", + entityattributes.AttributeEntityWorkload: "test-workload", + entityattributes.AttributeEntityServiceNameSource: "K8sWorkload", + entityattributes.AttributeEntityPlatformType: "AWS::EKS", + semconv.AttributeK8SNamespaceName: "test-namespace", + semconv.AttributeK8SDeploymentName: "test-workload", + semconv.AttributeK8SNodeName: "test-node", + }, + }, + { + name: "ResourceAttributeEnvironmentFallbackToASG", + platform: config.ModeEC2, + metrics: generateMetrics(), + mockServiceNameSource: newMockGetServiceNameAndSource("unknown_service", "Unknown"), + mockGetEC2InfoFromEntityStore: newMockGetEC2InfoFromEntityStore("i-123456789", "0123456789012", "test-asg"), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "unknown_service", + entityattributes.AttributeEntityDeploymentEnvironment: "ec2:test-asg", + entityattributes.AttributeEntityPlatformType: "AWS::EC2", + entityattributes.AttributeEntityInstanceID: "i-123456789", + entityattributes.AttributeEntityAwsAccountId: "0123456789012", + entityattributes.AttributeEntityServiceNameSource: "Unknown", + entityattributes.AttributeEntityAutoScalingGroup: "test-asg", + }, + }, + { + name: "ResourceAttributeEnvironmentFallbackToDefault", + platform: config.ModeEC2, + metrics: generateMetrics(), + mockServiceNameSource: newMockGetServiceNameAndSource("unknown_service", "Unknown"), + mockGetEC2InfoFromEntityStore: newMockGetEC2InfoFromEntityStore("i-123456789", "0123456789012", ""), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "unknown_service", + entityattributes.AttributeEntityDeploymentEnvironment: "ec2:default", + entityattributes.AttributeEntityPlatformType: "AWS::EC2", + entityattributes.AttributeEntityInstanceID: "i-123456789", + entityattributes.AttributeEntityAwsAccountId: "0123456789012", + entityattributes.AttributeEntityServiceNameSource: "Unknown", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Make copy of original functions to use as resets later to prevent failing test when tests are ran in bulk + resetServiceNameSource := getServiceNameSource + if tt.mockServiceNameSource != nil { + getServiceNameSource = tt.mockServiceNameSource + } + if tt.mockGetEC2InfoFromEntityStore != nil { + getEC2InfoFromEntityStore = tt.mockGetEC2InfoFromEntityStore + } + p := newAwsEntityProcessor(&Config{EntityType: attributeService, ClusterName: tt.clusterName}, logger) + p.config.Platform = tt.platform + p.config.KubernetesMode = tt.kubernetesMode + _, err := p.processMetrics(ctx, tt.metrics) + assert.NoError(t, err) + rm := tt.metrics.ResourceMetrics() + if rm.Len() > 0 { + assert.Equal(t, tt.want, rm.At(0).Resource().Attributes().AsRaw()) + } + getServiceNameSource = resetServiceNameSource + }) + } +} + +func TestProcessMetricsResourceEntityProcessing(t *testing.T) { + logger, _ := zap.NewDevelopment() + ctx := context.Background() + tests := []struct { + name string + metrics pmetric.Metrics + want map[string]any + instance string + accountId string + asg string + }{ + { + name: "EmptyMetrics", + metrics: pmetric.NewMetrics(), + want: map[string]any{}, + }, + { + name: "ResourceEntityEC2", + metrics: generateMetrics(), + instance: "i-123456789", + accountId: "0123456789012", + want: map[string]any{ + "com.amazonaws.cloudwatch.entity.internal.type": "AWS::Resource", + "com.amazonaws.cloudwatch.entity.internal.resource.type": "AWS::EC2::Instance", + "com.amazonaws.cloudwatch.entity.internal.identifier": "i-123456789", + "com.amazonaws.cloudwatch.entity.internal.aws.account.id": "0123456789012", + }, + }, + { + name: "ResourceEntityEC2NoInstance", + metrics: generateMetrics(), + instance: "", + accountId: "", + want: map[string]any{}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + getEC2InfoFromEntityStore = newMockGetEC2InfoFromEntityStore(tt.instance, tt.accountId, tt.asg) + p := newAwsEntityProcessor(&Config{EntityType: entityattributes.Resource}, logger) + p.config.Platform = config.ModeEC2 + _, err := p.processMetrics(ctx, tt.metrics) + assert.NoError(t, err) + rm := tt.metrics.ResourceMetrics() + if rm.Len() > 0 { + assert.Equal(t, tt.want, rm.At(0).Resource().Attributes().AsRaw()) + } + }) + } +} + +func TestAWSEntityProcessorNoSensitiveInfoInLogs(t *testing.T) { + // Create a buffer to capture log output + var buf bytes.Buffer + logger := CreateTestLogger(&buf) + + configs := []struct { + name string + config *Config + }{ + { + name: "EC2Service", + config: &Config{ + EntityType: entityattributes.Service, + Platform: config.ModeEC2, + }, + }, + { + name: "EKSService", + config: &Config{ + EntityType: entityattributes.Service, + Platform: config.ModeEC2, + KubernetesMode: config.ModeEKS, + ClusterName: "test-cluster", + }, + }, + { + name: "EC2Resource", + config: &Config{ + EntityType: entityattributes.Resource, + Platform: config.ModeEC2, + }, + }, + { + name: "K8sOnPremService", + config: &Config{ + EntityType: entityattributes.Service, + Platform: config.ModeOnPrem, + KubernetesMode: config.ModeK8sOnPrem, + ClusterName: "test-cluster", + }, + }, + } + + for _, cfg := range configs { + t.Run(cfg.name, func(t *testing.T) { + buf.Reset() + processor := newAwsEntityProcessor(cfg.config, logger) + + resetServiceNameSource := getServiceNameSource + getServiceNameSource = newMockGetServiceNameAndSource("test-service", "UserConfiguration") + defer func() { getServiceNameSource = resetServiceNameSource }() + + resetGetEC2InfoFromEntityStore := getEC2InfoFromEntityStore + asgName := "test-asg" + getEC2InfoFromEntityStore = newMockGetEC2InfoFromEntityStore("i-1234567890abcdef0", "123456789012", asgName) + defer func() { getEC2InfoFromEntityStore = resetGetEC2InfoFromEntityStore }() + + md := generateTestMetrics() + _, err := processor.processMetrics(context.Background(), md) + assert.NoError(t, err) + + logOutput := buf.String() + assertNoSensitiveInfo(t, logOutput, md, asgName) + }) + } +} + +func generateTestMetrics() pmetric.Metrics { + md := pmetric.NewMetrics() + rm := md.ResourceMetrics().AppendEmpty() + + attrs := rm.Resource().Attributes() + attrs.PutStr(attributeAwsLogGroupNames, "test-log-group") + attrs.PutStr(attributeServiceName, "test-service") + attrs.PutStr(attributeDeploymentEnvironment, "test-environment") + attrs.PutStr(semconv.AttributeK8SPodName, "test-pod") + attrs.PutStr(semconv.AttributeK8SNamespaceName, "test-namespace") + attrs.PutStr(semconv.AttributeK8SDeploymentName, "test-deployment") + attrs.PutStr(semconv.AttributeK8SNodeName, "test-node") + + metric := rm.ScopeMetrics().AppendEmpty().Metrics().AppendEmpty() + metric.SetName("test-metric") + dp := metric.SetEmptyGauge().DataPoints().AppendEmpty() + dp.Attributes().PutStr(attributeServiceName, "datapoint-service-name") + dp.Attributes().PutStr(attributeDeploymentEnvironment, "datapoint-environment") + + return md +} + +func assertNoSensitiveInfo(t *testing.T, logOutput string, md pmetric.Metrics, asgName string) { + rm := md.ResourceMetrics().At(0) + attrs := rm.Resource().Attributes() + dp := rm.ScopeMetrics().At(0).Metrics().At(0).Gauge().DataPoints().At(0) + + getStringOrEmpty := func(val pcommon.Value, exists bool) string { + if !exists { + return "" + } + return val.AsString() + } + + sensitivePatterns := []string{ + `i-[0-9a-f]{17}`, // EC2 Instance ID regex pattern + `\d{12}`, // AWS Account ID regex pattern + asgName, // Auto Scaling Group name + getStringOrEmpty(attrs.Get(attributeAwsLogGroupNames)), + getStringOrEmpty(attrs.Get(attributeServiceName)), + getStringOrEmpty(attrs.Get(attributeDeploymentEnvironment)), + getStringOrEmpty(attrs.Get(semconv.AttributeK8SPodName)), + getStringOrEmpty(attrs.Get(semconv.AttributeK8SNamespaceName)), + getStringOrEmpty(attrs.Get(semconv.AttributeK8SDeploymentName)), + getStringOrEmpty(attrs.Get(semconv.AttributeK8SNodeName)), + getStringOrEmpty(dp.Attributes().Get(attributeServiceName)), + getStringOrEmpty(dp.Attributes().Get(attributeDeploymentEnvironment)), + } + + for _, pattern := range sensitivePatterns { + assert.NotRegexp(t, pattern, logOutput) + } +} + +func TestProcessMetricsDatapointAttributeScraping(t *testing.T) { + logger, _ := zap.NewDevelopment() + ctx := context.Background() + tests := []struct { + name string + checkDatapointAttributeRemoval bool + metrics pmetric.Metrics + mockServiceNameAndSource func() (string, string) + mockGetEC2InfoFromEntityStore func() entitystore.EC2Info + want map[string]any + wantDatapointAttributes map[string]any + }{ + { + name: "EmptyMetrics", + metrics: pmetric.NewMetrics(), + want: map[string]any{}, + }, + { + name: "DatapointAttributeServiceNameOnly", + metrics: generateDatapointMetrics(attributeServiceName, "test-service"), + mockGetEC2InfoFromEntityStore: newMockGetEC2InfoFromEntityStore("i-123456789", "0123456789012", "auto-scaling"), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "test-service", + entityattributes.AttributeEntityServiceNameSource: "Unknown", + entityattributes.AttributeEntityPlatformType: "AWS::EC2", + entityattributes.AttributeEntityInstanceID: "i-123456789", + entityattributes.AttributeEntityAwsAccountId: "0123456789012", + entityattributes.AttributeEntityAutoScalingGroup: "auto-scaling", + entityattributes.AttributeEntityDeploymentEnvironment: "ec2:auto-scaling", + }, + }, + { + name: "DatapointAttributeEnvironmentOnly", + metrics: generateDatapointMetrics(attributeDeploymentEnvironment, "test-environment"), + mockServiceNameAndSource: newMockGetServiceNameAndSource("test-service-name", "ClientIamRole"), + mockGetEC2InfoFromEntityStore: newMockGetEC2InfoFromEntityStore("i-123456789", "0123456789012", ""), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "test-service-name", + entityattributes.AttributeEntityDeploymentEnvironment: "test-environment", + entityattributes.AttributeEntityPlatformType: "AWS::EC2", + entityattributes.AttributeEntityInstanceID: "i-123456789", + entityattributes.AttributeEntityAwsAccountId: "0123456789012", + entityattributes.AttributeEntityServiceNameSource: "ClientIamRole", + }, + }, + { + name: "DatapointAttributeServiceNameAndEnvironment", + metrics: generateDatapointMetrics(attributeServiceName, "test-service", attributeDeploymentEnvironment, "test-environment"), + mockGetEC2InfoFromEntityStore: newMockGetEC2InfoFromEntityStore("i-123456789", "0123456789012", ""), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "test-service", + entityattributes.AttributeEntityDeploymentEnvironment: "test-environment", + entityattributes.AttributeEntityPlatformType: "AWS::EC2", + entityattributes.AttributeEntityInstanceID: "i-123456789", + entityattributes.AttributeEntityAwsAccountId: "0123456789012", + entityattributes.AttributeEntityServiceNameSource: "Unknown", + }, + }, + { + name: "DatapointAttributeServiceAndEnvironmentNameUserConfiguration", + checkDatapointAttributeRemoval: true, + metrics: generateDatapointMetrics(attributeServiceName, "test-service", attributeDeploymentEnvironment, "test-environment", entityattributes.AttributeServiceNameSource, entityattributes.AttributeServiceNameSourceUserConfig, entityattributes.AttributeDeploymentEnvironmentSource, entityattributes.AttributeServiceNameSourceUserConfig), + mockGetEC2InfoFromEntityStore: newMockGetEC2InfoFromEntityStore("i-123456789", "0123456789012", ""), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "test-service", + entityattributes.AttributeEntityDeploymentEnvironment: "test-environment", + entityattributes.AttributeEntityPlatformType: "AWS::EC2", + entityattributes.AttributeEntityInstanceID: "i-123456789", + entityattributes.AttributeEntityAwsAccountId: "0123456789012", + entityattributes.AttributeEntityServiceNameSource: "UserConfiguration", + }, + wantDatapointAttributes: map[string]any{}, + }, + { + name: "DatapointAttributeServiceNameUserConfigurationAndUserEnvironment", + checkDatapointAttributeRemoval: true, + metrics: generateDatapointMetrics(attributeServiceName, "test-service", attributeDeploymentEnvironment, "test-environment", entityattributes.AttributeServiceNameSource, entityattributes.AttributeServiceNameSourceUserConfig), + mockGetEC2InfoFromEntityStore: newMockGetEC2InfoFromEntityStore("i-123456789", "0123456789012", ""), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "test-service", + entityattributes.AttributeEntityDeploymentEnvironment: "test-environment", + entityattributes.AttributeEntityPlatformType: "AWS::EC2", + entityattributes.AttributeEntityInstanceID: "i-123456789", + entityattributes.AttributeEntityAwsAccountId: "0123456789012", + entityattributes.AttributeEntityServiceNameSource: "UserConfiguration", + }, + wantDatapointAttributes: map[string]any{ + attributeDeploymentEnvironment: "test-environment", + }, + }, + { + name: "DatapointAttributeEnvironmentNameUserConfigurationAndUserServiceName", + checkDatapointAttributeRemoval: true, + metrics: generateDatapointMetrics(attributeServiceName, "test-service", attributeDeploymentEnvironment, "test-environment", entityattributes.AttributeDeploymentEnvironmentSource, entityattributes.AttributeServiceNameSourceUserConfig), + mockGetEC2InfoFromEntityStore: newMockGetEC2InfoFromEntityStore("i-123456789", "0123456789012", ""), + want: map[string]any{ + entityattributes.AttributeEntityType: "Service", + entityattributes.AttributeEntityServiceName: "test-service", + entityattributes.AttributeEntityDeploymentEnvironment: "test-environment", + entityattributes.AttributeEntityPlatformType: "AWS::EC2", + entityattributes.AttributeEntityInstanceID: "i-123456789", + entityattributes.AttributeEntityAwsAccountId: "0123456789012", + entityattributes.AttributeEntityServiceNameSource: "Unknown", + }, + wantDatapointAttributes: map[string]any{ + attributeServiceName: "test-service", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Make copy of original functions to use as resets later to prevent failing test when tests are ran in bulk + resetServiceNameSource := getServiceNameSource + if tt.mockServiceNameAndSource != nil { + getServiceNameSource = tt.mockServiceNameAndSource + } + if tt.mockGetEC2InfoFromEntityStore != nil { + getEC2InfoFromEntityStore = tt.mockGetEC2InfoFromEntityStore + } + p := newAwsEntityProcessor(&Config{ScrapeDatapointAttribute: true, EntityType: attributeService}, logger) + p.config.Platform = config.ModeEC2 + _, err := p.processMetrics(ctx, tt.metrics) + assert.NoError(t, err) + rm := tt.metrics.ResourceMetrics() + if rm.Len() > 0 { + assert.Equal(t, tt.want, rm.At(0).Resource().Attributes().AsRaw()) + } + if tt.checkDatapointAttributeRemoval { + assert.Equal(t, tt.wantDatapointAttributes, rm.At(0).ScopeMetrics().At(0).Metrics().At(0).Gauge().DataPoints().At(0).Attributes().AsRaw()) + } + getServiceNameSource = resetServiceNameSource + }) + } +} + +func generateMetrics(resourceAttrs ...string) pmetric.Metrics { + md := pmetric.NewMetrics() + generateResource(md, resourceAttrs...) + return md +} + +func generateMetricsWithTwoResources() pmetric.Metrics { + md := pmetric.NewMetrics() + generateResource(md, attributeAwsLogGroupNames, "test-log-group1", attributeServiceName, "test-service1") + generateResource(md, attributeAwsLogGroupNames, "test-log-group2", attributeServiceName, "test-service2") + return md +} + +func generateDatapointMetrics(datapointAttrs ...string) pmetric.Metrics { + md := pmetric.NewMetrics() + generateDatapoints(md, datapointAttrs...) + return md +} + +func generateResource(md pmetric.Metrics, resourceAttrs ...string) { + attrs := md.ResourceMetrics().AppendEmpty().Resource().Attributes() + for i := 0; i < len(resourceAttrs); i += 2 { + attrs.PutStr(resourceAttrs[i], resourceAttrs[i+1]) + } +} + +func generateDatapoints(md pmetric.Metrics, datapointAttrs ...string) { + attrs := md.ResourceMetrics().AppendEmpty().ScopeMetrics().AppendEmpty().Metrics().AppendEmpty().SetEmptyGauge().DataPoints().AppendEmpty().Attributes() + for i := 0; i < len(datapointAttrs); i += 2 { + attrs.PutStr(datapointAttrs[i], datapointAttrs[i+1]) + } +} diff --git a/plugins/processors/awsentity/util.go b/plugins/processors/awsentity/util.go new file mode 100644 index 0000000000..804a97c14c --- /dev/null +++ b/plugins/processors/awsentity/util.go @@ -0,0 +1,12 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package awsentity + +import "go.opentelemetry.io/collector/pdata/pcommon" + +func AddAttributeIfNonEmpty(p pcommon.Map, key string, value string) { + if value != "" { + p.PutStr(key, value) + } +} diff --git a/plugins/processors/ec2tagger/constants.go b/plugins/processors/ec2tagger/constants.go index 782ff303cd..32a6f960c2 100644 --- a/plugins/processors/ec2tagger/constants.go +++ b/plugins/processors/ec2tagger/constants.go @@ -60,7 +60,7 @@ const sampleConfig = ` ` const ( - ec2InstanceTagKeyASG = "aws:autoscaling:groupName" + Ec2InstanceTagKeyASG = "aws:autoscaling:groupName" cwDimensionASG = "AutoScalingGroupName" mdKeyInstanceId = "InstanceId" mdKeyImageId = "ImageId" @@ -70,5 +70,6 @@ const ( var ( // issue with newer versions of the sdk take longer when hop limit is 1 in eks defaultRefreshInterval = 180 * time.Second - backoffSleepArray = []time.Duration{0, 1 * time.Minute, 1 * time.Minute, 3 * time.Minute, 3 * time.Minute, 3 * time.Minute, 10 * time.Minute} // backoff retry for ec2 describe instances API call. Assuming the throttle limit is 20 per second. 10 mins allow 12000 API calls. + ThrottleBackOffArray = []time.Duration{0, 1 * time.Minute, 3 * time.Minute} // backoff retry for ec2 describe instances API call. Assuming the throttle limit is 20 per second. 10 mins allow 12000 API calls. + BackoffSleepArray = []time.Duration{0, 1 * time.Minute, 1 * time.Minute, 3 * time.Minute, 3 * time.Minute, 3 * time.Minute, 10 * time.Minute} // backoff retry for ec2 describe instances API call. Assuming the throttle limit is 20 per second. 10 mins allow 12000 API calls. ) diff --git a/plugins/processors/ec2tagger/ec2metadataprovider.go b/plugins/processors/ec2tagger/ec2metadataprovider.go deleted file mode 100644 index 6278f69dff..0000000000 --- a/plugins/processors/ec2tagger/ec2metadataprovider.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: MIT - -package ec2tagger - -import ( - "context" - "log" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - - configaws "github.com/aws/amazon-cloudwatch-agent/cfg/aws" - "github.com/aws/amazon-cloudwatch-agent/extension/agenthealth/handler/stats/agent" - "github.com/aws/amazon-cloudwatch-agent/internal/retryer" -) - -type MetadataProvider interface { - Get(ctx context.Context) (ec2metadata.EC2InstanceIdentityDocument, error) - Hostname(ctx context.Context) (string, error) - InstanceID(ctx context.Context) (string, error) -} - -type metadataClient struct { - metadataFallbackDisabled *ec2metadata.EC2Metadata - metadataFallbackEnabled *ec2metadata.EC2Metadata -} - -var _ MetadataProvider = (*metadataClient)(nil) - -func NewMetadataProvider(p client.ConfigProvider, retries int) MetadataProvider { - disableFallbackConfig := &aws.Config{ - LogLevel: configaws.SDKLogLevel(), - Logger: configaws.SDKLogger{}, - Retryer: retryer.NewIMDSRetryer(retries), - EC2MetadataEnableFallback: aws.Bool(false), - } - enableFallbackConfig := &aws.Config{ - LogLevel: configaws.SDKLogLevel(), - Logger: configaws.SDKLogger{}, - } - return &metadataClient{ - metadataFallbackDisabled: ec2metadata.New(p, disableFallbackConfig), - metadataFallbackEnabled: ec2metadata.New(p, enableFallbackConfig), - } -} - -func (c *metadataClient) InstanceID(ctx context.Context) (string, error) { - instanceId, err := c.metadataFallbackDisabled.GetMetadataWithContext(ctx, "instance-id") - if err != nil { - log.Printf("D! could not get instance id without imds v1 fallback enable thus enable fallback") - instanceInner, errorInner := c.metadataFallbackEnabled.GetMetadataWithContext(ctx, "instance-id") - if errorInner == nil { - agent.UsageFlags().Set(agent.FlagIMDSFallbackSuccess) - } - return instanceInner, errorInner - } - return instanceId, err -} - -func (c *metadataClient) Hostname(ctx context.Context) (string, error) { - hostname, err := c.metadataFallbackDisabled.GetMetadataWithContext(ctx, "hostname") - if err != nil { - log.Printf("D! could not get hostname without imds v1 fallback enable thus enable fallback") - hostnameInner, errorInner := c.metadataFallbackEnabled.GetMetadataWithContext(ctx, "hostname") - if errorInner == nil { - agent.UsageFlags().Set(agent.FlagIMDSFallbackSuccess) - } - return hostnameInner, errorInner - } - return hostname, err -} - -func (c *metadataClient) Get(ctx context.Context) (ec2metadata.EC2InstanceIdentityDocument, error) { - instanceDocument, err := c.metadataFallbackDisabled.GetInstanceIdentityDocumentWithContext(ctx) - if err != nil { - log.Printf("D! could not get instance document without imds v1 fallback enable thus enable fallback") - instanceDocumentInner, errorInner := c.metadataFallbackEnabled.GetInstanceIdentityDocumentWithContext(ctx) - if errorInner == nil { - agent.UsageFlags().Set(agent.FlagIMDSFallbackSuccess) - } - return instanceDocumentInner, errorInner - } - return instanceDocument, err -} diff --git a/plugins/processors/ec2tagger/ec2tagger.go b/plugins/processors/ec2tagger/ec2tagger.go index d4236397d5..52e9423100 100644 --- a/plugins/processors/ec2tagger/ec2tagger.go +++ b/plugins/processors/ec2tagger/ec2tagger.go @@ -19,6 +19,7 @@ import ( "go.uber.org/zap" configaws "github.com/aws/amazon-cloudwatch-agent/cfg/aws" + "github.com/aws/amazon-cloudwatch-agent/internal/ec2metadataprovider" "github.com/aws/amazon-cloudwatch-agent/plugins/processors/ec2tagger/internal/volume" translatorCtx "github.com/aws/amazon-cloudwatch-agent/translator/context" ) @@ -43,7 +44,7 @@ type Tagger struct { logger *zap.Logger cancelFunc context.CancelFunc - metadataProvider MetadataProvider + metadataProvider ec2metadataprovider.MetadataProvider ec2Provider ec2ProviderType shutdownC chan bool @@ -67,7 +68,7 @@ func newTagger(config *Config, logger *zap.Logger) *Tagger { Config: config, logger: logger, cancelFunc: cancel, - metadataProvider: NewMetadataProvider(mdCredentialConfig.Credentials(), config.IMDSRetries), + metadataProvider: ec2metadataprovider.NewMetadataProvider(mdCredentialConfig.Credentials(), config.IMDSRetries), ec2Provider: func(ec2CredentialConfig *configaws.CredentialConfig) ec2iface.EC2API { return ec2.New( ec2CredentialConfig.Credentials(), @@ -172,7 +173,7 @@ func (t *Tagger) updateTags() error { } for _, tag := range result.Tags { key := *tag.Key - if ec2InstanceTagKeyASG == key { + if Ec2InstanceTagKeyASG == key { // rename to match CW dimension as applied by AutoScaling service, not the EC2 tag key = cwDimensionASG } @@ -246,7 +247,7 @@ func (t *Tagger) ec2TagsRetrieved() bool { defer t.RUnlock() if t.ec2TagCache != nil { for _, key := range t.EC2InstanceTagKeys { - if key == ec2InstanceTagKeyASG { + if key == Ec2InstanceTagKeyASG { key = cwDimensionASG } if key == "*" { @@ -305,7 +306,7 @@ func (t *Tagger) Start(ctx context.Context, _ component.Host) error { // and filter for the EC2 tag name called 'aws:autoscaling:groupName' for i, key := range t.EC2InstanceTagKeys { if cwDimensionASG == key { - t.EC2InstanceTagKeys[i] = ec2InstanceTagKeyASG + t.EC2InstanceTagKeys[i] = Ec2InstanceTagKeyASG } } @@ -442,10 +443,10 @@ func (t *Tagger) initialRetrievalOfTagsAndVolumes() { retry := 0 for { var waitDuration time.Duration - if retry < len(backoffSleepArray) { - waitDuration = backoffSleepArray[retry] + if retry < len(BackoffSleepArray) { + waitDuration = BackoffSleepArray[retry] } else { - waitDuration = backoffSleepArray[len(backoffSleepArray)-1] + waitDuration = BackoffSleepArray[len(BackoffSleepArray)-1] } wait := time.NewTimer(waitDuration) diff --git a/plugins/processors/ec2tagger/ec2tagger_test.go b/plugins/processors/ec2tagger/ec2tagger_test.go index 0f3d3d84c8..25e419b20c 100644 --- a/plugins/processors/ec2tagger/ec2tagger_test.go +++ b/plugins/processors/ec2tagger/ec2tagger_test.go @@ -144,6 +144,18 @@ func (m *mockMetadataProvider) InstanceID(ctx context.Context) (string, error) { return "MockInstanceID", nil } +func (m *mockMetadataProvider) InstanceTags(ctx context.Context) (string, error) { + return "MockInstanceTag", nil +} + +func (m *mockMetadataProvider) InstanceProfileIAMRole() (string, error) { + return "MockIAM", nil +} + +func (m *mockMetadataProvider) InstanceTagValue(ctx context.Context, tagKey string) (string, error) { + return "MockInstanceValue", nil +} + var mockedInstanceIdentityDoc = &ec2metadata.EC2InstanceIdentityDocument{ InstanceID: "i-01d2417c27a396e44", Region: "us-east-1", @@ -286,7 +298,7 @@ func TestStartSuccessWithNoTagsVolumesUpdate(t *testing.T) { } volumeCache := &mockVolumeCache{cache: make(map[string]string)} - backoffSleepArray = []time.Duration{10 * time.Millisecond, 20 * time.Millisecond, 30 * time.Millisecond} + BackoffSleepArray = []time.Duration{10 * time.Millisecond, 20 * time.Millisecond, 30 * time.Millisecond} defaultRefreshInterval = 50 * time.Millisecond tagger := &Tagger{ Config: cfg, @@ -329,7 +341,7 @@ func TestStartSuccessWithTagsVolumesUpdate(t *testing.T) { return ec2Client } volumeCache := &mockVolumeCache{cache: make(map[string]string)} - backoffSleepArray = []time.Duration{10 * time.Millisecond, 20 * time.Millisecond, 30 * time.Millisecond} + BackoffSleepArray = []time.Duration{10 * time.Millisecond, 20 * time.Millisecond, 30 * time.Millisecond} defaultRefreshInterval = 10 * time.Millisecond tagger := &Tagger{ @@ -385,7 +397,7 @@ func TestStartSuccessWithWildcardTagVolumeKey(t *testing.T) { return ec2Client } volumeCache := &mockVolumeCache{cache: make(map[string]string)} - backoffSleepArray = []time.Duration{10 * time.Millisecond, 20 * time.Millisecond, 30 * time.Millisecond} + BackoffSleepArray = []time.Duration{10 * time.Millisecond, 20 * time.Millisecond, 30 * time.Millisecond} defaultRefreshInterval = 50 * time.Millisecond tagger := &Tagger{ Config: cfg, @@ -430,7 +442,7 @@ func TestApplyWithTagsVolumesUpdate(t *testing.T) { return ec2Client } volumeCache := &mockVolumeCache{cache: make(map[string]string)} - backoffSleepArray = []time.Duration{10 * time.Millisecond, 20 * time.Millisecond, 30 * time.Millisecond} + BackoffSleepArray = []time.Duration{10 * time.Millisecond, 20 * time.Millisecond, 30 * time.Millisecond} defaultRefreshInterval = 50 * time.Millisecond tagger := &Tagger{ Config: cfg, @@ -523,7 +535,7 @@ func TestMetricsDroppedBeforeStarted(t *testing.T) { return ec2Client } volumeCache := &mockVolumeCache{cache: make(map[string]string)} - backoffSleepArray = []time.Duration{10 * time.Millisecond, 20 * time.Millisecond, 30 * time.Millisecond} + BackoffSleepArray = []time.Duration{10 * time.Millisecond, 20 * time.Millisecond, 30 * time.Millisecond} defaultRefreshInterval = 50 * time.Millisecond tagger := &Tagger{ Config: cfg, @@ -587,7 +599,7 @@ func TestTaggerStartDoesNotBlock(t *testing.T) { ec2Provider := func(*configaws.CredentialConfig) ec2iface.EC2API { return ec2Client } - backoffSleepArray = []time.Duration{1 * time.Minute, 1 * time.Minute, 1 * time.Minute, 3 * time.Minute, 3 * time.Minute, 3 * time.Minute, 10 * time.Minute} + BackoffSleepArray = []time.Duration{1 * time.Minute, 1 * time.Minute, 1 * time.Minute, 3 * time.Minute, 3 * time.Minute, 3 * time.Minute, 10 * time.Minute} defaultRefreshInterval = 180 * time.Second tagger := &Tagger{ Config: cfg, diff --git a/sdk/service/cloudwatch/api.go b/sdk/service/cloudwatch/api.go new file mode 100644 index 0000000000..17db77ac6b --- /dev/null +++ b/sdk/service/cloudwatch/api.go @@ -0,0 +1,12754 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudwatch + +import ( + "fmt" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/query" +) + +const opDeleteAlarms = "DeleteAlarms" + +// DeleteAlarmsRequest generates a "aws/request.Request" representing the +// client's request for the DeleteAlarms operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteAlarms for more information on using the DeleteAlarms +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteAlarmsRequest method. +// req, resp := client.DeleteAlarmsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAlarms +func (c *CloudWatch) DeleteAlarmsRequest(input *DeleteAlarmsInput) (req *request.Request, output *DeleteAlarmsOutput) { + op := &request.Operation{ + Name: opDeleteAlarms, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteAlarmsInput{} + } + + output = &DeleteAlarmsOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteAlarms API operation for Amazon CloudWatch. +// +// Deletes the specified alarms. You can delete up to 100 alarms in one operation. +// However, this total can include no more than one composite alarm. For example, +// you could delete 99 metric alarms and one composite alarms with one operation, +// but you can't delete two composite alarms with one operation. +// +// If you specify an incorrect alarm name or make any other error in the operation, +// no alarms are deleted. To confirm that alarms were deleted successfully, +// you can use the DescribeAlarms (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarms.html) +// operation after using DeleteAlarms. +// +// It is possible to create a loop or cycle of composite alarms, where composite +// alarm A depends on composite alarm B, and composite alarm B also depends +// on composite alarm A. In this scenario, you can't delete any composite alarm +// that is part of the cycle because there is always still a composite alarm +// that depends on that alarm that you want to delete. +// +// To get out of such a situation, you must break the cycle by changing the +// rule of one of the composite alarms in the cycle to remove a dependency that +// creates the cycle. The simplest change to make to break a cycle is to change +// the AlarmRule of one of the alarms to false. +// +// Additionally, the evaluation of composite alarms stops if CloudWatch detects +// a cycle in the evaluation path. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DeleteAlarms for usage and error information. +// +// Returned Error Codes: +// - ErrCodeResourceNotFound "ResourceNotFound" +// The named resource does not exist. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAlarms +func (c *CloudWatch) DeleteAlarms(input *DeleteAlarmsInput) (*DeleteAlarmsOutput, error) { + req, out := c.DeleteAlarmsRequest(input) + return out, req.Send() +} + +// DeleteAlarmsWithContext is the same as DeleteAlarms with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAlarms for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DeleteAlarmsWithContext(ctx aws.Context, input *DeleteAlarmsInput, opts ...request.Option) (*DeleteAlarmsOutput, error) { + req, out := c.DeleteAlarmsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteAnomalyDetector = "DeleteAnomalyDetector" + +// DeleteAnomalyDetectorRequest generates a "aws/request.Request" representing the +// client's request for the DeleteAnomalyDetector operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteAnomalyDetector for more information on using the DeleteAnomalyDetector +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteAnomalyDetectorRequest method. +// req, resp := client.DeleteAnomalyDetectorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAnomalyDetector +func (c *CloudWatch) DeleteAnomalyDetectorRequest(input *DeleteAnomalyDetectorInput) (req *request.Request, output *DeleteAnomalyDetectorOutput) { + op := &request.Operation{ + Name: opDeleteAnomalyDetector, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteAnomalyDetectorInput{} + } + + output = &DeleteAnomalyDetectorOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteAnomalyDetector API operation for Amazon CloudWatch. +// +// Deletes the specified anomaly detection model from your account. For more +// information about how to delete an anomaly detection model, see Deleting +// an anomaly detection model (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Create_Anomaly_Detection_Alarm.html#Delete_Anomaly_Detection_Model) +// in the CloudWatch User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DeleteAnomalyDetector for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The named resource does not exist. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// - ErrCodeInvalidParameterCombinationException "InvalidParameterCombination" +// Parameters were used together that cannot be used together. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAnomalyDetector +func (c *CloudWatch) DeleteAnomalyDetector(input *DeleteAnomalyDetectorInput) (*DeleteAnomalyDetectorOutput, error) { + req, out := c.DeleteAnomalyDetectorRequest(input) + return out, req.Send() +} + +// DeleteAnomalyDetectorWithContext is the same as DeleteAnomalyDetector with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAnomalyDetector for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DeleteAnomalyDetectorWithContext(ctx aws.Context, input *DeleteAnomalyDetectorInput, opts ...request.Option) (*DeleteAnomalyDetectorOutput, error) { + req, out := c.DeleteAnomalyDetectorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteDashboards = "DeleteDashboards" + +// DeleteDashboardsRequest generates a "aws/request.Request" representing the +// client's request for the DeleteDashboards operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteDashboards for more information on using the DeleteDashboards +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteDashboardsRequest method. +// req, resp := client.DeleteDashboardsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteDashboards +func (c *CloudWatch) DeleteDashboardsRequest(input *DeleteDashboardsInput) (req *request.Request, output *DeleteDashboardsOutput) { + op := &request.Operation{ + Name: opDeleteDashboards, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteDashboardsInput{} + } + + output = &DeleteDashboardsOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteDashboards API operation for Amazon CloudWatch. +// +// Deletes all dashboards that you specify. You can specify up to 100 dashboards +// to delete. If there is an error during this call, no dashboards are deleted. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DeleteDashboards for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeDashboardNotFoundError "ResourceNotFound" +// The specified dashboard does not exist. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteDashboards +func (c *CloudWatch) DeleteDashboards(input *DeleteDashboardsInput) (*DeleteDashboardsOutput, error) { + req, out := c.DeleteDashboardsRequest(input) + return out, req.Send() +} + +// DeleteDashboardsWithContext is the same as DeleteDashboards with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDashboards for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DeleteDashboardsWithContext(ctx aws.Context, input *DeleteDashboardsInput, opts ...request.Option) (*DeleteDashboardsOutput, error) { + req, out := c.DeleteDashboardsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteInsightRules = "DeleteInsightRules" + +// DeleteInsightRulesRequest generates a "aws/request.Request" representing the +// client's request for the DeleteInsightRules operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteInsightRules for more information on using the DeleteInsightRules +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteInsightRulesRequest method. +// req, resp := client.DeleteInsightRulesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteInsightRules +func (c *CloudWatch) DeleteInsightRulesRequest(input *DeleteInsightRulesInput) (req *request.Request, output *DeleteInsightRulesOutput) { + op := &request.Operation{ + Name: opDeleteInsightRules, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteInsightRulesInput{} + } + + output = &DeleteInsightRulesOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteInsightRules API operation for Amazon CloudWatch. +// +// Permanently deletes the specified Contributor Insights rules. +// +// If you create a rule, delete it, and then re-create it with the same name, +// historical data from the first time the rule was created might not be available. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DeleteInsightRules for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteInsightRules +func (c *CloudWatch) DeleteInsightRules(input *DeleteInsightRulesInput) (*DeleteInsightRulesOutput, error) { + req, out := c.DeleteInsightRulesRequest(input) + return out, req.Send() +} + +// DeleteInsightRulesWithContext is the same as DeleteInsightRules with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteInsightRules for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DeleteInsightRulesWithContext(ctx aws.Context, input *DeleteInsightRulesInput, opts ...request.Option) (*DeleteInsightRulesOutput, error) { + req, out := c.DeleteInsightRulesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteMetricStream = "DeleteMetricStream" + +// DeleteMetricStreamRequest generates a "aws/request.Request" representing the +// client's request for the DeleteMetricStream operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteMetricStream for more information on using the DeleteMetricStream +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteMetricStreamRequest method. +// req, resp := client.DeleteMetricStreamRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteMetricStream +func (c *CloudWatch) DeleteMetricStreamRequest(input *DeleteMetricStreamInput) (req *request.Request, output *DeleteMetricStreamOutput) { + op := &request.Operation{ + Name: opDeleteMetricStream, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteMetricStreamInput{} + } + + output = &DeleteMetricStreamOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteMetricStream API operation for Amazon CloudWatch. +// +// Permanently deletes the metric stream that you specify. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DeleteMetricStream for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteMetricStream +func (c *CloudWatch) DeleteMetricStream(input *DeleteMetricStreamInput) (*DeleteMetricStreamOutput, error) { + req, out := c.DeleteMetricStreamRequest(input) + return out, req.Send() +} + +// DeleteMetricStreamWithContext is the same as DeleteMetricStream with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteMetricStream for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DeleteMetricStreamWithContext(ctx aws.Context, input *DeleteMetricStreamInput, opts ...request.Option) (*DeleteMetricStreamOutput, error) { + req, out := c.DeleteMetricStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeAlarmHistory = "DescribeAlarmHistory" + +// DescribeAlarmHistoryRequest generates a "aws/request.Request" representing the +// client's request for the DescribeAlarmHistory operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeAlarmHistory for more information on using the DescribeAlarmHistory +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeAlarmHistoryRequest method. +// req, resp := client.DescribeAlarmHistoryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmHistory +func (c *CloudWatch) DescribeAlarmHistoryRequest(input *DescribeAlarmHistoryInput) (req *request.Request, output *DescribeAlarmHistoryOutput) { + op := &request.Operation{ + Name: opDescribeAlarmHistory, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxRecords", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeAlarmHistoryInput{} + } + + output = &DescribeAlarmHistoryOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeAlarmHistory API operation for Amazon CloudWatch. +// +// Retrieves the history for the specified alarm. You can filter the results +// by date range or item type. If an alarm name is not specified, the histories +// for either all metric alarms or all composite alarms are returned. +// +// CloudWatch retains the history of an alarm even if you delete the alarm. +// +// To use this operation and return information about a composite alarm, you +// must be signed on with the cloudwatch:DescribeAlarmHistory permission that +// is scoped to *. You can't return information about composite alarms if your +// cloudwatch:DescribeAlarmHistory permission has a narrower scope. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DescribeAlarmHistory for usage and error information. +// +// Returned Error Codes: +// - ErrCodeInvalidNextToken "InvalidNextToken" +// The next token specified is invalid. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmHistory +func (c *CloudWatch) DescribeAlarmHistory(input *DescribeAlarmHistoryInput) (*DescribeAlarmHistoryOutput, error) { + req, out := c.DescribeAlarmHistoryRequest(input) + return out, req.Send() +} + +// DescribeAlarmHistoryWithContext is the same as DescribeAlarmHistory with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAlarmHistory for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DescribeAlarmHistoryWithContext(ctx aws.Context, input *DescribeAlarmHistoryInput, opts ...request.Option) (*DescribeAlarmHistoryOutput, error) { + req, out := c.DescribeAlarmHistoryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeAlarmHistoryPages iterates over the pages of a DescribeAlarmHistory operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeAlarmHistory method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeAlarmHistory operation. +// pageNum := 0 +// err := client.DescribeAlarmHistoryPages(params, +// func(page *cloudwatch.DescribeAlarmHistoryOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatch) DescribeAlarmHistoryPages(input *DescribeAlarmHistoryInput, fn func(*DescribeAlarmHistoryOutput, bool) bool) error { + return c.DescribeAlarmHistoryPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeAlarmHistoryPagesWithContext same as DescribeAlarmHistoryPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DescribeAlarmHistoryPagesWithContext(ctx aws.Context, input *DescribeAlarmHistoryInput, fn func(*DescribeAlarmHistoryOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeAlarmHistoryInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeAlarmHistoryRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeAlarmHistoryOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDescribeAlarms = "DescribeAlarms" + +// DescribeAlarmsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeAlarms operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeAlarms for more information on using the DescribeAlarms +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeAlarmsRequest method. +// req, resp := client.DescribeAlarmsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarms +func (c *CloudWatch) DescribeAlarmsRequest(input *DescribeAlarmsInput) (req *request.Request, output *DescribeAlarmsOutput) { + op := &request.Operation{ + Name: opDescribeAlarms, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxRecords", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeAlarmsInput{} + } + + output = &DescribeAlarmsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeAlarms API operation for Amazon CloudWatch. +// +// Retrieves the specified alarms. You can filter the results by specifying +// a prefix for the alarm name, the alarm state, or a prefix for any action. +// +// To use this operation and return information about composite alarms, you +// must be signed on with the cloudwatch:DescribeAlarms permission that is scoped +// to *. You can't return information about composite alarms if your cloudwatch:DescribeAlarms +// permission has a narrower scope. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DescribeAlarms for usage and error information. +// +// Returned Error Codes: +// - ErrCodeInvalidNextToken "InvalidNextToken" +// The next token specified is invalid. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarms +func (c *CloudWatch) DescribeAlarms(input *DescribeAlarmsInput) (*DescribeAlarmsOutput, error) { + req, out := c.DescribeAlarmsRequest(input) + return out, req.Send() +} + +// DescribeAlarmsWithContext is the same as DescribeAlarms with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAlarms for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DescribeAlarmsWithContext(ctx aws.Context, input *DescribeAlarmsInput, opts ...request.Option) (*DescribeAlarmsOutput, error) { + req, out := c.DescribeAlarmsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeAlarmsPages iterates over the pages of a DescribeAlarms operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeAlarms method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeAlarms operation. +// pageNum := 0 +// err := client.DescribeAlarmsPages(params, +// func(page *cloudwatch.DescribeAlarmsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatch) DescribeAlarmsPages(input *DescribeAlarmsInput, fn func(*DescribeAlarmsOutput, bool) bool) error { + return c.DescribeAlarmsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeAlarmsPagesWithContext same as DescribeAlarmsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DescribeAlarmsPagesWithContext(ctx aws.Context, input *DescribeAlarmsInput, fn func(*DescribeAlarmsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeAlarmsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeAlarmsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeAlarmsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDescribeAlarmsForMetric = "DescribeAlarmsForMetric" + +// DescribeAlarmsForMetricRequest generates a "aws/request.Request" representing the +// client's request for the DescribeAlarmsForMetric operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeAlarmsForMetric for more information on using the DescribeAlarmsForMetric +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeAlarmsForMetricRequest method. +// req, resp := client.DescribeAlarmsForMetricRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmsForMetric +func (c *CloudWatch) DescribeAlarmsForMetricRequest(input *DescribeAlarmsForMetricInput) (req *request.Request, output *DescribeAlarmsForMetricOutput) { + op := &request.Operation{ + Name: opDescribeAlarmsForMetric, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeAlarmsForMetricInput{} + } + + output = &DescribeAlarmsForMetricOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeAlarmsForMetric API operation for Amazon CloudWatch. +// +// Retrieves the alarms for the specified metric. To filter the results, specify +// a statistic, period, or unit. +// +// This operation retrieves only standard alarms that are based on the specified +// metric. It does not return alarms based on math expressions that use the +// specified metric, or composite alarms that use the specified metric. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DescribeAlarmsForMetric for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmsForMetric +func (c *CloudWatch) DescribeAlarmsForMetric(input *DescribeAlarmsForMetricInput) (*DescribeAlarmsForMetricOutput, error) { + req, out := c.DescribeAlarmsForMetricRequest(input) + return out, req.Send() +} + +// DescribeAlarmsForMetricWithContext is the same as DescribeAlarmsForMetric with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAlarmsForMetric for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DescribeAlarmsForMetricWithContext(ctx aws.Context, input *DescribeAlarmsForMetricInput, opts ...request.Option) (*DescribeAlarmsForMetricOutput, error) { + req, out := c.DescribeAlarmsForMetricRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeAnomalyDetectors = "DescribeAnomalyDetectors" + +// DescribeAnomalyDetectorsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeAnomalyDetectors operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeAnomalyDetectors for more information on using the DescribeAnomalyDetectors +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeAnomalyDetectorsRequest method. +// req, resp := client.DescribeAnomalyDetectorsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAnomalyDetectors +func (c *CloudWatch) DescribeAnomalyDetectorsRequest(input *DescribeAnomalyDetectorsInput) (req *request.Request, output *DescribeAnomalyDetectorsOutput) { + op := &request.Operation{ + Name: opDescribeAnomalyDetectors, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeAnomalyDetectorsInput{} + } + + output = &DescribeAnomalyDetectorsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeAnomalyDetectors API operation for Amazon CloudWatch. +// +// Lists the anomaly detection models that you have created in your account. +// For single metric anomaly detectors, you can list all of the models in your +// account or filter the results to only the models that are related to a certain +// namespace, metric name, or metric dimension. For metric math anomaly detectors, +// you can list them by adding METRIC_MATH to the AnomalyDetectorTypes array. +// This will return all metric math anomaly detectors in your account. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DescribeAnomalyDetectors for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidNextToken "InvalidNextToken" +// The next token specified is invalid. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeInvalidParameterCombinationException "InvalidParameterCombination" +// Parameters were used together that cannot be used together. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAnomalyDetectors +func (c *CloudWatch) DescribeAnomalyDetectors(input *DescribeAnomalyDetectorsInput) (*DescribeAnomalyDetectorsOutput, error) { + req, out := c.DescribeAnomalyDetectorsRequest(input) + return out, req.Send() +} + +// DescribeAnomalyDetectorsWithContext is the same as DescribeAnomalyDetectors with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAnomalyDetectors for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DescribeAnomalyDetectorsWithContext(ctx aws.Context, input *DescribeAnomalyDetectorsInput, opts ...request.Option) (*DescribeAnomalyDetectorsOutput, error) { + req, out := c.DescribeAnomalyDetectorsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeAnomalyDetectorsPages iterates over the pages of a DescribeAnomalyDetectors operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeAnomalyDetectors method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeAnomalyDetectors operation. +// pageNum := 0 +// err := client.DescribeAnomalyDetectorsPages(params, +// func(page *cloudwatch.DescribeAnomalyDetectorsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatch) DescribeAnomalyDetectorsPages(input *DescribeAnomalyDetectorsInput, fn func(*DescribeAnomalyDetectorsOutput, bool) bool) error { + return c.DescribeAnomalyDetectorsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeAnomalyDetectorsPagesWithContext same as DescribeAnomalyDetectorsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DescribeAnomalyDetectorsPagesWithContext(ctx aws.Context, input *DescribeAnomalyDetectorsInput, fn func(*DescribeAnomalyDetectorsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeAnomalyDetectorsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeAnomalyDetectorsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeAnomalyDetectorsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDescribeInsightRules = "DescribeInsightRules" + +// DescribeInsightRulesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeInsightRules operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeInsightRules for more information on using the DescribeInsightRules +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeInsightRulesRequest method. +// req, resp := client.DescribeInsightRulesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeInsightRules +func (c *CloudWatch) DescribeInsightRulesRequest(input *DescribeInsightRulesInput) (req *request.Request, output *DescribeInsightRulesOutput) { + op := &request.Operation{ + Name: opDescribeInsightRules, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeInsightRulesInput{} + } + + output = &DescribeInsightRulesOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeInsightRules API operation for Amazon CloudWatch. +// +// Returns a list of all the Contributor Insights rules in your account. +// +// For more information about Contributor Insights, see Using Contributor Insights +// to Analyze High-Cardinality Data (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContributorInsights.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DescribeInsightRules for usage and error information. +// +// Returned Error Codes: +// - ErrCodeInvalidNextToken "InvalidNextToken" +// The next token specified is invalid. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeInsightRules +func (c *CloudWatch) DescribeInsightRules(input *DescribeInsightRulesInput) (*DescribeInsightRulesOutput, error) { + req, out := c.DescribeInsightRulesRequest(input) + return out, req.Send() +} + +// DescribeInsightRulesWithContext is the same as DescribeInsightRules with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeInsightRules for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DescribeInsightRulesWithContext(ctx aws.Context, input *DescribeInsightRulesInput, opts ...request.Option) (*DescribeInsightRulesOutput, error) { + req, out := c.DescribeInsightRulesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeInsightRulesPages iterates over the pages of a DescribeInsightRules operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeInsightRules method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeInsightRules operation. +// pageNum := 0 +// err := client.DescribeInsightRulesPages(params, +// func(page *cloudwatch.DescribeInsightRulesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatch) DescribeInsightRulesPages(input *DescribeInsightRulesInput, fn func(*DescribeInsightRulesOutput, bool) bool) error { + return c.DescribeInsightRulesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeInsightRulesPagesWithContext same as DescribeInsightRulesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DescribeInsightRulesPagesWithContext(ctx aws.Context, input *DescribeInsightRulesInput, fn func(*DescribeInsightRulesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeInsightRulesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeInsightRulesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeInsightRulesOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDisableAlarmActions = "DisableAlarmActions" + +// DisableAlarmActionsRequest generates a "aws/request.Request" representing the +// client's request for the DisableAlarmActions operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DisableAlarmActions for more information on using the DisableAlarmActions +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DisableAlarmActionsRequest method. +// req, resp := client.DisableAlarmActionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DisableAlarmActions +func (c *CloudWatch) DisableAlarmActionsRequest(input *DisableAlarmActionsInput) (req *request.Request, output *DisableAlarmActionsOutput) { + op := &request.Operation{ + Name: opDisableAlarmActions, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DisableAlarmActionsInput{} + } + + output = &DisableAlarmActionsOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DisableAlarmActions API operation for Amazon CloudWatch. +// +// Disables the actions for the specified alarms. When an alarm's actions are +// disabled, the alarm actions do not execute when the alarm state changes. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DisableAlarmActions for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DisableAlarmActions +func (c *CloudWatch) DisableAlarmActions(input *DisableAlarmActionsInput) (*DisableAlarmActionsOutput, error) { + req, out := c.DisableAlarmActionsRequest(input) + return out, req.Send() +} + +// DisableAlarmActionsWithContext is the same as DisableAlarmActions with the addition of +// the ability to pass a context and additional request options. +// +// See DisableAlarmActions for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DisableAlarmActionsWithContext(ctx aws.Context, input *DisableAlarmActionsInput, opts ...request.Option) (*DisableAlarmActionsOutput, error) { + req, out := c.DisableAlarmActionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDisableInsightRules = "DisableInsightRules" + +// DisableInsightRulesRequest generates a "aws/request.Request" representing the +// client's request for the DisableInsightRules operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DisableInsightRules for more information on using the DisableInsightRules +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DisableInsightRulesRequest method. +// req, resp := client.DisableInsightRulesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DisableInsightRules +func (c *CloudWatch) DisableInsightRulesRequest(input *DisableInsightRulesInput) (req *request.Request, output *DisableInsightRulesOutput) { + op := &request.Operation{ + Name: opDisableInsightRules, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DisableInsightRulesInput{} + } + + output = &DisableInsightRulesOutput{} + req = c.newRequest(op, input, output) + return +} + +// DisableInsightRules API operation for Amazon CloudWatch. +// +// Disables the specified Contributor Insights rules. When rules are disabled, +// they do not analyze log groups and do not incur costs. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation DisableInsightRules for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DisableInsightRules +func (c *CloudWatch) DisableInsightRules(input *DisableInsightRulesInput) (*DisableInsightRulesOutput, error) { + req, out := c.DisableInsightRulesRequest(input) + return out, req.Send() +} + +// DisableInsightRulesWithContext is the same as DisableInsightRules with the addition of +// the ability to pass a context and additional request options. +// +// See DisableInsightRules for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) DisableInsightRulesWithContext(ctx aws.Context, input *DisableInsightRulesInput, opts ...request.Option) (*DisableInsightRulesOutput, error) { + req, out := c.DisableInsightRulesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opEnableAlarmActions = "EnableAlarmActions" + +// EnableAlarmActionsRequest generates a "aws/request.Request" representing the +// client's request for the EnableAlarmActions operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See EnableAlarmActions for more information on using the EnableAlarmActions +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the EnableAlarmActionsRequest method. +// req, resp := client.EnableAlarmActionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/EnableAlarmActions +func (c *CloudWatch) EnableAlarmActionsRequest(input *EnableAlarmActionsInput) (req *request.Request, output *EnableAlarmActionsOutput) { + op := &request.Operation{ + Name: opEnableAlarmActions, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &EnableAlarmActionsInput{} + } + + output = &EnableAlarmActionsOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// EnableAlarmActions API operation for Amazon CloudWatch. +// +// Enables the actions for the specified alarms. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation EnableAlarmActions for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/EnableAlarmActions +func (c *CloudWatch) EnableAlarmActions(input *EnableAlarmActionsInput) (*EnableAlarmActionsOutput, error) { + req, out := c.EnableAlarmActionsRequest(input) + return out, req.Send() +} + +// EnableAlarmActionsWithContext is the same as EnableAlarmActions with the addition of +// the ability to pass a context and additional request options. +// +// See EnableAlarmActions for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) EnableAlarmActionsWithContext(ctx aws.Context, input *EnableAlarmActionsInput, opts ...request.Option) (*EnableAlarmActionsOutput, error) { + req, out := c.EnableAlarmActionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opEnableInsightRules = "EnableInsightRules" + +// EnableInsightRulesRequest generates a "aws/request.Request" representing the +// client's request for the EnableInsightRules operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See EnableInsightRules for more information on using the EnableInsightRules +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the EnableInsightRulesRequest method. +// req, resp := client.EnableInsightRulesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/EnableInsightRules +func (c *CloudWatch) EnableInsightRulesRequest(input *EnableInsightRulesInput) (req *request.Request, output *EnableInsightRulesOutput) { + op := &request.Operation{ + Name: opEnableInsightRules, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &EnableInsightRulesInput{} + } + + output = &EnableInsightRulesOutput{} + req = c.newRequest(op, input, output) + return +} + +// EnableInsightRules API operation for Amazon CloudWatch. +// +// Enables the specified Contributor Insights rules. When rules are enabled, +// they immediately begin analyzing log data. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation EnableInsightRules for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// - ErrCodeLimitExceededException "LimitExceededException" +// The operation exceeded one or more limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/EnableInsightRules +func (c *CloudWatch) EnableInsightRules(input *EnableInsightRulesInput) (*EnableInsightRulesOutput, error) { + req, out := c.EnableInsightRulesRequest(input) + return out, req.Send() +} + +// EnableInsightRulesWithContext is the same as EnableInsightRules with the addition of +// the ability to pass a context and additional request options. +// +// See EnableInsightRules for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) EnableInsightRulesWithContext(ctx aws.Context, input *EnableInsightRulesInput, opts ...request.Option) (*EnableInsightRulesOutput, error) { + req, out := c.EnableInsightRulesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetDashboard = "GetDashboard" + +// GetDashboardRequest generates a "aws/request.Request" representing the +// client's request for the GetDashboard operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetDashboard for more information on using the GetDashboard +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetDashboardRequest method. +// req, resp := client.GetDashboardRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetDashboard +func (c *CloudWatch) GetDashboardRequest(input *GetDashboardInput) (req *request.Request, output *GetDashboardOutput) { + op := &request.Operation{ + Name: opGetDashboard, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetDashboardInput{} + } + + output = &GetDashboardOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetDashboard API operation for Amazon CloudWatch. +// +// Displays the details of the dashboard that you specify. +// +// To copy an existing dashboard, use GetDashboard, and then use the data returned +// within DashboardBody as the template for the new dashboard when you call +// PutDashboard to create the copy. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation GetDashboard for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeDashboardNotFoundError "ResourceNotFound" +// The specified dashboard does not exist. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetDashboard +func (c *CloudWatch) GetDashboard(input *GetDashboardInput) (*GetDashboardOutput, error) { + req, out := c.GetDashboardRequest(input) + return out, req.Send() +} + +// GetDashboardWithContext is the same as GetDashboard with the addition of +// the ability to pass a context and additional request options. +// +// See GetDashboard for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) GetDashboardWithContext(ctx aws.Context, input *GetDashboardInput, opts ...request.Option) (*GetDashboardOutput, error) { + req, out := c.GetDashboardRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetInsightRuleReport = "GetInsightRuleReport" + +// GetInsightRuleReportRequest generates a "aws/request.Request" representing the +// client's request for the GetInsightRuleReport operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetInsightRuleReport for more information on using the GetInsightRuleReport +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetInsightRuleReportRequest method. +// req, resp := client.GetInsightRuleReportRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetInsightRuleReport +func (c *CloudWatch) GetInsightRuleReportRequest(input *GetInsightRuleReportInput) (req *request.Request, output *GetInsightRuleReportOutput) { + op := &request.Operation{ + Name: opGetInsightRuleReport, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetInsightRuleReportInput{} + } + + output = &GetInsightRuleReportOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetInsightRuleReport API operation for Amazon CloudWatch. +// +// This operation returns the time series data collected by a Contributor Insights +// rule. The data includes the identity and number of contributors to the log +// group. +// +// You can also optionally return one or more statistics about each data point +// in the time series. These statistics can include the following: +// +// - UniqueContributors -- the number of unique contributors for each data +// point. +// +// - MaxContributorValue -- the value of the top contributor for each data +// point. The identity of the contributor might change for each data point +// in the graph. If this rule aggregates by COUNT, the top contributor for +// each data point is the contributor with the most occurrences in that period. +// If the rule aggregates by SUM, the top contributor is the contributor +// with the highest sum in the log field specified by the rule's Value, during +// that period. +// +// - SampleCount -- the number of data points matched by the rule. +// +// - Sum -- the sum of the values from all contributors during the time period +// represented by that data point. +// +// - Minimum -- the minimum value from a single observation during the time +// period represented by that data point. +// +// - Maximum -- the maximum value from a single observation during the time +// period represented by that data point. +// +// - Average -- the average value from all contributors during the time period +// represented by that data point. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation GetInsightRuleReport for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// - ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The named resource does not exist. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetInsightRuleReport +func (c *CloudWatch) GetInsightRuleReport(input *GetInsightRuleReportInput) (*GetInsightRuleReportOutput, error) { + req, out := c.GetInsightRuleReportRequest(input) + return out, req.Send() +} + +// GetInsightRuleReportWithContext is the same as GetInsightRuleReport with the addition of +// the ability to pass a context and additional request options. +// +// See GetInsightRuleReport for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) GetInsightRuleReportWithContext(ctx aws.Context, input *GetInsightRuleReportInput, opts ...request.Option) (*GetInsightRuleReportOutput, error) { + req, out := c.GetInsightRuleReportRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetMetricData = "GetMetricData" + +// GetMetricDataRequest generates a "aws/request.Request" representing the +// client's request for the GetMetricData operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetMetricData for more information on using the GetMetricData +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetMetricDataRequest method. +// req, resp := client.GetMetricDataRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricData +func (c *CloudWatch) GetMetricDataRequest(input *GetMetricDataInput) (req *request.Request, output *GetMetricDataOutput) { + op := &request.Operation{ + Name: opGetMetricData, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxDatapoints", + TruncationToken: "", + }, + } + + if input == nil { + input = &GetMetricDataInput{} + } + + output = &GetMetricDataOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetMetricData API operation for Amazon CloudWatch. +// +// You can use the GetMetricData API to retrieve CloudWatch metric values. The +// operation can also include a CloudWatch Metrics Insights query, and one or +// more metric math functions. +// +// A GetMetricData operation that does not include a query can retrieve as many +// as 500 different metrics in a single request, with a total of as many as +// 100,800 data points. You can also optionally perform metric math expressions +// on the values of the returned statistics, to create new time series that +// represent new insights into your data. For example, using Lambda metrics, +// you could divide the Errors metric by the Invocations metric to get an error +// rate time series. For more information about metric math expressions, see +// Metric Math Syntax and Functions (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html#metric-math-syntax) +// in the Amazon CloudWatch User Guide. +// +// If you include a Metrics Insights query, each GetMetricData operation can +// include only one query. But the same GetMetricData operation can also retrieve +// other metrics. Metrics Insights queries can query only the most recent three +// hours of metric data. For more information about Metrics Insights, see Query +// your metrics with CloudWatch Metrics Insights (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/query_with_cloudwatch-metrics-insights.html). +// +// Calls to the GetMetricData API have a different pricing structure than calls +// to GetMetricStatistics. For more information about pricing, see Amazon CloudWatch +// Pricing (https://aws.amazon.com/cloudwatch/pricing/). +// +// Amazon CloudWatch retains metric data as follows: +// +// - Data points with a period of less than 60 seconds are available for +// 3 hours. These data points are high-resolution metrics and are available +// only for custom metrics that have been defined with a StorageResolution +// of 1. +// +// - Data points with a period of 60 seconds (1-minute) are available for +// 15 days. +// +// - Data points with a period of 300 seconds (5-minute) are available for +// 63 days. +// +// - Data points with a period of 3600 seconds (1 hour) are available for +// 455 days (15 months). +// +// Data points that are initially published with a shorter period are aggregated +// together for long-term storage. For example, if you collect data using a +// period of 1 minute, the data remains available for 15 days with 1-minute +// resolution. After 15 days, this data is still available, but is aggregated +// and retrievable only with a resolution of 5 minutes. After 63 days, the data +// is further aggregated and is available with a resolution of 1 hour. +// +// If you omit Unit in your request, all data that was collected with any unit +// is returned, along with the corresponding units that were specified when +// the data was reported to CloudWatch. If you specify a unit, the operation +// returns only data that was collected with that unit specified. If you specify +// a unit that does not match the data collected, the results of the operation +// are null. CloudWatch does not perform unit conversions. +// +// # Using Metrics Insights queries with metric math +// +// You can't mix a Metric Insights query and metric math syntax in the same +// expression, but you can reference results from a Metrics Insights query within +// other Metric math expressions. A Metrics Insights query without a GROUP BY +// clause returns a single time-series (TS), and can be used as input for a +// metric math expression that expects a single time series. A Metrics Insights +// query with a GROUP BY clause returns an array of time-series (TS[]), and +// can be used as input for a metric math expression that expects an array of +// time series. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation GetMetricData for usage and error information. +// +// Returned Error Codes: +// - ErrCodeInvalidNextToken "InvalidNextToken" +// The next token specified is invalid. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricData +func (c *CloudWatch) GetMetricData(input *GetMetricDataInput) (*GetMetricDataOutput, error) { + req, out := c.GetMetricDataRequest(input) + return out, req.Send() +} + +// GetMetricDataWithContext is the same as GetMetricData with the addition of +// the ability to pass a context and additional request options. +// +// See GetMetricData for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) GetMetricDataWithContext(ctx aws.Context, input *GetMetricDataInput, opts ...request.Option) (*GetMetricDataOutput, error) { + req, out := c.GetMetricDataRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// GetMetricDataPages iterates over the pages of a GetMetricData operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See GetMetricData method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a GetMetricData operation. +// pageNum := 0 +// err := client.GetMetricDataPages(params, +// func(page *cloudwatch.GetMetricDataOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatch) GetMetricDataPages(input *GetMetricDataInput, fn func(*GetMetricDataOutput, bool) bool) error { + return c.GetMetricDataPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetMetricDataPagesWithContext same as GetMetricDataPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) GetMetricDataPagesWithContext(ctx aws.Context, input *GetMetricDataInput, fn func(*GetMetricDataOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetMetricDataInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetMetricDataRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*GetMetricDataOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opGetMetricStatistics = "GetMetricStatistics" + +// GetMetricStatisticsRequest generates a "aws/request.Request" representing the +// client's request for the GetMetricStatistics operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetMetricStatistics for more information on using the GetMetricStatistics +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetMetricStatisticsRequest method. +// req, resp := client.GetMetricStatisticsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricStatistics +func (c *CloudWatch) GetMetricStatisticsRequest(input *GetMetricStatisticsInput) (req *request.Request, output *GetMetricStatisticsOutput) { + op := &request.Operation{ + Name: opGetMetricStatistics, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetMetricStatisticsInput{} + } + + output = &GetMetricStatisticsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetMetricStatistics API operation for Amazon CloudWatch. +// +// Gets statistics for the specified metric. +// +// The maximum number of data points returned from a single call is 1,440. If +// you request more than 1,440 data points, CloudWatch returns an error. To +// reduce the number of data points, you can narrow the specified time range +// and make multiple requests across adjacent time ranges, or you can increase +// the specified period. Data points are not returned in chronological order. +// +// CloudWatch aggregates data points based on the length of the period that +// you specify. For example, if you request statistics with a one-hour period, +// CloudWatch aggregates all data points with time stamps that fall within each +// one-hour period. Therefore, the number of values aggregated by CloudWatch +// is larger than the number of data points returned. +// +// CloudWatch needs raw data points to calculate percentile statistics. If you +// publish data using a statistic set instead, you can only retrieve percentile +// statistics for this data if one of the following conditions is true: +// +// - The SampleCount value of the statistic set is 1. +// +// - The Min and the Max values of the statistic set are equal. +// +// Percentile statistics are not available for metrics when any of the metric +// values are negative numbers. +// +// Amazon CloudWatch retains metric data as follows: +// +// - Data points with a period of less than 60 seconds are available for +// 3 hours. These data points are high-resolution metrics and are available +// only for custom metrics that have been defined with a StorageResolution +// of 1. +// +// - Data points with a period of 60 seconds (1-minute) are available for +// 15 days. +// +// - Data points with a period of 300 seconds (5-minute) are available for +// 63 days. +// +// - Data points with a period of 3600 seconds (1 hour) are available for +// 455 days (15 months). +// +// Data points that are initially published with a shorter period are aggregated +// together for long-term storage. For example, if you collect data using a +// period of 1 minute, the data remains available for 15 days with 1-minute +// resolution. After 15 days, this data is still available, but is aggregated +// and retrievable only with a resolution of 5 minutes. After 63 days, the data +// is further aggregated and is available with a resolution of 1 hour. +// +// CloudWatch started retaining 5-minute and 1-hour metric data as of July 9, +// 2016. +// +// For information about metrics and dimensions supported by Amazon Web Services +// services, see the Amazon CloudWatch Metrics and Dimensions Reference (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html) +// in the Amazon CloudWatch User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation GetMetricStatistics for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// - ErrCodeInvalidParameterCombinationException "InvalidParameterCombination" +// Parameters were used together that cannot be used together. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricStatistics +func (c *CloudWatch) GetMetricStatistics(input *GetMetricStatisticsInput) (*GetMetricStatisticsOutput, error) { + req, out := c.GetMetricStatisticsRequest(input) + return out, req.Send() +} + +// GetMetricStatisticsWithContext is the same as GetMetricStatistics with the addition of +// the ability to pass a context and additional request options. +// +// See GetMetricStatistics for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) GetMetricStatisticsWithContext(ctx aws.Context, input *GetMetricStatisticsInput, opts ...request.Option) (*GetMetricStatisticsOutput, error) { + req, out := c.GetMetricStatisticsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetMetricStream = "GetMetricStream" + +// GetMetricStreamRequest generates a "aws/request.Request" representing the +// client's request for the GetMetricStream operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetMetricStream for more information on using the GetMetricStream +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetMetricStreamRequest method. +// req, resp := client.GetMetricStreamRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricStream +func (c *CloudWatch) GetMetricStreamRequest(input *GetMetricStreamInput) (req *request.Request, output *GetMetricStreamOutput) { + op := &request.Operation{ + Name: opGetMetricStream, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetMetricStreamInput{} + } + + output = &GetMetricStreamOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetMetricStream API operation for Amazon CloudWatch. +// +// Returns information about the metric stream that you specify. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation GetMetricStream for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The named resource does not exist. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// - ErrCodeInvalidParameterCombinationException "InvalidParameterCombination" +// Parameters were used together that cannot be used together. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricStream +func (c *CloudWatch) GetMetricStream(input *GetMetricStreamInput) (*GetMetricStreamOutput, error) { + req, out := c.GetMetricStreamRequest(input) + return out, req.Send() +} + +// GetMetricStreamWithContext is the same as GetMetricStream with the addition of +// the ability to pass a context and additional request options. +// +// See GetMetricStream for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) GetMetricStreamWithContext(ctx aws.Context, input *GetMetricStreamInput, opts ...request.Option) (*GetMetricStreamOutput, error) { + req, out := c.GetMetricStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetMetricWidgetImage = "GetMetricWidgetImage" + +// GetMetricWidgetImageRequest generates a "aws/request.Request" representing the +// client's request for the GetMetricWidgetImage operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetMetricWidgetImage for more information on using the GetMetricWidgetImage +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetMetricWidgetImageRequest method. +// req, resp := client.GetMetricWidgetImageRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricWidgetImage +func (c *CloudWatch) GetMetricWidgetImageRequest(input *GetMetricWidgetImageInput) (req *request.Request, output *GetMetricWidgetImageOutput) { + op := &request.Operation{ + Name: opGetMetricWidgetImage, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetMetricWidgetImageInput{} + } + + output = &GetMetricWidgetImageOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetMetricWidgetImage API operation for Amazon CloudWatch. +// +// You can use the GetMetricWidgetImage API to retrieve a snapshot graph of +// one or more Amazon CloudWatch metrics as a bitmap image. You can then embed +// this image into your services and products, such as wiki pages, reports, +// and documents. You could also retrieve images regularly, such as every minute, +// and create your own custom live dashboard. +// +// The graph you retrieve can include all CloudWatch metric graph features, +// including metric math and horizontal and vertical annotations. +// +// There is a limit of 20 transactions per second for this API. Each GetMetricWidgetImage +// action has the following limits: +// +// - As many as 100 metrics in the graph. +// +// - Up to 100 KB uncompressed payload. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation GetMetricWidgetImage for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricWidgetImage +func (c *CloudWatch) GetMetricWidgetImage(input *GetMetricWidgetImageInput) (*GetMetricWidgetImageOutput, error) { + req, out := c.GetMetricWidgetImageRequest(input) + return out, req.Send() +} + +// GetMetricWidgetImageWithContext is the same as GetMetricWidgetImage with the addition of +// the ability to pass a context and additional request options. +// +// See GetMetricWidgetImage for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) GetMetricWidgetImageWithContext(ctx aws.Context, input *GetMetricWidgetImageInput, opts ...request.Option) (*GetMetricWidgetImageOutput, error) { + req, out := c.GetMetricWidgetImageRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListDashboards = "ListDashboards" + +// ListDashboardsRequest generates a "aws/request.Request" representing the +// client's request for the ListDashboards operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListDashboards for more information on using the ListDashboards +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the ListDashboardsRequest method. +// req, resp := client.ListDashboardsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListDashboards +func (c *CloudWatch) ListDashboardsRequest(input *ListDashboardsInput) (req *request.Request, output *ListDashboardsOutput) { + op := &request.Operation{ + Name: opListDashboards, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListDashboardsInput{} + } + + output = &ListDashboardsOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListDashboards API operation for Amazon CloudWatch. +// +// Returns a list of the dashboards for your account. If you include DashboardNamePrefix, +// only those dashboards with names starting with the prefix are listed. Otherwise, +// all dashboards in your account are listed. +// +// ListDashboards returns up to 1000 results on one page. If there are more +// than 1000 dashboards, you can call ListDashboards again and include the value +// you received for NextToken in the first call, to receive the next 1000 results. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation ListDashboards for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListDashboards +func (c *CloudWatch) ListDashboards(input *ListDashboardsInput) (*ListDashboardsOutput, error) { + req, out := c.ListDashboardsRequest(input) + return out, req.Send() +} + +// ListDashboardsWithContext is the same as ListDashboards with the addition of +// the ability to pass a context and additional request options. +// +// See ListDashboards for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) ListDashboardsWithContext(ctx aws.Context, input *ListDashboardsInput, opts ...request.Option) (*ListDashboardsOutput, error) { + req, out := c.ListDashboardsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListDashboardsPages iterates over the pages of a ListDashboards operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListDashboards method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListDashboards operation. +// pageNum := 0 +// err := client.ListDashboardsPages(params, +// func(page *cloudwatch.ListDashboardsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatch) ListDashboardsPages(input *ListDashboardsInput, fn func(*ListDashboardsOutput, bool) bool) error { + return c.ListDashboardsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListDashboardsPagesWithContext same as ListDashboardsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) ListDashboardsPagesWithContext(ctx aws.Context, input *ListDashboardsInput, fn func(*ListDashboardsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListDashboardsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListDashboardsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*ListDashboardsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opListMetricStreams = "ListMetricStreams" + +// ListMetricStreamsRequest generates a "aws/request.Request" representing the +// client's request for the ListMetricStreams operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListMetricStreams for more information on using the ListMetricStreams +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the ListMetricStreamsRequest method. +// req, resp := client.ListMetricStreamsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetricStreams +func (c *CloudWatch) ListMetricStreamsRequest(input *ListMetricStreamsInput) (req *request.Request, output *ListMetricStreamsOutput) { + op := &request.Operation{ + Name: opListMetricStreams, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListMetricStreamsInput{} + } + + output = &ListMetricStreamsOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListMetricStreams API operation for Amazon CloudWatch. +// +// Returns a list of metric streams in this account. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation ListMetricStreams for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidNextToken "InvalidNextToken" +// The next token specified is invalid. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetricStreams +func (c *CloudWatch) ListMetricStreams(input *ListMetricStreamsInput) (*ListMetricStreamsOutput, error) { + req, out := c.ListMetricStreamsRequest(input) + return out, req.Send() +} + +// ListMetricStreamsWithContext is the same as ListMetricStreams with the addition of +// the ability to pass a context and additional request options. +// +// See ListMetricStreams for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) ListMetricStreamsWithContext(ctx aws.Context, input *ListMetricStreamsInput, opts ...request.Option) (*ListMetricStreamsOutput, error) { + req, out := c.ListMetricStreamsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListMetricStreamsPages iterates over the pages of a ListMetricStreams operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListMetricStreams method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListMetricStreams operation. +// pageNum := 0 +// err := client.ListMetricStreamsPages(params, +// func(page *cloudwatch.ListMetricStreamsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatch) ListMetricStreamsPages(input *ListMetricStreamsInput, fn func(*ListMetricStreamsOutput, bool) bool) error { + return c.ListMetricStreamsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListMetricStreamsPagesWithContext same as ListMetricStreamsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) ListMetricStreamsPagesWithContext(ctx aws.Context, input *ListMetricStreamsInput, fn func(*ListMetricStreamsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListMetricStreamsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListMetricStreamsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*ListMetricStreamsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opListMetrics = "ListMetrics" + +// ListMetricsRequest generates a "aws/request.Request" representing the +// client's request for the ListMetrics operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListMetrics for more information on using the ListMetrics +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the ListMetricsRequest method. +// req, resp := client.ListMetricsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetrics +func (c *CloudWatch) ListMetricsRequest(input *ListMetricsInput) (req *request.Request, output *ListMetricsOutput) { + op := &request.Operation{ + Name: opListMetrics, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListMetricsInput{} + } + + output = &ListMetricsOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListMetrics API operation for Amazon CloudWatch. +// +// List the specified metrics. You can use the returned metrics with GetMetricData +// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) +// or GetMetricStatistics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html) +// to get statistical data. +// +// Up to 500 results are returned for any one call. To retrieve additional results, +// use the returned token with subsequent calls. +// +// After you create a metric, allow up to 15 minutes for the metric to appear. +// To see metric statistics sooner, use GetMetricData (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) +// or GetMetricStatistics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html). +// +// If you are using CloudWatch cross-account observability, you can use this +// operation in a monitoring account and view metrics from the linked source +// accounts. For more information, see CloudWatch cross-account observability +// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html). +// +// ListMetrics doesn't return information about metrics if those metrics haven't +// reported data in the past two weeks. To retrieve those metrics, use GetMetricData +// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) +// or GetMetricStatistics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation ListMetrics for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetrics +func (c *CloudWatch) ListMetrics(input *ListMetricsInput) (*ListMetricsOutput, error) { + req, out := c.ListMetricsRequest(input) + return out, req.Send() +} + +// ListMetricsWithContext is the same as ListMetrics with the addition of +// the ability to pass a context and additional request options. +// +// See ListMetrics for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) ListMetricsWithContext(ctx aws.Context, input *ListMetricsInput, opts ...request.Option) (*ListMetricsOutput, error) { + req, out := c.ListMetricsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListMetricsPages iterates over the pages of a ListMetrics operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListMetrics method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListMetrics operation. +// pageNum := 0 +// err := client.ListMetricsPages(params, +// func(page *cloudwatch.ListMetricsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatch) ListMetricsPages(input *ListMetricsInput, fn func(*ListMetricsOutput, bool) bool) error { + return c.ListMetricsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListMetricsPagesWithContext same as ListMetricsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) ListMetricsPagesWithContext(ctx aws.Context, input *ListMetricsInput, fn func(*ListMetricsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListMetricsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListMetricsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*ListMetricsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opListTagsForResource = "ListTagsForResource" + +// ListTagsForResourceRequest generates a "aws/request.Request" representing the +// client's request for the ListTagsForResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListTagsForResource for more information on using the ListTagsForResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the ListTagsForResourceRequest method. +// req, resp := client.ListTagsForResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListTagsForResource +func (c *CloudWatch) ListTagsForResourceRequest(input *ListTagsForResourceInput) (req *request.Request, output *ListTagsForResourceOutput) { + op := &request.Operation{ + Name: opListTagsForResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListTagsForResourceInput{} + } + + output = &ListTagsForResourceOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListTagsForResource API operation for Amazon CloudWatch. +// +// Displays the tags associated with a CloudWatch resource. Currently, alarms +// and Contributor Insights rules support tagging. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation ListTagsForResource for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The named resource does not exist. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListTagsForResource +func (c *CloudWatch) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutAnomalyDetector = "PutAnomalyDetector" + +// PutAnomalyDetectorRequest generates a "aws/request.Request" representing the +// client's request for the PutAnomalyDetector operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutAnomalyDetector for more information on using the PutAnomalyDetector +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutAnomalyDetectorRequest method. +// req, resp := client.PutAnomalyDetectorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutAnomalyDetector +func (c *CloudWatch) PutAnomalyDetectorRequest(input *PutAnomalyDetectorInput) (req *request.Request, output *PutAnomalyDetectorOutput) { + op := &request.Operation{ + Name: opPutAnomalyDetector, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutAnomalyDetectorInput{} + } + + output = &PutAnomalyDetectorOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// PutAnomalyDetector API operation for Amazon CloudWatch. +// +// Creates an anomaly detection model for a CloudWatch metric. You can use the +// model to display a band of expected normal values when the metric is graphed. +// +// If you have enabled unified cross-account observability, and this account +// is a monitoring account, the metric can be in the same account or a source +// account. You can specify the account ID in the object you specify in the +// SingleMetricAnomalyDetector parameter. +// +// For more information, see CloudWatch Anomaly Detection (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Anomaly_Detection.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation PutAnomalyDetector for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeLimitExceededException "LimitExceededException" +// The operation exceeded one or more limits. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// - ErrCodeInvalidParameterCombinationException "InvalidParameterCombination" +// Parameters were used together that cannot be used together. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutAnomalyDetector +func (c *CloudWatch) PutAnomalyDetector(input *PutAnomalyDetectorInput) (*PutAnomalyDetectorOutput, error) { + req, out := c.PutAnomalyDetectorRequest(input) + return out, req.Send() +} + +// PutAnomalyDetectorWithContext is the same as PutAnomalyDetector with the addition of +// the ability to pass a context and additional request options. +// +// See PutAnomalyDetector for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) PutAnomalyDetectorWithContext(ctx aws.Context, input *PutAnomalyDetectorInput, opts ...request.Option) (*PutAnomalyDetectorOutput, error) { + req, out := c.PutAnomalyDetectorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutCompositeAlarm = "PutCompositeAlarm" + +// PutCompositeAlarmRequest generates a "aws/request.Request" representing the +// client's request for the PutCompositeAlarm operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutCompositeAlarm for more information on using the PutCompositeAlarm +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutCompositeAlarmRequest method. +// req, resp := client.PutCompositeAlarmRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutCompositeAlarm +func (c *CloudWatch) PutCompositeAlarmRequest(input *PutCompositeAlarmInput) (req *request.Request, output *PutCompositeAlarmOutput) { + op := &request.Operation{ + Name: opPutCompositeAlarm, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutCompositeAlarmInput{} + } + + output = &PutCompositeAlarmOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// PutCompositeAlarm API operation for Amazon CloudWatch. +// +// Creates or updates a composite alarm. When you create a composite alarm, +// you specify a rule expression for the alarm that takes into account the alarm +// states of other alarms that you have created. The composite alarm goes into +// ALARM state only if all conditions of the rule are met. +// +// The alarms specified in a composite alarm's rule expression can include metric +// alarms and other composite alarms. The rule expression of a composite alarm +// can include as many as 100 underlying alarms. Any single alarm can be included +// in the rule expressions of as many as 150 composite alarms. +// +// Using composite alarms can reduce alarm noise. You can create multiple metric +// alarms, and also create a composite alarm and set up alerts only for the +// composite alarm. For example, you could create a composite alarm that goes +// into ALARM state only when more than one of the underlying metric alarms +// are in ALARM state. +// +// Composite alarms can take the following actions: +// +// - Notify Amazon SNS topics. +// +// - Invoke Lambda functions. +// +// - Create OpsItems in Systems Manager Ops Center. +// +// - Create incidents in Systems Manager Incident Manager. +// +// It is possible to create a loop or cycle of composite alarms, where composite +// alarm A depends on composite alarm B, and composite alarm B also depends +// on composite alarm A. In this scenario, you can't delete any composite alarm +// that is part of the cycle because there is always still a composite alarm +// that depends on that alarm that you want to delete. +// +// To get out of such a situation, you must break the cycle by changing the +// rule of one of the composite alarms in the cycle to remove a dependency that +// creates the cycle. The simplest change to make to break a cycle is to change +// the AlarmRule of one of the alarms to false. +// +// Additionally, the evaluation of composite alarms stops if CloudWatch detects +// a cycle in the evaluation path. +// +// When this operation creates an alarm, the alarm state is immediately set +// to INSUFFICIENT_DATA. The alarm is then evaluated and its state is set appropriately. +// Any actions associated with the new state are then executed. For a composite +// alarm, this initial time after creation is the only time that the alarm can +// be in INSUFFICIENT_DATA state. +// +// When you update an existing alarm, its state is left unchanged, but the update +// completely overwrites the previous configuration of the alarm. +// +// To use this operation, you must be signed on with the cloudwatch:PutCompositeAlarm +// permission that is scoped to *. You can't create a composite alarms if your +// cloudwatch:PutCompositeAlarm permission has a narrower scope. +// +// If you are an IAM user, you must have iam:CreateServiceLinkedRole to create +// a composite alarm that has Systems Manager OpsItem actions. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation PutCompositeAlarm for usage and error information. +// +// Returned Error Codes: +// - ErrCodeLimitExceededFault "LimitExceeded" +// The quota for alarms for this customer has already been reached. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutCompositeAlarm +func (c *CloudWatch) PutCompositeAlarm(input *PutCompositeAlarmInput) (*PutCompositeAlarmOutput, error) { + req, out := c.PutCompositeAlarmRequest(input) + return out, req.Send() +} + +// PutCompositeAlarmWithContext is the same as PutCompositeAlarm with the addition of +// the ability to pass a context and additional request options. +// +// See PutCompositeAlarm for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) PutCompositeAlarmWithContext(ctx aws.Context, input *PutCompositeAlarmInput, opts ...request.Option) (*PutCompositeAlarmOutput, error) { + req, out := c.PutCompositeAlarmRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutDashboard = "PutDashboard" + +// PutDashboardRequest generates a "aws/request.Request" representing the +// client's request for the PutDashboard operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutDashboard for more information on using the PutDashboard +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutDashboardRequest method. +// req, resp := client.PutDashboardRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutDashboard +func (c *CloudWatch) PutDashboardRequest(input *PutDashboardInput) (req *request.Request, output *PutDashboardOutput) { + op := &request.Operation{ + Name: opPutDashboard, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutDashboardInput{} + } + + output = &PutDashboardOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutDashboard API operation for Amazon CloudWatch. +// +// Creates a dashboard if it does not already exist, or updates an existing +// dashboard. If you update a dashboard, the entire contents are replaced with +// what you specify here. +// +// All dashboards in your account are global, not region-specific. +// +// A simple way to create a dashboard using PutDashboard is to copy an existing +// dashboard. To copy an existing dashboard using the console, you can load +// the dashboard and then use the View/edit source command in the Actions menu +// to display the JSON block for that dashboard. Another way to copy a dashboard +// is to use GetDashboard, and then use the data returned within DashboardBody +// as the template for the new dashboard when you call PutDashboard. +// +// When you create a dashboard with PutDashboard, a good practice is to add +// a text widget at the top of the dashboard with a message that the dashboard +// was created by script and should not be changed in the console. This message +// could also point console users to the location of the DashboardBody script +// or the CloudFormation template used to create the dashboard. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation PutDashboard for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeDashboardInvalidInputError "InvalidParameterInput" +// Some part of the dashboard data is invalid. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutDashboard +func (c *CloudWatch) PutDashboard(input *PutDashboardInput) (*PutDashboardOutput, error) { + req, out := c.PutDashboardRequest(input) + return out, req.Send() +} + +// PutDashboardWithContext is the same as PutDashboard with the addition of +// the ability to pass a context and additional request options. +// +// See PutDashboard for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) PutDashboardWithContext(ctx aws.Context, input *PutDashboardInput, opts ...request.Option) (*PutDashboardOutput, error) { + req, out := c.PutDashboardRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutInsightRule = "PutInsightRule" + +// PutInsightRuleRequest generates a "aws/request.Request" representing the +// client's request for the PutInsightRule operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutInsightRule for more information on using the PutInsightRule +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutInsightRuleRequest method. +// req, resp := client.PutInsightRuleRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutInsightRule +func (c *CloudWatch) PutInsightRuleRequest(input *PutInsightRuleInput) (req *request.Request, output *PutInsightRuleOutput) { + op := &request.Operation{ + Name: opPutInsightRule, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutInsightRuleInput{} + } + + output = &PutInsightRuleOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// PutInsightRule API operation for Amazon CloudWatch. +// +// Creates a Contributor Insights rule. Rules evaluate log events in a CloudWatch +// Logs log group, enabling you to find contributor data for the log events +// in that log group. For more information, see Using Contributor Insights to +// Analyze High-Cardinality Data (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContributorInsights.html). +// +// If you create a rule, delete it, and then re-create it with the same name, +// historical data from the first time the rule was created might not be available. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation PutInsightRule for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// - ErrCodeLimitExceededException "LimitExceededException" +// The operation exceeded one or more limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutInsightRule +func (c *CloudWatch) PutInsightRule(input *PutInsightRuleInput) (*PutInsightRuleOutput, error) { + req, out := c.PutInsightRuleRequest(input) + return out, req.Send() +} + +// PutInsightRuleWithContext is the same as PutInsightRule with the addition of +// the ability to pass a context and additional request options. +// +// See PutInsightRule for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) PutInsightRuleWithContext(ctx aws.Context, input *PutInsightRuleInput, opts ...request.Option) (*PutInsightRuleOutput, error) { + req, out := c.PutInsightRuleRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutMetricAlarm = "PutMetricAlarm" + +// PutMetricAlarmRequest generates a "aws/request.Request" representing the +// client's request for the PutMetricAlarm operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutMetricAlarm for more information on using the PutMetricAlarm +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutMetricAlarmRequest method. +// req, resp := client.PutMetricAlarmRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricAlarm +func (c *CloudWatch) PutMetricAlarmRequest(input *PutMetricAlarmInput) (req *request.Request, output *PutMetricAlarmOutput) { + op := &request.Operation{ + Name: opPutMetricAlarm, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutMetricAlarmInput{} + } + + output = &PutMetricAlarmOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// PutMetricAlarm API operation for Amazon CloudWatch. +// +// Creates or updates an alarm and associates it with the specified metric, +// metric math expression, anomaly detection model, or Metrics Insights query. +// For more information about using a Metrics Insights query for an alarm, see +// Create alarms on Metrics Insights queries (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Create_Metrics_Insights_Alarm.html). +// +// Alarms based on anomaly detection models cannot have Auto Scaling actions. +// +// When this operation creates an alarm, the alarm state is immediately set +// to INSUFFICIENT_DATA. The alarm is then evaluated and its state is set appropriately. +// Any actions associated with the new state are then executed. +// +// When you update an existing alarm, its state is left unchanged, but the update +// completely overwrites the previous configuration of the alarm. +// +// If you are an IAM user, you must have Amazon EC2 permissions for some alarm +// operations: +// +// - The iam:CreateServiceLinkedRole permission for all alarms with EC2 actions +// +// - The iam:CreateServiceLinkedRole permissions to create an alarm with +// Systems Manager OpsItem or response plan actions. +// +// The first time you create an alarm in the Amazon Web Services Management +// Console, the CLI, or by using the PutMetricAlarm API, CloudWatch creates +// the necessary service-linked role for you. The service-linked roles are called +// AWSServiceRoleForCloudWatchEvents and AWSServiceRoleForCloudWatchAlarms_ActionSSM. +// For more information, see Amazon Web Services service-linked role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role). +// +// Each PutMetricAlarm action has a maximum uncompressed payload of 120 KB. +// +// # Cross-account alarms +// +// You can set an alarm on metrics in the current account, or in another account. +// To create a cross-account alarm that watches a metric in a different account, +// you must have completed the following pre-requisites: +// +// - The account where the metrics are located (the sharing account) must +// already have a sharing role named CloudWatch-CrossAccountSharingRole. +// If it does not already have this role, you must create it using the instructions +// in Set up a sharing account in Cross-account cross-Region CloudWatch console +// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html#enable-cross-account-cross-Region). +// The policy for that role must grant access to the ID of the account where +// you are creating the alarm. +// +// - The account where you are creating the alarm (the monitoring account) +// must already have a service-linked role named AWSServiceRoleForCloudWatchCrossAccount +// to allow CloudWatch to assume the sharing role in the sharing account. +// If it does not, you must create it following the directions in Set up +// a monitoring account in Cross-account cross-Region CloudWatch console +// (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html#enable-cross-account-cross-Region). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation PutMetricAlarm for usage and error information. +// +// Returned Error Codes: +// - ErrCodeLimitExceededFault "LimitExceeded" +// The quota for alarms for this customer has already been reached. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricAlarm +func (c *CloudWatch) PutMetricAlarm(input *PutMetricAlarmInput) (*PutMetricAlarmOutput, error) { + req, out := c.PutMetricAlarmRequest(input) + return out, req.Send() +} + +// PutMetricAlarmWithContext is the same as PutMetricAlarm with the addition of +// the ability to pass a context and additional request options. +// +// See PutMetricAlarm for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) PutMetricAlarmWithContext(ctx aws.Context, input *PutMetricAlarmInput, opts ...request.Option) (*PutMetricAlarmOutput, error) { + req, out := c.PutMetricAlarmRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutMetricData = "PutMetricData" + +// PutMetricDataRequest generates a "aws/request.Request" representing the +// client's request for the PutMetricData operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutMetricData for more information on using the PutMetricData +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutMetricDataRequest method. +// req, resp := client.PutMetricDataRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricData +func (c *CloudWatch) PutMetricDataRequest(input *PutMetricDataInput) (req *request.Request, output *PutMetricDataOutput) { + op := &request.Operation{ + Name: opPutMetricData, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutMetricDataInput{} + } + + output = &PutMetricDataOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// PutMetricData API operation for Amazon CloudWatch. +// +// Publishes metric data to Amazon CloudWatch. CloudWatch associates the data +// with the specified metric. If the specified metric does not exist, CloudWatch +// creates the metric. When CloudWatch creates a metric, it can take up to fifteen +// minutes for the metric to appear in calls to ListMetrics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html). +// +// You can publish either individual values in the Value field, or arrays of +// values and the number of times each value occurred during the period by using +// the Values and Counts fields in the MetricData structure. Using the Values +// and Counts method enables you to publish up to 150 values per metric with +// one PutMetricData request, and supports retrieving percentile statistics +// on this data. +// +// Each PutMetricData request is limited to 1 MB in size for HTTP POST requests. +// You can send a payload compressed by gzip. Each request is also limited to +// no more than 1000 different metrics. +// +// Although the Value parameter accepts numbers of type Double, CloudWatch rejects +// values that are either too small or too large. Values must be in the range +// of -2^360 to 2^360. In addition, special values (for example, NaN, +Infinity, +// -Infinity) are not supported. +// +// You can use up to 30 dimensions per metric to further clarify what data the +// metric collects. Each dimension consists of a Name and Value pair. For more +// information about specifying dimensions, see Publishing Metrics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html) +// in the Amazon CloudWatch User Guide. +// +// You specify the time stamp to be associated with each data point. You can +// specify time stamps that are as much as two weeks before the current date, +// and as much as 2 hours after the current day and time. +// +// Data points with time stamps from 24 hours ago or longer can take at least +// 48 hours to become available for GetMetricData (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) +// or GetMetricStatistics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html) +// from the time they are submitted. Data points with time stamps between 3 +// and 24 hours ago can take as much as 2 hours to become available for for +// GetMetricData (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) +// or GetMetricStatistics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricStatistics.html). +// +// CloudWatch needs raw data points to calculate percentile statistics. If you +// publish data using a statistic set instead, you can only retrieve percentile +// statistics for this data if one of the following conditions is true: +// +// - The SampleCount value of the statistic set is 1 and Min, Max, and Sum +// are all equal. +// +// - The Min and Max are equal, and Sum is equal to Min multiplied by SampleCount. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation PutMetricData for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// - ErrCodeInvalidParameterCombinationException "InvalidParameterCombination" +// Parameters were used together that cannot be used together. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricData +func (c *CloudWatch) PutMetricData(input *PutMetricDataInput) (*PutMetricDataOutput, error) { + req, out := c.PutMetricDataRequest(input) + return out, req.Send() +} + +// PutMetricDataWithContext is the same as PutMetricData with the addition of +// the ability to pass a context and additional request options. +// +// See PutMetricData for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) PutMetricDataWithContext(ctx aws.Context, input *PutMetricDataInput, opts ...request.Option) (*PutMetricDataOutput, error) { + req, out := c.PutMetricDataRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutMetricStream = "PutMetricStream" + +// PutMetricStreamRequest generates a "aws/request.Request" representing the +// client's request for the PutMetricStream operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutMetricStream for more information on using the PutMetricStream +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutMetricStreamRequest method. +// req, resp := client.PutMetricStreamRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricStream +func (c *CloudWatch) PutMetricStreamRequest(input *PutMetricStreamInput) (req *request.Request, output *PutMetricStreamOutput) { + op := &request.Operation{ + Name: opPutMetricStream, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutMetricStreamInput{} + } + + output = &PutMetricStreamOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutMetricStream API operation for Amazon CloudWatch. +// +// Creates or updates a metric stream. Metric streams can automatically stream +// CloudWatch metrics to Amazon Web Services destinations, including Amazon +// S3, and to many third-party solutions. +// +// For more information, see Using Metric Streams (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Metric-Streams.html). +// +// To create a metric stream, you must be signed in to an account that has the +// iam:PassRole permission and either the CloudWatchFullAccess policy or the +// cloudwatch:PutMetricStream permission. +// +// When you create or update a metric stream, you choose one of the following: +// +// - Stream metrics from all metric namespaces in the account. +// +// - Stream metrics from all metric namespaces in the account, except for +// the namespaces that you list in ExcludeFilters. +// +// - Stream metrics from only the metric namespaces that you list in IncludeFilters. +// +// By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT +// statistics for each metric that is streamed. You can use the StatisticsConfigurations +// parameter to have the metric stream send additional statistics in the stream. +// Streaming additional statistics incurs additional costs. For more information, +// see Amazon CloudWatch Pricing (https://aws.amazon.com/cloudwatch/pricing/). +// +// When you use PutMetricStream to create a new metric stream, the stream is +// created in the running state. If you use it to update an existing stream, +// the state of the stream is not changed. +// +// If you are using CloudWatch cross-account observability and you create a +// metric stream in a monitoring account, you can choose whether to include +// metrics from source accounts in the stream. For more information, see CloudWatch +// cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation PutMetricStream for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeConcurrentModificationException "ConcurrentModificationException" +// More than one process tried to modify a resource at the same time. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// - ErrCodeInvalidParameterCombinationException "InvalidParameterCombination" +// Parameters were used together that cannot be used together. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricStream +func (c *CloudWatch) PutMetricStream(input *PutMetricStreamInput) (*PutMetricStreamOutput, error) { + req, out := c.PutMetricStreamRequest(input) + return out, req.Send() +} + +// PutMetricStreamWithContext is the same as PutMetricStream with the addition of +// the ability to pass a context and additional request options. +// +// See PutMetricStream for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) PutMetricStreamWithContext(ctx aws.Context, input *PutMetricStreamInput, opts ...request.Option) (*PutMetricStreamOutput, error) { + req, out := c.PutMetricStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opSetAlarmState = "SetAlarmState" + +// SetAlarmStateRequest generates a "aws/request.Request" representing the +// client's request for the SetAlarmState operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See SetAlarmState for more information on using the SetAlarmState +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the SetAlarmStateRequest method. +// req, resp := client.SetAlarmStateRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/SetAlarmState +func (c *CloudWatch) SetAlarmStateRequest(input *SetAlarmStateInput) (req *request.Request, output *SetAlarmStateOutput) { + op := &request.Operation{ + Name: opSetAlarmState, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &SetAlarmStateInput{} + } + + output = &SetAlarmStateOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// SetAlarmState API operation for Amazon CloudWatch. +// +// Temporarily sets the state of an alarm for testing purposes. When the updated +// state differs from the previous value, the action configured for the appropriate +// state is invoked. For example, if your alarm is configured to send an Amazon +// SNS message when an alarm is triggered, temporarily changing the alarm state +// to ALARM sends an SNS message. +// +// Metric alarms returns to their actual state quickly, often within seconds. +// Because the metric alarm state change happens quickly, it is typically only +// visible in the alarm's History tab in the Amazon CloudWatch console or through +// DescribeAlarmHistory (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarmHistory.html). +// +// If you use SetAlarmState on a composite alarm, the composite alarm is not +// guaranteed to return to its actual state. It returns to its actual state +// only once any of its children alarms change state. It is also reevaluated +// if you update its configuration. +// +// If an alarm triggers EC2 Auto Scaling policies or application Auto Scaling +// policies, you must include information in the StateReasonData parameter to +// enable the policy to take the correct action. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation SetAlarmState for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeResourceNotFound "ResourceNotFound" +// The named resource does not exist. +// +// - ErrCodeInvalidFormatFault "InvalidFormat" +// Data was not syntactically valid JSON. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/SetAlarmState +func (c *CloudWatch) SetAlarmState(input *SetAlarmStateInput) (*SetAlarmStateOutput, error) { + req, out := c.SetAlarmStateRequest(input) + return out, req.Send() +} + +// SetAlarmStateWithContext is the same as SetAlarmState with the addition of +// the ability to pass a context and additional request options. +// +// See SetAlarmState for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) SetAlarmStateWithContext(ctx aws.Context, input *SetAlarmStateInput, opts ...request.Option) (*SetAlarmStateOutput, error) { + req, out := c.SetAlarmStateRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opStartMetricStreams = "StartMetricStreams" + +// StartMetricStreamsRequest generates a "aws/request.Request" representing the +// client's request for the StartMetricStreams operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See StartMetricStreams for more information on using the StartMetricStreams +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the StartMetricStreamsRequest method. +// req, resp := client.StartMetricStreamsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/StartMetricStreams +func (c *CloudWatch) StartMetricStreamsRequest(input *StartMetricStreamsInput) (req *request.Request, output *StartMetricStreamsOutput) { + op := &request.Operation{ + Name: opStartMetricStreams, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &StartMetricStreamsInput{} + } + + output = &StartMetricStreamsOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// StartMetricStreams API operation for Amazon CloudWatch. +// +// Starts the streaming of metrics for one or more of your metric streams. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation StartMetricStreams for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/StartMetricStreams +func (c *CloudWatch) StartMetricStreams(input *StartMetricStreamsInput) (*StartMetricStreamsOutput, error) { + req, out := c.StartMetricStreamsRequest(input) + return out, req.Send() +} + +// StartMetricStreamsWithContext is the same as StartMetricStreams with the addition of +// the ability to pass a context and additional request options. +// +// See StartMetricStreams for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) StartMetricStreamsWithContext(ctx aws.Context, input *StartMetricStreamsInput, opts ...request.Option) (*StartMetricStreamsOutput, error) { + req, out := c.StartMetricStreamsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opStopMetricStreams = "StopMetricStreams" + +// StopMetricStreamsRequest generates a "aws/request.Request" representing the +// client's request for the StopMetricStreams operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See StopMetricStreams for more information on using the StopMetricStreams +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the StopMetricStreamsRequest method. +// req, resp := client.StopMetricStreamsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/StopMetricStreams +func (c *CloudWatch) StopMetricStreamsRequest(input *StopMetricStreamsInput) (req *request.Request, output *StopMetricStreamsOutput) { + op := &request.Operation{ + Name: opStopMetricStreams, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &StopMetricStreamsInput{} + } + + output = &StopMetricStreamsOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// StopMetricStreams API operation for Amazon CloudWatch. +// +// Stops the streaming of metrics for one or more of your metric streams. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation StopMetricStreams for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeMissingRequiredParameterException "MissingParameter" +// An input parameter that is required is missing. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/StopMetricStreams +func (c *CloudWatch) StopMetricStreams(input *StopMetricStreamsInput) (*StopMetricStreamsOutput, error) { + req, out := c.StopMetricStreamsRequest(input) + return out, req.Send() +} + +// StopMetricStreamsWithContext is the same as StopMetricStreams with the addition of +// the ability to pass a context and additional request options. +// +// See StopMetricStreams for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) StopMetricStreamsWithContext(ctx aws.Context, input *StopMetricStreamsInput, opts ...request.Option) (*StopMetricStreamsOutput, error) { + req, out := c.StopMetricStreamsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opTagResource = "TagResource" + +// TagResourceRequest generates a "aws/request.Request" representing the +// client's request for the TagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See TagResource for more information on using the TagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the TagResourceRequest method. +// req, resp := client.TagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/TagResource +func (c *CloudWatch) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) { + op := &request.Operation{ + Name: opTagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &TagResourceInput{} + } + + output = &TagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// TagResource API operation for Amazon CloudWatch. +// +// Assigns one or more tags (key-value pairs) to the specified CloudWatch resource. +// Currently, the only CloudWatch resources that can be tagged are alarms and +// Contributor Insights rules. +// +// Tags can help you organize and categorize your resources. You can also use +// them to scope user permissions by granting a user permission to access or +// change only resources with certain tag values. +// +// Tags don't have any semantic meaning to Amazon Web Services and are interpreted +// strictly as strings of characters. +// +// You can use the TagResource action with an alarm that already has tags. If +// you specify a new tag key for the alarm, this tag is appended to the list +// of tags associated with the alarm. If you specify a tag key that is already +// associated with the alarm, the new tag value that you specify replaces the +// previous value for that tag. +// +// You can associate as many as 50 tags with a CloudWatch resource. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation TagResource for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The named resource does not exist. +// +// - ErrCodeConcurrentModificationException "ConcurrentModificationException" +// More than one process tried to modify a resource at the same time. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/TagResource +func (c *CloudWatch) TagResource(input *TagResourceInput) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + return out, req.Send() +} + +// TagResourceWithContext is the same as TagResource with the addition of +// the ability to pass a context and additional request options. +// +// See TagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) TagResourceWithContext(ctx aws.Context, input *TagResourceInput, opts ...request.Option) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUntagResource = "UntagResource" + +// UntagResourceRequest generates a "aws/request.Request" representing the +// client's request for the UntagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UntagResource for more information on using the UntagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the UntagResourceRequest method. +// req, resp := client.UntagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/UntagResource +func (c *CloudWatch) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) { + op := &request.Operation{ + Name: opUntagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UntagResourceInput{} + } + + output = &UntagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(query.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// UntagResource API operation for Amazon CloudWatch. +// +// Removes one or more tags from the specified resource. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch's +// API operation UntagResource for usage and error information. +// +// Returned Error Codes: +// +// - ErrCodeInvalidParameterValueException "InvalidParameterValue" +// The value of an input parameter is bad or out-of-range. +// +// - ErrCodeResourceNotFoundException "ResourceNotFoundException" +// The named resource does not exist. +// +// - ErrCodeConcurrentModificationException "ConcurrentModificationException" +// More than one process tried to modify a resource at the same time. +// +// - ErrCodeInternalServiceFault "InternalServiceError" +// Request processing has failed due to some unknown error, exception, or failure. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/UntagResource +func (c *CloudWatch) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + return out, req.Send() +} + +// UntagResourceWithContext is the same as UntagResource with the addition of +// the ability to pass a context and additional request options. +// +// See UntagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) UntagResourceWithContext(ctx aws.Context, input *UntagResourceInput, opts ...request.Option) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// Represents the history of a specific alarm. +type AlarmHistoryItem struct { + _ struct{} `type:"structure"` + + // The descriptive name for the alarm. + AlarmName *string `min:"1" type:"string"` + + // The type of alarm, either metric alarm or composite alarm. + AlarmType *string `type:"string" enum:"AlarmType"` + + // Data about the alarm, in JSON format. + HistoryData *string `min:"1" type:"string"` + + // The type of alarm history item. + HistoryItemType *string `type:"string" enum:"HistoryItemType"` + + // A summary of the alarm history, in text format. + HistorySummary *string `min:"1" type:"string"` + + // The time stamp for the alarm history item. + Timestamp *time.Time `type:"timestamp"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AlarmHistoryItem) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AlarmHistoryItem) GoString() string { + return s.String() +} + +// SetAlarmName sets the AlarmName field's value. +func (s *AlarmHistoryItem) SetAlarmName(v string) *AlarmHistoryItem { + s.AlarmName = &v + return s +} + +// SetAlarmType sets the AlarmType field's value. +func (s *AlarmHistoryItem) SetAlarmType(v string) *AlarmHistoryItem { + s.AlarmType = &v + return s +} + +// SetHistoryData sets the HistoryData field's value. +func (s *AlarmHistoryItem) SetHistoryData(v string) *AlarmHistoryItem { + s.HistoryData = &v + return s +} + +// SetHistoryItemType sets the HistoryItemType field's value. +func (s *AlarmHistoryItem) SetHistoryItemType(v string) *AlarmHistoryItem { + s.HistoryItemType = &v + return s +} + +// SetHistorySummary sets the HistorySummary field's value. +func (s *AlarmHistoryItem) SetHistorySummary(v string) *AlarmHistoryItem { + s.HistorySummary = &v + return s +} + +// SetTimestamp sets the Timestamp field's value. +func (s *AlarmHistoryItem) SetTimestamp(v time.Time) *AlarmHistoryItem { + s.Timestamp = &v + return s +} + +// An anomaly detection model associated with a particular CloudWatch metric, +// statistic, or metric math expression. You can use the model to display a +// band of expected, normal values when the metric is graphed. +// +// If you have enabled unified cross-account observability, and this account +// is a monitoring account, the metric can be in the same account or a source +// account. +type AnomalyDetector struct { + _ struct{} `type:"structure"` + + // The configuration specifies details about how the anomaly detection model + // is to be trained, including time ranges to exclude from use for training + // the model, and the time zone to use for the metric. + Configuration *AnomalyDetectorConfiguration `type:"structure"` + + // The metric dimensions associated with the anomaly detection model. + // + // Deprecated: Use SingleMetricAnomalyDetector.Dimensions property. + Dimensions []*Dimension `deprecated:"true" type:"list"` + + // This object includes parameters that you can use to provide information about + // your metric to CloudWatch to help it build more accurate anomaly detection + // models. Currently, it includes the PeriodicSpikes parameter. + MetricCharacteristics *MetricCharacteristics `type:"structure"` + + // The CloudWatch metric math expression for this anomaly detector. + MetricMathAnomalyDetector *MetricMathAnomalyDetector `type:"structure"` + + // The name of the metric associated with the anomaly detection model. + // + // Deprecated: Use SingleMetricAnomalyDetector.MetricName property. + MetricName *string `min:"1" deprecated:"true" type:"string"` + + // The namespace of the metric associated with the anomaly detection model. + // + // Deprecated: Use SingleMetricAnomalyDetector.Namespace property. + Namespace *string `min:"1" deprecated:"true" type:"string"` + + // The CloudWatch metric and statistic for this anomaly detector. + SingleMetricAnomalyDetector *SingleMetricAnomalyDetector `type:"structure"` + + // The statistic associated with the anomaly detection model. + // + // Deprecated: Use SingleMetricAnomalyDetector.Stat property. + Stat *string `deprecated:"true" type:"string"` + + // The current status of the anomaly detector's training. + StateValue *string `type:"string" enum:"AnomalyDetectorStateValue"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AnomalyDetector) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AnomalyDetector) GoString() string { + return s.String() +} + +// SetConfiguration sets the Configuration field's value. +func (s *AnomalyDetector) SetConfiguration(v *AnomalyDetectorConfiguration) *AnomalyDetector { + s.Configuration = v + return s +} + +// SetDimensions sets the Dimensions field's value. +func (s *AnomalyDetector) SetDimensions(v []*Dimension) *AnomalyDetector { + s.Dimensions = v + return s +} + +// SetMetricCharacteristics sets the MetricCharacteristics field's value. +func (s *AnomalyDetector) SetMetricCharacteristics(v *MetricCharacteristics) *AnomalyDetector { + s.MetricCharacteristics = v + return s +} + +// SetMetricMathAnomalyDetector sets the MetricMathAnomalyDetector field's value. +func (s *AnomalyDetector) SetMetricMathAnomalyDetector(v *MetricMathAnomalyDetector) *AnomalyDetector { + s.MetricMathAnomalyDetector = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *AnomalyDetector) SetMetricName(v string) *AnomalyDetector { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *AnomalyDetector) SetNamespace(v string) *AnomalyDetector { + s.Namespace = &v + return s +} + +// SetSingleMetricAnomalyDetector sets the SingleMetricAnomalyDetector field's value. +func (s *AnomalyDetector) SetSingleMetricAnomalyDetector(v *SingleMetricAnomalyDetector) *AnomalyDetector { + s.SingleMetricAnomalyDetector = v + return s +} + +// SetStat sets the Stat field's value. +func (s *AnomalyDetector) SetStat(v string) *AnomalyDetector { + s.Stat = &v + return s +} + +// SetStateValue sets the StateValue field's value. +func (s *AnomalyDetector) SetStateValue(v string) *AnomalyDetector { + s.StateValue = &v + return s +} + +// The configuration specifies details about how the anomaly detection model +// is to be trained, including time ranges to exclude from use for training +// the model and the time zone to use for the metric. +type AnomalyDetectorConfiguration struct { + _ struct{} `type:"structure"` + + // An array of time ranges to exclude from use when the anomaly detection model + // is trained. Use this to make sure that events that could cause unusual values + // for the metric, such as deployments, aren't used when CloudWatch creates + // the model. + ExcludedTimeRanges []*Range `type:"list"` + + // The time zone to use for the metric. This is useful to enable the model to + // automatically account for daylight savings time changes if the metric is + // sensitive to such time changes. + // + // To specify a time zone, use the name of the time zone as specified in the + // standard tz database. For more information, see tz database (https://en.wikipedia.org/wiki/Tz_database). + MetricTimezone *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AnomalyDetectorConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AnomalyDetectorConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AnomalyDetectorConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AnomalyDetectorConfiguration"} + if s.ExcludedTimeRanges != nil { + for i, v := range s.ExcludedTimeRanges { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ExcludedTimeRanges", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetExcludedTimeRanges sets the ExcludedTimeRanges field's value. +func (s *AnomalyDetectorConfiguration) SetExcludedTimeRanges(v []*Range) *AnomalyDetectorConfiguration { + s.ExcludedTimeRanges = v + return s +} + +// SetMetricTimezone sets the MetricTimezone field's value. +func (s *AnomalyDetectorConfiguration) SetMetricTimezone(v string) *AnomalyDetectorConfiguration { + s.MetricTimezone = &v + return s +} + +// The details about a composite alarm. +type CompositeAlarm struct { + _ struct{} `type:"structure"` + + // Indicates whether actions should be executed during any changes to the alarm + // state. + ActionsEnabled *bool `type:"boolean"` + + // When the value is ALARM, it means that the actions are suppressed because + // the suppressor alarm is in ALARM When the value is WaitPeriod, it means that + // the actions are suppressed because the composite alarm is waiting for the + // suppressor alarm to go into into the ALARM state. The maximum waiting time + // is as specified in ActionsSuppressorWaitPeriod. After this time, the composite + // alarm performs its actions. When the value is ExtensionPeriod, it means that + // the actions are suppressed because the composite alarm is waiting after the + // suppressor alarm went out of the ALARM state. The maximum waiting time is + // as specified in ActionsSuppressorExtensionPeriod. After this time, the composite + // alarm performs its actions. + ActionsSuppressedBy *string `type:"string" enum:"ActionsSuppressedBy"` + + // Captures the reason for action suppression. + ActionsSuppressedReason *string `type:"string"` + + // Actions will be suppressed if the suppressor alarm is in the ALARM state. + // ActionsSuppressor can be an AlarmName or an Amazon Resource Name (ARN) from + // an existing alarm. + ActionsSuppressor *string `min:"1" type:"string"` + + // The maximum time in seconds that the composite alarm waits after suppressor + // alarm goes out of the ALARM state. After this time, the composite alarm performs + // its actions. + // + // ExtensionPeriod is required only when ActionsSuppressor is specified. + ActionsSuppressorExtensionPeriod *int64 `type:"integer"` + + // The maximum time in seconds that the composite alarm waits for the suppressor + // alarm to go into the ALARM state. After this time, the composite alarm performs + // its actions. + // + // WaitPeriod is required only when ActionsSuppressor is specified. + ActionsSuppressorWaitPeriod *int64 `type:"integer"` + + // The actions to execute when this alarm transitions to the ALARM state from + // any other state. Each action is specified as an Amazon Resource Name (ARN). + AlarmActions []*string `type:"list"` + + // The Amazon Resource Name (ARN) of the alarm. + AlarmArn *string `min:"1" type:"string"` + + // The time stamp of the last update to the alarm configuration. + AlarmConfigurationUpdatedTimestamp *time.Time `type:"timestamp"` + + // The description of the alarm. + AlarmDescription *string `type:"string"` + + // The name of the alarm. + AlarmName *string `min:"1" type:"string"` + + // The rule that this alarm uses to evaluate its alarm state. + AlarmRule *string `min:"1" type:"string"` + + // The actions to execute when this alarm transitions to the INSUFFICIENT_DATA + // state from any other state. Each action is specified as an Amazon Resource + // Name (ARN). + InsufficientDataActions []*string `type:"list"` + + // The actions to execute when this alarm transitions to the OK state from any + // other state. Each action is specified as an Amazon Resource Name (ARN). + OKActions []*string `type:"list"` + + // An explanation for the alarm state, in text format. + StateReason *string `type:"string"` + + // An explanation for the alarm state, in JSON format. + StateReasonData *string `type:"string"` + + // The timestamp of the last change to the alarm's StateValue. + StateTransitionedTimestamp *time.Time `type:"timestamp"` + + // Tracks the timestamp of any state update, even if StateValue doesn't change. + StateUpdatedTimestamp *time.Time `type:"timestamp"` + + // The state value for the alarm. + StateValue *string `type:"string" enum:"StateValue"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CompositeAlarm) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CompositeAlarm) GoString() string { + return s.String() +} + +// SetActionsEnabled sets the ActionsEnabled field's value. +func (s *CompositeAlarm) SetActionsEnabled(v bool) *CompositeAlarm { + s.ActionsEnabled = &v + return s +} + +// SetActionsSuppressedBy sets the ActionsSuppressedBy field's value. +func (s *CompositeAlarm) SetActionsSuppressedBy(v string) *CompositeAlarm { + s.ActionsSuppressedBy = &v + return s +} + +// SetActionsSuppressedReason sets the ActionsSuppressedReason field's value. +func (s *CompositeAlarm) SetActionsSuppressedReason(v string) *CompositeAlarm { + s.ActionsSuppressedReason = &v + return s +} + +// SetActionsSuppressor sets the ActionsSuppressor field's value. +func (s *CompositeAlarm) SetActionsSuppressor(v string) *CompositeAlarm { + s.ActionsSuppressor = &v + return s +} + +// SetActionsSuppressorExtensionPeriod sets the ActionsSuppressorExtensionPeriod field's value. +func (s *CompositeAlarm) SetActionsSuppressorExtensionPeriod(v int64) *CompositeAlarm { + s.ActionsSuppressorExtensionPeriod = &v + return s +} + +// SetActionsSuppressorWaitPeriod sets the ActionsSuppressorWaitPeriod field's value. +func (s *CompositeAlarm) SetActionsSuppressorWaitPeriod(v int64) *CompositeAlarm { + s.ActionsSuppressorWaitPeriod = &v + return s +} + +// SetAlarmActions sets the AlarmActions field's value. +func (s *CompositeAlarm) SetAlarmActions(v []*string) *CompositeAlarm { + s.AlarmActions = v + return s +} + +// SetAlarmArn sets the AlarmArn field's value. +func (s *CompositeAlarm) SetAlarmArn(v string) *CompositeAlarm { + s.AlarmArn = &v + return s +} + +// SetAlarmConfigurationUpdatedTimestamp sets the AlarmConfigurationUpdatedTimestamp field's value. +func (s *CompositeAlarm) SetAlarmConfigurationUpdatedTimestamp(v time.Time) *CompositeAlarm { + s.AlarmConfigurationUpdatedTimestamp = &v + return s +} + +// SetAlarmDescription sets the AlarmDescription field's value. +func (s *CompositeAlarm) SetAlarmDescription(v string) *CompositeAlarm { + s.AlarmDescription = &v + return s +} + +// SetAlarmName sets the AlarmName field's value. +func (s *CompositeAlarm) SetAlarmName(v string) *CompositeAlarm { + s.AlarmName = &v + return s +} + +// SetAlarmRule sets the AlarmRule field's value. +func (s *CompositeAlarm) SetAlarmRule(v string) *CompositeAlarm { + s.AlarmRule = &v + return s +} + +// SetInsufficientDataActions sets the InsufficientDataActions field's value. +func (s *CompositeAlarm) SetInsufficientDataActions(v []*string) *CompositeAlarm { + s.InsufficientDataActions = v + return s +} + +// SetOKActions sets the OKActions field's value. +func (s *CompositeAlarm) SetOKActions(v []*string) *CompositeAlarm { + s.OKActions = v + return s +} + +// SetStateReason sets the StateReason field's value. +func (s *CompositeAlarm) SetStateReason(v string) *CompositeAlarm { + s.StateReason = &v + return s +} + +// SetStateReasonData sets the StateReasonData field's value. +func (s *CompositeAlarm) SetStateReasonData(v string) *CompositeAlarm { + s.StateReasonData = &v + return s +} + +// SetStateTransitionedTimestamp sets the StateTransitionedTimestamp field's value. +func (s *CompositeAlarm) SetStateTransitionedTimestamp(v time.Time) *CompositeAlarm { + s.StateTransitionedTimestamp = &v + return s +} + +// SetStateUpdatedTimestamp sets the StateUpdatedTimestamp field's value. +func (s *CompositeAlarm) SetStateUpdatedTimestamp(v time.Time) *CompositeAlarm { + s.StateUpdatedTimestamp = &v + return s +} + +// SetStateValue sets the StateValue field's value. +func (s *CompositeAlarm) SetStateValue(v string) *CompositeAlarm { + s.StateValue = &v + return s +} + +// Represents a specific dashboard. +type DashboardEntry struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the dashboard. + DashboardArn *string `type:"string"` + + // The name of the dashboard. + DashboardName *string `type:"string"` + + // The time stamp of when the dashboard was last modified, either by an API + // call or through the console. This number is expressed as the number of milliseconds + // since Jan 1, 1970 00:00:00 UTC. + LastModified *time.Time `type:"timestamp"` + + // The size of the dashboard, in bytes. + Size *int64 `type:"long"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DashboardEntry) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DashboardEntry) GoString() string { + return s.String() +} + +// SetDashboardArn sets the DashboardArn field's value. +func (s *DashboardEntry) SetDashboardArn(v string) *DashboardEntry { + s.DashboardArn = &v + return s +} + +// SetDashboardName sets the DashboardName field's value. +func (s *DashboardEntry) SetDashboardName(v string) *DashboardEntry { + s.DashboardName = &v + return s +} + +// SetLastModified sets the LastModified field's value. +func (s *DashboardEntry) SetLastModified(v time.Time) *DashboardEntry { + s.LastModified = &v + return s +} + +// SetSize sets the Size field's value. +func (s *DashboardEntry) SetSize(v int64) *DashboardEntry { + s.Size = &v + return s +} + +// An error or warning for the operation. +type DashboardValidationMessage struct { + _ struct{} `type:"structure"` + + // The data path related to the message. + DataPath *string `type:"string"` + + // A message describing the error or warning. + Message *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DashboardValidationMessage) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DashboardValidationMessage) GoString() string { + return s.String() +} + +// SetDataPath sets the DataPath field's value. +func (s *DashboardValidationMessage) SetDataPath(v string) *DashboardValidationMessage { + s.DataPath = &v + return s +} + +// SetMessage sets the Message field's value. +func (s *DashboardValidationMessage) SetMessage(v string) *DashboardValidationMessage { + s.Message = &v + return s +} + +// Encapsulates the statistical data that CloudWatch computes from metric data. +type Datapoint struct { + _ struct{} `type:"structure"` + + // The average of the metric values that correspond to the data point. + Average *float64 `type:"double"` + + // The percentile statistic for the data point. + ExtendedStatistics map[string]*float64 `type:"map"` + + // The maximum metric value for the data point. + Maximum *float64 `type:"double"` + + // The minimum metric value for the data point. + Minimum *float64 `type:"double"` + + // The number of metric values that contributed to the aggregate value of this + // data point. + SampleCount *float64 `type:"double"` + + // The sum of the metric values for the data point. + Sum *float64 `type:"double"` + + // The time stamp used for the data point. + Timestamp *time.Time `type:"timestamp"` + + // The standard unit for the data point. + Unit *string `type:"string" enum:"StandardUnit"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Datapoint) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Datapoint) GoString() string { + return s.String() +} + +// SetAverage sets the Average field's value. +func (s *Datapoint) SetAverage(v float64) *Datapoint { + s.Average = &v + return s +} + +// SetExtendedStatistics sets the ExtendedStatistics field's value. +func (s *Datapoint) SetExtendedStatistics(v map[string]*float64) *Datapoint { + s.ExtendedStatistics = v + return s +} + +// SetMaximum sets the Maximum field's value. +func (s *Datapoint) SetMaximum(v float64) *Datapoint { + s.Maximum = &v + return s +} + +// SetMinimum sets the Minimum field's value. +func (s *Datapoint) SetMinimum(v float64) *Datapoint { + s.Minimum = &v + return s +} + +// SetSampleCount sets the SampleCount field's value. +func (s *Datapoint) SetSampleCount(v float64) *Datapoint { + s.SampleCount = &v + return s +} + +// SetSum sets the Sum field's value. +func (s *Datapoint) SetSum(v float64) *Datapoint { + s.Sum = &v + return s +} + +// SetTimestamp sets the Timestamp field's value. +func (s *Datapoint) SetTimestamp(v time.Time) *Datapoint { + s.Timestamp = &v + return s +} + +// SetUnit sets the Unit field's value. +func (s *Datapoint) SetUnit(v string) *Datapoint { + s.Unit = &v + return s +} + +type DeleteAlarmsInput struct { + _ struct{} `type:"structure"` + + // The alarms to be deleted. Do not enclose the alarm names in quote marks. + // + // AlarmNames is a required field + AlarmNames []*string `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAlarmsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAlarmsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteAlarmsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteAlarmsInput"} + if s.AlarmNames == nil { + invalidParams.Add(request.NewErrParamRequired("AlarmNames")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAlarmNames sets the AlarmNames field's value. +func (s *DeleteAlarmsInput) SetAlarmNames(v []*string) *DeleteAlarmsInput { + s.AlarmNames = v + return s +} + +type DeleteAlarmsOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAlarmsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAlarmsOutput) GoString() string { + return s.String() +} + +type DeleteAnomalyDetectorInput struct { + _ struct{} `type:"structure"` + + // The metric dimensions associated with the anomaly detection model to delete. + // + // Deprecated: Use SingleMetricAnomalyDetector. + Dimensions []*Dimension `deprecated:"true" type:"list"` + + // The metric math anomaly detector to be deleted. + // + // When using MetricMathAnomalyDetector, you cannot include following parameters + // in the same operation: + // + // * Dimensions, + // + // * MetricName + // + // * Namespace + // + // * Stat + // + // * the SingleMetricAnomalyDetector parameters of DeleteAnomalyDetectorInput + // + // Instead, specify the metric math anomaly detector attributes as part of the + // MetricMathAnomalyDetector property. + MetricMathAnomalyDetector *MetricMathAnomalyDetector `type:"structure"` + + // The metric name associated with the anomaly detection model to delete. + // + // Deprecated: Use SingleMetricAnomalyDetector. + MetricName *string `min:"1" deprecated:"true" type:"string"` + + // The namespace associated with the anomaly detection model to delete. + // + // Deprecated: Use SingleMetricAnomalyDetector. + Namespace *string `min:"1" deprecated:"true" type:"string"` + + // A single metric anomaly detector to be deleted. + // + // When using SingleMetricAnomalyDetector, you cannot include the following + // parameters in the same operation: + // + // * Dimensions, + // + // * MetricName + // + // * Namespace + // + // * Stat + // + // * the MetricMathAnomalyDetector parameters of DeleteAnomalyDetectorInput + // + // Instead, specify the single metric anomaly detector attributes as part of + // the SingleMetricAnomalyDetector property. + SingleMetricAnomalyDetector *SingleMetricAnomalyDetector `type:"structure"` + + // The statistic associated with the anomaly detection model to delete. + // + // Deprecated: Use SingleMetricAnomalyDetector. + Stat *string `deprecated:"true" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAnomalyDetectorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAnomalyDetectorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteAnomalyDetectorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteAnomalyDetectorInput"} + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + if s.MetricMathAnomalyDetector != nil { + if err := s.MetricMathAnomalyDetector.Validate(); err != nil { + invalidParams.AddNested("MetricMathAnomalyDetector", err.(request.ErrInvalidParams)) + } + } + if s.SingleMetricAnomalyDetector != nil { + if err := s.SingleMetricAnomalyDetector.Validate(); err != nil { + invalidParams.AddNested("SingleMetricAnomalyDetector", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDimensions sets the Dimensions field's value. +func (s *DeleteAnomalyDetectorInput) SetDimensions(v []*Dimension) *DeleteAnomalyDetectorInput { + s.Dimensions = v + return s +} + +// SetMetricMathAnomalyDetector sets the MetricMathAnomalyDetector field's value. +func (s *DeleteAnomalyDetectorInput) SetMetricMathAnomalyDetector(v *MetricMathAnomalyDetector) *DeleteAnomalyDetectorInput { + s.MetricMathAnomalyDetector = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *DeleteAnomalyDetectorInput) SetMetricName(v string) *DeleteAnomalyDetectorInput { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *DeleteAnomalyDetectorInput) SetNamespace(v string) *DeleteAnomalyDetectorInput { + s.Namespace = &v + return s +} + +// SetSingleMetricAnomalyDetector sets the SingleMetricAnomalyDetector field's value. +func (s *DeleteAnomalyDetectorInput) SetSingleMetricAnomalyDetector(v *SingleMetricAnomalyDetector) *DeleteAnomalyDetectorInput { + s.SingleMetricAnomalyDetector = v + return s +} + +// SetStat sets the Stat field's value. +func (s *DeleteAnomalyDetectorInput) SetStat(v string) *DeleteAnomalyDetectorInput { + s.Stat = &v + return s +} + +type DeleteAnomalyDetectorOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAnomalyDetectorOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAnomalyDetectorOutput) GoString() string { + return s.String() +} + +type DeleteDashboardsInput struct { + _ struct{} `type:"structure"` + + // The dashboards to be deleted. This parameter is required. + // + // DashboardNames is a required field + DashboardNames []*string `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDashboardsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDashboardsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteDashboardsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteDashboardsInput"} + if s.DashboardNames == nil { + invalidParams.Add(request.NewErrParamRequired("DashboardNames")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDashboardNames sets the DashboardNames field's value. +func (s *DeleteDashboardsInput) SetDashboardNames(v []*string) *DeleteDashboardsInput { + s.DashboardNames = v + return s +} + +type DeleteDashboardsOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDashboardsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDashboardsOutput) GoString() string { + return s.String() +} + +type DeleteInsightRulesInput struct { + _ struct{} `type:"structure"` + + // An array of the rule names to delete. If you need to find out the names of + // your rules, use DescribeInsightRules (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeInsightRules.html). + // + // RuleNames is a required field + RuleNames []*string `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteInsightRulesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteInsightRulesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteInsightRulesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteInsightRulesInput"} + if s.RuleNames == nil { + invalidParams.Add(request.NewErrParamRequired("RuleNames")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRuleNames sets the RuleNames field's value. +func (s *DeleteInsightRulesInput) SetRuleNames(v []*string) *DeleteInsightRulesInput { + s.RuleNames = v + return s +} + +type DeleteInsightRulesOutput struct { + _ struct{} `type:"structure"` + + // An array listing the rules that could not be deleted. You cannot delete built-in + // rules. + Failures []*PartialFailure `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteInsightRulesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteInsightRulesOutput) GoString() string { + return s.String() +} + +// SetFailures sets the Failures field's value. +func (s *DeleteInsightRulesOutput) SetFailures(v []*PartialFailure) *DeleteInsightRulesOutput { + s.Failures = v + return s +} + +type DeleteMetricStreamInput struct { + _ struct{} `type:"structure"` + + // The name of the metric stream to delete. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteMetricStreamInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteMetricStreamInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteMetricStreamInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteMetricStreamInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *DeleteMetricStreamInput) SetName(v string) *DeleteMetricStreamInput { + s.Name = &v + return s +} + +type DeleteMetricStreamOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteMetricStreamOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteMetricStreamOutput) GoString() string { + return s.String() +} + +type DescribeAlarmHistoryInput struct { + _ struct{} `type:"structure"` + + // The name of the alarm. + AlarmName *string `min:"1" type:"string"` + + // Use this parameter to specify whether you want the operation to return metric + // alarms or composite alarms. If you omit this parameter, only metric alarms + // are returned. + AlarmTypes []*string `type:"list" enum:"AlarmType"` + + // The ending date to retrieve alarm history. + EndDate *time.Time `type:"timestamp"` + + // The type of alarm histories to retrieve. + HistoryItemType *string `type:"string" enum:"HistoryItemType"` + + // The maximum number of alarm history records to retrieve. + MaxRecords *int64 `min:"1" type:"integer"` + + // The token returned by a previous call to indicate that there is more data + // available. + NextToken *string `type:"string"` + + // Specified whether to return the newest or oldest alarm history first. Specify + // TimestampDescending to have the newest event history returned first, and + // specify TimestampAscending to have the oldest history returned first. + ScanBy *string `type:"string" enum:"ScanBy"` + + // The starting date to retrieve alarm history. + StartDate *time.Time `type:"timestamp"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmHistoryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmHistoryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeAlarmHistoryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeAlarmHistoryInput"} + if s.AlarmName != nil && len(*s.AlarmName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AlarmName", 1)) + } + if s.MaxRecords != nil && *s.MaxRecords < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxRecords", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAlarmName sets the AlarmName field's value. +func (s *DescribeAlarmHistoryInput) SetAlarmName(v string) *DescribeAlarmHistoryInput { + s.AlarmName = &v + return s +} + +// SetAlarmTypes sets the AlarmTypes field's value. +func (s *DescribeAlarmHistoryInput) SetAlarmTypes(v []*string) *DescribeAlarmHistoryInput { + s.AlarmTypes = v + return s +} + +// SetEndDate sets the EndDate field's value. +func (s *DescribeAlarmHistoryInput) SetEndDate(v time.Time) *DescribeAlarmHistoryInput { + s.EndDate = &v + return s +} + +// SetHistoryItemType sets the HistoryItemType field's value. +func (s *DescribeAlarmHistoryInput) SetHistoryItemType(v string) *DescribeAlarmHistoryInput { + s.HistoryItemType = &v + return s +} + +// SetMaxRecords sets the MaxRecords field's value. +func (s *DescribeAlarmHistoryInput) SetMaxRecords(v int64) *DescribeAlarmHistoryInput { + s.MaxRecords = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeAlarmHistoryInput) SetNextToken(v string) *DescribeAlarmHistoryInput { + s.NextToken = &v + return s +} + +// SetScanBy sets the ScanBy field's value. +func (s *DescribeAlarmHistoryInput) SetScanBy(v string) *DescribeAlarmHistoryInput { + s.ScanBy = &v + return s +} + +// SetStartDate sets the StartDate field's value. +func (s *DescribeAlarmHistoryInput) SetStartDate(v time.Time) *DescribeAlarmHistoryInput { + s.StartDate = &v + return s +} + +type DescribeAlarmHistoryOutput struct { + _ struct{} `type:"structure"` + + // The alarm histories, in JSON format. + AlarmHistoryItems []*AlarmHistoryItem `type:"list"` + + // The token that marks the start of the next batch of returned results. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmHistoryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmHistoryOutput) GoString() string { + return s.String() +} + +// SetAlarmHistoryItems sets the AlarmHistoryItems field's value. +func (s *DescribeAlarmHistoryOutput) SetAlarmHistoryItems(v []*AlarmHistoryItem) *DescribeAlarmHistoryOutput { + s.AlarmHistoryItems = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeAlarmHistoryOutput) SetNextToken(v string) *DescribeAlarmHistoryOutput { + s.NextToken = &v + return s +} + +type DescribeAlarmsForMetricInput struct { + _ struct{} `type:"structure"` + + // The dimensions associated with the metric. If the metric has any associated + // dimensions, you must specify them in order for the call to succeed. + Dimensions []*Dimension `type:"list"` + + // The percentile statistic for the metric. Specify a value between p0.0 and + // p100. + ExtendedStatistic *string `type:"string"` + + // The name of the metric. + // + // MetricName is a required field + MetricName *string `min:"1" type:"string" required:"true"` + + // The namespace of the metric. + // + // Namespace is a required field + Namespace *string `min:"1" type:"string" required:"true"` + + // The period, in seconds, over which the statistic is applied. + Period *int64 `min:"1" type:"integer"` + + // The statistic for the metric, other than percentiles. For percentile statistics, + // use ExtendedStatistics. + Statistic *string `type:"string" enum:"Statistic"` + + // The unit for the metric. + Unit *string `type:"string" enum:"StandardUnit"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmsForMetricInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmsForMetricInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeAlarmsForMetricInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeAlarmsForMetricInput"} + if s.MetricName == nil { + invalidParams.Add(request.NewErrParamRequired("MetricName")) + } + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace == nil { + invalidParams.Add(request.NewErrParamRequired("Namespace")) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.Period != nil && *s.Period < 1 { + invalidParams.Add(request.NewErrParamMinValue("Period", 1)) + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDimensions sets the Dimensions field's value. +func (s *DescribeAlarmsForMetricInput) SetDimensions(v []*Dimension) *DescribeAlarmsForMetricInput { + s.Dimensions = v + return s +} + +// SetExtendedStatistic sets the ExtendedStatistic field's value. +func (s *DescribeAlarmsForMetricInput) SetExtendedStatistic(v string) *DescribeAlarmsForMetricInput { + s.ExtendedStatistic = &v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *DescribeAlarmsForMetricInput) SetMetricName(v string) *DescribeAlarmsForMetricInput { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *DescribeAlarmsForMetricInput) SetNamespace(v string) *DescribeAlarmsForMetricInput { + s.Namespace = &v + return s +} + +// SetPeriod sets the Period field's value. +func (s *DescribeAlarmsForMetricInput) SetPeriod(v int64) *DescribeAlarmsForMetricInput { + s.Period = &v + return s +} + +// SetStatistic sets the Statistic field's value. +func (s *DescribeAlarmsForMetricInput) SetStatistic(v string) *DescribeAlarmsForMetricInput { + s.Statistic = &v + return s +} + +// SetUnit sets the Unit field's value. +func (s *DescribeAlarmsForMetricInput) SetUnit(v string) *DescribeAlarmsForMetricInput { + s.Unit = &v + return s +} + +type DescribeAlarmsForMetricOutput struct { + _ struct{} `type:"structure"` + + // The information for each alarm with the specified metric. + MetricAlarms []*MetricAlarm `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmsForMetricOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmsForMetricOutput) GoString() string { + return s.String() +} + +// SetMetricAlarms sets the MetricAlarms field's value. +func (s *DescribeAlarmsForMetricOutput) SetMetricAlarms(v []*MetricAlarm) *DescribeAlarmsForMetricOutput { + s.MetricAlarms = v + return s +} + +type DescribeAlarmsInput struct { + _ struct{} `type:"structure"` + + // Use this parameter to filter the results of the operation to only those alarms + // that use a certain alarm action. For example, you could specify the ARN of + // an SNS topic to find all alarms that send notifications to that topic. + ActionPrefix *string `min:"1" type:"string"` + + // An alarm name prefix. If you specify this parameter, you receive information + // about all alarms that have names that start with this prefix. + // + // If this parameter is specified, you cannot specify AlarmNames. + AlarmNamePrefix *string `min:"1" type:"string"` + + // The names of the alarms to retrieve information about. + AlarmNames []*string `type:"list"` + + // Use this parameter to specify whether you want the operation to return metric + // alarms or composite alarms. If you omit this parameter, only metric alarms + // are returned, even if composite alarms exist in the account. + // + // For example, if you omit this parameter or specify MetricAlarms, the operation + // returns only a list of metric alarms. It does not return any composite alarms, + // even if composite alarms exist in the account. + // + // If you specify CompositeAlarms, the operation returns only a list of composite + // alarms, and does not return any metric alarms. + AlarmTypes []*string `type:"list" enum:"AlarmType"` + + // If you use this parameter and specify the name of a composite alarm, the + // operation returns information about the "children" alarms of the alarm you + // specify. These are the metric alarms and composite alarms referenced in the + // AlarmRule field of the composite alarm that you specify in ChildrenOfAlarmName. + // Information about the composite alarm that you name in ChildrenOfAlarmName + // is not returned. + // + // If you specify ChildrenOfAlarmName, you cannot specify any other parameters + // in the request except for MaxRecords and NextToken. If you do so, you receive + // a validation error. + // + // Only the Alarm Name, ARN, StateValue (OK/ALARM/INSUFFICIENT_DATA), and StateUpdatedTimestamp + // information are returned by this operation when you use this parameter. To + // get complete information about these alarms, perform another DescribeAlarms + // operation and specify the parent alarm names in the AlarmNames parameter. + ChildrenOfAlarmName *string `min:"1" type:"string"` + + // The maximum number of alarm descriptions to retrieve. + MaxRecords *int64 `min:"1" type:"integer"` + + // The token returned by a previous call to indicate that there is more data + // available. + NextToken *string `type:"string"` + + // If you use this parameter and specify the name of a metric or composite alarm, + // the operation returns information about the "parent" alarms of the alarm + // you specify. These are the composite alarms that have AlarmRule parameters + // that reference the alarm named in ParentsOfAlarmName. Information about the + // alarm that you specify in ParentsOfAlarmName is not returned. + // + // If you specify ParentsOfAlarmName, you cannot specify any other parameters + // in the request except for MaxRecords and NextToken. If you do so, you receive + // a validation error. + // + // Only the Alarm Name and ARN are returned by this operation when you use this + // parameter. To get complete information about these alarms, perform another + // DescribeAlarms operation and specify the parent alarm names in the AlarmNames + // parameter. + ParentsOfAlarmName *string `min:"1" type:"string"` + + // Specify this parameter to receive information only about alarms that are + // currently in the state that you specify. + StateValue *string `type:"string" enum:"StateValue"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeAlarmsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeAlarmsInput"} + if s.ActionPrefix != nil && len(*s.ActionPrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ActionPrefix", 1)) + } + if s.AlarmNamePrefix != nil && len(*s.AlarmNamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AlarmNamePrefix", 1)) + } + if s.ChildrenOfAlarmName != nil && len(*s.ChildrenOfAlarmName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ChildrenOfAlarmName", 1)) + } + if s.MaxRecords != nil && *s.MaxRecords < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxRecords", 1)) + } + if s.ParentsOfAlarmName != nil && len(*s.ParentsOfAlarmName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ParentsOfAlarmName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetActionPrefix sets the ActionPrefix field's value. +func (s *DescribeAlarmsInput) SetActionPrefix(v string) *DescribeAlarmsInput { + s.ActionPrefix = &v + return s +} + +// SetAlarmNamePrefix sets the AlarmNamePrefix field's value. +func (s *DescribeAlarmsInput) SetAlarmNamePrefix(v string) *DescribeAlarmsInput { + s.AlarmNamePrefix = &v + return s +} + +// SetAlarmNames sets the AlarmNames field's value. +func (s *DescribeAlarmsInput) SetAlarmNames(v []*string) *DescribeAlarmsInput { + s.AlarmNames = v + return s +} + +// SetAlarmTypes sets the AlarmTypes field's value. +func (s *DescribeAlarmsInput) SetAlarmTypes(v []*string) *DescribeAlarmsInput { + s.AlarmTypes = v + return s +} + +// SetChildrenOfAlarmName sets the ChildrenOfAlarmName field's value. +func (s *DescribeAlarmsInput) SetChildrenOfAlarmName(v string) *DescribeAlarmsInput { + s.ChildrenOfAlarmName = &v + return s +} + +// SetMaxRecords sets the MaxRecords field's value. +func (s *DescribeAlarmsInput) SetMaxRecords(v int64) *DescribeAlarmsInput { + s.MaxRecords = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeAlarmsInput) SetNextToken(v string) *DescribeAlarmsInput { + s.NextToken = &v + return s +} + +// SetParentsOfAlarmName sets the ParentsOfAlarmName field's value. +func (s *DescribeAlarmsInput) SetParentsOfAlarmName(v string) *DescribeAlarmsInput { + s.ParentsOfAlarmName = &v + return s +} + +// SetStateValue sets the StateValue field's value. +func (s *DescribeAlarmsInput) SetStateValue(v string) *DescribeAlarmsInput { + s.StateValue = &v + return s +} + +type DescribeAlarmsOutput struct { + _ struct{} `type:"structure"` + + // The information about any composite alarms returned by the operation. + CompositeAlarms []*CompositeAlarm `type:"list"` + + // The information about any metric alarms returned by the operation. + MetricAlarms []*MetricAlarm `type:"list"` + + // The token that marks the start of the next batch of returned results. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAlarmsOutput) GoString() string { + return s.String() +} + +// SetCompositeAlarms sets the CompositeAlarms field's value. +func (s *DescribeAlarmsOutput) SetCompositeAlarms(v []*CompositeAlarm) *DescribeAlarmsOutput { + s.CompositeAlarms = v + return s +} + +// SetMetricAlarms sets the MetricAlarms field's value. +func (s *DescribeAlarmsOutput) SetMetricAlarms(v []*MetricAlarm) *DescribeAlarmsOutput { + s.MetricAlarms = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeAlarmsOutput) SetNextToken(v string) *DescribeAlarmsOutput { + s.NextToken = &v + return s +} + +type DescribeAnomalyDetectorsInput struct { + _ struct{} `type:"structure"` + + // The anomaly detector types to request when using DescribeAnomalyDetectorsInput. + // If empty, defaults to SINGLE_METRIC. + AnomalyDetectorTypes []*string `type:"list" enum:"AnomalyDetectorType"` + + // Limits the results to only the anomaly detection models that are associated + // with the specified metric dimensions. If there are multiple metrics that + // have these dimensions and have anomaly detection models associated, they're + // all returned. + Dimensions []*Dimension `type:"list"` + + // The maximum number of results to return in one operation. The maximum value + // that you can specify is 100. + // + // To retrieve the remaining results, make another call with the returned NextToken + // value. + MaxResults *int64 `min:"1" type:"integer"` + + // Limits the results to only the anomaly detection models that are associated + // with the specified metric name. If there are multiple metrics with this name + // in different namespaces that have anomaly detection models, they're all returned. + MetricName *string `min:"1" type:"string"` + + // Limits the results to only the anomaly detection models that are associated + // with the specified namespace. + Namespace *string `min:"1" type:"string"` + + // Use the token returned by the previous operation to request the next page + // of results. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAnomalyDetectorsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAnomalyDetectorsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeAnomalyDetectorsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeAnomalyDetectorsInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAnomalyDetectorTypes sets the AnomalyDetectorTypes field's value. +func (s *DescribeAnomalyDetectorsInput) SetAnomalyDetectorTypes(v []*string) *DescribeAnomalyDetectorsInput { + s.AnomalyDetectorTypes = v + return s +} + +// SetDimensions sets the Dimensions field's value. +func (s *DescribeAnomalyDetectorsInput) SetDimensions(v []*Dimension) *DescribeAnomalyDetectorsInput { + s.Dimensions = v + return s +} + +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeAnomalyDetectorsInput) SetMaxResults(v int64) *DescribeAnomalyDetectorsInput { + s.MaxResults = &v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *DescribeAnomalyDetectorsInput) SetMetricName(v string) *DescribeAnomalyDetectorsInput { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *DescribeAnomalyDetectorsInput) SetNamespace(v string) *DescribeAnomalyDetectorsInput { + s.Namespace = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeAnomalyDetectorsInput) SetNextToken(v string) *DescribeAnomalyDetectorsInput { + s.NextToken = &v + return s +} + +type DescribeAnomalyDetectorsOutput struct { + _ struct{} `type:"structure"` + + // The list of anomaly detection models returned by the operation. + AnomalyDetectors []*AnomalyDetector `type:"list"` + + // A token that you can use in a subsequent operation to retrieve the next set + // of results. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAnomalyDetectorsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAnomalyDetectorsOutput) GoString() string { + return s.String() +} + +// SetAnomalyDetectors sets the AnomalyDetectors field's value. +func (s *DescribeAnomalyDetectorsOutput) SetAnomalyDetectors(v []*AnomalyDetector) *DescribeAnomalyDetectorsOutput { + s.AnomalyDetectors = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeAnomalyDetectorsOutput) SetNextToken(v string) *DescribeAnomalyDetectorsOutput { + s.NextToken = &v + return s +} + +type DescribeInsightRulesInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results to return in one operation. If you omit this + // parameter, the default of 500 is used. + MaxResults *int64 `min:"1" type:"integer"` + + // Include this value, if it was returned by the previous operation, to get + // the next set of rules. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeInsightRulesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeInsightRulesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeInsightRulesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeInsightRulesInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeInsightRulesInput) SetMaxResults(v int64) *DescribeInsightRulesInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeInsightRulesInput) SetNextToken(v string) *DescribeInsightRulesInput { + s.NextToken = &v + return s +} + +type DescribeInsightRulesOutput struct { + _ struct{} `type:"structure"` + + // The rules returned by the operation. + InsightRules []*InsightRule `type:"list"` + + // If this parameter is present, it is a token that marks the start of the next + // batch of returned results. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeInsightRulesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeInsightRulesOutput) GoString() string { + return s.String() +} + +// SetInsightRules sets the InsightRules field's value. +func (s *DescribeInsightRulesOutput) SetInsightRules(v []*InsightRule) *DescribeInsightRulesOutput { + s.InsightRules = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeInsightRulesOutput) SetNextToken(v string) *DescribeInsightRulesOutput { + s.NextToken = &v + return s +} + +// A dimension is a name/value pair that is part of the identity of a metric. +// Because dimensions are part of the unique identifier for a metric, whenever +// you add a unique name/value pair to one of your metrics, you are creating +// a new variation of that metric. For example, many Amazon EC2 metrics publish +// InstanceId as a dimension name, and the actual instance ID as the value for +// that dimension. +// +// You can assign up to 30 dimensions to a metric. +type Dimension struct { + _ struct{} `type:"structure"` + + // The name of the dimension. Dimension names must contain only ASCII characters, + // must include at least one non-whitespace character, and cannot start with + // a colon (:). ASCII control characters are not supported as part of dimension + // names. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` + + // The value of the dimension. Dimension values must contain only ASCII characters + // and must include at least one non-whitespace character. ASCII control characters + // are not supported as part of dimension values. + // + // Value is a required field + Value *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Dimension) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Dimension) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Dimension) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Dimension"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + if s.Value == nil { + invalidParams.Add(request.NewErrParamRequired("Value")) + } + if s.Value != nil && len(*s.Value) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Value", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *Dimension) SetName(v string) *Dimension { + s.Name = &v + return s +} + +// SetValue sets the Value field's value. +func (s *Dimension) SetValue(v string) *Dimension { + s.Value = &v + return s +} + +// Represents filters for a dimension. +type DimensionFilter struct { + _ struct{} `type:"structure"` + + // The dimension name to be matched. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` + + // The value of the dimension to be matched. + Value *string `min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DimensionFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DimensionFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DimensionFilter) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DimensionFilter"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + if s.Value != nil && len(*s.Value) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Value", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *DimensionFilter) SetName(v string) *DimensionFilter { + s.Name = &v + return s +} + +// SetValue sets the Value field's value. +func (s *DimensionFilter) SetValue(v string) *DimensionFilter { + s.Value = &v + return s +} + +type DisableAlarmActionsInput struct { + _ struct{} `type:"structure"` + + // The names of the alarms. + // + // AlarmNames is a required field + AlarmNames []*string `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisableAlarmActionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisableAlarmActionsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DisableAlarmActionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DisableAlarmActionsInput"} + if s.AlarmNames == nil { + invalidParams.Add(request.NewErrParamRequired("AlarmNames")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAlarmNames sets the AlarmNames field's value. +func (s *DisableAlarmActionsInput) SetAlarmNames(v []*string) *DisableAlarmActionsInput { + s.AlarmNames = v + return s +} + +type DisableAlarmActionsOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisableAlarmActionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisableAlarmActionsOutput) GoString() string { + return s.String() +} + +type DisableInsightRulesInput struct { + _ struct{} `type:"structure"` + + // An array of the rule names to disable. If you need to find out the names + // of your rules, use DescribeInsightRules (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeInsightRules.html). + // + // RuleNames is a required field + RuleNames []*string `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisableInsightRulesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisableInsightRulesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DisableInsightRulesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DisableInsightRulesInput"} + if s.RuleNames == nil { + invalidParams.Add(request.NewErrParamRequired("RuleNames")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRuleNames sets the RuleNames field's value. +func (s *DisableInsightRulesInput) SetRuleNames(v []*string) *DisableInsightRulesInput { + s.RuleNames = v + return s +} + +type DisableInsightRulesOutput struct { + _ struct{} `type:"structure"` + + // An array listing the rules that could not be disabled. You cannot disable + // built-in rules. + Failures []*PartialFailure `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisableInsightRulesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisableInsightRulesOutput) GoString() string { + return s.String() +} + +// SetFailures sets the Failures field's value. +func (s *DisableInsightRulesOutput) SetFailures(v []*PartialFailure) *DisableInsightRulesOutput { + s.Failures = v + return s +} + +type EnableAlarmActionsInput struct { + _ struct{} `type:"structure"` + + // The names of the alarms. + // + // AlarmNames is a required field + AlarmNames []*string `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s EnableAlarmActionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s EnableAlarmActionsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *EnableAlarmActionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EnableAlarmActionsInput"} + if s.AlarmNames == nil { + invalidParams.Add(request.NewErrParamRequired("AlarmNames")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAlarmNames sets the AlarmNames field's value. +func (s *EnableAlarmActionsInput) SetAlarmNames(v []*string) *EnableAlarmActionsInput { + s.AlarmNames = v + return s +} + +type EnableAlarmActionsOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s EnableAlarmActionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s EnableAlarmActionsOutput) GoString() string { + return s.String() +} + +type EnableInsightRulesInput struct { + _ struct{} `type:"structure"` + + // An array of the rule names to enable. If you need to find out the names of + // your rules, use DescribeInsightRules (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeInsightRules.html). + // + // RuleNames is a required field + RuleNames []*string `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s EnableInsightRulesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s EnableInsightRulesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *EnableInsightRulesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EnableInsightRulesInput"} + if s.RuleNames == nil { + invalidParams.Add(request.NewErrParamRequired("RuleNames")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRuleNames sets the RuleNames field's value. +func (s *EnableInsightRulesInput) SetRuleNames(v []*string) *EnableInsightRulesInput { + s.RuleNames = v + return s +} + +type EnableInsightRulesOutput struct { + _ struct{} `type:"structure"` + + // An array listing the rules that could not be enabled. You cannot disable + // or enable built-in rules. + Failures []*PartialFailure `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s EnableInsightRulesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s EnableInsightRulesOutput) GoString() string { + return s.String() +} + +// SetFailures sets the Failures field's value. +func (s *EnableInsightRulesOutput) SetFailures(v []*PartialFailure) *EnableInsightRulesOutput { + s.Failures = v + return s +} + +type Entity struct { + _ struct{} `type:"structure"` + + Attributes map[string]*string `type:"map"` + + KeyAttributes map[string]*string `min:"2" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Entity) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Entity) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Entity) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Entity"} + if s.KeyAttributes != nil && len(s.KeyAttributes) < 2 { + invalidParams.Add(request.NewErrParamMinLen("KeyAttributes", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAttributes sets the Attributes field's value. +func (s *Entity) SetAttributes(v map[string]*string) *Entity { + s.Attributes = v + return s +} + +// SetKeyAttributes sets the KeyAttributes field's value. +func (s *Entity) SetKeyAttributes(v map[string]*string) *Entity { + s.KeyAttributes = v + return s +} + +type EntityMetricData struct { + _ struct{} `type:"structure"` + + Entity *Entity `type:"structure"` + + MetricData []*MetricDatum `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s EntityMetricData) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s EntityMetricData) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *EntityMetricData) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EntityMetricData"} + if s.Entity != nil { + if err := s.Entity.Validate(); err != nil { + invalidParams.AddNested("Entity", err.(request.ErrInvalidParams)) + } + } + if s.MetricData != nil { + for i, v := range s.MetricData { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricData", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEntity sets the Entity field's value. +func (s *EntityMetricData) SetEntity(v *Entity) *EntityMetricData { + s.Entity = v + return s +} + +// SetMetricData sets the MetricData field's value. +func (s *EntityMetricData) SetMetricData(v []*MetricDatum) *EntityMetricData { + s.MetricData = v + return s +} + +type GetDashboardInput struct { + _ struct{} `type:"structure"` + + // The name of the dashboard to be described. + // + // DashboardName is a required field + DashboardName *string `type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDashboardInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDashboardInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetDashboardInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetDashboardInput"} + if s.DashboardName == nil { + invalidParams.Add(request.NewErrParamRequired("DashboardName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDashboardName sets the DashboardName field's value. +func (s *GetDashboardInput) SetDashboardName(v string) *GetDashboardInput { + s.DashboardName = &v + return s +} + +type GetDashboardOutput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the dashboard. + DashboardArn *string `type:"string"` + + // The detailed information about the dashboard, including what widgets are + // included and their location on the dashboard. For more information about + // the DashboardBody syntax, see Dashboard Body Structure and Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html). + DashboardBody *string `type:"string"` + + // The name of the dashboard. + DashboardName *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDashboardOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDashboardOutput) GoString() string { + return s.String() +} + +// SetDashboardArn sets the DashboardArn field's value. +func (s *GetDashboardOutput) SetDashboardArn(v string) *GetDashboardOutput { + s.DashboardArn = &v + return s +} + +// SetDashboardBody sets the DashboardBody field's value. +func (s *GetDashboardOutput) SetDashboardBody(v string) *GetDashboardOutput { + s.DashboardBody = &v + return s +} + +// SetDashboardName sets the DashboardName field's value. +func (s *GetDashboardOutput) SetDashboardName(v string) *GetDashboardOutput { + s.DashboardName = &v + return s +} + +type GetInsightRuleReportInput struct { + _ struct{} `type:"structure"` + + // The end time of the data to use in the report. When used in a raw HTTP Query + // API, it is formatted as yyyy-MM-dd'T'HH:mm:ss. For example, 2019-07-01T23:59:59. + // + // EndTime is a required field + EndTime *time.Time `type:"timestamp" required:"true"` + + // The maximum number of contributors to include in the report. The range is + // 1 to 100. If you omit this, the default of 10 is used. + MaxContributorCount *int64 `type:"integer"` + + // Specifies which metrics to use for aggregation of contributor values for + // the report. You can specify one or more of the following metrics: + // + // * UniqueContributors -- the number of unique contributors for each data + // point. + // + // * MaxContributorValue -- the value of the top contributor for each data + // point. The identity of the contributor might change for each data point + // in the graph. If this rule aggregates by COUNT, the top contributor for + // each data point is the contributor with the most occurrences in that period. + // If the rule aggregates by SUM, the top contributor is the contributor + // with the highest sum in the log field specified by the rule's Value, during + // that period. + // + // * SampleCount -- the number of data points matched by the rule. + // + // * Sum -- the sum of the values from all contributors during the time period + // represented by that data point. + // + // * Minimum -- the minimum value from a single observation during the time + // period represented by that data point. + // + // * Maximum -- the maximum value from a single observation during the time + // period represented by that data point. + // + // * Average -- the average value from all contributors during the time period + // represented by that data point. + Metrics []*string `type:"list"` + + // Determines what statistic to use to rank the contributors. Valid values are + // Sum and Maximum. + OrderBy *string `min:"1" type:"string"` + + // The period, in seconds, to use for the statistics in the InsightRuleMetricDatapoint + // results. + // + // Period is a required field + Period *int64 `min:"1" type:"integer" required:"true"` + + // The name of the rule that you want to see data from. + // + // RuleName is a required field + RuleName *string `min:"1" type:"string" required:"true"` + + // The start time of the data to use in the report. When used in a raw HTTP + // Query API, it is formatted as yyyy-MM-dd'T'HH:mm:ss. For example, 2019-07-01T23:59:59. + // + // StartTime is a required field + StartTime *time.Time `type:"timestamp" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetInsightRuleReportInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetInsightRuleReportInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetInsightRuleReportInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetInsightRuleReportInput"} + if s.EndTime == nil { + invalidParams.Add(request.NewErrParamRequired("EndTime")) + } + if s.OrderBy != nil && len(*s.OrderBy) < 1 { + invalidParams.Add(request.NewErrParamMinLen("OrderBy", 1)) + } + if s.Period == nil { + invalidParams.Add(request.NewErrParamRequired("Period")) + } + if s.Period != nil && *s.Period < 1 { + invalidParams.Add(request.NewErrParamMinValue("Period", 1)) + } + if s.RuleName == nil { + invalidParams.Add(request.NewErrParamRequired("RuleName")) + } + if s.RuleName != nil && len(*s.RuleName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RuleName", 1)) + } + if s.StartTime == nil { + invalidParams.Add(request.NewErrParamRequired("StartTime")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEndTime sets the EndTime field's value. +func (s *GetInsightRuleReportInput) SetEndTime(v time.Time) *GetInsightRuleReportInput { + s.EndTime = &v + return s +} + +// SetMaxContributorCount sets the MaxContributorCount field's value. +func (s *GetInsightRuleReportInput) SetMaxContributorCount(v int64) *GetInsightRuleReportInput { + s.MaxContributorCount = &v + return s +} + +// SetMetrics sets the Metrics field's value. +func (s *GetInsightRuleReportInput) SetMetrics(v []*string) *GetInsightRuleReportInput { + s.Metrics = v + return s +} + +// SetOrderBy sets the OrderBy field's value. +func (s *GetInsightRuleReportInput) SetOrderBy(v string) *GetInsightRuleReportInput { + s.OrderBy = &v + return s +} + +// SetPeriod sets the Period field's value. +func (s *GetInsightRuleReportInput) SetPeriod(v int64) *GetInsightRuleReportInput { + s.Period = &v + return s +} + +// SetRuleName sets the RuleName field's value. +func (s *GetInsightRuleReportInput) SetRuleName(v string) *GetInsightRuleReportInput { + s.RuleName = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *GetInsightRuleReportInput) SetStartTime(v time.Time) *GetInsightRuleReportInput { + s.StartTime = &v + return s +} + +type GetInsightRuleReportOutput struct { + _ struct{} `type:"structure"` + + // The sum of the values from all individual contributors that match the rule. + AggregateValue *float64 `type:"double"` + + // Specifies whether this rule aggregates contributor data by COUNT or SUM. + AggregationStatistic *string `type:"string"` + + // An approximate count of the unique contributors found by this rule in this + // time period. + ApproximateUniqueCount *int64 `type:"long"` + + // An array of the unique contributors found by this rule in this time period. + // If the rule contains multiple keys, each combination of values for the keys + // counts as a unique contributor. + Contributors []*InsightRuleContributor `type:"list"` + + // An array of the strings used as the keys for this rule. The keys are the + // dimensions used to classify contributors. If the rule contains more than + // one key, then each unique combination of values for the keys is counted as + // a unique contributor. + KeyLabels []*string `type:"list"` + + // A time series of metric data points that matches the time period in the rule + // request. + MetricDatapoints []*InsightRuleMetricDatapoint `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetInsightRuleReportOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetInsightRuleReportOutput) GoString() string { + return s.String() +} + +// SetAggregateValue sets the AggregateValue field's value. +func (s *GetInsightRuleReportOutput) SetAggregateValue(v float64) *GetInsightRuleReportOutput { + s.AggregateValue = &v + return s +} + +// SetAggregationStatistic sets the AggregationStatistic field's value. +func (s *GetInsightRuleReportOutput) SetAggregationStatistic(v string) *GetInsightRuleReportOutput { + s.AggregationStatistic = &v + return s +} + +// SetApproximateUniqueCount sets the ApproximateUniqueCount field's value. +func (s *GetInsightRuleReportOutput) SetApproximateUniqueCount(v int64) *GetInsightRuleReportOutput { + s.ApproximateUniqueCount = &v + return s +} + +// SetContributors sets the Contributors field's value. +func (s *GetInsightRuleReportOutput) SetContributors(v []*InsightRuleContributor) *GetInsightRuleReportOutput { + s.Contributors = v + return s +} + +// SetKeyLabels sets the KeyLabels field's value. +func (s *GetInsightRuleReportOutput) SetKeyLabels(v []*string) *GetInsightRuleReportOutput { + s.KeyLabels = v + return s +} + +// SetMetricDatapoints sets the MetricDatapoints field's value. +func (s *GetInsightRuleReportOutput) SetMetricDatapoints(v []*InsightRuleMetricDatapoint) *GetInsightRuleReportOutput { + s.MetricDatapoints = v + return s +} + +type GetMetricDataInput struct { + _ struct{} `type:"structure"` + + // The time stamp indicating the latest data to be returned. + // + // The value specified is exclusive; results include data points up to the specified + // time stamp. + // + // For better performance, specify StartTime and EndTime values that align with + // the value of the metric's Period and sync up with the beginning and end of + // an hour. For example, if the Period of a metric is 5 minutes, specifying + // 12:05 or 12:30 as EndTime can get a faster response from CloudWatch than + // setting 12:07 or 12:29 as the EndTime. + // + // EndTime is a required field + EndTime *time.Time `type:"timestamp" required:"true"` + + // This structure includes the Timezone parameter, which you can use to specify + // your time zone so that the labels of returned data display the correct time + // for your time zone. + LabelOptions *LabelOptions `type:"structure"` + + // The maximum number of data points the request should return before paginating. + // If you omit this, the default of 100,800 is used. + MaxDatapoints *int64 `type:"integer"` + + // The metric queries to be returned. A single GetMetricData call can include + // as many as 500 MetricDataQuery structures. Each of these structures can specify + // either a metric to retrieve, a Metrics Insights query, or a math expression + // to perform on retrieved data. + // + // MetricDataQueries is a required field + MetricDataQueries []*MetricDataQuery `type:"list" required:"true"` + + // Include this value, if it was returned by the previous GetMetricData operation, + // to get the next set of data points. + NextToken *string `type:"string"` + + // The order in which data points should be returned. TimestampDescending returns + // the newest data first and paginates when the MaxDatapoints limit is reached. + // TimestampAscending returns the oldest data first and paginates when the MaxDatapoints + // limit is reached. + // + // If you omit this parameter, the default of TimestampDescending is used. + ScanBy *string `type:"string" enum:"ScanBy"` + + // The time stamp indicating the earliest data to be returned. + // + // The value specified is inclusive; results include data points with the specified + // time stamp. + // + // CloudWatch rounds the specified time stamp as follows: + // + // * Start time less than 15 days ago - Round down to the nearest whole minute. + // For example, 12:32:34 is rounded down to 12:32:00. + // + // * Start time between 15 and 63 days ago - Round down to the nearest 5-minute + // clock interval. For example, 12:32:34 is rounded down to 12:30:00. + // + // * Start time greater than 63 days ago - Round down to the nearest 1-hour + // clock interval. For example, 12:32:34 is rounded down to 12:00:00. + // + // If you set Period to 5, 10, or 30, the start time of your request is rounded + // down to the nearest time that corresponds to even 5-, 10-, or 30-second divisions + // of a minute. For example, if you make a query at (HH:mm:ss) 01:05:23 for + // the previous 10-second period, the start time of your request is rounded + // down and you receive data from 01:05:10 to 01:05:20. If you make a query + // at 15:07:17 for the previous 5 minutes of data, using a period of 5 seconds, + // you receive data timestamped between 15:02:15 and 15:07:15. + // + // For better performance, specify StartTime and EndTime values that align with + // the value of the metric's Period and sync up with the beginning and end of + // an hour. For example, if the Period of a metric is 5 minutes, specifying + // 12:05 or 12:30 as StartTime can get a faster response from CloudWatch than + // setting 12:07 or 12:29 as the StartTime. + // + // StartTime is a required field + StartTime *time.Time `type:"timestamp" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricDataInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricDataInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetMetricDataInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetMetricDataInput"} + if s.EndTime == nil { + invalidParams.Add(request.NewErrParamRequired("EndTime")) + } + if s.MetricDataQueries == nil { + invalidParams.Add(request.NewErrParamRequired("MetricDataQueries")) + } + if s.StartTime == nil { + invalidParams.Add(request.NewErrParamRequired("StartTime")) + } + if s.MetricDataQueries != nil { + for i, v := range s.MetricDataQueries { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricDataQueries", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEndTime sets the EndTime field's value. +func (s *GetMetricDataInput) SetEndTime(v time.Time) *GetMetricDataInput { + s.EndTime = &v + return s +} + +// SetLabelOptions sets the LabelOptions field's value. +func (s *GetMetricDataInput) SetLabelOptions(v *LabelOptions) *GetMetricDataInput { + s.LabelOptions = v + return s +} + +// SetMaxDatapoints sets the MaxDatapoints field's value. +func (s *GetMetricDataInput) SetMaxDatapoints(v int64) *GetMetricDataInput { + s.MaxDatapoints = &v + return s +} + +// SetMetricDataQueries sets the MetricDataQueries field's value. +func (s *GetMetricDataInput) SetMetricDataQueries(v []*MetricDataQuery) *GetMetricDataInput { + s.MetricDataQueries = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *GetMetricDataInput) SetNextToken(v string) *GetMetricDataInput { + s.NextToken = &v + return s +} + +// SetScanBy sets the ScanBy field's value. +func (s *GetMetricDataInput) SetScanBy(v string) *GetMetricDataInput { + s.ScanBy = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *GetMetricDataInput) SetStartTime(v time.Time) *GetMetricDataInput { + s.StartTime = &v + return s +} + +type GetMetricDataOutput struct { + _ struct{} `type:"structure"` + + // Contains a message about this GetMetricData operation, if the operation results + // in such a message. An example of a message that might be returned is Maximum + // number of allowed metrics exceeded. If there is a message, as much of the + // operation as possible is still executed. + // + // A message appears here only if it is related to the global GetMetricData + // operation. Any message about a specific metric returned by the operation + // appears in the MetricDataResult object returned for that metric. + Messages []*MessageData `type:"list"` + + // The metrics that are returned, including the metric name, namespace, and + // dimensions. + MetricDataResults []*MetricDataResult `type:"list"` + + // A token that marks the next batch of returned results. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricDataOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricDataOutput) GoString() string { + return s.String() +} + +// SetMessages sets the Messages field's value. +func (s *GetMetricDataOutput) SetMessages(v []*MessageData) *GetMetricDataOutput { + s.Messages = v + return s +} + +// SetMetricDataResults sets the MetricDataResults field's value. +func (s *GetMetricDataOutput) SetMetricDataResults(v []*MetricDataResult) *GetMetricDataOutput { + s.MetricDataResults = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *GetMetricDataOutput) SetNextToken(v string) *GetMetricDataOutput { + s.NextToken = &v + return s +} + +type GetMetricStatisticsInput struct { + _ struct{} `type:"structure"` + + // The dimensions. If the metric contains multiple dimensions, you must include + // a value for each dimension. CloudWatch treats each unique combination of + // dimensions as a separate metric. If a specific combination of dimensions + // was not published, you can't retrieve statistics for it. You must specify + // the same dimensions that were used when the metrics were created. For an + // example, see Dimension Combinations (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations) + // in the Amazon CloudWatch User Guide. For more information about specifying + // dimensions, see Publishing Metrics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html) + // in the Amazon CloudWatch User Guide. + Dimensions []*Dimension `type:"list"` + + // The time stamp that determines the last data point to return. + // + // The value specified is exclusive; results include data points up to the specified + // time stamp. In a raw HTTP query, the time stamp must be in ISO 8601 UTC format + // (for example, 2016-10-10T23:00:00Z). + // + // EndTime is a required field + EndTime *time.Time `type:"timestamp" required:"true"` + + // The percentile statistics. Specify values between p0.0 and p100. When calling + // GetMetricStatistics, you must specify either Statistics or ExtendedStatistics, + // but not both. Percentile statistics are not available for metrics when any + // of the metric values are negative numbers. + ExtendedStatistics []*string `min:"1" type:"list"` + + // The name of the metric, with or without spaces. + // + // MetricName is a required field + MetricName *string `min:"1" type:"string" required:"true"` + + // The namespace of the metric, with or without spaces. + // + // Namespace is a required field + Namespace *string `min:"1" type:"string" required:"true"` + + // The granularity, in seconds, of the returned data points. For metrics with + // regular resolution, a period can be as short as one minute (60 seconds) and + // must be a multiple of 60. For high-resolution metrics that are collected + // at intervals of less than one minute, the period can be 1, 5, 10, 30, 60, + // or any multiple of 60. High-resolution metrics are those metrics stored by + // a PutMetricData call that includes a StorageResolution of 1 second. + // + // If the StartTime parameter specifies a time stamp that is greater than 3 + // hours ago, you must specify the period as follows or no data points in that + // time range is returned: + // + // * Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds + // (1 minute). + // + // * Start time between 15 and 63 days ago - Use a multiple of 300 seconds + // (5 minutes). + // + // * Start time greater than 63 days ago - Use a multiple of 3600 seconds + // (1 hour). + // + // Period is a required field + Period *int64 `min:"1" type:"integer" required:"true"` + + // The time stamp that determines the first data point to return. Start times + // are evaluated relative to the time that CloudWatch receives the request. + // + // The value specified is inclusive; results include data points with the specified + // time stamp. In a raw HTTP query, the time stamp must be in ISO 8601 UTC format + // (for example, 2016-10-03T23:00:00Z). + // + // CloudWatch rounds the specified time stamp as follows: + // + // * Start time less than 15 days ago - Round down to the nearest whole minute. + // For example, 12:32:34 is rounded down to 12:32:00. + // + // * Start time between 15 and 63 days ago - Round down to the nearest 5-minute + // clock interval. For example, 12:32:34 is rounded down to 12:30:00. + // + // * Start time greater than 63 days ago - Round down to the nearest 1-hour + // clock interval. For example, 12:32:34 is rounded down to 12:00:00. + // + // If you set Period to 5, 10, or 30, the start time of your request is rounded + // down to the nearest time that corresponds to even 5-, 10-, or 30-second divisions + // of a minute. For example, if you make a query at (HH:mm:ss) 01:05:23 for + // the previous 10-second period, the start time of your request is rounded + // down and you receive data from 01:05:10 to 01:05:20. If you make a query + // at 15:07:17 for the previous 5 minutes of data, using a period of 5 seconds, + // you receive data timestamped between 15:02:15 and 15:07:15. + // + // StartTime is a required field + StartTime *time.Time `type:"timestamp" required:"true"` + + // The metric statistics, other than percentile. For percentile statistics, + // use ExtendedStatistics. When calling GetMetricStatistics, you must specify + // either Statistics or ExtendedStatistics, but not both. + Statistics []*string `min:"1" type:"list" enum:"Statistic"` + + // The unit for a given metric. If you omit Unit, all data that was collected + // with any unit is returned, along with the corresponding units that were specified + // when the data was reported to CloudWatch. If you specify a unit, the operation + // returns only data that was collected with that unit specified. If you specify + // a unit that does not match the data collected, the results of the operation + // are null. CloudWatch does not perform unit conversions. + Unit *string `type:"string" enum:"StandardUnit"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricStatisticsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricStatisticsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetMetricStatisticsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetMetricStatisticsInput"} + if s.EndTime == nil { + invalidParams.Add(request.NewErrParamRequired("EndTime")) + } + if s.ExtendedStatistics != nil && len(s.ExtendedStatistics) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ExtendedStatistics", 1)) + } + if s.MetricName == nil { + invalidParams.Add(request.NewErrParamRequired("MetricName")) + } + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace == nil { + invalidParams.Add(request.NewErrParamRequired("Namespace")) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.Period == nil { + invalidParams.Add(request.NewErrParamRequired("Period")) + } + if s.Period != nil && *s.Period < 1 { + invalidParams.Add(request.NewErrParamMinValue("Period", 1)) + } + if s.StartTime == nil { + invalidParams.Add(request.NewErrParamRequired("StartTime")) + } + if s.Statistics != nil && len(s.Statistics) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Statistics", 1)) + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDimensions sets the Dimensions field's value. +func (s *GetMetricStatisticsInput) SetDimensions(v []*Dimension) *GetMetricStatisticsInput { + s.Dimensions = v + return s +} + +// SetEndTime sets the EndTime field's value. +func (s *GetMetricStatisticsInput) SetEndTime(v time.Time) *GetMetricStatisticsInput { + s.EndTime = &v + return s +} + +// SetExtendedStatistics sets the ExtendedStatistics field's value. +func (s *GetMetricStatisticsInput) SetExtendedStatistics(v []*string) *GetMetricStatisticsInput { + s.ExtendedStatistics = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *GetMetricStatisticsInput) SetMetricName(v string) *GetMetricStatisticsInput { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *GetMetricStatisticsInput) SetNamespace(v string) *GetMetricStatisticsInput { + s.Namespace = &v + return s +} + +// SetPeriod sets the Period field's value. +func (s *GetMetricStatisticsInput) SetPeriod(v int64) *GetMetricStatisticsInput { + s.Period = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *GetMetricStatisticsInput) SetStartTime(v time.Time) *GetMetricStatisticsInput { + s.StartTime = &v + return s +} + +// SetStatistics sets the Statistics field's value. +func (s *GetMetricStatisticsInput) SetStatistics(v []*string) *GetMetricStatisticsInput { + s.Statistics = v + return s +} + +// SetUnit sets the Unit field's value. +func (s *GetMetricStatisticsInput) SetUnit(v string) *GetMetricStatisticsInput { + s.Unit = &v + return s +} + +type GetMetricStatisticsOutput struct { + _ struct{} `type:"structure"` + + // The data points for the specified metric. + Datapoints []*Datapoint `type:"list"` + + // A label for the specified metric. + Label *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricStatisticsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricStatisticsOutput) GoString() string { + return s.String() +} + +// SetDatapoints sets the Datapoints field's value. +func (s *GetMetricStatisticsOutput) SetDatapoints(v []*Datapoint) *GetMetricStatisticsOutput { + s.Datapoints = v + return s +} + +// SetLabel sets the Label field's value. +func (s *GetMetricStatisticsOutput) SetLabel(v string) *GetMetricStatisticsOutput { + s.Label = &v + return s +} + +type GetMetricStreamInput struct { + _ struct{} `type:"structure"` + + // The name of the metric stream to retrieve information about. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricStreamInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricStreamInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetMetricStreamInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetMetricStreamInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *GetMetricStreamInput) SetName(v string) *GetMetricStreamInput { + s.Name = &v + return s +} + +type GetMetricStreamOutput struct { + _ struct{} `type:"structure"` + + // The ARN of the metric stream. + Arn *string `min:"1" type:"string"` + + // The date that the metric stream was created. + CreationDate *time.Time `type:"timestamp"` + + // If this array of metric namespaces is present, then these namespaces are + // the only metric namespaces that are not streamed by this metric stream. In + // this case, all other metric namespaces in the account are streamed by this + // metric stream. + ExcludeFilters []*MetricStreamFilter `type:"list"` + + // The ARN of the Amazon Kinesis Data Firehose delivery stream that is used + // by this metric stream. + FirehoseArn *string `min:"1" type:"string"` + + // If this array of metric namespaces is present, then these namespaces are + // the only metric namespaces that are streamed by this metric stream. + IncludeFilters []*MetricStreamFilter `type:"list"` + + // If this is true and this metric stream is in a monitoring account, then the + // stream includes metrics from source accounts that the monitoring account + // is linked to. + IncludeLinkedAccountsMetrics *bool `type:"boolean"` + + // The date of the most recent update to the metric stream's configuration. + LastUpdateDate *time.Time `type:"timestamp"` + + // The name of the metric stream. + Name *string `min:"1" type:"string"` + + // The output format for the stream. Valid values are json, opentelemetry1.0, + // and opentelemetry0.7. For more information about metric stream output formats, + // see Metric streams output formats (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-formats.html). + OutputFormat *string `min:"1" type:"string"` + + // The ARN of the IAM role that is used by this metric stream. + RoleArn *string `min:"1" type:"string"` + + // The state of the metric stream. The possible values are running and stopped. + State *string `type:"string"` + + // Each entry in this array displays information about one or more metrics that + // include additional statistics in the metric stream. For more information + // about the additional statistics, see CloudWatch statistics definitions (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html.html). + StatisticsConfigurations []*MetricStreamStatisticsConfiguration `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricStreamOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricStreamOutput) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *GetMetricStreamOutput) SetArn(v string) *GetMetricStreamOutput { + s.Arn = &v + return s +} + +// SetCreationDate sets the CreationDate field's value. +func (s *GetMetricStreamOutput) SetCreationDate(v time.Time) *GetMetricStreamOutput { + s.CreationDate = &v + return s +} + +// SetExcludeFilters sets the ExcludeFilters field's value. +func (s *GetMetricStreamOutput) SetExcludeFilters(v []*MetricStreamFilter) *GetMetricStreamOutput { + s.ExcludeFilters = v + return s +} + +// SetFirehoseArn sets the FirehoseArn field's value. +func (s *GetMetricStreamOutput) SetFirehoseArn(v string) *GetMetricStreamOutput { + s.FirehoseArn = &v + return s +} + +// SetIncludeFilters sets the IncludeFilters field's value. +func (s *GetMetricStreamOutput) SetIncludeFilters(v []*MetricStreamFilter) *GetMetricStreamOutput { + s.IncludeFilters = v + return s +} + +// SetIncludeLinkedAccountsMetrics sets the IncludeLinkedAccountsMetrics field's value. +func (s *GetMetricStreamOutput) SetIncludeLinkedAccountsMetrics(v bool) *GetMetricStreamOutput { + s.IncludeLinkedAccountsMetrics = &v + return s +} + +// SetLastUpdateDate sets the LastUpdateDate field's value. +func (s *GetMetricStreamOutput) SetLastUpdateDate(v time.Time) *GetMetricStreamOutput { + s.LastUpdateDate = &v + return s +} + +// SetName sets the Name field's value. +func (s *GetMetricStreamOutput) SetName(v string) *GetMetricStreamOutput { + s.Name = &v + return s +} + +// SetOutputFormat sets the OutputFormat field's value. +func (s *GetMetricStreamOutput) SetOutputFormat(v string) *GetMetricStreamOutput { + s.OutputFormat = &v + return s +} + +// SetRoleArn sets the RoleArn field's value. +func (s *GetMetricStreamOutput) SetRoleArn(v string) *GetMetricStreamOutput { + s.RoleArn = &v + return s +} + +// SetState sets the State field's value. +func (s *GetMetricStreamOutput) SetState(v string) *GetMetricStreamOutput { + s.State = &v + return s +} + +// SetStatisticsConfigurations sets the StatisticsConfigurations field's value. +func (s *GetMetricStreamOutput) SetStatisticsConfigurations(v []*MetricStreamStatisticsConfiguration) *GetMetricStreamOutput { + s.StatisticsConfigurations = v + return s +} + +type GetMetricWidgetImageInput struct { + _ struct{} `type:"structure"` + + // A JSON string that defines the bitmap graph to be retrieved. The string includes + // the metrics to include in the graph, statistics, annotations, title, axis + // limits, and so on. You can include only one MetricWidget parameter in each + // GetMetricWidgetImage call. + // + // For more information about the syntax of MetricWidget see GetMetricWidgetImage: + // Metric Widget Structure and Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Metric-Widget-Structure.html). + // + // If any metric on the graph could not load all the requested data points, + // an orange triangle with an exclamation point appears next to the graph legend. + // + // MetricWidget is a required field + MetricWidget *string `type:"string" required:"true"` + + // The format of the resulting image. Only PNG images are supported. + // + // The default is png. If you specify png, the API returns an HTTP response + // with the content-type set to text/xml. The image data is in a MetricWidgetImage + // field. For example: + // + // > + // + // + // + // + // + // iVBORw0KGgoAAAANSUhEUgAAAlgAAAGQEAYAAAAip... + // + // + // + // + // + // + // + // 6f0d4192-4d42-11e8-82c1-f539a07e0e3b + // + // + // + // + // + // The image/png setting is intended only for custom HTTP requests. For most + // use cases, and all actions using an Amazon Web Services SDK, you should use + // png. If you specify image/png, the HTTP response has a content-type set to + // image/png, and the body of the response is a PNG image. + OutputFormat *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricWidgetImageInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricWidgetImageInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetMetricWidgetImageInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetMetricWidgetImageInput"} + if s.MetricWidget == nil { + invalidParams.Add(request.NewErrParamRequired("MetricWidget")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMetricWidget sets the MetricWidget field's value. +func (s *GetMetricWidgetImageInput) SetMetricWidget(v string) *GetMetricWidgetImageInput { + s.MetricWidget = &v + return s +} + +// SetOutputFormat sets the OutputFormat field's value. +func (s *GetMetricWidgetImageInput) SetOutputFormat(v string) *GetMetricWidgetImageInput { + s.OutputFormat = &v + return s +} + +type GetMetricWidgetImageOutput struct { + _ struct{} `type:"structure"` + + // The image of the graph, in the output format specified. The output is base64-encoded. + // MetricWidgetImage is automatically base64 encoded/decoded by the SDK. + MetricWidgetImage []byte `type:"blob"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricWidgetImageOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetMetricWidgetImageOutput) GoString() string { + return s.String() +} + +// SetMetricWidgetImage sets the MetricWidgetImage field's value. +func (s *GetMetricWidgetImageOutput) SetMetricWidgetImage(v []byte) *GetMetricWidgetImageOutput { + s.MetricWidgetImage = v + return s +} + +// This structure contains the definition for a Contributor Insights rule. For +// more information about this rule, see Using Constributor Insights to analyze +// high-cardinality data (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContributorInsights.html) +// in the Amazon CloudWatch User Guide. +type InsightRule struct { + _ struct{} `type:"structure"` + + // The definition of the rule, as a JSON object. The definition contains the + // keywords used to define contributors, the value to aggregate on if this rule + // returns a sum instead of a count, and the filters. For details on the valid + // syntax, see Contributor Insights Rule Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContributorInsights-RuleSyntax.html). + // + // Definition is a required field + Definition *string `min:"1" type:"string" required:"true"` + + DeleteAt *time.Time `type:"timestamp"` + + DisableAt *time.Time `type:"timestamp"` + + // An optional built-in rule that Amazon Web Services manages. + ManagedRule *bool `type:"boolean"` + + // The name of the rule. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` + + // For rules that you create, this is always {"Name": "CloudWatchLogRule", "Version": + // 1}. For managed rules, this is {"Name": "ServiceLogRule", "Version": 1} + // + // Schema is a required field + Schema *string `type:"string" required:"true"` + + // Indicates whether the rule is enabled or disabled. + // + // State is a required field + State *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InsightRule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InsightRule) GoString() string { + return s.String() +} + +// SetDefinition sets the Definition field's value. +func (s *InsightRule) SetDefinition(v string) *InsightRule { + s.Definition = &v + return s +} + +// SetDeleteAt sets the DeleteAt field's value. +func (s *InsightRule) SetDeleteAt(v time.Time) *InsightRule { + s.DeleteAt = &v + return s +} + +// SetDisableAt sets the DisableAt field's value. +func (s *InsightRule) SetDisableAt(v time.Time) *InsightRule { + s.DisableAt = &v + return s +} + +// SetManagedRule sets the ManagedRule field's value. +func (s *InsightRule) SetManagedRule(v bool) *InsightRule { + s.ManagedRule = &v + return s +} + +// SetName sets the Name field's value. +func (s *InsightRule) SetName(v string) *InsightRule { + s.Name = &v + return s +} + +// SetSchema sets the Schema field's value. +func (s *InsightRule) SetSchema(v string) *InsightRule { + s.Schema = &v + return s +} + +// SetState sets the State field's value. +func (s *InsightRule) SetState(v string) *InsightRule { + s.State = &v + return s +} + +// One of the unique contributors found by a Contributor Insights rule. If the +// rule contains multiple keys, then a unique contributor is a unique combination +// of values from all the keys in the rule. +// +// If the rule contains a single key, then each unique contributor is each unique +// value for this key. +// +// For more information, see GetInsightRuleReport (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetInsightRuleReport.html). +type InsightRuleContributor struct { + _ struct{} `type:"structure"` + + // An approximation of the aggregate value that comes from this contributor. + // + // ApproximateAggregateValue is a required field + ApproximateAggregateValue *float64 `type:"double" required:"true"` + + // An array of the data points where this contributor is present. Only the data + // points when this contributor appeared are included in the array. + // + // Datapoints is a required field + Datapoints []*InsightRuleContributorDatapoint `type:"list" required:"true"` + + // One of the log entry field keywords that is used to define contributors for + // this rule. + // + // Keys is a required field + Keys []*string `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InsightRuleContributor) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InsightRuleContributor) GoString() string { + return s.String() +} + +// SetApproximateAggregateValue sets the ApproximateAggregateValue field's value. +func (s *InsightRuleContributor) SetApproximateAggregateValue(v float64) *InsightRuleContributor { + s.ApproximateAggregateValue = &v + return s +} + +// SetDatapoints sets the Datapoints field's value. +func (s *InsightRuleContributor) SetDatapoints(v []*InsightRuleContributorDatapoint) *InsightRuleContributor { + s.Datapoints = v + return s +} + +// SetKeys sets the Keys field's value. +func (s *InsightRuleContributor) SetKeys(v []*string) *InsightRuleContributor { + s.Keys = v + return s +} + +// One data point related to one contributor. +// +// For more information, see GetInsightRuleReport (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetInsightRuleReport.html) +// and InsightRuleContributor (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_InsightRuleContributor.html). +type InsightRuleContributorDatapoint struct { + _ struct{} `type:"structure"` + + // The approximate value that this contributor added during this timestamp. + // + // ApproximateValue is a required field + ApproximateValue *float64 `type:"double" required:"true"` + + // The timestamp of the data point. + // + // Timestamp is a required field + Timestamp *time.Time `type:"timestamp" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InsightRuleContributorDatapoint) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InsightRuleContributorDatapoint) GoString() string { + return s.String() +} + +// SetApproximateValue sets the ApproximateValue field's value. +func (s *InsightRuleContributorDatapoint) SetApproximateValue(v float64) *InsightRuleContributorDatapoint { + s.ApproximateValue = &v + return s +} + +// SetTimestamp sets the Timestamp field's value. +func (s *InsightRuleContributorDatapoint) SetTimestamp(v time.Time) *InsightRuleContributorDatapoint { + s.Timestamp = &v + return s +} + +// One data point from the metric time series returned in a Contributor Insights +// rule report. +// +// For more information, see GetInsightRuleReport (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetInsightRuleReport.html). +type InsightRuleMetricDatapoint struct { + _ struct{} `type:"structure"` + + // The average value from all contributors during the time period represented + // by that data point. + // + // This statistic is returned only if you included it in the Metrics array in + // your request. + Average *float64 `type:"double"` + + // The maximum value provided by one contributor during this timestamp. Each + // timestamp is evaluated separately, so the identity of the max contributor + // could be different for each timestamp. + // + // This statistic is returned only if you included it in the Metrics array in + // your request. + MaxContributorValue *float64 `type:"double"` + + // The maximum value from a single occurence from a single contributor during + // the time period represented by that data point. + // + // This statistic is returned only if you included it in the Metrics array in + // your request. + Maximum *float64 `type:"double"` + + // The minimum value from a single contributor during the time period represented + // by that data point. + // + // This statistic is returned only if you included it in the Metrics array in + // your request. + Minimum *float64 `type:"double"` + + // The number of occurrences that matched the rule during this data point. + // + // This statistic is returned only if you included it in the Metrics array in + // your request. + SampleCount *float64 `type:"double"` + + // The sum of the values from all contributors during the time period represented + // by that data point. + // + // This statistic is returned only if you included it in the Metrics array in + // your request. + Sum *float64 `type:"double"` + + // The timestamp of the data point. + // + // Timestamp is a required field + Timestamp *time.Time `type:"timestamp" required:"true"` + + // The number of unique contributors who published data during this timestamp. + // + // This statistic is returned only if you included it in the Metrics array in + // your request. + UniqueContributors *float64 `type:"double"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InsightRuleMetricDatapoint) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InsightRuleMetricDatapoint) GoString() string { + return s.String() +} + +// SetAverage sets the Average field's value. +func (s *InsightRuleMetricDatapoint) SetAverage(v float64) *InsightRuleMetricDatapoint { + s.Average = &v + return s +} + +// SetMaxContributorValue sets the MaxContributorValue field's value. +func (s *InsightRuleMetricDatapoint) SetMaxContributorValue(v float64) *InsightRuleMetricDatapoint { + s.MaxContributorValue = &v + return s +} + +// SetMaximum sets the Maximum field's value. +func (s *InsightRuleMetricDatapoint) SetMaximum(v float64) *InsightRuleMetricDatapoint { + s.Maximum = &v + return s +} + +// SetMinimum sets the Minimum field's value. +func (s *InsightRuleMetricDatapoint) SetMinimum(v float64) *InsightRuleMetricDatapoint { + s.Minimum = &v + return s +} + +// SetSampleCount sets the SampleCount field's value. +func (s *InsightRuleMetricDatapoint) SetSampleCount(v float64) *InsightRuleMetricDatapoint { + s.SampleCount = &v + return s +} + +// SetSum sets the Sum field's value. +func (s *InsightRuleMetricDatapoint) SetSum(v float64) *InsightRuleMetricDatapoint { + s.Sum = &v + return s +} + +// SetTimestamp sets the Timestamp field's value. +func (s *InsightRuleMetricDatapoint) SetTimestamp(v time.Time) *InsightRuleMetricDatapoint { + s.Timestamp = &v + return s +} + +// SetUniqueContributors sets the UniqueContributors field's value. +func (s *InsightRuleMetricDatapoint) SetUniqueContributors(v float64) *InsightRuleMetricDatapoint { + s.UniqueContributors = &v + return s +} + +// This structure includes the Timezone parameter, which you can use to specify +// your time zone so that the labels that are associated with returned metrics +// display the correct time for your time zone. +// +// The Timezone value affects a label only if you have a time-based dynamic +// expression in the label. For more information about dynamic expressions in +// labels, see Using Dynamic Labels (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html). +type LabelOptions struct { + _ struct{} `type:"structure"` + + // The time zone to use for metric data return in this operation. The format + // is + or - followed by four digits. The first two digits indicate the number + // of hours ahead or behind of UTC, and the final two digits are the number + // of minutes. For example, +0130 indicates a time zone that is 1 hour and 30 + // minutes ahead of UTC. The default is +0000. + Timezone *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LabelOptions) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LabelOptions) GoString() string { + return s.String() +} + +// SetTimezone sets the Timezone field's value. +func (s *LabelOptions) SetTimezone(v string) *LabelOptions { + s.Timezone = &v + return s +} + +type ListDashboardsInput struct { + _ struct{} `type:"structure"` + + // If you specify this parameter, only the dashboards with names starting with + // the specified string are listed. The maximum length is 255, and valid characters + // are A-Z, a-z, 0-9, ".", "-", and "_". + DashboardNamePrefix *string `type:"string"` + + // The token returned by a previous call to indicate that there is more data + // available. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListDashboardsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListDashboardsInput) GoString() string { + return s.String() +} + +// SetDashboardNamePrefix sets the DashboardNamePrefix field's value. +func (s *ListDashboardsInput) SetDashboardNamePrefix(v string) *ListDashboardsInput { + s.DashboardNamePrefix = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListDashboardsInput) SetNextToken(v string) *ListDashboardsInput { + s.NextToken = &v + return s +} + +type ListDashboardsOutput struct { + _ struct{} `type:"structure"` + + // The list of matching dashboards. + DashboardEntries []*DashboardEntry `type:"list"` + + // The token that marks the start of the next batch of returned results. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListDashboardsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListDashboardsOutput) GoString() string { + return s.String() +} + +// SetDashboardEntries sets the DashboardEntries field's value. +func (s *ListDashboardsOutput) SetDashboardEntries(v []*DashboardEntry) *ListDashboardsOutput { + s.DashboardEntries = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListDashboardsOutput) SetNextToken(v string) *ListDashboardsOutput { + s.NextToken = &v + return s +} + +type ListMetricStreamsInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results to return in one operation. + MaxResults *int64 `min:"1" type:"integer"` + + // Include this value, if it was returned by the previous call, to get the next + // set of metric streams. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListMetricStreamsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListMetricStreamsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListMetricStreamsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListMetricStreamsInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMaxResults sets the MaxResults field's value. +func (s *ListMetricStreamsInput) SetMaxResults(v int64) *ListMetricStreamsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListMetricStreamsInput) SetNextToken(v string) *ListMetricStreamsInput { + s.NextToken = &v + return s +} + +type ListMetricStreamsOutput struct { + _ struct{} `type:"structure"` + + // The array of metric stream information. + Entries []*MetricStreamEntry `type:"list"` + + // The token that marks the start of the next batch of returned results. You + // can use this token in a subsequent operation to get the next batch of results. + NextToken *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListMetricStreamsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListMetricStreamsOutput) GoString() string { + return s.String() +} + +// SetEntries sets the Entries field's value. +func (s *ListMetricStreamsOutput) SetEntries(v []*MetricStreamEntry) *ListMetricStreamsOutput { + s.Entries = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListMetricStreamsOutput) SetNextToken(v string) *ListMetricStreamsOutput { + s.NextToken = &v + return s +} + +type ListMetricsInput struct { + _ struct{} `type:"structure"` + + // The dimensions to filter against. Only the dimensions that match exactly + // will be returned. + Dimensions []*DimensionFilter `type:"list"` + + // If you are using this operation in a monitoring account, specify true to + // include metrics from source accounts in the returned data. + // + // The default is false. + IncludeLinkedAccounts *bool `type:"boolean"` + + // The name of the metric to filter against. Only the metrics with names that + // match exactly will be returned. + MetricName *string `min:"1" type:"string"` + + // The metric namespace to filter against. Only the namespace that matches exactly + // will be returned. + Namespace *string `min:"1" type:"string"` + + // The token returned by a previous call to indicate that there is more data + // available. + NextToken *string `type:"string"` + + // When you use this operation in a monitoring account, use this field to return + // metrics only from one source account. To do so, specify that source account + // ID in this field, and also specify true for IncludeLinkedAccounts. + OwningAccount *string `min:"1" type:"string"` + + // To filter the results to show only metrics that have had data points published + // in the past three hours, specify this parameter with a value of PT3H. This + // is the only valid value for this parameter. + // + // The results that are returned are an approximation of the value you specify. + // There is a low probability that the returned results include metrics with + // last published data as much as 40 minutes more than the specified time interval. + RecentlyActive *string `type:"string" enum:"RecentlyActive"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListMetricsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListMetricsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListMetricsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListMetricsInput"} + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.OwningAccount != nil && len(*s.OwningAccount) < 1 { + invalidParams.Add(request.NewErrParamMinLen("OwningAccount", 1)) + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDimensions sets the Dimensions field's value. +func (s *ListMetricsInput) SetDimensions(v []*DimensionFilter) *ListMetricsInput { + s.Dimensions = v + return s +} + +// SetIncludeLinkedAccounts sets the IncludeLinkedAccounts field's value. +func (s *ListMetricsInput) SetIncludeLinkedAccounts(v bool) *ListMetricsInput { + s.IncludeLinkedAccounts = &v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *ListMetricsInput) SetMetricName(v string) *ListMetricsInput { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *ListMetricsInput) SetNamespace(v string) *ListMetricsInput { + s.Namespace = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListMetricsInput) SetNextToken(v string) *ListMetricsInput { + s.NextToken = &v + return s +} + +// SetOwningAccount sets the OwningAccount field's value. +func (s *ListMetricsInput) SetOwningAccount(v string) *ListMetricsInput { + s.OwningAccount = &v + return s +} + +// SetRecentlyActive sets the RecentlyActive field's value. +func (s *ListMetricsInput) SetRecentlyActive(v string) *ListMetricsInput { + s.RecentlyActive = &v + return s +} + +type ListMetricsOutput struct { + _ struct{} `type:"structure"` + + // The metrics that match your request. + Metrics []*Metric `type:"list"` + + // The token that marks the start of the next batch of returned results. + NextToken *string `type:"string"` + + // If you are using this operation in a monitoring account, this array contains + // the account IDs of the source accounts where the metrics in the returned + // data are from. + // + // This field is a 1:1 mapping between each metric that is returned and the + // ID of the owning account. + OwningAccounts []*string `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListMetricsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListMetricsOutput) GoString() string { + return s.String() +} + +// SetMetrics sets the Metrics field's value. +func (s *ListMetricsOutput) SetMetrics(v []*Metric) *ListMetricsOutput { + s.Metrics = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListMetricsOutput) SetNextToken(v string) *ListMetricsOutput { + s.NextToken = &v + return s +} + +// SetOwningAccounts sets the OwningAccounts field's value. +func (s *ListMetricsOutput) SetOwningAccounts(v []*string) *ListMetricsOutput { + s.OwningAccounts = v + return s +} + +type ListTagsForResourceInput struct { + _ struct{} `type:"structure"` + + // The ARN of the CloudWatch resource that you want to view tags for. + // + // The ARN format of an alarm is arn:aws:cloudwatch:Region:account-id:alarm:alarm-name + // + // The ARN format of a Contributor Insights rule is arn:aws:cloudwatch:Region:account-id:insight-rule/insight-rule-name + // + // For more information about ARN format, see Resource Types Defined by Amazon + // CloudWatch (https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatch.html#amazoncloudwatch-resources-for-iam-policies) + // in the Amazon Web Services General Reference. + // + // ResourceARN is a required field + ResourceARN *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsForResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsForResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListTagsForResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListTagsForResourceInput"} + if s.ResourceARN == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceARN")) + } + if s.ResourceARN != nil && len(*s.ResourceARN) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceARN", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceARN sets the ResourceARN field's value. +func (s *ListTagsForResourceInput) SetResourceARN(v string) *ListTagsForResourceInput { + s.ResourceARN = &v + return s +} + +type ListTagsForResourceOutput struct { + _ struct{} `type:"structure"` + + // The list of tag keys and values associated with the resource you specified. + Tags []*Tag `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsForResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsForResourceOutput) GoString() string { + return s.String() +} + +// SetTags sets the Tags field's value. +func (s *ListTagsForResourceOutput) SetTags(v []*Tag) *ListTagsForResourceOutput { + s.Tags = v + return s +} + +// A message returned by the GetMetricDataAPI, including a code and a description. +// +// If a cross-Region GetMetricData operation fails with a code of Forbidden +// and a value of Authentication too complex to retrieve cross region data, +// you can correct the problem by running the GetMetricData operation in the +// same Region where the metric data is. +type MessageData struct { + _ struct{} `type:"structure"` + + // The error code or status code associated with the message. + Code *string `type:"string"` + + // The message text. + Value *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MessageData) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MessageData) GoString() string { + return s.String() +} + +// SetCode sets the Code field's value. +func (s *MessageData) SetCode(v string) *MessageData { + s.Code = &v + return s +} + +// SetValue sets the Value field's value. +func (s *MessageData) SetValue(v string) *MessageData { + s.Value = &v + return s +} + +// Represents a specific metric. +type Metric struct { + _ struct{} `type:"structure"` + + // The dimensions for the metric. + Dimensions []*Dimension `type:"list"` + + // The name of the metric. This is a required field. + MetricName *string `min:"1" type:"string"` + + // The namespace of the metric. + Namespace *string `min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Metric) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Metric) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Metric) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Metric"} + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDimensions sets the Dimensions field's value. +func (s *Metric) SetDimensions(v []*Dimension) *Metric { + s.Dimensions = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *Metric) SetMetricName(v string) *Metric { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *Metric) SetNamespace(v string) *Metric { + s.Namespace = &v + return s +} + +// The details about a metric alarm. +type MetricAlarm struct { + _ struct{} `type:"structure"` + + // Indicates whether actions should be executed during any changes to the alarm + // state. + ActionsEnabled *bool `type:"boolean"` + + // The actions to execute when this alarm transitions to the ALARM state from + // any other state. Each action is specified as an Amazon Resource Name (ARN). + AlarmActions []*string `type:"list"` + + // The Amazon Resource Name (ARN) of the alarm. + AlarmArn *string `min:"1" type:"string"` + + // The time stamp of the last update to the alarm configuration. + AlarmConfigurationUpdatedTimestamp *time.Time `type:"timestamp"` + + // The description of the alarm. + AlarmDescription *string `type:"string"` + + // The name of the alarm. + AlarmName *string `min:"1" type:"string"` + + // The arithmetic operation to use when comparing the specified statistic and + // threshold. The specified statistic value is used as the first operand. + ComparisonOperator *string `type:"string" enum:"ComparisonOperator"` + + // The number of data points that must be breaching to trigger the alarm. + DatapointsToAlarm *int64 `min:"1" type:"integer"` + + // The dimensions for the metric associated with the alarm. + Dimensions []*Dimension `type:"list"` + + // Used only for alarms based on percentiles. If ignore, the alarm state does + // not change during periods with too few data points to be statistically significant. + // If evaluate or this parameter is not used, the alarm is always evaluated + // and possibly changes state no matter how many data points are available. + EvaluateLowSampleCountPercentile *string `min:"1" type:"string"` + + // The number of periods over which data is compared to the specified threshold. + EvaluationPeriods *int64 `min:"1" type:"integer"` + + // The percentile statistic for the metric associated with the alarm. Specify + // a value between p0.0 and p100. + ExtendedStatistic *string `type:"string"` + + // The actions to execute when this alarm transitions to the INSUFFICIENT_DATA + // state from any other state. Each action is specified as an Amazon Resource + // Name (ARN). + InsufficientDataActions []*string `type:"list"` + + // The name of the metric associated with the alarm, if this is an alarm based + // on a single metric. + MetricName *string `min:"1" type:"string"` + + // An array of MetricDataQuery structures, used in an alarm based on a metric + // math expression. Each structure either retrieves a metric or performs a math + // expression. One item in the Metrics array is the math expression that the + // alarm watches. This expression by designated by having ReturnData set to + // true. + Metrics []*MetricDataQuery `type:"list"` + + // The namespace of the metric associated with the alarm. + Namespace *string `min:"1" type:"string"` + + // The actions to execute when this alarm transitions to the OK state from any + // other state. Each action is specified as an Amazon Resource Name (ARN). + OKActions []*string `type:"list"` + + // The period, in seconds, over which the statistic is applied. + Period *int64 `min:"1" type:"integer"` + + // An explanation for the alarm state, in text format. + StateReason *string `type:"string"` + + // An explanation for the alarm state, in JSON format. + StateReasonData *string `type:"string"` + + // The date and time that the alarm's StateValue most recently changed. + StateTransitionedTimestamp *time.Time `type:"timestamp"` + + // The time stamp of the last update to the value of either the StateValue or + // EvaluationState parameters. + StateUpdatedTimestamp *time.Time `type:"timestamp"` + + // The state value for the alarm. + StateValue *string `type:"string" enum:"StateValue"` + + // The statistic for the metric associated with the alarm, other than percentile. + // For percentile statistics, use ExtendedStatistic. + Statistic *string `type:"string" enum:"Statistic"` + + // The value to compare with the specified statistic. + Threshold *float64 `type:"double"` + + // In an alarm based on an anomaly detection model, this is the ID of the ANOMALY_DETECTION_BAND + // function used as the threshold for the alarm. + ThresholdMetricId *string `min:"1" type:"string"` + + // Sets how this alarm is to handle missing data points. The valid values are + // breaching, notBreaching, ignore, and missing. For more information, see Configuring + // how CloudWatch alarms treat missing data (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data). + // + // If this parameter is omitted, the default behavior of missing is used. + TreatMissingData *string `min:"1" type:"string"` + + // The unit of the metric associated with the alarm. + Unit *string `type:"string" enum:"StandardUnit"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricAlarm) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricAlarm) GoString() string { + return s.String() +} + +// SetActionsEnabled sets the ActionsEnabled field's value. +func (s *MetricAlarm) SetActionsEnabled(v bool) *MetricAlarm { + s.ActionsEnabled = &v + return s +} + +// SetAlarmActions sets the AlarmActions field's value. +func (s *MetricAlarm) SetAlarmActions(v []*string) *MetricAlarm { + s.AlarmActions = v + return s +} + +// SetAlarmArn sets the AlarmArn field's value. +func (s *MetricAlarm) SetAlarmArn(v string) *MetricAlarm { + s.AlarmArn = &v + return s +} + +// SetAlarmConfigurationUpdatedTimestamp sets the AlarmConfigurationUpdatedTimestamp field's value. +func (s *MetricAlarm) SetAlarmConfigurationUpdatedTimestamp(v time.Time) *MetricAlarm { + s.AlarmConfigurationUpdatedTimestamp = &v + return s +} + +// SetAlarmDescription sets the AlarmDescription field's value. +func (s *MetricAlarm) SetAlarmDescription(v string) *MetricAlarm { + s.AlarmDescription = &v + return s +} + +// SetAlarmName sets the AlarmName field's value. +func (s *MetricAlarm) SetAlarmName(v string) *MetricAlarm { + s.AlarmName = &v + return s +} + +// SetComparisonOperator sets the ComparisonOperator field's value. +func (s *MetricAlarm) SetComparisonOperator(v string) *MetricAlarm { + s.ComparisonOperator = &v + return s +} + +// SetDatapointsToAlarm sets the DatapointsToAlarm field's value. +func (s *MetricAlarm) SetDatapointsToAlarm(v int64) *MetricAlarm { + s.DatapointsToAlarm = &v + return s +} + +// SetDimensions sets the Dimensions field's value. +func (s *MetricAlarm) SetDimensions(v []*Dimension) *MetricAlarm { + s.Dimensions = v + return s +} + +// SetEvaluateLowSampleCountPercentile sets the EvaluateLowSampleCountPercentile field's value. +func (s *MetricAlarm) SetEvaluateLowSampleCountPercentile(v string) *MetricAlarm { + s.EvaluateLowSampleCountPercentile = &v + return s +} + +// SetEvaluationPeriods sets the EvaluationPeriods field's value. +func (s *MetricAlarm) SetEvaluationPeriods(v int64) *MetricAlarm { + s.EvaluationPeriods = &v + return s +} + +// SetExtendedStatistic sets the ExtendedStatistic field's value. +func (s *MetricAlarm) SetExtendedStatistic(v string) *MetricAlarm { + s.ExtendedStatistic = &v + return s +} + +// SetInsufficientDataActions sets the InsufficientDataActions field's value. +func (s *MetricAlarm) SetInsufficientDataActions(v []*string) *MetricAlarm { + s.InsufficientDataActions = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *MetricAlarm) SetMetricName(v string) *MetricAlarm { + s.MetricName = &v + return s +} + +// SetMetrics sets the Metrics field's value. +func (s *MetricAlarm) SetMetrics(v []*MetricDataQuery) *MetricAlarm { + s.Metrics = v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *MetricAlarm) SetNamespace(v string) *MetricAlarm { + s.Namespace = &v + return s +} + +// SetOKActions sets the OKActions field's value. +func (s *MetricAlarm) SetOKActions(v []*string) *MetricAlarm { + s.OKActions = v + return s +} + +// SetPeriod sets the Period field's value. +func (s *MetricAlarm) SetPeriod(v int64) *MetricAlarm { + s.Period = &v + return s +} + +// SetStateReason sets the StateReason field's value. +func (s *MetricAlarm) SetStateReason(v string) *MetricAlarm { + s.StateReason = &v + return s +} + +// SetStateReasonData sets the StateReasonData field's value. +func (s *MetricAlarm) SetStateReasonData(v string) *MetricAlarm { + s.StateReasonData = &v + return s +} + +// SetStateTransitionedTimestamp sets the StateTransitionedTimestamp field's value. +func (s *MetricAlarm) SetStateTransitionedTimestamp(v time.Time) *MetricAlarm { + s.StateTransitionedTimestamp = &v + return s +} + +// SetStateUpdatedTimestamp sets the StateUpdatedTimestamp field's value. +func (s *MetricAlarm) SetStateUpdatedTimestamp(v time.Time) *MetricAlarm { + s.StateUpdatedTimestamp = &v + return s +} + +// SetStateValue sets the StateValue field's value. +func (s *MetricAlarm) SetStateValue(v string) *MetricAlarm { + s.StateValue = &v + return s +} + +// SetStatistic sets the Statistic field's value. +func (s *MetricAlarm) SetStatistic(v string) *MetricAlarm { + s.Statistic = &v + return s +} + +// SetThreshold sets the Threshold field's value. +func (s *MetricAlarm) SetThreshold(v float64) *MetricAlarm { + s.Threshold = &v + return s +} + +// SetThresholdMetricId sets the ThresholdMetricId field's value. +func (s *MetricAlarm) SetThresholdMetricId(v string) *MetricAlarm { + s.ThresholdMetricId = &v + return s +} + +// SetTreatMissingData sets the TreatMissingData field's value. +func (s *MetricAlarm) SetTreatMissingData(v string) *MetricAlarm { + s.TreatMissingData = &v + return s +} + +// SetUnit sets the Unit field's value. +func (s *MetricAlarm) SetUnit(v string) *MetricAlarm { + s.Unit = &v + return s +} + +// This object includes parameters that you can use to provide information to +// CloudWatch to help it build more accurate anomaly detection models. +type MetricCharacteristics struct { + _ struct{} `type:"structure"` + + // Set this parameter to true if values for this metric consistently include + // spikes that should not be considered to be anomalies. With this set to true, + // CloudWatch will expect to see spikes that occurred consistently during the + // model training period, and won't flag future similar spikes as anomalies. + PeriodicSpikes *bool `type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricCharacteristics) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricCharacteristics) GoString() string { + return s.String() +} + +// SetPeriodicSpikes sets the PeriodicSpikes field's value. +func (s *MetricCharacteristics) SetPeriodicSpikes(v bool) *MetricCharacteristics { + s.PeriodicSpikes = &v + return s +} + +// This structure is used in both GetMetricData and PutMetricAlarm. The supported +// use of this structure is different for those two operations. +// +// When used in GetMetricData, it indicates the metric data to return, and whether +// this call is just retrieving a batch set of data for one metric, or is performing +// a Metrics Insights query or a math expression. A single GetMetricData call +// can include up to 500 MetricDataQuery structures. +// +// When used in PutMetricAlarm, it enables you to create an alarm based on a +// metric math expression. Each MetricDataQuery in the array specifies either +// a metric to retrieve, or a math expression to be performed on retrieved metrics. +// A single PutMetricAlarm call can include up to 20 MetricDataQuery structures +// in the array. The 20 structures can include as many as 10 structures that +// contain a MetricStat parameter to retrieve a metric, and as many as 10 structures +// that contain the Expression parameter to perform a math expression. Of those +// Expression structures, one must have true as the value for ReturnData. The +// result of this expression is the value the alarm watches. +// +// Any expression used in a PutMetricAlarm operation must return a single time +// series. For more information, see Metric Math Syntax and Functions (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html#metric-math-syntax) +// in the Amazon CloudWatch User Guide. +// +// Some of the parameters of this structure also have different uses whether +// you are using this structure in a GetMetricData operation or a PutMetricAlarm +// operation. These differences are explained in the following parameter list. +type MetricDataQuery struct { + _ struct{} `type:"structure"` + + // The ID of the account where the metrics are located. + // + // If you are performing a GetMetricData operation in a monitoring account, + // use this to specify which account to retrieve this metric from. + // + // If you are performing a PutMetricAlarm operation, use this to specify which + // account contains the metric that the alarm is watching. + AccountId *string `min:"1" type:"string"` + + // This field can contain either a Metrics Insights query, or a metric math + // expression to be performed on the returned data. For more information about + // Metrics Insights queries, see Metrics Insights query components and syntax + // (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch-metrics-insights-querylanguage) + // in the Amazon CloudWatch User Guide. + // + // A math expression can use the Id of the other metrics or queries to refer + // to those metrics, and can also use the Id of other expressions to use the + // result of those expressions. For more information about metric math expressions, + // see Metric Math Syntax and Functions (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html#metric-math-syntax) + // in the Amazon CloudWatch User Guide. + // + // Within each MetricDataQuery object, you must specify either Expression or + // MetricStat but not both. + Expression *string `min:"1" type:"string"` + + // A short name used to tie this object to the results in the response. This + // name must be unique within a single call to GetMetricData. If you are performing + // math expressions on this set of data, this name represents that data and + // can serve as a variable in the mathematical expression. The valid characters + // are letters, numbers, and underscore. The first character must be a lowercase + // letter. + // + // Id is a required field + Id *string `min:"1" type:"string" required:"true"` + + // A human-readable label for this metric or expression. This is especially + // useful if this is an expression, so that you know what the value represents. + // If the metric or expression is shown in a CloudWatch dashboard widget, the + // label is shown. If Label is omitted, CloudWatch generates a default. + // + // You can put dynamic expressions into a label, so that it is more descriptive. + // For more information, see Using Dynamic Labels (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html). + Label *string `type:"string"` + + // The metric to be returned, along with statistics, period, and units. Use + // this parameter only if this object is retrieving a metric and not performing + // a math expression on returned data. + // + // Within one MetricDataQuery object, you must specify either Expression or + // MetricStat but not both. + MetricStat *MetricStat `type:"structure"` + + // The granularity, in seconds, of the returned data points. For metrics with + // regular resolution, a period can be as short as one minute (60 seconds) and + // must be a multiple of 60. For high-resolution metrics that are collected + // at intervals of less than one minute, the period can be 1, 5, 10, 30, 60, + // or any multiple of 60. High-resolution metrics are those metrics stored by + // a PutMetricData operation that includes a StorageResolution of 1 second. + Period *int64 `min:"1" type:"integer"` + + // When used in GetMetricData, this option indicates whether to return the timestamps + // and raw data values of this metric. If you are performing this call just + // to do math expressions and do not also need the raw data returned, you can + // specify false. If you omit this, the default of true is used. + // + // When used in PutMetricAlarm, specify true for the one expression result to + // use as the alarm. For all other metrics and expressions in the same PutMetricAlarm + // operation, specify ReturnData as False. + ReturnData *bool `type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricDataQuery) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricDataQuery) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricDataQuery) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MetricDataQuery"} + if s.AccountId != nil && len(*s.AccountId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AccountId", 1)) + } + if s.Expression != nil && len(*s.Expression) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Expression", 1)) + } + if s.Id == nil { + invalidParams.Add(request.NewErrParamRequired("Id")) + } + if s.Id != nil && len(*s.Id) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Id", 1)) + } + if s.Period != nil && *s.Period < 1 { + invalidParams.Add(request.NewErrParamMinValue("Period", 1)) + } + if s.MetricStat != nil { + if err := s.MetricStat.Validate(); err != nil { + invalidParams.AddNested("MetricStat", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAccountId sets the AccountId field's value. +func (s *MetricDataQuery) SetAccountId(v string) *MetricDataQuery { + s.AccountId = &v + return s +} + +// SetExpression sets the Expression field's value. +func (s *MetricDataQuery) SetExpression(v string) *MetricDataQuery { + s.Expression = &v + return s +} + +// SetId sets the Id field's value. +func (s *MetricDataQuery) SetId(v string) *MetricDataQuery { + s.Id = &v + return s +} + +// SetLabel sets the Label field's value. +func (s *MetricDataQuery) SetLabel(v string) *MetricDataQuery { + s.Label = &v + return s +} + +// SetMetricStat sets the MetricStat field's value. +func (s *MetricDataQuery) SetMetricStat(v *MetricStat) *MetricDataQuery { + s.MetricStat = v + return s +} + +// SetPeriod sets the Period field's value. +func (s *MetricDataQuery) SetPeriod(v int64) *MetricDataQuery { + s.Period = &v + return s +} + +// SetReturnData sets the ReturnData field's value. +func (s *MetricDataQuery) SetReturnData(v bool) *MetricDataQuery { + s.ReturnData = &v + return s +} + +// A GetMetricData call returns an array of MetricDataResult structures. Each +// of these structures includes the data points for that metric, along with +// the timestamps of those data points and other identifying information. +type MetricDataResult struct { + _ struct{} `type:"structure"` + + // The short name you specified to represent this metric. + Id *string `min:"1" type:"string"` + + // The human-readable label associated with the data. + Label *string `type:"string"` + + // A list of messages with additional information about the data returned. + Messages []*MessageData `type:"list"` + + // The status of the returned data. Complete indicates that all data points + // in the requested time range were returned. PartialData means that an incomplete + // set of data points were returned. You can use the NextToken value that was + // returned and repeat your request to get more data points. NextToken is not + // returned if you are performing a math expression. InternalError indicates + // that an error occurred. Retry your request using NextToken, if present. + StatusCode *string `type:"string" enum:"StatusCode"` + + // The timestamps for the data points, formatted in Unix timestamp format. The + // number of timestamps always matches the number of values and the value for + // Timestamps[x] is Values[x]. + Timestamps []*time.Time `type:"list"` + + // The data points for the metric corresponding to Timestamps. The number of + // values always matches the number of timestamps and the timestamp for Values[x] + // is Timestamps[x]. + Values []*float64 `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricDataResult) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricDataResult) GoString() string { + return s.String() +} + +// SetId sets the Id field's value. +func (s *MetricDataResult) SetId(v string) *MetricDataResult { + s.Id = &v + return s +} + +// SetLabel sets the Label field's value. +func (s *MetricDataResult) SetLabel(v string) *MetricDataResult { + s.Label = &v + return s +} + +// SetMessages sets the Messages field's value. +func (s *MetricDataResult) SetMessages(v []*MessageData) *MetricDataResult { + s.Messages = v + return s +} + +// SetStatusCode sets the StatusCode field's value. +func (s *MetricDataResult) SetStatusCode(v string) *MetricDataResult { + s.StatusCode = &v + return s +} + +// SetTimestamps sets the Timestamps field's value. +func (s *MetricDataResult) SetTimestamps(v []*time.Time) *MetricDataResult { + s.Timestamps = v + return s +} + +// SetValues sets the Values field's value. +func (s *MetricDataResult) SetValues(v []*float64) *MetricDataResult { + s.Values = v + return s +} + +// Encapsulates the information sent to either create a metric or add new values +// to be aggregated into an existing metric. +type MetricDatum struct { + _ struct{} `type:"structure"` + + // Array of numbers that is used along with the Values array. Each number in + // the Count array is the number of times the corresponding value in the Values + // array occurred during the period. + // + // If you omit the Counts array, the default of 1 is used as the value for each + // count. If you include a Counts array, it must include the same amount of + // values as the Values array. + Counts []*float64 `type:"list"` + + // The dimensions associated with the metric. + Dimensions []*Dimension `type:"list"` + + // The name of the metric. + // + // MetricName is a required field + MetricName *string `min:"1" type:"string" required:"true"` + + // The statistical values for the metric. + StatisticValues *StatisticSet `type:"structure"` + + // Valid values are 1 and 60. Setting this to 1 specifies this metric as a high-resolution + // metric, so that CloudWatch stores the metric with sub-minute resolution down + // to one second. Setting this to 60 specifies this metric as a regular-resolution + // metric, which CloudWatch stores at 1-minute resolution. Currently, high resolution + // is available only for custom metrics. For more information about high-resolution + // metrics, see High-Resolution Metrics (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html#high-resolution-metrics) + // in the Amazon CloudWatch User Guide. + // + // This field is optional, if you do not specify it the default of 60 is used. + StorageResolution *int64 `min:"1" type:"integer"` + + // The time the metric data was received, expressed as the number of milliseconds + // since Jan 1, 1970 00:00:00 UTC. + Timestamp *time.Time `type:"timestamp"` + + // When you are using a Put operation, this defines what unit you want to use + // when storing the metric. + // + // In a Get operation, this displays the unit that is used for the metric. + Unit *string `type:"string" enum:"StandardUnit"` + + // The value for the metric. + // + // Although the parameter accepts numbers of type Double, CloudWatch rejects + // values that are either too small or too large. Values must be in the range + // of -2^360 to 2^360. In addition, special values (for example, NaN, +Infinity, + // -Infinity) are not supported. + Value *float64 `type:"double"` + + // Array of numbers representing the values for the metric during the period. + // Each unique value is listed just once in this array, and the corresponding + // number in the Counts array specifies the number of times that value occurred + // during the period. You can include up to 150 unique values in each PutMetricData + // action that specifies a Values array. + // + // Although the Values array accepts numbers of type Double, CloudWatch rejects + // values that are either too small or too large. Values must be in the range + // of -2^360 to 2^360. In addition, special values (for example, NaN, +Infinity, + // -Infinity) are not supported. + Values []*float64 `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricDatum) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricDatum) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricDatum) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MetricDatum"} + if s.MetricName == nil { + invalidParams.Add(request.NewErrParamRequired("MetricName")) + } + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.StorageResolution != nil && *s.StorageResolution < 1 { + invalidParams.Add(request.NewErrParamMinValue("StorageResolution", 1)) + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + if s.StatisticValues != nil { + if err := s.StatisticValues.Validate(); err != nil { + invalidParams.AddNested("StatisticValues", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetCounts sets the Counts field's value. +func (s *MetricDatum) SetCounts(v []*float64) *MetricDatum { + s.Counts = v + return s +} + +// SetDimensions sets the Dimensions field's value. +func (s *MetricDatum) SetDimensions(v []*Dimension) *MetricDatum { + s.Dimensions = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *MetricDatum) SetMetricName(v string) *MetricDatum { + s.MetricName = &v + return s +} + +// SetStatisticValues sets the StatisticValues field's value. +func (s *MetricDatum) SetStatisticValues(v *StatisticSet) *MetricDatum { + s.StatisticValues = v + return s +} + +// SetStorageResolution sets the StorageResolution field's value. +func (s *MetricDatum) SetStorageResolution(v int64) *MetricDatum { + s.StorageResolution = &v + return s +} + +// SetTimestamp sets the Timestamp field's value. +func (s *MetricDatum) SetTimestamp(v time.Time) *MetricDatum { + s.Timestamp = &v + return s +} + +// SetUnit sets the Unit field's value. +func (s *MetricDatum) SetUnit(v string) *MetricDatum { + s.Unit = &v + return s +} + +// SetValue sets the Value field's value. +func (s *MetricDatum) SetValue(v float64) *MetricDatum { + s.Value = &v + return s +} + +// SetValues sets the Values field's value. +func (s *MetricDatum) SetValues(v []*float64) *MetricDatum { + s.Values = v + return s +} + +// Indicates the CloudWatch math expression that provides the time series the +// anomaly detector uses as input. The designated math expression must return +// a single time series. +type MetricMathAnomalyDetector struct { + _ struct{} `type:"structure"` + + // An array of metric data query structures that enables you to create an anomaly + // detector based on the result of a metric math expression. Each item in MetricDataQueries + // gets a metric or performs a math expression. One item in MetricDataQueries + // is the expression that provides the time series that the anomaly detector + // uses as input. Designate the expression by setting ReturnData to true for + // this object in the array. For all other expressions and metrics, set ReturnData + // to false. The designated expression must return a single time series. + MetricDataQueries []*MetricDataQuery `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricMathAnomalyDetector) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricMathAnomalyDetector) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricMathAnomalyDetector) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MetricMathAnomalyDetector"} + if s.MetricDataQueries != nil { + for i, v := range s.MetricDataQueries { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricDataQueries", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMetricDataQueries sets the MetricDataQueries field's value. +func (s *MetricMathAnomalyDetector) SetMetricDataQueries(v []*MetricDataQuery) *MetricMathAnomalyDetector { + s.MetricDataQueries = v + return s +} + +// This structure defines the metric to be returned, along with the statistics, +// period, and units. +type MetricStat struct { + _ struct{} `type:"structure"` + + // The metric to return, including the metric name, namespace, and dimensions. + // + // Metric is a required field + Metric *Metric `type:"structure" required:"true"` + + // The granularity, in seconds, of the returned data points. For metrics with + // regular resolution, a period can be as short as one minute (60 seconds) and + // must be a multiple of 60. For high-resolution metrics that are collected + // at intervals of less than one minute, the period can be 1, 5, 10, 30, 60, + // or any multiple of 60. High-resolution metrics are those metrics stored by + // a PutMetricData call that includes a StorageResolution of 1 second. + // + // If the StartTime parameter specifies a time stamp that is greater than 3 + // hours ago, you must specify the period as follows or no data points in that + // time range is returned: + // + // * Start time between 3 hours and 15 days ago - Use a multiple of 60 seconds + // (1 minute). + // + // * Start time between 15 and 63 days ago - Use a multiple of 300 seconds + // (5 minutes). + // + // * Start time greater than 63 days ago - Use a multiple of 3600 seconds + // (1 hour). + // + // Period is a required field + Period *int64 `min:"1" type:"integer" required:"true"` + + // The statistic to return. It can include any CloudWatch statistic or extended + // statistic. + // + // Stat is a required field + Stat *string `type:"string" required:"true"` + + // When you are using a Put operation, this defines what unit you want to use + // when storing the metric. + // + // In a Get operation, if you omit Unit then all data that was collected with + // any unit is returned, along with the corresponding units that were specified + // when the data was reported to CloudWatch. If you specify a unit, the operation + // returns only data that was collected with that unit specified. If you specify + // a unit that does not match the data collected, the results of the operation + // are null. CloudWatch does not perform unit conversions. + Unit *string `type:"string" enum:"StandardUnit"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricStat) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricStat) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricStat) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MetricStat"} + if s.Metric == nil { + invalidParams.Add(request.NewErrParamRequired("Metric")) + } + if s.Period == nil { + invalidParams.Add(request.NewErrParamRequired("Period")) + } + if s.Period != nil && *s.Period < 1 { + invalidParams.Add(request.NewErrParamMinValue("Period", 1)) + } + if s.Stat == nil { + invalidParams.Add(request.NewErrParamRequired("Stat")) + } + if s.Metric != nil { + if err := s.Metric.Validate(); err != nil { + invalidParams.AddNested("Metric", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMetric sets the Metric field's value. +func (s *MetricStat) SetMetric(v *Metric) *MetricStat { + s.Metric = v + return s +} + +// SetPeriod sets the Period field's value. +func (s *MetricStat) SetPeriod(v int64) *MetricStat { + s.Period = &v + return s +} + +// SetStat sets the Stat field's value. +func (s *MetricStat) SetStat(v string) *MetricStat { + s.Stat = &v + return s +} + +// SetUnit sets the Unit field's value. +func (s *MetricStat) SetUnit(v string) *MetricStat { + s.Unit = &v + return s +} + +// This structure contains the configuration information about one metric stream. +type MetricStreamEntry struct { + _ struct{} `type:"structure"` + + // The ARN of the metric stream. + Arn *string `min:"1" type:"string"` + + // The date that the metric stream was originally created. + CreationDate *time.Time `type:"timestamp"` + + // The ARN of the Kinesis Firehose devlivery stream that is used for this metric + // stream. + FirehoseArn *string `min:"1" type:"string"` + + // The date that the configuration of this metric stream was most recently updated. + LastUpdateDate *time.Time `type:"timestamp"` + + // The name of the metric stream. + Name *string `min:"1" type:"string"` + + // The output format of this metric stream. Valid values are json, opentelemetry1.0, + // and opentelemetry0.7. + OutputFormat *string `min:"1" type:"string"` + + // The current state of this stream. Valid values are running and stopped. + State *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricStreamEntry) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricStreamEntry) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *MetricStreamEntry) SetArn(v string) *MetricStreamEntry { + s.Arn = &v + return s +} + +// SetCreationDate sets the CreationDate field's value. +func (s *MetricStreamEntry) SetCreationDate(v time.Time) *MetricStreamEntry { + s.CreationDate = &v + return s +} + +// SetFirehoseArn sets the FirehoseArn field's value. +func (s *MetricStreamEntry) SetFirehoseArn(v string) *MetricStreamEntry { + s.FirehoseArn = &v + return s +} + +// SetLastUpdateDate sets the LastUpdateDate field's value. +func (s *MetricStreamEntry) SetLastUpdateDate(v time.Time) *MetricStreamEntry { + s.LastUpdateDate = &v + return s +} + +// SetName sets the Name field's value. +func (s *MetricStreamEntry) SetName(v string) *MetricStreamEntry { + s.Name = &v + return s +} + +// SetOutputFormat sets the OutputFormat field's value. +func (s *MetricStreamEntry) SetOutputFormat(v string) *MetricStreamEntry { + s.OutputFormat = &v + return s +} + +// SetState sets the State field's value. +func (s *MetricStreamEntry) SetState(v string) *MetricStreamEntry { + s.State = &v + return s +} + +// This structure contains a metric namespace and optionally, a list of metric +// names, to either include in a metric stream or exclude from a metric stream. +// +// A metric stream's filters can include up to 1000 total names. This limit +// applies to the sum of namespace names and metric names in the filters. For +// example, this could include 10 metric namespace filters with 99 metrics each, +// or 20 namespace filters with 49 metrics specified in each filter. +type MetricStreamFilter struct { + _ struct{} `type:"structure"` + + // The names of the metrics to either include or exclude from the metric stream. + // + // If you omit this parameter, all metrics in the namespace are included or + // excluded, depending on whether this filter is specified as an exclude filter + // or an include filter. + // + // Each metric name can contain only ASCII printable characters (ASCII range + // 32 through 126). Each metric name must contain at least one non-whitespace + // character. + MetricNames []*string `type:"list"` + + // The name of the metric namespace for this filter. + // + // The namespace can contain only ASCII printable characters (ASCII range 32 + // through 126). It must contain at least one non-whitespace character. + Namespace *string `min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricStreamFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricStreamFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricStreamFilter) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MetricStreamFilter"} + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMetricNames sets the MetricNames field's value. +func (s *MetricStreamFilter) SetMetricNames(v []*string) *MetricStreamFilter { + s.MetricNames = v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *MetricStreamFilter) SetNamespace(v string) *MetricStreamFilter { + s.Namespace = &v + return s +} + +// By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT +// statistics for each metric that is streamed. This structure contains information +// for one metric that includes additional statistics in the stream. For more +// information about statistics, see CloudWatch, listed in CloudWatch statistics +// definitions (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html.html). +type MetricStreamStatisticsConfiguration struct { + _ struct{} `type:"structure"` + + // The list of additional statistics that are to be streamed for the metrics + // listed in the IncludeMetrics array in this structure. This list can include + // as many as 20 statistics. + // + // If the OutputFormat for the stream is opentelemetry1.0 or opentelemetry0.7, + // the only valid values are p?? percentile statistics such as p90, p99 and + // so on. + // + // If the OutputFormat for the stream is json, the valid values include the + // abbreviations for all of the statistics listed in CloudWatch statistics definitions + // (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html.html). + // For example, this includes tm98, wm90, PR(:300), and so on. + // + // AdditionalStatistics is a required field + AdditionalStatistics []*string `type:"list" required:"true"` + + // An array of metric name and namespace pairs that stream the additional statistics + // listed in the value of the AdditionalStatistics parameter. There can be as + // many as 100 pairs in the array. + // + // All metrics that match the combination of metric name and namespace will + // be streamed with the additional statistics, no matter their dimensions. + // + // IncludeMetrics is a required field + IncludeMetrics []*MetricStreamStatisticsMetric `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricStreamStatisticsConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricStreamStatisticsConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricStreamStatisticsConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MetricStreamStatisticsConfiguration"} + if s.AdditionalStatistics == nil { + invalidParams.Add(request.NewErrParamRequired("AdditionalStatistics")) + } + if s.IncludeMetrics == nil { + invalidParams.Add(request.NewErrParamRequired("IncludeMetrics")) + } + if s.IncludeMetrics != nil { + for i, v := range s.IncludeMetrics { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "IncludeMetrics", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAdditionalStatistics sets the AdditionalStatistics field's value. +func (s *MetricStreamStatisticsConfiguration) SetAdditionalStatistics(v []*string) *MetricStreamStatisticsConfiguration { + s.AdditionalStatistics = v + return s +} + +// SetIncludeMetrics sets the IncludeMetrics field's value. +func (s *MetricStreamStatisticsConfiguration) SetIncludeMetrics(v []*MetricStreamStatisticsMetric) *MetricStreamStatisticsConfiguration { + s.IncludeMetrics = v + return s +} + +// This object contains the information for one metric that is to be streamed +// with additional statistics. +type MetricStreamStatisticsMetric struct { + _ struct{} `type:"structure"` + + // The name of the metric. + // + // MetricName is a required field + MetricName *string `min:"1" type:"string" required:"true"` + + // The namespace of the metric. + // + // Namespace is a required field + Namespace *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricStreamStatisticsMetric) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricStreamStatisticsMetric) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricStreamStatisticsMetric) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MetricStreamStatisticsMetric"} + if s.MetricName == nil { + invalidParams.Add(request.NewErrParamRequired("MetricName")) + } + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace == nil { + invalidParams.Add(request.NewErrParamRequired("Namespace")) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMetricName sets the MetricName field's value. +func (s *MetricStreamStatisticsMetric) SetMetricName(v string) *MetricStreamStatisticsMetric { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *MetricStreamStatisticsMetric) SetNamespace(v string) *MetricStreamStatisticsMetric { + s.Namespace = &v + return s +} + +// This array is empty if the API operation was successful for all the rules +// specified in the request. If the operation could not process one of the rules, +// the following data is returned for each of those rules. +type PartialFailure struct { + _ struct{} `type:"structure"` + + // The type of error. + ExceptionType *string `type:"string"` + + // The code of the error. + FailureCode *string `type:"string"` + + // A description of the error. + FailureDescription *string `type:"string"` + + // The specified rule that could not be deleted. + FailureResource *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PartialFailure) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PartialFailure) GoString() string { + return s.String() +} + +// SetExceptionType sets the ExceptionType field's value. +func (s *PartialFailure) SetExceptionType(v string) *PartialFailure { + s.ExceptionType = &v + return s +} + +// SetFailureCode sets the FailureCode field's value. +func (s *PartialFailure) SetFailureCode(v string) *PartialFailure { + s.FailureCode = &v + return s +} + +// SetFailureDescription sets the FailureDescription field's value. +func (s *PartialFailure) SetFailureDescription(v string) *PartialFailure { + s.FailureDescription = &v + return s +} + +// SetFailureResource sets the FailureResource field's value. +func (s *PartialFailure) SetFailureResource(v string) *PartialFailure { + s.FailureResource = &v + return s +} + +type PutAnomalyDetectorInput struct { + _ struct{} `type:"structure"` + + // The configuration specifies details about how the anomaly detection model + // is to be trained, including time ranges to exclude when training and updating + // the model. You can specify as many as 10 time ranges. + // + // The configuration can also include the time zone to use for the metric. + Configuration *AnomalyDetectorConfiguration `type:"structure"` + + // The metric dimensions to create the anomaly detection model for. + // + // Deprecated: Use SingleMetricAnomalyDetector. + Dimensions []*Dimension `deprecated:"true" type:"list"` + + // Use this object to include parameters to provide information about your metric + // to CloudWatch to help it build more accurate anomaly detection models. Currently, + // it includes the PeriodicSpikes parameter. + MetricCharacteristics *MetricCharacteristics `type:"structure"` + + // The metric math anomaly detector to be created. + // + // When using MetricMathAnomalyDetector, you cannot include the following parameters + // in the same operation: + // + // * Dimensions + // + // * MetricName + // + // * Namespace + // + // * Stat + // + // * the SingleMetricAnomalyDetector parameters of PutAnomalyDetectorInput + // + // Instead, specify the metric math anomaly detector attributes as part of the + // property MetricMathAnomalyDetector. + MetricMathAnomalyDetector *MetricMathAnomalyDetector `type:"structure"` + + // The name of the metric to create the anomaly detection model for. + // + // Deprecated: Use SingleMetricAnomalyDetector. + MetricName *string `min:"1" deprecated:"true" type:"string"` + + // The namespace of the metric to create the anomaly detection model for. + // + // Deprecated: Use SingleMetricAnomalyDetector. + Namespace *string `min:"1" deprecated:"true" type:"string"` + + // A single metric anomaly detector to be created. + // + // When using SingleMetricAnomalyDetector, you cannot include the following + // parameters in the same operation: + // + // * Dimensions + // + // * MetricName + // + // * Namespace + // + // * Stat + // + // * the MetricMathAnomalyDetector parameters of PutAnomalyDetectorInput + // + // Instead, specify the single metric anomaly detector attributes as part of + // the property SingleMetricAnomalyDetector. + SingleMetricAnomalyDetector *SingleMetricAnomalyDetector `type:"structure"` + + // The statistic to use for the metric and the anomaly detection model. + // + // Deprecated: Use SingleMetricAnomalyDetector. + Stat *string `deprecated:"true" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutAnomalyDetectorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutAnomalyDetectorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutAnomalyDetectorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutAnomalyDetectorInput"} + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.Configuration != nil { + if err := s.Configuration.Validate(); err != nil { + invalidParams.AddNested("Configuration", err.(request.ErrInvalidParams)) + } + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + if s.MetricMathAnomalyDetector != nil { + if err := s.MetricMathAnomalyDetector.Validate(); err != nil { + invalidParams.AddNested("MetricMathAnomalyDetector", err.(request.ErrInvalidParams)) + } + } + if s.SingleMetricAnomalyDetector != nil { + if err := s.SingleMetricAnomalyDetector.Validate(); err != nil { + invalidParams.AddNested("SingleMetricAnomalyDetector", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetConfiguration sets the Configuration field's value. +func (s *PutAnomalyDetectorInput) SetConfiguration(v *AnomalyDetectorConfiguration) *PutAnomalyDetectorInput { + s.Configuration = v + return s +} + +// SetDimensions sets the Dimensions field's value. +func (s *PutAnomalyDetectorInput) SetDimensions(v []*Dimension) *PutAnomalyDetectorInput { + s.Dimensions = v + return s +} + +// SetMetricCharacteristics sets the MetricCharacteristics field's value. +func (s *PutAnomalyDetectorInput) SetMetricCharacteristics(v *MetricCharacteristics) *PutAnomalyDetectorInput { + s.MetricCharacteristics = v + return s +} + +// SetMetricMathAnomalyDetector sets the MetricMathAnomalyDetector field's value. +func (s *PutAnomalyDetectorInput) SetMetricMathAnomalyDetector(v *MetricMathAnomalyDetector) *PutAnomalyDetectorInput { + s.MetricMathAnomalyDetector = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *PutAnomalyDetectorInput) SetMetricName(v string) *PutAnomalyDetectorInput { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *PutAnomalyDetectorInput) SetNamespace(v string) *PutAnomalyDetectorInput { + s.Namespace = &v + return s +} + +// SetSingleMetricAnomalyDetector sets the SingleMetricAnomalyDetector field's value. +func (s *PutAnomalyDetectorInput) SetSingleMetricAnomalyDetector(v *SingleMetricAnomalyDetector) *PutAnomalyDetectorInput { + s.SingleMetricAnomalyDetector = v + return s +} + +// SetStat sets the Stat field's value. +func (s *PutAnomalyDetectorInput) SetStat(v string) *PutAnomalyDetectorInput { + s.Stat = &v + return s +} + +type PutAnomalyDetectorOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutAnomalyDetectorOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutAnomalyDetectorOutput) GoString() string { + return s.String() +} + +type PutCompositeAlarmInput struct { + _ struct{} `type:"structure"` + + // Indicates whether actions should be executed during any changes to the alarm + // state of the composite alarm. The default is TRUE. + ActionsEnabled *bool `type:"boolean"` + + // Actions will be suppressed if the suppressor alarm is in the ALARM state. + // ActionsSuppressor can be an AlarmName or an Amazon Resource Name (ARN) from + // an existing alarm. + ActionsSuppressor *string `min:"1" type:"string"` + + // The maximum time in seconds that the composite alarm waits after suppressor + // alarm goes out of the ALARM state. After this time, the composite alarm performs + // its actions. + // + // ExtensionPeriod is required only when ActionsSuppressor is specified. + ActionsSuppressorExtensionPeriod *int64 `type:"integer"` + + // The maximum time in seconds that the composite alarm waits for the suppressor + // alarm to go into the ALARM state. After this time, the composite alarm performs + // its actions. + // + // WaitPeriod is required only when ActionsSuppressor is specified. + ActionsSuppressorWaitPeriod *int64 `type:"integer"` + + // The actions to execute when this alarm transitions to the ALARM state from + // any other state. Each action is specified as an Amazon Resource Name (ARN). + // + // Valid Values: ] + // + // Amazon SNS actions: + // + // arn:aws:sns:region:account-id:sns-topic-name + // + // Lambda actions: + // + // * Invoke the latest version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name + // + // * Invoke a specific version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name:version-number + // + // * Invoke a function by using an alias Lambda function: arn:aws:lambda:region:account-id:function:function-name:alias-name + // + // Systems Manager actions: + // + // arn:aws:ssm:region:account-id:opsitem:severity + AlarmActions []*string `type:"list"` + + // The description for the composite alarm. + AlarmDescription *string `type:"string"` + + // The name for the composite alarm. This name must be unique within the Region. + // + // AlarmName is a required field + AlarmName *string `min:"1" type:"string" required:"true"` + + // An expression that specifies which other alarms are to be evaluated to determine + // this composite alarm's state. For each alarm that you reference, you designate + // a function that specifies whether that alarm needs to be in ALARM state, + // OK state, or INSUFFICIENT_DATA state. You can use operators (AND, OR and + // NOT) to combine multiple functions in a single expression. You can use parenthesis + // to logically group the functions in your expression. + // + // You can use either alarm names or ARNs to reference the other alarms that + // are to be evaluated. + // + // Functions can include the following: + // + // * ALARM("alarm-name or alarm-ARN") is TRUE if the named alarm is in ALARM + // state. + // + // * OK("alarm-name or alarm-ARN") is TRUE if the named alarm is in OK state. + // + // * INSUFFICIENT_DATA("alarm-name or alarm-ARN") is TRUE if the named alarm + // is in INSUFFICIENT_DATA state. + // + // * TRUE always evaluates to TRUE. + // + // * FALSE always evaluates to FALSE. + // + // TRUE and FALSE are useful for testing a complex AlarmRule structure, and + // for testing your alarm actions. + // + // Alarm names specified in AlarmRule can be surrounded with double-quotes ("), + // but do not have to be. + // + // The following are some examples of AlarmRule: + // + // * ALARM(CPUUtilizationTooHigh) AND ALARM(DiskReadOpsTooHigh) specifies + // that the composite alarm goes into ALARM state only if both CPUUtilizationTooHigh + // and DiskReadOpsTooHigh alarms are in ALARM state. + // + // * ALARM(CPUUtilizationTooHigh) AND NOT ALARM(DeploymentInProgress) specifies + // that the alarm goes to ALARM state if CPUUtilizationTooHigh is in ALARM + // state and DeploymentInProgress is not in ALARM state. This example reduces + // alarm noise during a known deployment window. + // + // * (ALARM(CPUUtilizationTooHigh) OR ALARM(DiskReadOpsTooHigh)) AND OK(NetworkOutTooHigh) + // goes into ALARM state if CPUUtilizationTooHigh OR DiskReadOpsTooHigh is + // in ALARM state, and if NetworkOutTooHigh is in OK state. This provides + // another example of using a composite alarm to prevent noise. This rule + // ensures that you are not notified with an alarm action on high CPU or + // disk usage if a known network problem is also occurring. + // + // The AlarmRule can specify as many as 100 "children" alarms. The AlarmRule + // expression can have as many as 500 elements. Elements are child alarms, TRUE + // or FALSE statements, and parentheses. + // + // AlarmRule is a required field + AlarmRule *string `min:"1" type:"string" required:"true"` + + // The actions to execute when this alarm transitions to the INSUFFICIENT_DATA + // state from any other state. Each action is specified as an Amazon Resource + // Name (ARN). + // + // Valid Values: ] + // + // Amazon SNS actions: + // + // arn:aws:sns:region:account-id:sns-topic-name + // + // Lambda actions: + // + // * Invoke the latest version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name + // + // * Invoke a specific version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name:version-number + // + // * Invoke a function by using an alias Lambda function: arn:aws:lambda:region:account-id:function:function-name:alias-name + InsufficientDataActions []*string `type:"list"` + + // The actions to execute when this alarm transitions to an OK state from any + // other state. Each action is specified as an Amazon Resource Name (ARN). + // + // Valid Values: ] + // + // Amazon SNS actions: + // + // arn:aws:sns:region:account-id:sns-topic-name + // + // Lambda actions: + // + // * Invoke the latest version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name + // + // * Invoke a specific version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name:version-number + // + // * Invoke a function by using an alias Lambda function: arn:aws:lambda:region:account-id:function:function-name:alias-name + OKActions []*string `type:"list"` + + // A list of key-value pairs to associate with the alarm. You can associate + // as many as 50 tags with an alarm. To be able to associate tags with the alarm + // when you create the alarm, you must have the cloudwatch:TagResource permission. + // + // Tags can help you organize and categorize your resources. You can also use + // them to scope user permissions by granting a user permission to access or + // change only resources with certain tag values. + // + // If you are using this operation to update an existing alarm, any tags you + // specify in this parameter are ignored. To change the tags of an existing + // alarm, use TagResource (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html) + // or UntagResource (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_UntagResource.html). + Tags []*Tag `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutCompositeAlarmInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutCompositeAlarmInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutCompositeAlarmInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutCompositeAlarmInput"} + if s.ActionsSuppressor != nil && len(*s.ActionsSuppressor) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ActionsSuppressor", 1)) + } + if s.AlarmName == nil { + invalidParams.Add(request.NewErrParamRequired("AlarmName")) + } + if s.AlarmName != nil && len(*s.AlarmName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AlarmName", 1)) + } + if s.AlarmRule == nil { + invalidParams.Add(request.NewErrParamRequired("AlarmRule")) + } + if s.AlarmRule != nil && len(*s.AlarmRule) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AlarmRule", 1)) + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetActionsEnabled sets the ActionsEnabled field's value. +func (s *PutCompositeAlarmInput) SetActionsEnabled(v bool) *PutCompositeAlarmInput { + s.ActionsEnabled = &v + return s +} + +// SetActionsSuppressor sets the ActionsSuppressor field's value. +func (s *PutCompositeAlarmInput) SetActionsSuppressor(v string) *PutCompositeAlarmInput { + s.ActionsSuppressor = &v + return s +} + +// SetActionsSuppressorExtensionPeriod sets the ActionsSuppressorExtensionPeriod field's value. +func (s *PutCompositeAlarmInput) SetActionsSuppressorExtensionPeriod(v int64) *PutCompositeAlarmInput { + s.ActionsSuppressorExtensionPeriod = &v + return s +} + +// SetActionsSuppressorWaitPeriod sets the ActionsSuppressorWaitPeriod field's value. +func (s *PutCompositeAlarmInput) SetActionsSuppressorWaitPeriod(v int64) *PutCompositeAlarmInput { + s.ActionsSuppressorWaitPeriod = &v + return s +} + +// SetAlarmActions sets the AlarmActions field's value. +func (s *PutCompositeAlarmInput) SetAlarmActions(v []*string) *PutCompositeAlarmInput { + s.AlarmActions = v + return s +} + +// SetAlarmDescription sets the AlarmDescription field's value. +func (s *PutCompositeAlarmInput) SetAlarmDescription(v string) *PutCompositeAlarmInput { + s.AlarmDescription = &v + return s +} + +// SetAlarmName sets the AlarmName field's value. +func (s *PutCompositeAlarmInput) SetAlarmName(v string) *PutCompositeAlarmInput { + s.AlarmName = &v + return s +} + +// SetAlarmRule sets the AlarmRule field's value. +func (s *PutCompositeAlarmInput) SetAlarmRule(v string) *PutCompositeAlarmInput { + s.AlarmRule = &v + return s +} + +// SetInsufficientDataActions sets the InsufficientDataActions field's value. +func (s *PutCompositeAlarmInput) SetInsufficientDataActions(v []*string) *PutCompositeAlarmInput { + s.InsufficientDataActions = v + return s +} + +// SetOKActions sets the OKActions field's value. +func (s *PutCompositeAlarmInput) SetOKActions(v []*string) *PutCompositeAlarmInput { + s.OKActions = v + return s +} + +// SetTags sets the Tags field's value. +func (s *PutCompositeAlarmInput) SetTags(v []*Tag) *PutCompositeAlarmInput { + s.Tags = v + return s +} + +type PutCompositeAlarmOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutCompositeAlarmOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutCompositeAlarmOutput) GoString() string { + return s.String() +} + +type PutDashboardInput struct { + _ struct{} `type:"structure"` + + // The detailed information about the dashboard in JSON format, including the + // widgets to include and their location on the dashboard. This parameter is + // required. + // + // For more information about the syntax, see Dashboard Body Structure and Syntax + // (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html). + // + // DashboardBody is a required field + DashboardBody *string `type:"string" required:"true"` + + // The name of the dashboard. If a dashboard with this name already exists, + // this call modifies that dashboard, replacing its current contents. Otherwise, + // a new dashboard is created. The maximum length is 255, and valid characters + // are A-Z, a-z, 0-9, "-", and "_". This parameter is required. + // + // DashboardName is a required field + DashboardName *string `type:"string" required:"true"` + + Tags []*Tag `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDashboardInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDashboardInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutDashboardInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutDashboardInput"} + if s.DashboardBody == nil { + invalidParams.Add(request.NewErrParamRequired("DashboardBody")) + } + if s.DashboardName == nil { + invalidParams.Add(request.NewErrParamRequired("DashboardName")) + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDashboardBody sets the DashboardBody field's value. +func (s *PutDashboardInput) SetDashboardBody(v string) *PutDashboardInput { + s.DashboardBody = &v + return s +} + +// SetDashboardName sets the DashboardName field's value. +func (s *PutDashboardInput) SetDashboardName(v string) *PutDashboardInput { + s.DashboardName = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *PutDashboardInput) SetTags(v []*Tag) *PutDashboardInput { + s.Tags = v + return s +} + +type PutDashboardOutput struct { + _ struct{} `type:"structure"` + + // If the input for PutDashboard was correct and the dashboard was successfully + // created or modified, this result is empty. + // + // If this result includes only warning messages, then the input was valid enough + // for the dashboard to be created or modified, but some elements of the dashboard + // might not render. + // + // If this result includes error messages, the input was not valid and the operation + // failed. + DashboardValidationMessages []*DashboardValidationMessage `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDashboardOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDashboardOutput) GoString() string { + return s.String() +} + +// SetDashboardValidationMessages sets the DashboardValidationMessages field's value. +func (s *PutDashboardOutput) SetDashboardValidationMessages(v []*DashboardValidationMessage) *PutDashboardOutput { + s.DashboardValidationMessages = v + return s +} + +type PutInsightRuleInput struct { + _ struct{} `type:"structure"` + + // The definition of the rule, as a JSON object. For details on the valid syntax, + // see Contributor Insights Rule Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContributorInsights-RuleSyntax.html). + // + // RuleDefinition is a required field + RuleDefinition *string `min:"1" type:"string" required:"true"` + + // A unique name for the rule. + // + // RuleName is a required field + RuleName *string `min:"1" type:"string" required:"true"` + + // The state of the rule. Valid values are ENABLED and DISABLED. + RuleState *string `min:"1" type:"string"` + + // A list of key-value pairs to associate with the Contributor Insights rule. + // You can associate as many as 50 tags with a rule. + // + // Tags can help you organize and categorize your resources. You can also use + // them to scope user permissions, by granting a user permission to access or + // change only the resources that have certain tag values. + // + // To be able to associate tags with a rule, you must have the cloudwatch:TagResource + // permission in addition to the cloudwatch:PutInsightRule permission. + // + // If you are using this operation to update an existing Contributor Insights + // rule, any tags you specify in this parameter are ignored. To change the tags + // of an existing rule, use TagResource (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html). + Tags []*Tag `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutInsightRuleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutInsightRuleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutInsightRuleInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutInsightRuleInput"} + if s.RuleDefinition == nil { + invalidParams.Add(request.NewErrParamRequired("RuleDefinition")) + } + if s.RuleDefinition != nil && len(*s.RuleDefinition) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RuleDefinition", 1)) + } + if s.RuleName == nil { + invalidParams.Add(request.NewErrParamRequired("RuleName")) + } + if s.RuleName != nil && len(*s.RuleName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RuleName", 1)) + } + if s.RuleState != nil && len(*s.RuleState) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RuleState", 1)) + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRuleDefinition sets the RuleDefinition field's value. +func (s *PutInsightRuleInput) SetRuleDefinition(v string) *PutInsightRuleInput { + s.RuleDefinition = &v + return s +} + +// SetRuleName sets the RuleName field's value. +func (s *PutInsightRuleInput) SetRuleName(v string) *PutInsightRuleInput { + s.RuleName = &v + return s +} + +// SetRuleState sets the RuleState field's value. +func (s *PutInsightRuleInput) SetRuleState(v string) *PutInsightRuleInput { + s.RuleState = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *PutInsightRuleInput) SetTags(v []*Tag) *PutInsightRuleInput { + s.Tags = v + return s +} + +type PutInsightRuleOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutInsightRuleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutInsightRuleOutput) GoString() string { + return s.String() +} + +type PutMetricAlarmInput struct { + _ struct{} `type:"structure"` + + // Indicates whether actions should be executed during any changes to the alarm + // state. The default is TRUE. + ActionsEnabled *bool `type:"boolean"` + + // The actions to execute when this alarm transitions to the ALARM state from + // any other state. Each action is specified as an Amazon Resource Name (ARN). + // Valid values: + // + // EC2 actions: + // + // * arn:aws:automate:region:ec2:stop + // + // * arn:aws:automate:region:ec2:terminate + // + // * arn:aws:automate:region:ec2:reboot + // + // * arn:aws:automate:region:ec2:recover + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Stop/1.0 + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Terminate/1.0 + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Reboot/1.0 + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Recover/1.0 + // + // Autoscaling action: + // + // * arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name + // + // Lambda actions: + // + // * Invoke the latest version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name + // + // * Invoke a specific version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name:version-number + // + // * Invoke a function by using an alias Lambda function: arn:aws:lambda:region:account-id:function:function-name:alias-name + // + // SNS notification action: + // + // * arn:aws:sns:region:account-id:sns-topic-name + // + // SSM integration actions: + // + // * arn:aws:ssm:region:account-id:opsitem:severity#CATEGORY=category-name + // + // * arn:aws:ssm-incidents::account-id:responseplan/response-plan-name + AlarmActions []*string `type:"list"` + + // The description for the alarm. + AlarmDescription *string `type:"string"` + + // The name for the alarm. This name must be unique within the Region. + // + // The name must contain only UTF-8 characters, and can't contain ASCII control + // characters + // + // AlarmName is a required field + AlarmName *string `min:"1" type:"string" required:"true"` + + // The arithmetic operation to use when comparing the specified statistic and + // threshold. The specified statistic value is used as the first operand. + // + // The values LessThanLowerOrGreaterThanUpperThreshold, LessThanLowerThreshold, + // and GreaterThanUpperThreshold are used only for alarms based on anomaly detection + // models. + // + // ComparisonOperator is a required field + ComparisonOperator *string `type:"string" required:"true" enum:"ComparisonOperator"` + + // The number of data points that must be breaching to trigger the alarm. This + // is used only if you are setting an "M out of N" alarm. In that case, this + // value is the M. For more information, see Evaluating an Alarm (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation) + // in the Amazon CloudWatch User Guide. + DatapointsToAlarm *int64 `min:"1" type:"integer"` + + // The dimensions for the metric specified in MetricName. + Dimensions []*Dimension `type:"list"` + + // Used only for alarms based on percentiles. If you specify ignore, the alarm + // state does not change during periods with too few data points to be statistically + // significant. If you specify evaluate or omit this parameter, the alarm is + // always evaluated and possibly changes state no matter how many data points + // are available. For more information, see Percentile-Based CloudWatch Alarms + // and Low Data Samples (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#percentiles-with-low-samples). + // + // Valid Values: evaluate | ignore + EvaluateLowSampleCountPercentile *string `min:"1" type:"string"` + + // The number of periods over which data is compared to the specified threshold. + // If you are setting an alarm that requires that a number of consecutive data + // points be breaching to trigger the alarm, this value specifies that number. + // If you are setting an "M out of N" alarm, this value is the N. + // + // An alarm's total current evaluation period can be no longer than one day, + // so this number multiplied by Period cannot be more than 86,400 seconds. + // + // EvaluationPeriods is a required field + EvaluationPeriods *int64 `min:"1" type:"integer" required:"true"` + + // The extended statistic for the metric specified in MetricName. When you call + // PutMetricAlarm and specify a MetricName, you must specify either Statistic + // or ExtendedStatistic but not both. + // + // If you specify ExtendedStatistic, the following are valid values: + // + // * p90 + // + // * tm90 + // + // * tc90 + // + // * ts90 + // + // * wm90 + // + // * IQM + // + // * PR(n:m) where n and m are values of the metric + // + // * TC(X%:X%) where X is between 10 and 90 inclusive. + // + // * TM(X%:X%) where X is between 10 and 90 inclusive. + // + // * TS(X%:X%) where X is between 10 and 90 inclusive. + // + // * WM(X%:X%) where X is between 10 and 90 inclusive. + // + // For more information about these extended statistics, see CloudWatch statistics + // definitions (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html). + ExtendedStatistic *string `type:"string"` + + // The actions to execute when this alarm transitions to the INSUFFICIENT_DATA + // state from any other state. Each action is specified as an Amazon Resource + // Name (ARN). Valid values: + // + // EC2 actions: + // + // * arn:aws:automate:region:ec2:stop + // + // * arn:aws:automate:region:ec2:terminate + // + // * arn:aws:automate:region:ec2:reboot + // + // * arn:aws:automate:region:ec2:recover + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Stop/1.0 + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Terminate/1.0 + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Reboot/1.0 + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Recover/1.0 + // + // Autoscaling action: + // + // * arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name + // + // Lambda actions: + // + // * Invoke the latest version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name + // + // * Invoke a specific version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name:version-number + // + // * Invoke a function by using an alias Lambda function: arn:aws:lambda:region:account-id:function:function-name:alias-name + // + // SNS notification action: + // + // * arn:aws:sns:region:account-id:sns-topic-name + // + // SSM integration actions: + // + // * arn:aws:ssm:region:account-id:opsitem:severity#CATEGORY=category-name + // + // * arn:aws:ssm-incidents::account-id:responseplan/response-plan-name + InsufficientDataActions []*string `type:"list"` + + // The name for the metric associated with the alarm. For each PutMetricAlarm + // operation, you must specify either MetricName or a Metrics array. + // + // If you are creating an alarm based on a math expression, you cannot specify + // this parameter, or any of the Namespace, Dimensions, Period, Unit, Statistic, + // or ExtendedStatistic parameters. Instead, you specify all this information + // in the Metrics array. + MetricName *string `min:"1" type:"string"` + + // An array of MetricDataQuery structures that enable you to create an alarm + // based on the result of a metric math expression. For each PutMetricAlarm + // operation, you must specify either MetricName or a Metrics array. + // + // Each item in the Metrics array either retrieves a metric or performs a math + // expression. + // + // One item in the Metrics array is the expression that the alarm watches. You + // designate this expression by setting ReturnData to true for this object in + // the array. For more information, see MetricDataQuery (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDataQuery.html). + // + // If you use the Metrics parameter, you cannot include the Namespace, MetricName, + // Dimensions, Period, Unit, Statistic, or ExtendedStatistic parameters of PutMetricAlarm + // in the same operation. Instead, you retrieve the metrics you are using in + // your math expression as part of the Metrics array. + Metrics []*MetricDataQuery `type:"list"` + + // The namespace for the metric associated specified in MetricName. + Namespace *string `min:"1" type:"string"` + + // The actions to execute when this alarm transitions to an OK state from any + // other state. Each action is specified as an Amazon Resource Name (ARN). Valid + // values: + // + // EC2 actions: + // + // * arn:aws:automate:region:ec2:stop + // + // * arn:aws:automate:region:ec2:terminate + // + // * arn:aws:automate:region:ec2:reboot + // + // * arn:aws:automate:region:ec2:recover + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Stop/1.0 + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Terminate/1.0 + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Reboot/1.0 + // + // * arn:aws:swf:region:account-id:action/actions/AWS_EC2.InstanceId.Recover/1.0 + // + // Autoscaling action: + // + // * arn:aws:autoscaling:region:account-id:scalingPolicy:policy-id:autoScalingGroupName/group-friendly-name:policyName/policy-friendly-name + // + // Lambda actions: + // + // * Invoke the latest version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name + // + // * Invoke a specific version of a Lambda function: arn:aws:lambda:region:account-id:function:function-name:version-number + // + // * Invoke a function by using an alias Lambda function: arn:aws:lambda:region:account-id:function:function-name:alias-name + // + // SNS notification action: + // + // * arn:aws:sns:region:account-id:sns-topic-name + // + // SSM integration actions: + // + // * arn:aws:ssm:region:account-id:opsitem:severity#CATEGORY=category-name + // + // * arn:aws:ssm-incidents::account-id:responseplan/response-plan-name + OKActions []*string `type:"list"` + + // The length, in seconds, used each time the metric specified in MetricName + // is evaluated. Valid values are 10, 30, and any multiple of 60. + // + // Period is required for alarms based on static thresholds. If you are creating + // an alarm based on a metric math expression, you specify the period for each + // metric within the objects in the Metrics array. + // + // Be sure to specify 10 or 30 only for metrics that are stored by a PutMetricData + // call with a StorageResolution of 1. If you specify a period of 10 or 30 for + // a metric that does not have sub-minute resolution, the alarm still attempts + // to gather data at the period rate that you specify. In this case, it does + // not receive data for the attempts that do not correspond to a one-minute + // data resolution, and the alarm might often lapse into INSUFFICENT_DATA status. + // Specifying 10 or 30 also sets this alarm as a high-resolution alarm, which + // has a higher charge than other alarms. For more information about pricing, + // see Amazon CloudWatch Pricing (https://aws.amazon.com/cloudwatch/pricing/). + // + // An alarm's total current evaluation period can be no longer than one day, + // so Period multiplied by EvaluationPeriods cannot be more than 86,400 seconds. + Period *int64 `min:"1" type:"integer"` + + // The statistic for the metric specified in MetricName, other than percentile. + // For percentile statistics, use ExtendedStatistic. When you call PutMetricAlarm + // and specify a MetricName, you must specify either Statistic or ExtendedStatistic, + // but not both. + Statistic *string `type:"string" enum:"Statistic"` + + // A list of key-value pairs to associate with the alarm. You can associate + // as many as 50 tags with an alarm. To be able to associate tags with the alarm + // when you create the alarm, you must have the cloudwatch:TagResource permission. + // + // Tags can help you organize and categorize your resources. You can also use + // them to scope user permissions by granting a user permission to access or + // change only resources with certain tag values. + // + // If you are using this operation to update an existing alarm, any tags you + // specify in this parameter are ignored. To change the tags of an existing + // alarm, use TagResource (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html) + // or UntagResource (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_UntagResource.html). + // + // To use this field to set tags for an alarm when you create it, you must be + // signed on with both the cloudwatch:PutMetricAlarm and cloudwatch:TagResource + // permissions. + Tags []*Tag `type:"list"` + + // The value against which the specified statistic is compared. + // + // This parameter is required for alarms based on static thresholds, but should + // not be used for alarms based on anomaly detection models. + Threshold *float64 `type:"double"` + + // If this is an alarm based on an anomaly detection model, make this value + // match the ID of the ANOMALY_DETECTION_BAND function. + // + // For an example of how to use this parameter, see the Anomaly Detection Model + // Alarm example on this page. + // + // If your alarm uses this parameter, it cannot have Auto Scaling actions. + ThresholdMetricId *string `min:"1" type:"string"` + + // Sets how this alarm is to handle missing data points. If TreatMissingData + // is omitted, the default behavior of missing is used. For more information, + // see Configuring How CloudWatch Alarms Treats Missing Data (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data). + // + // Valid Values: breaching | notBreaching | ignore | missing + // + // Alarms that evaluate metrics in the AWS/DynamoDB namespace always ignore + // missing data even if you choose a different option for TreatMissingData. + // When an AWS/DynamoDB metric has missing data, alarms that evaluate that metric + // remain in their current state. + TreatMissingData *string `min:"1" type:"string"` + + // The unit of measure for the statistic. For example, the units for the Amazon + // EC2 NetworkIn metric are Bytes because NetworkIn tracks the number of bytes + // that an instance receives on all network interfaces. You can also specify + // a unit when you create a custom metric. Units help provide conceptual meaning + // to your data. Metric data points that specify a unit of measure, such as + // Percent, are aggregated separately. If you are creating an alarm based on + // a metric math expression, you can specify the unit for each metric (if needed) + // within the objects in the Metrics array. + // + // If you don't specify Unit, CloudWatch retrieves all unit types that have + // been published for the metric and attempts to evaluate the alarm. Usually, + // metrics are published with only one unit, so the alarm works as intended. + // + // However, if the metric is published with multiple types of units and you + // don't specify a unit, the alarm's behavior is not defined and it behaves + // unpredictably. + // + // We recommend omitting Unit so that you don't inadvertently specify an incorrect + // unit that is not published for this metric. Doing so causes the alarm to + // be stuck in the INSUFFICIENT DATA state. + Unit *string `type:"string" enum:"StandardUnit"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricAlarmInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricAlarmInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutMetricAlarmInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutMetricAlarmInput"} + if s.AlarmName == nil { + invalidParams.Add(request.NewErrParamRequired("AlarmName")) + } + if s.AlarmName != nil && len(*s.AlarmName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AlarmName", 1)) + } + if s.ComparisonOperator == nil { + invalidParams.Add(request.NewErrParamRequired("ComparisonOperator")) + } + if s.DatapointsToAlarm != nil && *s.DatapointsToAlarm < 1 { + invalidParams.Add(request.NewErrParamMinValue("DatapointsToAlarm", 1)) + } + if s.EvaluateLowSampleCountPercentile != nil && len(*s.EvaluateLowSampleCountPercentile) < 1 { + invalidParams.Add(request.NewErrParamMinLen("EvaluateLowSampleCountPercentile", 1)) + } + if s.EvaluationPeriods == nil { + invalidParams.Add(request.NewErrParamRequired("EvaluationPeriods")) + } + if s.EvaluationPeriods != nil && *s.EvaluationPeriods < 1 { + invalidParams.Add(request.NewErrParamMinValue("EvaluationPeriods", 1)) + } + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.Period != nil && *s.Period < 1 { + invalidParams.Add(request.NewErrParamMinValue("Period", 1)) + } + if s.ThresholdMetricId != nil && len(*s.ThresholdMetricId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ThresholdMetricId", 1)) + } + if s.TreatMissingData != nil && len(*s.TreatMissingData) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TreatMissingData", 1)) + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + if s.Metrics != nil { + for i, v := range s.Metrics { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Metrics", i), err.(request.ErrInvalidParams)) + } + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetActionsEnabled sets the ActionsEnabled field's value. +func (s *PutMetricAlarmInput) SetActionsEnabled(v bool) *PutMetricAlarmInput { + s.ActionsEnabled = &v + return s +} + +// SetAlarmActions sets the AlarmActions field's value. +func (s *PutMetricAlarmInput) SetAlarmActions(v []*string) *PutMetricAlarmInput { + s.AlarmActions = v + return s +} + +// SetAlarmDescription sets the AlarmDescription field's value. +func (s *PutMetricAlarmInput) SetAlarmDescription(v string) *PutMetricAlarmInput { + s.AlarmDescription = &v + return s +} + +// SetAlarmName sets the AlarmName field's value. +func (s *PutMetricAlarmInput) SetAlarmName(v string) *PutMetricAlarmInput { + s.AlarmName = &v + return s +} + +// SetComparisonOperator sets the ComparisonOperator field's value. +func (s *PutMetricAlarmInput) SetComparisonOperator(v string) *PutMetricAlarmInput { + s.ComparisonOperator = &v + return s +} + +// SetDatapointsToAlarm sets the DatapointsToAlarm field's value. +func (s *PutMetricAlarmInput) SetDatapointsToAlarm(v int64) *PutMetricAlarmInput { + s.DatapointsToAlarm = &v + return s +} + +// SetDimensions sets the Dimensions field's value. +func (s *PutMetricAlarmInput) SetDimensions(v []*Dimension) *PutMetricAlarmInput { + s.Dimensions = v + return s +} + +// SetEvaluateLowSampleCountPercentile sets the EvaluateLowSampleCountPercentile field's value. +func (s *PutMetricAlarmInput) SetEvaluateLowSampleCountPercentile(v string) *PutMetricAlarmInput { + s.EvaluateLowSampleCountPercentile = &v + return s +} + +// SetEvaluationPeriods sets the EvaluationPeriods field's value. +func (s *PutMetricAlarmInput) SetEvaluationPeriods(v int64) *PutMetricAlarmInput { + s.EvaluationPeriods = &v + return s +} + +// SetExtendedStatistic sets the ExtendedStatistic field's value. +func (s *PutMetricAlarmInput) SetExtendedStatistic(v string) *PutMetricAlarmInput { + s.ExtendedStatistic = &v + return s +} + +// SetInsufficientDataActions sets the InsufficientDataActions field's value. +func (s *PutMetricAlarmInput) SetInsufficientDataActions(v []*string) *PutMetricAlarmInput { + s.InsufficientDataActions = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *PutMetricAlarmInput) SetMetricName(v string) *PutMetricAlarmInput { + s.MetricName = &v + return s +} + +// SetMetrics sets the Metrics field's value. +func (s *PutMetricAlarmInput) SetMetrics(v []*MetricDataQuery) *PutMetricAlarmInput { + s.Metrics = v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *PutMetricAlarmInput) SetNamespace(v string) *PutMetricAlarmInput { + s.Namespace = &v + return s +} + +// SetOKActions sets the OKActions field's value. +func (s *PutMetricAlarmInput) SetOKActions(v []*string) *PutMetricAlarmInput { + s.OKActions = v + return s +} + +// SetPeriod sets the Period field's value. +func (s *PutMetricAlarmInput) SetPeriod(v int64) *PutMetricAlarmInput { + s.Period = &v + return s +} + +// SetStatistic sets the Statistic field's value. +func (s *PutMetricAlarmInput) SetStatistic(v string) *PutMetricAlarmInput { + s.Statistic = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *PutMetricAlarmInput) SetTags(v []*Tag) *PutMetricAlarmInput { + s.Tags = v + return s +} + +// SetThreshold sets the Threshold field's value. +func (s *PutMetricAlarmInput) SetThreshold(v float64) *PutMetricAlarmInput { + s.Threshold = &v + return s +} + +// SetThresholdMetricId sets the ThresholdMetricId field's value. +func (s *PutMetricAlarmInput) SetThresholdMetricId(v string) *PutMetricAlarmInput { + s.ThresholdMetricId = &v + return s +} + +// SetTreatMissingData sets the TreatMissingData field's value. +func (s *PutMetricAlarmInput) SetTreatMissingData(v string) *PutMetricAlarmInput { + s.TreatMissingData = &v + return s +} + +// SetUnit sets the Unit field's value. +func (s *PutMetricAlarmInput) SetUnit(v string) *PutMetricAlarmInput { + s.Unit = &v + return s +} + +type PutMetricAlarmOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricAlarmOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricAlarmOutput) GoString() string { + return s.String() +} + +type PutMetricDataInput struct { + _ struct{} `type:"structure"` + + EntityMetricData []*EntityMetricData `type:"list"` + + // The data for the metric. The array can include no more than 1000 metrics + // per call. + // + // MetricData is a required field + MetricData []*MetricDatum `type:"list" required:"true"` + + // The namespace for the metric data. You can use ASCII characters for the namespace, + // except for control characters which are not supported. + // + // To avoid conflicts with Amazon Web Services service namespaces, you should + // not specify a namespace that begins with AWS/ + // + // Namespace is a required field + Namespace *string `min:"1" type:"string" required:"true"` + + StrictEntityValidation *bool `type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricDataInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricDataInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutMetricDataInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutMetricDataInput"} + if s.MetricData == nil { + invalidParams.Add(request.NewErrParamRequired("MetricData")) + } + if s.Namespace == nil { + invalidParams.Add(request.NewErrParamRequired("Namespace")) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.EntityMetricData != nil { + for i, v := range s.EntityMetricData { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "EntityMetricData", i), err.(request.ErrInvalidParams)) + } + } + } + if s.MetricData != nil { + for i, v := range s.MetricData { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricData", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEntityMetricData sets the EntityMetricData field's value. +func (s *PutMetricDataInput) SetEntityMetricData(v []*EntityMetricData) *PutMetricDataInput { + s.EntityMetricData = v + return s +} + +// SetMetricData sets the MetricData field's value. +func (s *PutMetricDataInput) SetMetricData(v []*MetricDatum) *PutMetricDataInput { + s.MetricData = v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *PutMetricDataInput) SetNamespace(v string) *PutMetricDataInput { + s.Namespace = &v + return s +} + +// SetStrictEntityValidation sets the StrictEntityValidation field's value. +func (s *PutMetricDataInput) SetStrictEntityValidation(v bool) *PutMetricDataInput { + s.StrictEntityValidation = &v + return s +} + +type PutMetricDataOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricDataOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricDataOutput) GoString() string { + return s.String() +} + +type PutMetricStreamInput struct { + _ struct{} `type:"structure"` + + // If you specify this parameter, the stream sends metrics from all metric namespaces + // except for the namespaces that you specify here. + // + // You cannot include ExcludeFilters and IncludeFilters in the same operation. + ExcludeFilters []*MetricStreamFilter `type:"list"` + + // The ARN of the Amazon Kinesis Data Firehose delivery stream to use for this + // metric stream. This Amazon Kinesis Data Firehose delivery stream must already + // exist and must be in the same account as the metric stream. + // + // FirehoseArn is a required field + FirehoseArn *string `min:"1" type:"string" required:"true"` + + // If you specify this parameter, the stream sends only the metrics from the + // metric namespaces that you specify here. + // + // You cannot include IncludeFilters and ExcludeFilters in the same operation. + IncludeFilters []*MetricStreamFilter `type:"list"` + + // If you are creating a metric stream in a monitoring account, specify true + // to include metrics from source accounts in the metric stream. + IncludeLinkedAccountsMetrics *bool `type:"boolean"` + + // If you are creating a new metric stream, this is the name for the new stream. + // The name must be different than the names of other metric streams in this + // account and Region. + // + // If you are updating a metric stream, specify the name of that stream here. + // + // Valid characters are A-Z, a-z, 0-9, "-" and "_". + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` + + // The output format for the stream. Valid values are json, opentelemetry1.0, + // and opentelemetry0.7. For more information about metric stream output formats, + // see Metric streams output formats (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-formats.html). + // + // OutputFormat is a required field + OutputFormat *string `min:"1" type:"string" required:"true"` + + // The ARN of an IAM role that this metric stream will use to access Amazon + // Kinesis Data Firehose resources. This IAM role must already exist and must + // be in the same account as the metric stream. This IAM role must include the + // following permissions: + // + // * firehose:PutRecord + // + // * firehose:PutRecordBatch + // + // RoleArn is a required field + RoleArn *string `min:"1" type:"string" required:"true"` + + // By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT + // statistics for each metric that is streamed. You can use this parameter to + // have the metric stream also send additional statistics in the stream. This + // array can have up to 100 members. + // + // For each entry in this array, you specify one or more metrics and the list + // of additional statistics to stream for those metrics. The additional statistics + // that you can stream depend on the stream's OutputFormat. If the OutputFormat + // is json, you can stream any additional statistic that is supported by CloudWatch, + // listed in CloudWatch statistics definitions (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html.html). + // If the OutputFormat is opentelemetry1.0 or opentelemetry0.7, you can stream + // percentile statistics such as p95, p99.9, and so on. + StatisticsConfigurations []*MetricStreamStatisticsConfiguration `type:"list"` + + // A list of key-value pairs to associate with the metric stream. You can associate + // as many as 50 tags with a metric stream. + // + // Tags can help you organize and categorize your resources. You can also use + // them to scope user permissions by granting a user permission to access or + // change only resources with certain tag values. + // + // You can use this parameter only when you are creating a new metric stream. + // If you are using this operation to update an existing metric stream, any + // tags you specify in this parameter are ignored. To change the tags of an + // existing metric stream, use TagResource (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html) + // or UntagResource (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_UntagResource.html). + Tags []*Tag `type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricStreamInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricStreamInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutMetricStreamInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutMetricStreamInput"} + if s.FirehoseArn == nil { + invalidParams.Add(request.NewErrParamRequired("FirehoseArn")) + } + if s.FirehoseArn != nil && len(*s.FirehoseArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("FirehoseArn", 1)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + if s.OutputFormat == nil { + invalidParams.Add(request.NewErrParamRequired("OutputFormat")) + } + if s.OutputFormat != nil && len(*s.OutputFormat) < 1 { + invalidParams.Add(request.NewErrParamMinLen("OutputFormat", 1)) + } + if s.RoleArn == nil { + invalidParams.Add(request.NewErrParamRequired("RoleArn")) + } + if s.RoleArn != nil && len(*s.RoleArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RoleArn", 1)) + } + if s.ExcludeFilters != nil { + for i, v := range s.ExcludeFilters { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ExcludeFilters", i), err.(request.ErrInvalidParams)) + } + } + } + if s.IncludeFilters != nil { + for i, v := range s.IncludeFilters { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "IncludeFilters", i), err.(request.ErrInvalidParams)) + } + } + } + if s.StatisticsConfigurations != nil { + for i, v := range s.StatisticsConfigurations { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "StatisticsConfigurations", i), err.(request.ErrInvalidParams)) + } + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetExcludeFilters sets the ExcludeFilters field's value. +func (s *PutMetricStreamInput) SetExcludeFilters(v []*MetricStreamFilter) *PutMetricStreamInput { + s.ExcludeFilters = v + return s +} + +// SetFirehoseArn sets the FirehoseArn field's value. +func (s *PutMetricStreamInput) SetFirehoseArn(v string) *PutMetricStreamInput { + s.FirehoseArn = &v + return s +} + +// SetIncludeFilters sets the IncludeFilters field's value. +func (s *PutMetricStreamInput) SetIncludeFilters(v []*MetricStreamFilter) *PutMetricStreamInput { + s.IncludeFilters = v + return s +} + +// SetIncludeLinkedAccountsMetrics sets the IncludeLinkedAccountsMetrics field's value. +func (s *PutMetricStreamInput) SetIncludeLinkedAccountsMetrics(v bool) *PutMetricStreamInput { + s.IncludeLinkedAccountsMetrics = &v + return s +} + +// SetName sets the Name field's value. +func (s *PutMetricStreamInput) SetName(v string) *PutMetricStreamInput { + s.Name = &v + return s +} + +// SetOutputFormat sets the OutputFormat field's value. +func (s *PutMetricStreamInput) SetOutputFormat(v string) *PutMetricStreamInput { + s.OutputFormat = &v + return s +} + +// SetRoleArn sets the RoleArn field's value. +func (s *PutMetricStreamInput) SetRoleArn(v string) *PutMetricStreamInput { + s.RoleArn = &v + return s +} + +// SetStatisticsConfigurations sets the StatisticsConfigurations field's value. +func (s *PutMetricStreamInput) SetStatisticsConfigurations(v []*MetricStreamStatisticsConfiguration) *PutMetricStreamInput { + s.StatisticsConfigurations = v + return s +} + +// SetTags sets the Tags field's value. +func (s *PutMetricStreamInput) SetTags(v []*Tag) *PutMetricStreamInput { + s.Tags = v + return s +} + +type PutMetricStreamOutput struct { + _ struct{} `type:"structure"` + + // The ARN of the metric stream. + Arn *string `min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricStreamOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricStreamOutput) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *PutMetricStreamOutput) SetArn(v string) *PutMetricStreamOutput { + s.Arn = &v + return s +} + +// Specifies one range of days or times to exclude from use for training an +// anomaly detection model. +type Range struct { + _ struct{} `type:"structure"` + + // The end time of the range to exclude. The format is yyyy-MM-dd'T'HH:mm:ss. + // For example, 2019-07-01T23:59:59. + // + // EndTime is a required field + EndTime *time.Time `type:"timestamp" required:"true"` + + // The start time of the range to exclude. The format is yyyy-MM-dd'T'HH:mm:ss. + // For example, 2019-07-01T23:59:59. + // + // StartTime is a required field + StartTime *time.Time `type:"timestamp" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Range) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Range) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Range) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Range"} + if s.EndTime == nil { + invalidParams.Add(request.NewErrParamRequired("EndTime")) + } + if s.StartTime == nil { + invalidParams.Add(request.NewErrParamRequired("StartTime")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEndTime sets the EndTime field's value. +func (s *Range) SetEndTime(v time.Time) *Range { + s.EndTime = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *Range) SetStartTime(v time.Time) *Range { + s.StartTime = &v + return s +} + +type SetAlarmStateInput struct { + _ struct{} `type:"structure"` + + // The name of the alarm. + // + // AlarmName is a required field + AlarmName *string `min:"1" type:"string" required:"true"` + + // The reason that this alarm is set to this specific state, in text format. + // + // StateReason is a required field + StateReason *string `type:"string" required:"true"` + + // The reason that this alarm is set to this specific state, in JSON format. + // + // For SNS or EC2 alarm actions, this is just informational. But for EC2 Auto + // Scaling or application Auto Scaling alarm actions, the Auto Scaling policy + // uses the information in this field to take the correct action. + StateReasonData *string `type:"string"` + + // The value of the state. + // + // StateValue is a required field + StateValue *string `type:"string" required:"true" enum:"StateValue"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SetAlarmStateInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SetAlarmStateInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SetAlarmStateInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "SetAlarmStateInput"} + if s.AlarmName == nil { + invalidParams.Add(request.NewErrParamRequired("AlarmName")) + } + if s.AlarmName != nil && len(*s.AlarmName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AlarmName", 1)) + } + if s.StateReason == nil { + invalidParams.Add(request.NewErrParamRequired("StateReason")) + } + if s.StateValue == nil { + invalidParams.Add(request.NewErrParamRequired("StateValue")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAlarmName sets the AlarmName field's value. +func (s *SetAlarmStateInput) SetAlarmName(v string) *SetAlarmStateInput { + s.AlarmName = &v + return s +} + +// SetStateReason sets the StateReason field's value. +func (s *SetAlarmStateInput) SetStateReason(v string) *SetAlarmStateInput { + s.StateReason = &v + return s +} + +// SetStateReasonData sets the StateReasonData field's value. +func (s *SetAlarmStateInput) SetStateReasonData(v string) *SetAlarmStateInput { + s.StateReasonData = &v + return s +} + +// SetStateValue sets the StateValue field's value. +func (s *SetAlarmStateInput) SetStateValue(v string) *SetAlarmStateInput { + s.StateValue = &v + return s +} + +type SetAlarmStateOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SetAlarmStateOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SetAlarmStateOutput) GoString() string { + return s.String() +} + +// Designates the CloudWatch metric and statistic that provides the time series +// the anomaly detector uses as input. If you have enabled unified cross-account +// observability, and this account is a monitoring account, the metric can be +// in the same account or a source account. +type SingleMetricAnomalyDetector struct { + _ struct{} `type:"structure"` + + // If the CloudWatch metric that provides the time series that the anomaly detector + // uses as input is in another account, specify that account ID here. If you + // omit this parameter, the current account is used. + AccountId *string `min:"1" type:"string"` + + // The metric dimensions to create the anomaly detection model for. + Dimensions []*Dimension `type:"list"` + + // The name of the metric to create the anomaly detection model for. + MetricName *string `min:"1" type:"string"` + + // The namespace of the metric to create the anomaly detection model for. + Namespace *string `min:"1" type:"string"` + + // The statistic to use for the metric and anomaly detection model. + Stat *string `type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SingleMetricAnomalyDetector) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SingleMetricAnomalyDetector) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SingleMetricAnomalyDetector) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "SingleMetricAnomalyDetector"} + if s.AccountId != nil && len(*s.AccountId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AccountId", 1)) + } + if s.MetricName != nil && len(*s.MetricName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricName", 1)) + } + if s.Namespace != nil && len(*s.Namespace) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Namespace", 1)) + } + if s.Dimensions != nil { + for i, v := range s.Dimensions { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAccountId sets the AccountId field's value. +func (s *SingleMetricAnomalyDetector) SetAccountId(v string) *SingleMetricAnomalyDetector { + s.AccountId = &v + return s +} + +// SetDimensions sets the Dimensions field's value. +func (s *SingleMetricAnomalyDetector) SetDimensions(v []*Dimension) *SingleMetricAnomalyDetector { + s.Dimensions = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *SingleMetricAnomalyDetector) SetMetricName(v string) *SingleMetricAnomalyDetector { + s.MetricName = &v + return s +} + +// SetNamespace sets the Namespace field's value. +func (s *SingleMetricAnomalyDetector) SetNamespace(v string) *SingleMetricAnomalyDetector { + s.Namespace = &v + return s +} + +// SetStat sets the Stat field's value. +func (s *SingleMetricAnomalyDetector) SetStat(v string) *SingleMetricAnomalyDetector { + s.Stat = &v + return s +} + +type StartMetricStreamsInput struct { + _ struct{} `type:"structure"` + + // The array of the names of metric streams to start streaming. + // + // This is an "all or nothing" operation. If you do not have permission to access + // all of the metric streams that you list here, then none of the streams that + // you list in the operation will start streaming. + // + // Names is a required field + Names []*string `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartMetricStreamsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartMetricStreamsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StartMetricStreamsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StartMetricStreamsInput"} + if s.Names == nil { + invalidParams.Add(request.NewErrParamRequired("Names")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetNames sets the Names field's value. +func (s *StartMetricStreamsInput) SetNames(v []*string) *StartMetricStreamsInput { + s.Names = v + return s +} + +type StartMetricStreamsOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartMetricStreamsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartMetricStreamsOutput) GoString() string { + return s.String() +} + +// Represents a set of statistics that describes a specific metric. +type StatisticSet struct { + _ struct{} `type:"structure"` + + // The maximum value of the sample set. + // + // Maximum is a required field + Maximum *float64 `type:"double" required:"true"` + + // The minimum value of the sample set. + // + // Minimum is a required field + Minimum *float64 `type:"double" required:"true"` + + // The number of samples used for the statistic set. + // + // SampleCount is a required field + SampleCount *float64 `type:"double" required:"true"` + + // The sum of values for the sample set. + // + // Sum is a required field + Sum *float64 `type:"double" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StatisticSet) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StatisticSet) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StatisticSet) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StatisticSet"} + if s.Maximum == nil { + invalidParams.Add(request.NewErrParamRequired("Maximum")) + } + if s.Minimum == nil { + invalidParams.Add(request.NewErrParamRequired("Minimum")) + } + if s.SampleCount == nil { + invalidParams.Add(request.NewErrParamRequired("SampleCount")) + } + if s.Sum == nil { + invalidParams.Add(request.NewErrParamRequired("Sum")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMaximum sets the Maximum field's value. +func (s *StatisticSet) SetMaximum(v float64) *StatisticSet { + s.Maximum = &v + return s +} + +// SetMinimum sets the Minimum field's value. +func (s *StatisticSet) SetMinimum(v float64) *StatisticSet { + s.Minimum = &v + return s +} + +// SetSampleCount sets the SampleCount field's value. +func (s *StatisticSet) SetSampleCount(v float64) *StatisticSet { + s.SampleCount = &v + return s +} + +// SetSum sets the Sum field's value. +func (s *StatisticSet) SetSum(v float64) *StatisticSet { + s.Sum = &v + return s +} + +type StopMetricStreamsInput struct { + _ struct{} `type:"structure"` + + // The array of the names of metric streams to stop streaming. + // + // This is an "all or nothing" operation. If you do not have permission to access + // all of the metric streams that you list here, then none of the streams that + // you list in the operation will stop streaming. + // + // Names is a required field + Names []*string `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StopMetricStreamsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StopMetricStreamsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StopMetricStreamsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StopMetricStreamsInput"} + if s.Names == nil { + invalidParams.Add(request.NewErrParamRequired("Names")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetNames sets the Names field's value. +func (s *StopMetricStreamsInput) SetNames(v []*string) *StopMetricStreamsInput { + s.Names = v + return s +} + +type StopMetricStreamsOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StopMetricStreamsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StopMetricStreamsOutput) GoString() string { + return s.String() +} + +// A key-value pair associated with a CloudWatch resource. +type Tag struct { + _ struct{} `type:"structure"` + + // A string that you can use to assign a value. The combination of tag keys + // and values can help you organize and categorize your resources. + // + // Key is a required field + Key *string `min:"1" type:"string" required:"true"` + + // The value for the specified tag key. + // + // Value is a required field + Value *string `type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Tag) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Tag) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Tag) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Tag"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.Value == nil { + invalidParams.Add(request.NewErrParamRequired("Value")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetKey sets the Key field's value. +func (s *Tag) SetKey(v string) *Tag { + s.Key = &v + return s +} + +// SetValue sets the Value field's value. +func (s *Tag) SetValue(v string) *Tag { + s.Value = &v + return s +} + +type TagResourceInput struct { + _ struct{} `type:"structure"` + + // The ARN of the CloudWatch resource that you're adding tags to. + // + // The ARN format of an alarm is arn:aws:cloudwatch:Region:account-id:alarm:alarm-name + // + // The ARN format of a Contributor Insights rule is arn:aws:cloudwatch:Region:account-id:insight-rule/insight-rule-name + // + // For more information about ARN format, see Resource Types Defined by Amazon + // CloudWatch (https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatch.html#amazoncloudwatch-resources-for-iam-policies) + // in the Amazon Web Services General Reference. + // + // ResourceARN is a required field + ResourceARN *string `min:"1" type:"string" required:"true"` + + // The list of key-value pairs to associate with the alarm. + // + // Tags is a required field + Tags []*Tag `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TagResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TagResourceInput"} + if s.ResourceARN == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceARN")) + } + if s.ResourceARN != nil && len(*s.ResourceARN) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceARN", 1)) + } + if s.Tags == nil { + invalidParams.Add(request.NewErrParamRequired("Tags")) + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceARN sets the ResourceARN field's value. +func (s *TagResourceInput) SetResourceARN(v string) *TagResourceInput { + s.ResourceARN = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *TagResourceInput) SetTags(v []*Tag) *TagResourceInput { + s.Tags = v + return s +} + +type TagResourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagResourceOutput) GoString() string { + return s.String() +} + +type UntagResourceInput struct { + _ struct{} `type:"structure"` + + // The ARN of the CloudWatch resource that you're removing tags from. + // + // The ARN format of an alarm is arn:aws:cloudwatch:Region:account-id:alarm:alarm-name + // + // The ARN format of a Contributor Insights rule is arn:aws:cloudwatch:Region:account-id:insight-rule/insight-rule-name + // + // For more information about ARN format, see Resource Types Defined by Amazon + // CloudWatch (https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatch.html#amazoncloudwatch-resources-for-iam-policies) + // in the Amazon Web Services General Reference. + // + // ResourceARN is a required field + ResourceARN *string `min:"1" type:"string" required:"true"` + + // The list of tag keys to remove from the resource. + // + // TagKeys is a required field + TagKeys []*string `type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UntagResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UntagResourceInput"} + if s.ResourceARN == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceARN")) + } + if s.ResourceARN != nil && len(*s.ResourceARN) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceARN", 1)) + } + if s.TagKeys == nil { + invalidParams.Add(request.NewErrParamRequired("TagKeys")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceARN sets the ResourceARN field's value. +func (s *UntagResourceInput) SetResourceARN(v string) *UntagResourceInput { + s.ResourceARN = &v + return s +} + +// SetTagKeys sets the TagKeys field's value. +func (s *UntagResourceInput) SetTagKeys(v []*string) *UntagResourceInput { + s.TagKeys = v + return s +} + +type UntagResourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagResourceOutput) GoString() string { + return s.String() +} + +const ( + // ActionsSuppressedByWaitPeriod is a ActionsSuppressedBy enum value + ActionsSuppressedByWaitPeriod = "WaitPeriod" + + // ActionsSuppressedByExtensionPeriod is a ActionsSuppressedBy enum value + ActionsSuppressedByExtensionPeriod = "ExtensionPeriod" + + // ActionsSuppressedByAlarm is a ActionsSuppressedBy enum value + ActionsSuppressedByAlarm = "Alarm" +) + +// ActionsSuppressedBy_Values returns all elements of the ActionsSuppressedBy enum +func ActionsSuppressedBy_Values() []string { + return []string{ + ActionsSuppressedByWaitPeriod, + ActionsSuppressedByExtensionPeriod, + ActionsSuppressedByAlarm, + } +} + +const ( + // AlarmTypeCompositeAlarm is a AlarmType enum value + AlarmTypeCompositeAlarm = "CompositeAlarm" + + // AlarmTypeMetricAlarm is a AlarmType enum value + AlarmTypeMetricAlarm = "MetricAlarm" +) + +// AlarmType_Values returns all elements of the AlarmType enum +func AlarmType_Values() []string { + return []string{ + AlarmTypeCompositeAlarm, + AlarmTypeMetricAlarm, + } +} + +const ( + // AnomalyDetectorStateValuePendingTraining is a AnomalyDetectorStateValue enum value + AnomalyDetectorStateValuePendingTraining = "PENDING_TRAINING" + + // AnomalyDetectorStateValueTrainedInsufficientData is a AnomalyDetectorStateValue enum value + AnomalyDetectorStateValueTrainedInsufficientData = "TRAINED_INSUFFICIENT_DATA" + + // AnomalyDetectorStateValueTrained is a AnomalyDetectorStateValue enum value + AnomalyDetectorStateValueTrained = "TRAINED" +) + +// AnomalyDetectorStateValue_Values returns all elements of the AnomalyDetectorStateValue enum +func AnomalyDetectorStateValue_Values() []string { + return []string{ + AnomalyDetectorStateValuePendingTraining, + AnomalyDetectorStateValueTrainedInsufficientData, + AnomalyDetectorStateValueTrained, + } +} + +const ( + // AnomalyDetectorTypeSingleMetric is a AnomalyDetectorType enum value + AnomalyDetectorTypeSingleMetric = "SINGLE_METRIC" + + // AnomalyDetectorTypeMetricMath is a AnomalyDetectorType enum value + AnomalyDetectorTypeMetricMath = "METRIC_MATH" +) + +// AnomalyDetectorType_Values returns all elements of the AnomalyDetectorType enum +func AnomalyDetectorType_Values() []string { + return []string{ + AnomalyDetectorTypeSingleMetric, + AnomalyDetectorTypeMetricMath, + } +} + +const ( + // ComparisonOperatorGreaterThanOrEqualToThreshold is a ComparisonOperator enum value + ComparisonOperatorGreaterThanOrEqualToThreshold = "GreaterThanOrEqualToThreshold" + + // ComparisonOperatorGreaterThanThreshold is a ComparisonOperator enum value + ComparisonOperatorGreaterThanThreshold = "GreaterThanThreshold" + + // ComparisonOperatorLessThanThreshold is a ComparisonOperator enum value + ComparisonOperatorLessThanThreshold = "LessThanThreshold" + + // ComparisonOperatorLessThanOrEqualToThreshold is a ComparisonOperator enum value + ComparisonOperatorLessThanOrEqualToThreshold = "LessThanOrEqualToThreshold" + + // ComparisonOperatorLessThanLowerOrGreaterThanUpperThreshold is a ComparisonOperator enum value + ComparisonOperatorLessThanLowerOrGreaterThanUpperThreshold = "LessThanLowerOrGreaterThanUpperThreshold" + + // ComparisonOperatorLessThanLowerThreshold is a ComparisonOperator enum value + ComparisonOperatorLessThanLowerThreshold = "LessThanLowerThreshold" + + // ComparisonOperatorGreaterThanUpperThreshold is a ComparisonOperator enum value + ComparisonOperatorGreaterThanUpperThreshold = "GreaterThanUpperThreshold" +) + +// ComparisonOperator_Values returns all elements of the ComparisonOperator enum +func ComparisonOperator_Values() []string { + return []string{ + ComparisonOperatorGreaterThanOrEqualToThreshold, + ComparisonOperatorGreaterThanThreshold, + ComparisonOperatorLessThanThreshold, + ComparisonOperatorLessThanOrEqualToThreshold, + ComparisonOperatorLessThanLowerOrGreaterThanUpperThreshold, + ComparisonOperatorLessThanLowerThreshold, + ComparisonOperatorGreaterThanUpperThreshold, + } +} + +const ( + // HistoryItemTypeConfigurationUpdate is a HistoryItemType enum value + HistoryItemTypeConfigurationUpdate = "ConfigurationUpdate" + + // HistoryItemTypeStateUpdate is a HistoryItemType enum value + HistoryItemTypeStateUpdate = "StateUpdate" + + // HistoryItemTypeAction is a HistoryItemType enum value + HistoryItemTypeAction = "Action" +) + +// HistoryItemType_Values returns all elements of the HistoryItemType enum +func HistoryItemType_Values() []string { + return []string{ + HistoryItemTypeConfigurationUpdate, + HistoryItemTypeStateUpdate, + HistoryItemTypeAction, + } +} + +const ( + // RecentlyActivePt3h is a RecentlyActive enum value + RecentlyActivePt3h = "PT3H" +) + +// RecentlyActive_Values returns all elements of the RecentlyActive enum +func RecentlyActive_Values() []string { + return []string{ + RecentlyActivePt3h, + } +} + +const ( + // ScanByTimestampDescending is a ScanBy enum value + ScanByTimestampDescending = "TimestampDescending" + + // ScanByTimestampAscending is a ScanBy enum value + ScanByTimestampAscending = "TimestampAscending" +) + +// ScanBy_Values returns all elements of the ScanBy enum +func ScanBy_Values() []string { + return []string{ + ScanByTimestampDescending, + ScanByTimestampAscending, + } +} + +const ( + // StandardUnitSeconds is a StandardUnit enum value + StandardUnitSeconds = "Seconds" + + // StandardUnitMicroseconds is a StandardUnit enum value + StandardUnitMicroseconds = "Microseconds" + + // StandardUnitMilliseconds is a StandardUnit enum value + StandardUnitMilliseconds = "Milliseconds" + + // StandardUnitBytes is a StandardUnit enum value + StandardUnitBytes = "Bytes" + + // StandardUnitKilobytes is a StandardUnit enum value + StandardUnitKilobytes = "Kilobytes" + + // StandardUnitMegabytes is a StandardUnit enum value + StandardUnitMegabytes = "Megabytes" + + // StandardUnitGigabytes is a StandardUnit enum value + StandardUnitGigabytes = "Gigabytes" + + // StandardUnitTerabytes is a StandardUnit enum value + StandardUnitTerabytes = "Terabytes" + + // StandardUnitBits is a StandardUnit enum value + StandardUnitBits = "Bits" + + // StandardUnitKilobits is a StandardUnit enum value + StandardUnitKilobits = "Kilobits" + + // StandardUnitMegabits is a StandardUnit enum value + StandardUnitMegabits = "Megabits" + + // StandardUnitGigabits is a StandardUnit enum value + StandardUnitGigabits = "Gigabits" + + // StandardUnitTerabits is a StandardUnit enum value + StandardUnitTerabits = "Terabits" + + // StandardUnitPercent is a StandardUnit enum value + StandardUnitPercent = "Percent" + + // StandardUnitCount is a StandardUnit enum value + StandardUnitCount = "Count" + + // StandardUnitBytesSecond is a StandardUnit enum value + StandardUnitBytesSecond = "Bytes/Second" + + // StandardUnitKilobytesSecond is a StandardUnit enum value + StandardUnitKilobytesSecond = "Kilobytes/Second" + + // StandardUnitMegabytesSecond is a StandardUnit enum value + StandardUnitMegabytesSecond = "Megabytes/Second" + + // StandardUnitGigabytesSecond is a StandardUnit enum value + StandardUnitGigabytesSecond = "Gigabytes/Second" + + // StandardUnitTerabytesSecond is a StandardUnit enum value + StandardUnitTerabytesSecond = "Terabytes/Second" + + // StandardUnitBitsSecond is a StandardUnit enum value + StandardUnitBitsSecond = "Bits/Second" + + // StandardUnitKilobitsSecond is a StandardUnit enum value + StandardUnitKilobitsSecond = "Kilobits/Second" + + // StandardUnitMegabitsSecond is a StandardUnit enum value + StandardUnitMegabitsSecond = "Megabits/Second" + + // StandardUnitGigabitsSecond is a StandardUnit enum value + StandardUnitGigabitsSecond = "Gigabits/Second" + + // StandardUnitTerabitsSecond is a StandardUnit enum value + StandardUnitTerabitsSecond = "Terabits/Second" + + // StandardUnitCountSecond is a StandardUnit enum value + StandardUnitCountSecond = "Count/Second" + + // StandardUnitNone is a StandardUnit enum value + StandardUnitNone = "None" +) + +// StandardUnit_Values returns all elements of the StandardUnit enum +func StandardUnit_Values() []string { + return []string{ + StandardUnitSeconds, + StandardUnitMicroseconds, + StandardUnitMilliseconds, + StandardUnitBytes, + StandardUnitKilobytes, + StandardUnitMegabytes, + StandardUnitGigabytes, + StandardUnitTerabytes, + StandardUnitBits, + StandardUnitKilobits, + StandardUnitMegabits, + StandardUnitGigabits, + StandardUnitTerabits, + StandardUnitPercent, + StandardUnitCount, + StandardUnitBytesSecond, + StandardUnitKilobytesSecond, + StandardUnitMegabytesSecond, + StandardUnitGigabytesSecond, + StandardUnitTerabytesSecond, + StandardUnitBitsSecond, + StandardUnitKilobitsSecond, + StandardUnitMegabitsSecond, + StandardUnitGigabitsSecond, + StandardUnitTerabitsSecond, + StandardUnitCountSecond, + StandardUnitNone, + } +} + +const ( + // StateValueOk is a StateValue enum value + StateValueOk = "OK" + + // StateValueAlarm is a StateValue enum value + StateValueAlarm = "ALARM" + + // StateValueInsufficientData is a StateValue enum value + StateValueInsufficientData = "INSUFFICIENT_DATA" +) + +// StateValue_Values returns all elements of the StateValue enum +func StateValue_Values() []string { + return []string{ + StateValueOk, + StateValueAlarm, + StateValueInsufficientData, + } +} + +const ( + // StatisticSampleCount is a Statistic enum value + StatisticSampleCount = "SampleCount" + + // StatisticAverage is a Statistic enum value + StatisticAverage = "Average" + + // StatisticSum is a Statistic enum value + StatisticSum = "Sum" + + // StatisticMinimum is a Statistic enum value + StatisticMinimum = "Minimum" + + // StatisticMaximum is a Statistic enum value + StatisticMaximum = "Maximum" +) + +// Statistic_Values returns all elements of the Statistic enum +func Statistic_Values() []string { + return []string{ + StatisticSampleCount, + StatisticAverage, + StatisticSum, + StatisticMinimum, + StatisticMaximum, + } +} + +const ( + // StatusCodeComplete is a StatusCode enum value + StatusCodeComplete = "Complete" + + // StatusCodeInternalError is a StatusCode enum value + StatusCodeInternalError = "InternalError" + + // StatusCodePartialData is a StatusCode enum value + StatusCodePartialData = "PartialData" + + // StatusCodeForbidden is a StatusCode enum value + StatusCodeForbidden = "Forbidden" +) + +// StatusCode_Values returns all elements of the StatusCode enum +func StatusCode_Values() []string { + return []string{ + StatusCodeComplete, + StatusCodeInternalError, + StatusCodePartialData, + StatusCodeForbidden, + } +} diff --git a/sdk/service/cloudwatch/cloudwatchiface/interface.go b/sdk/service/cloudwatch/cloudwatchiface/interface.go new file mode 100644 index 0000000000..267394511e --- /dev/null +++ b/sdk/service/cloudwatch/cloudwatchiface/interface.go @@ -0,0 +1,239 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package cloudwatchiface provides an interface to enable mocking the Amazon CloudWatch service client +// for testing your code. +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// and waiters. +package cloudwatchiface + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" + + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatch" +) + +// CloudWatchAPI provides an interface to enable mocking the +// cloudwatch.CloudWatch service client's API operation, +// paginators, and waiters. This make unit testing your code that calls out +// to the SDK's service client's calls easier. +// +// 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 SDK's request pipeline. +// +// // myFunc uses an SDK service client to make a request to +// // Amazon CloudWatch. +// func myFunc(svc cloudwatchiface.CloudWatchAPI) bool { +// // Make svc.DeleteAlarms request +// } +// +// func main() { +// sess := session.New() +// svc := cloudwatch.New(sess) +// +// myFunc(svc) +// } +// +// In your _test.go file: +// +// // Define a mock struct to be used in your unit tests of myFunc. +// type mockCloudWatchClient struct { +// cloudwatchiface.CloudWatchAPI +// } +// func (m *mockCloudWatchClient) DeleteAlarms(input *cloudwatch.DeleteAlarmsInput) (*cloudwatch.DeleteAlarmsOutput, error) { +// // mock response/functionality +// } +// +// func TestMyFunc(t *testing.T) { +// // Setup Test +// mockSvc := &mockCloudWatchClient{} +// +// myfunc(mockSvc) +// +// // Verify myFunc's functionality +// } +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// and waiters. Its suggested to use the pattern above for testing, or using +// tooling to generate mocks to satisfy the interfaces. +type CloudWatchAPI interface { + DeleteAlarms(*cloudwatch.DeleteAlarmsInput) (*cloudwatch.DeleteAlarmsOutput, error) + DeleteAlarmsWithContext(aws.Context, *cloudwatch.DeleteAlarmsInput, ...request.Option) (*cloudwatch.DeleteAlarmsOutput, error) + DeleteAlarmsRequest(*cloudwatch.DeleteAlarmsInput) (*request.Request, *cloudwatch.DeleteAlarmsOutput) + + DeleteAnomalyDetector(*cloudwatch.DeleteAnomalyDetectorInput) (*cloudwatch.DeleteAnomalyDetectorOutput, error) + DeleteAnomalyDetectorWithContext(aws.Context, *cloudwatch.DeleteAnomalyDetectorInput, ...request.Option) (*cloudwatch.DeleteAnomalyDetectorOutput, error) + DeleteAnomalyDetectorRequest(*cloudwatch.DeleteAnomalyDetectorInput) (*request.Request, *cloudwatch.DeleteAnomalyDetectorOutput) + + DeleteDashboards(*cloudwatch.DeleteDashboardsInput) (*cloudwatch.DeleteDashboardsOutput, error) + DeleteDashboardsWithContext(aws.Context, *cloudwatch.DeleteDashboardsInput, ...request.Option) (*cloudwatch.DeleteDashboardsOutput, error) + DeleteDashboardsRequest(*cloudwatch.DeleteDashboardsInput) (*request.Request, *cloudwatch.DeleteDashboardsOutput) + + DeleteInsightRules(*cloudwatch.DeleteInsightRulesInput) (*cloudwatch.DeleteInsightRulesOutput, error) + DeleteInsightRulesWithContext(aws.Context, *cloudwatch.DeleteInsightRulesInput, ...request.Option) (*cloudwatch.DeleteInsightRulesOutput, error) + DeleteInsightRulesRequest(*cloudwatch.DeleteInsightRulesInput) (*request.Request, *cloudwatch.DeleteInsightRulesOutput) + + DeleteMetricStream(*cloudwatch.DeleteMetricStreamInput) (*cloudwatch.DeleteMetricStreamOutput, error) + DeleteMetricStreamWithContext(aws.Context, *cloudwatch.DeleteMetricStreamInput, ...request.Option) (*cloudwatch.DeleteMetricStreamOutput, error) + DeleteMetricStreamRequest(*cloudwatch.DeleteMetricStreamInput) (*request.Request, *cloudwatch.DeleteMetricStreamOutput) + + DescribeAlarmHistory(*cloudwatch.DescribeAlarmHistoryInput) (*cloudwatch.DescribeAlarmHistoryOutput, error) + DescribeAlarmHistoryWithContext(aws.Context, *cloudwatch.DescribeAlarmHistoryInput, ...request.Option) (*cloudwatch.DescribeAlarmHistoryOutput, error) + DescribeAlarmHistoryRequest(*cloudwatch.DescribeAlarmHistoryInput) (*request.Request, *cloudwatch.DescribeAlarmHistoryOutput) + + DescribeAlarmHistoryPages(*cloudwatch.DescribeAlarmHistoryInput, func(*cloudwatch.DescribeAlarmHistoryOutput, bool) bool) error + DescribeAlarmHistoryPagesWithContext(aws.Context, *cloudwatch.DescribeAlarmHistoryInput, func(*cloudwatch.DescribeAlarmHistoryOutput, bool) bool, ...request.Option) error + + DescribeAlarms(*cloudwatch.DescribeAlarmsInput) (*cloudwatch.DescribeAlarmsOutput, error) + DescribeAlarmsWithContext(aws.Context, *cloudwatch.DescribeAlarmsInput, ...request.Option) (*cloudwatch.DescribeAlarmsOutput, error) + DescribeAlarmsRequest(*cloudwatch.DescribeAlarmsInput) (*request.Request, *cloudwatch.DescribeAlarmsOutput) + + DescribeAlarmsPages(*cloudwatch.DescribeAlarmsInput, func(*cloudwatch.DescribeAlarmsOutput, bool) bool) error + DescribeAlarmsPagesWithContext(aws.Context, *cloudwatch.DescribeAlarmsInput, func(*cloudwatch.DescribeAlarmsOutput, bool) bool, ...request.Option) error + + DescribeAlarmsForMetric(*cloudwatch.DescribeAlarmsForMetricInput) (*cloudwatch.DescribeAlarmsForMetricOutput, error) + DescribeAlarmsForMetricWithContext(aws.Context, *cloudwatch.DescribeAlarmsForMetricInput, ...request.Option) (*cloudwatch.DescribeAlarmsForMetricOutput, error) + DescribeAlarmsForMetricRequest(*cloudwatch.DescribeAlarmsForMetricInput) (*request.Request, *cloudwatch.DescribeAlarmsForMetricOutput) + + DescribeAnomalyDetectors(*cloudwatch.DescribeAnomalyDetectorsInput) (*cloudwatch.DescribeAnomalyDetectorsOutput, error) + DescribeAnomalyDetectorsWithContext(aws.Context, *cloudwatch.DescribeAnomalyDetectorsInput, ...request.Option) (*cloudwatch.DescribeAnomalyDetectorsOutput, error) + DescribeAnomalyDetectorsRequest(*cloudwatch.DescribeAnomalyDetectorsInput) (*request.Request, *cloudwatch.DescribeAnomalyDetectorsOutput) + + DescribeAnomalyDetectorsPages(*cloudwatch.DescribeAnomalyDetectorsInput, func(*cloudwatch.DescribeAnomalyDetectorsOutput, bool) bool) error + DescribeAnomalyDetectorsPagesWithContext(aws.Context, *cloudwatch.DescribeAnomalyDetectorsInput, func(*cloudwatch.DescribeAnomalyDetectorsOutput, bool) bool, ...request.Option) error + + DescribeInsightRules(*cloudwatch.DescribeInsightRulesInput) (*cloudwatch.DescribeInsightRulesOutput, error) + DescribeInsightRulesWithContext(aws.Context, *cloudwatch.DescribeInsightRulesInput, ...request.Option) (*cloudwatch.DescribeInsightRulesOutput, error) + DescribeInsightRulesRequest(*cloudwatch.DescribeInsightRulesInput) (*request.Request, *cloudwatch.DescribeInsightRulesOutput) + + DescribeInsightRulesPages(*cloudwatch.DescribeInsightRulesInput, func(*cloudwatch.DescribeInsightRulesOutput, bool) bool) error + DescribeInsightRulesPagesWithContext(aws.Context, *cloudwatch.DescribeInsightRulesInput, func(*cloudwatch.DescribeInsightRulesOutput, bool) bool, ...request.Option) error + + DisableAlarmActions(*cloudwatch.DisableAlarmActionsInput) (*cloudwatch.DisableAlarmActionsOutput, error) + DisableAlarmActionsWithContext(aws.Context, *cloudwatch.DisableAlarmActionsInput, ...request.Option) (*cloudwatch.DisableAlarmActionsOutput, error) + DisableAlarmActionsRequest(*cloudwatch.DisableAlarmActionsInput) (*request.Request, *cloudwatch.DisableAlarmActionsOutput) + + DisableInsightRules(*cloudwatch.DisableInsightRulesInput) (*cloudwatch.DisableInsightRulesOutput, error) + DisableInsightRulesWithContext(aws.Context, *cloudwatch.DisableInsightRulesInput, ...request.Option) (*cloudwatch.DisableInsightRulesOutput, error) + DisableInsightRulesRequest(*cloudwatch.DisableInsightRulesInput) (*request.Request, *cloudwatch.DisableInsightRulesOutput) + + EnableAlarmActions(*cloudwatch.EnableAlarmActionsInput) (*cloudwatch.EnableAlarmActionsOutput, error) + EnableAlarmActionsWithContext(aws.Context, *cloudwatch.EnableAlarmActionsInput, ...request.Option) (*cloudwatch.EnableAlarmActionsOutput, error) + EnableAlarmActionsRequest(*cloudwatch.EnableAlarmActionsInput) (*request.Request, *cloudwatch.EnableAlarmActionsOutput) + + EnableInsightRules(*cloudwatch.EnableInsightRulesInput) (*cloudwatch.EnableInsightRulesOutput, error) + EnableInsightRulesWithContext(aws.Context, *cloudwatch.EnableInsightRulesInput, ...request.Option) (*cloudwatch.EnableInsightRulesOutput, error) + EnableInsightRulesRequest(*cloudwatch.EnableInsightRulesInput) (*request.Request, *cloudwatch.EnableInsightRulesOutput) + + GetDashboard(*cloudwatch.GetDashboardInput) (*cloudwatch.GetDashboardOutput, error) + GetDashboardWithContext(aws.Context, *cloudwatch.GetDashboardInput, ...request.Option) (*cloudwatch.GetDashboardOutput, error) + GetDashboardRequest(*cloudwatch.GetDashboardInput) (*request.Request, *cloudwatch.GetDashboardOutput) + + GetInsightRuleReport(*cloudwatch.GetInsightRuleReportInput) (*cloudwatch.GetInsightRuleReportOutput, error) + GetInsightRuleReportWithContext(aws.Context, *cloudwatch.GetInsightRuleReportInput, ...request.Option) (*cloudwatch.GetInsightRuleReportOutput, error) + GetInsightRuleReportRequest(*cloudwatch.GetInsightRuleReportInput) (*request.Request, *cloudwatch.GetInsightRuleReportOutput) + + GetMetricData(*cloudwatch.GetMetricDataInput) (*cloudwatch.GetMetricDataOutput, error) + GetMetricDataWithContext(aws.Context, *cloudwatch.GetMetricDataInput, ...request.Option) (*cloudwatch.GetMetricDataOutput, error) + GetMetricDataRequest(*cloudwatch.GetMetricDataInput) (*request.Request, *cloudwatch.GetMetricDataOutput) + + GetMetricDataPages(*cloudwatch.GetMetricDataInput, func(*cloudwatch.GetMetricDataOutput, bool) bool) error + GetMetricDataPagesWithContext(aws.Context, *cloudwatch.GetMetricDataInput, func(*cloudwatch.GetMetricDataOutput, bool) bool, ...request.Option) error + + GetMetricStatistics(*cloudwatch.GetMetricStatisticsInput) (*cloudwatch.GetMetricStatisticsOutput, error) + GetMetricStatisticsWithContext(aws.Context, *cloudwatch.GetMetricStatisticsInput, ...request.Option) (*cloudwatch.GetMetricStatisticsOutput, error) + GetMetricStatisticsRequest(*cloudwatch.GetMetricStatisticsInput) (*request.Request, *cloudwatch.GetMetricStatisticsOutput) + + GetMetricStream(*cloudwatch.GetMetricStreamInput) (*cloudwatch.GetMetricStreamOutput, error) + GetMetricStreamWithContext(aws.Context, *cloudwatch.GetMetricStreamInput, ...request.Option) (*cloudwatch.GetMetricStreamOutput, error) + GetMetricStreamRequest(*cloudwatch.GetMetricStreamInput) (*request.Request, *cloudwatch.GetMetricStreamOutput) + + GetMetricWidgetImage(*cloudwatch.GetMetricWidgetImageInput) (*cloudwatch.GetMetricWidgetImageOutput, error) + GetMetricWidgetImageWithContext(aws.Context, *cloudwatch.GetMetricWidgetImageInput, ...request.Option) (*cloudwatch.GetMetricWidgetImageOutput, error) + GetMetricWidgetImageRequest(*cloudwatch.GetMetricWidgetImageInput) (*request.Request, *cloudwatch.GetMetricWidgetImageOutput) + + ListDashboards(*cloudwatch.ListDashboardsInput) (*cloudwatch.ListDashboardsOutput, error) + ListDashboardsWithContext(aws.Context, *cloudwatch.ListDashboardsInput, ...request.Option) (*cloudwatch.ListDashboardsOutput, error) + ListDashboardsRequest(*cloudwatch.ListDashboardsInput) (*request.Request, *cloudwatch.ListDashboardsOutput) + + ListDashboardsPages(*cloudwatch.ListDashboardsInput, func(*cloudwatch.ListDashboardsOutput, bool) bool) error + ListDashboardsPagesWithContext(aws.Context, *cloudwatch.ListDashboardsInput, func(*cloudwatch.ListDashboardsOutput, bool) bool, ...request.Option) error + + ListMetricStreams(*cloudwatch.ListMetricStreamsInput) (*cloudwatch.ListMetricStreamsOutput, error) + ListMetricStreamsWithContext(aws.Context, *cloudwatch.ListMetricStreamsInput, ...request.Option) (*cloudwatch.ListMetricStreamsOutput, error) + ListMetricStreamsRequest(*cloudwatch.ListMetricStreamsInput) (*request.Request, *cloudwatch.ListMetricStreamsOutput) + + ListMetricStreamsPages(*cloudwatch.ListMetricStreamsInput, func(*cloudwatch.ListMetricStreamsOutput, bool) bool) error + ListMetricStreamsPagesWithContext(aws.Context, *cloudwatch.ListMetricStreamsInput, func(*cloudwatch.ListMetricStreamsOutput, bool) bool, ...request.Option) error + + ListMetrics(*cloudwatch.ListMetricsInput) (*cloudwatch.ListMetricsOutput, error) + ListMetricsWithContext(aws.Context, *cloudwatch.ListMetricsInput, ...request.Option) (*cloudwatch.ListMetricsOutput, error) + ListMetricsRequest(*cloudwatch.ListMetricsInput) (*request.Request, *cloudwatch.ListMetricsOutput) + + ListMetricsPages(*cloudwatch.ListMetricsInput, func(*cloudwatch.ListMetricsOutput, bool) bool) error + ListMetricsPagesWithContext(aws.Context, *cloudwatch.ListMetricsInput, func(*cloudwatch.ListMetricsOutput, bool) bool, ...request.Option) error + + ListTagsForResource(*cloudwatch.ListTagsForResourceInput) (*cloudwatch.ListTagsForResourceOutput, error) + ListTagsForResourceWithContext(aws.Context, *cloudwatch.ListTagsForResourceInput, ...request.Option) (*cloudwatch.ListTagsForResourceOutput, error) + ListTagsForResourceRequest(*cloudwatch.ListTagsForResourceInput) (*request.Request, *cloudwatch.ListTagsForResourceOutput) + + PutAnomalyDetector(*cloudwatch.PutAnomalyDetectorInput) (*cloudwatch.PutAnomalyDetectorOutput, error) + PutAnomalyDetectorWithContext(aws.Context, *cloudwatch.PutAnomalyDetectorInput, ...request.Option) (*cloudwatch.PutAnomalyDetectorOutput, error) + PutAnomalyDetectorRequest(*cloudwatch.PutAnomalyDetectorInput) (*request.Request, *cloudwatch.PutAnomalyDetectorOutput) + + PutCompositeAlarm(*cloudwatch.PutCompositeAlarmInput) (*cloudwatch.PutCompositeAlarmOutput, error) + PutCompositeAlarmWithContext(aws.Context, *cloudwatch.PutCompositeAlarmInput, ...request.Option) (*cloudwatch.PutCompositeAlarmOutput, error) + PutCompositeAlarmRequest(*cloudwatch.PutCompositeAlarmInput) (*request.Request, *cloudwatch.PutCompositeAlarmOutput) + + PutDashboard(*cloudwatch.PutDashboardInput) (*cloudwatch.PutDashboardOutput, error) + PutDashboardWithContext(aws.Context, *cloudwatch.PutDashboardInput, ...request.Option) (*cloudwatch.PutDashboardOutput, error) + PutDashboardRequest(*cloudwatch.PutDashboardInput) (*request.Request, *cloudwatch.PutDashboardOutput) + + PutInsightRule(*cloudwatch.PutInsightRuleInput) (*cloudwatch.PutInsightRuleOutput, error) + PutInsightRuleWithContext(aws.Context, *cloudwatch.PutInsightRuleInput, ...request.Option) (*cloudwatch.PutInsightRuleOutput, error) + PutInsightRuleRequest(*cloudwatch.PutInsightRuleInput) (*request.Request, *cloudwatch.PutInsightRuleOutput) + + PutMetricAlarm(*cloudwatch.PutMetricAlarmInput) (*cloudwatch.PutMetricAlarmOutput, error) + PutMetricAlarmWithContext(aws.Context, *cloudwatch.PutMetricAlarmInput, ...request.Option) (*cloudwatch.PutMetricAlarmOutput, error) + PutMetricAlarmRequest(*cloudwatch.PutMetricAlarmInput) (*request.Request, *cloudwatch.PutMetricAlarmOutput) + + PutMetricData(*cloudwatch.PutMetricDataInput) (*cloudwatch.PutMetricDataOutput, error) + PutMetricDataWithContext(aws.Context, *cloudwatch.PutMetricDataInput, ...request.Option) (*cloudwatch.PutMetricDataOutput, error) + PutMetricDataRequest(*cloudwatch.PutMetricDataInput) (*request.Request, *cloudwatch.PutMetricDataOutput) + + PutMetricStream(*cloudwatch.PutMetricStreamInput) (*cloudwatch.PutMetricStreamOutput, error) + PutMetricStreamWithContext(aws.Context, *cloudwatch.PutMetricStreamInput, ...request.Option) (*cloudwatch.PutMetricStreamOutput, error) + PutMetricStreamRequest(*cloudwatch.PutMetricStreamInput) (*request.Request, *cloudwatch.PutMetricStreamOutput) + + SetAlarmState(*cloudwatch.SetAlarmStateInput) (*cloudwatch.SetAlarmStateOutput, error) + SetAlarmStateWithContext(aws.Context, *cloudwatch.SetAlarmStateInput, ...request.Option) (*cloudwatch.SetAlarmStateOutput, error) + SetAlarmStateRequest(*cloudwatch.SetAlarmStateInput) (*request.Request, *cloudwatch.SetAlarmStateOutput) + + StartMetricStreams(*cloudwatch.StartMetricStreamsInput) (*cloudwatch.StartMetricStreamsOutput, error) + StartMetricStreamsWithContext(aws.Context, *cloudwatch.StartMetricStreamsInput, ...request.Option) (*cloudwatch.StartMetricStreamsOutput, error) + StartMetricStreamsRequest(*cloudwatch.StartMetricStreamsInput) (*request.Request, *cloudwatch.StartMetricStreamsOutput) + + StopMetricStreams(*cloudwatch.StopMetricStreamsInput) (*cloudwatch.StopMetricStreamsOutput, error) + StopMetricStreamsWithContext(aws.Context, *cloudwatch.StopMetricStreamsInput, ...request.Option) (*cloudwatch.StopMetricStreamsOutput, error) + StopMetricStreamsRequest(*cloudwatch.StopMetricStreamsInput) (*request.Request, *cloudwatch.StopMetricStreamsOutput) + + TagResource(*cloudwatch.TagResourceInput) (*cloudwatch.TagResourceOutput, error) + TagResourceWithContext(aws.Context, *cloudwatch.TagResourceInput, ...request.Option) (*cloudwatch.TagResourceOutput, error) + TagResourceRequest(*cloudwatch.TagResourceInput) (*request.Request, *cloudwatch.TagResourceOutput) + + UntagResource(*cloudwatch.UntagResourceInput) (*cloudwatch.UntagResourceOutput, error) + UntagResourceWithContext(aws.Context, *cloudwatch.UntagResourceInput, ...request.Option) (*cloudwatch.UntagResourceOutput, error) + UntagResourceRequest(*cloudwatch.UntagResourceInput) (*request.Request, *cloudwatch.UntagResourceOutput) + + WaitUntilAlarmExists(*cloudwatch.DescribeAlarmsInput) error + WaitUntilAlarmExistsWithContext(aws.Context, *cloudwatch.DescribeAlarmsInput, ...request.WaiterOption) error + + WaitUntilCompositeAlarmExists(*cloudwatch.DescribeAlarmsInput) error + WaitUntilCompositeAlarmExistsWithContext(aws.Context, *cloudwatch.DescribeAlarmsInput, ...request.WaiterOption) error +} + +var _ CloudWatchAPI = (*cloudwatch.CloudWatch)(nil) diff --git a/sdk/service/cloudwatch/doc.go b/sdk/service/cloudwatch/doc.go new file mode 100644 index 0000000000..deffff1b0a --- /dev/null +++ b/sdk/service/cloudwatch/doc.go @@ -0,0 +1,43 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package cloudwatch provides the client and types for making API +// requests to Amazon CloudWatch. +// +// Amazon CloudWatch monitors your Amazon Web Services (Amazon Web Services) +// resources and the applications you run on Amazon Web Services in real time. +// You can use CloudWatch to collect and track metrics, which are the variables +// you want to measure for your resources and applications. +// +// CloudWatch alarms send notifications or automatically change the resources +// you are monitoring based on rules that you define. For example, you can monitor +// the CPU usage and disk reads and writes of your Amazon EC2 instances. Then, +// use this data to determine whether you should launch additional instances +// to handle increased load. You can also use this data to stop under-used instances +// to save money. +// +// In addition to monitoring the built-in metrics that come with Amazon Web +// Services, you can monitor your own custom metrics. With CloudWatch, you gain +// system-wide visibility into resource utilization, application performance, +// and operational health. +// +// See https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01 for more information on this service. +// +// See cloudwatch package documentation for more information. +// https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatch/ +// +// # Using the Client +// +// To contact Amazon CloudWatch 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 client CloudWatch for more +// information on creating client for this service. +// https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatch/#New +package cloudwatch diff --git a/sdk/service/cloudwatch/errors.go b/sdk/service/cloudwatch/errors.go new file mode 100644 index 0000000000..77d0ded200 --- /dev/null +++ b/sdk/service/cloudwatch/errors.go @@ -0,0 +1,84 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudwatch + +const ( + + // ErrCodeConcurrentModificationException for service response error code + // "ConcurrentModificationException". + // + // More than one process tried to modify a resource at the same time. + ErrCodeConcurrentModificationException = "ConcurrentModificationException" + + // ErrCodeDashboardInvalidInputError for service response error code + // "InvalidParameterInput". + // + // Some part of the dashboard data is invalid. + ErrCodeDashboardInvalidInputError = "InvalidParameterInput" + + // ErrCodeDashboardNotFoundError for service response error code + // "ResourceNotFound". + // + // The specified dashboard does not exist. + ErrCodeDashboardNotFoundError = "ResourceNotFound" + + // ErrCodeInternalServiceFault for service response error code + // "InternalServiceError". + // + // Request processing has failed due to some unknown error, exception, or failure. + ErrCodeInternalServiceFault = "InternalServiceError" + + // ErrCodeInvalidFormatFault for service response error code + // "InvalidFormat". + // + // Data was not syntactically valid JSON. + ErrCodeInvalidFormatFault = "InvalidFormat" + + // ErrCodeInvalidNextToken for service response error code + // "InvalidNextToken". + // + // The next token specified is invalid. + ErrCodeInvalidNextToken = "InvalidNextToken" + + // ErrCodeInvalidParameterCombinationException for service response error code + // "InvalidParameterCombination". + // + // Parameters were used together that cannot be used together. + ErrCodeInvalidParameterCombinationException = "InvalidParameterCombination" + + // ErrCodeInvalidParameterValueException for service response error code + // "InvalidParameterValue". + // + // The value of an input parameter is bad or out-of-range. + ErrCodeInvalidParameterValueException = "InvalidParameterValue" + + // ErrCodeLimitExceededException for service response error code + // "LimitExceededException". + // + // The operation exceeded one or more limits. + ErrCodeLimitExceededException = "LimitExceededException" + + // ErrCodeLimitExceededFault for service response error code + // "LimitExceeded". + // + // The quota for alarms for this customer has already been reached. + ErrCodeLimitExceededFault = "LimitExceeded" + + // ErrCodeMissingRequiredParameterException for service response error code + // "MissingParameter". + // + // An input parameter that is required is missing. + ErrCodeMissingRequiredParameterException = "MissingParameter" + + // ErrCodeResourceNotFound for service response error code + // "ResourceNotFound". + // + // The named resource does not exist. + ErrCodeResourceNotFound = "ResourceNotFound" + + // ErrCodeResourceNotFoundException for service response error code + // "ResourceNotFoundException". + // + // The named resource does not exist. + ErrCodeResourceNotFoundException = "ResourceNotFoundException" +) diff --git a/sdk/service/cloudwatch/integ_test.go b/sdk/service/cloudwatch/integ_test.go new file mode 100644 index 0000000000..0e3952c1fe --- /dev/null +++ b/sdk/service/cloudwatch/integ_test.go @@ -0,0 +1,70 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +//go:build go1.16 && integration +// +build go1.16,integration + +package cloudwatch_test + +import ( + "context" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/awstesting/integration" + "github.com/aws/aws-sdk-go/service/cloudwatch" +) + +var _ aws.Config +var _ awserr.Error +var _ request.Request + +func TestInteg_00_ListMetrics(t *testing.T) { + ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second) + defer cancelFn() + + sess := integration.SessionWithDefaultRegion("us-west-2") + svc := cloudwatch.New(sess) + params := &cloudwatch.ListMetricsInput{ + Namespace: aws.String("AWS/EC2"), + } + _, err := svc.ListMetricsWithContext(ctx, params, func(r *request.Request) { + r.Handlers.Validate.RemoveByName("core.ValidateParametersHandler") + }) + if err != nil { + t.Errorf("expect no error, got %v", err) + } +} +func TestInteg_01_SetAlarmState(t *testing.T) { + ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second) + defer cancelFn() + + sess := integration.SessionWithDefaultRegion("us-west-2") + svc := cloudwatch.New(sess) + params := &cloudwatch.SetAlarmStateInput{ + AlarmName: aws.String("abc"), + StateReason: aws.String("xyz"), + StateValue: aws.String("mno"), + } + _, err := svc.SetAlarmStateWithContext(ctx, params, func(r *request.Request) { + r.Handlers.Validate.RemoveByName("core.ValidateParametersHandler") + }) + if err == nil { + t.Fatalf("expect request to fail") + } + aerr, ok := err.(awserr.RequestFailure) + if !ok { + t.Fatalf("expect awserr, was %T", err) + } + if len(aerr.Code()) == 0 { + t.Errorf("expect non-empty error code") + } + if len(aerr.Message()) == 0 { + t.Errorf("expect non-empty error message") + } + if v := aerr.Code(); v == request.ErrCodeSerialization { + t.Errorf("expect API error code got serialization failure") + } +} diff --git a/sdk/service/cloudwatch/service.go b/sdk/service/cloudwatch/service.go new file mode 100644 index 0000000000..a581f22a33 --- /dev/null +++ b/sdk/service/cloudwatch/service.go @@ -0,0 +1,104 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudwatch + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" + v4 "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/private/protocol/query" +) + +// CloudWatch provides the API operation methods for making requests to +// Amazon CloudWatch. See this package's package overview docs +// for details on the service. +// +// CloudWatch methods are safe to use concurrently. It is not safe to +// modify mutate any of the struct's properties though. +type CloudWatch struct { + *client.Client +} + +// Used for custom client initialization logic +var initClient func(*client.Client) + +// Used for custom request initialization logic +var initRequest func(*request.Request) + +// Service information constants +const ( + ServiceName = "monitoring" // Name of service. + EndpointsID = ServiceName // ID to lookup a service endpoint with. + ServiceID = "CloudWatch" // ServiceID is a unique identifier of a specific service. +) + +// New creates a new instance of the CloudWatch client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// +// mySession := session.Must(session.NewSession()) +// +// // Create a CloudWatch client from just a session. +// svc := cloudwatch.New(mySession) +// +// // Create a CloudWatch client with additional configuration +// svc := cloudwatch.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudWatch { + c := p.ClientConfig(EndpointsID, cfgs...) + if c.SigningNameDerived || len(c.SigningName) == 0 { + c.SigningName = EndpointsID + // No Fallback + } + return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *CloudWatch { + svc := &CloudWatch{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + ServiceID: ServiceID, + SigningName: signingName, + SigningRegion: signingRegion, + PartitionID: partitionID, + Endpoint: endpoint, + APIVersion: "2010-08-01", + ResolvedRegion: resolvedRegion, + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) + } + + return svc +} + +// newRequest creates a new request for a CloudWatch operation and runs any +// custom request initialization. +func (c *CloudWatch) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(req) + } + + return req +} diff --git a/sdk/service/cloudwatch/waiters.go b/sdk/service/cloudwatch/waiters.go new file mode 100644 index 0000000000..164d306c45 --- /dev/null +++ b/sdk/service/cloudwatch/waiters.go @@ -0,0 +1,102 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudwatch + +import ( + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" +) + +// WaitUntilAlarmExists uses the CloudWatch API operation +// DescribeAlarms to wait for a condition to be met before returning. +// If the condition is not met within the max attempt window, an error will +// be returned. +func (c *CloudWatch) WaitUntilAlarmExists(input *DescribeAlarmsInput) error { + return c.WaitUntilAlarmExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilAlarmExistsWithContext is an extended version of WaitUntilAlarmExists. +// With the support for passing in a context and options to configure the +// Waiter and the underlying request options. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) WaitUntilAlarmExistsWithContext(ctx aws.Context, input *DescribeAlarmsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilAlarmExists", + MaxAttempts: 40, + Delay: request.ConstantWaiterDelay(5 * time.Second), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "length(MetricAlarms[]) > `0`", + Expected: true, + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeAlarmsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeAlarmsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} + +// WaitUntilCompositeAlarmExists uses the CloudWatch API operation +// DescribeAlarms to wait for a condition to be met before returning. +// If the condition is not met within the max attempt window, an error will +// be returned. +func (c *CloudWatch) WaitUntilCompositeAlarmExists(input *DescribeAlarmsInput) error { + return c.WaitUntilCompositeAlarmExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilCompositeAlarmExistsWithContext is an extended version of WaitUntilCompositeAlarmExists. +// With the support for passing in a context and options to configure the +// Waiter and the underlying request options. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatch) WaitUntilCompositeAlarmExistsWithContext(ctx aws.Context, input *DescribeAlarmsInput, opts ...request.WaiterOption) error { + w := request.Waiter{ + Name: "WaitUntilCompositeAlarmExists", + MaxAttempts: 40, + Delay: request.ConstantWaiterDelay(5 * time.Second), + Acceptors: []request.WaiterAcceptor{ + { + State: request.SuccessWaiterState, + Matcher: request.PathWaiterMatch, Argument: "length(CompositeAlarms[]) > `0`", + Expected: true, + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []request.Option) (*request.Request, error) { + var inCpy *DescribeAlarmsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeAlarmsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} diff --git a/sdk/service/cloudwatchlogs/api.go b/sdk/service/cloudwatchlogs/api.go new file mode 100644 index 0000000000..f9e564e960 --- /dev/null +++ b/sdk/service/cloudwatchlogs/api.go @@ -0,0 +1,21522 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudwatchlogs + +import ( + "bytes" + "fmt" + "io" + "sync" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/eventstream" + "github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" + "github.com/aws/aws-sdk-go/private/protocol/rest" +) + +const opAssociateKmsKey = "AssociateKmsKey" + +// AssociateKmsKeyRequest generates a "aws/request.Request" representing the +// client's request for the AssociateKmsKey operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See AssociateKmsKey for more information on using the AssociateKmsKey +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the AssociateKmsKeyRequest method. +// req, resp := client.AssociateKmsKeyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/AssociateKmsKey +func (c *CloudWatchLogs) AssociateKmsKeyRequest(input *AssociateKmsKeyInput) (req *request.Request, output *AssociateKmsKeyOutput) { + op := &request.Operation{ + Name: opAssociateKmsKey, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &AssociateKmsKeyInput{} + } + + output = &AssociateKmsKeyOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// AssociateKmsKey API operation for Amazon CloudWatch Logs. +// +// Associates the specified KMS key with either one log group in the account, +// or with all stored CloudWatch Logs query insights results in the account. +// +// When you use AssociateKmsKey, you specify either the logGroupName parameter +// or the resourceIdentifier parameter. You can't specify both of those parameters +// in the same operation. +// +// - Specify the logGroupName parameter to cause all log events stored in +// the log group to be encrypted with that key. Only the log events ingested +// after the key is associated are encrypted with that key. Associating a +// KMS key with a log group overrides any existing associations between the +// log group and a KMS key. After a KMS key is associated with a log group, +// all newly ingested data for the log group is encrypted using the KMS key. +// This association is stored as long as the data encrypted with the KMS +// key is still within CloudWatch Logs. This enables CloudWatch Logs to decrypt +// this data whenever it is requested. Associating a key with a log group +// does not cause the results of queries of that log group to be encrypted +// with that key. To have query results encrypted with a KMS key, you must +// use an AssociateKmsKey operation with the resourceIdentifier parameter +// that specifies a query-result resource. +// +// - Specify the resourceIdentifier parameter with a query-result resource, +// to use that key to encrypt the stored results of all future StartQuery +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html) +// operations in the account. The response from a GetQueryResults (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetQueryResults.html) +// operation will still return the query results in plain text. Even if you +// have not associated a key with your query results, the query results are +// encrypted when stored, using the default CloudWatch Logs method. If you +// run a query from a monitoring account that queries logs in a source account, +// the query results key from the monitoring account, if any, is used. +// +// If you delete the key that is used to encrypt log events or log group query +// results, then all the associated stored log events or query results that +// were encrypted with that key will be unencryptable and unusable. +// +// CloudWatch Logs supports only symmetric KMS keys. Do not use an associate +// an asymmetric KMS key with your log group or query results. For more information, +// see Using Symmetric and Asymmetric Keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html). +// +// It can take up to 5 minutes for this operation to take effect. +// +// If you attempt to associate a KMS key with a log group but the KMS key does +// not exist or the KMS key is disabled, you receive an InvalidParameterException +// error. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation AssociateKmsKey for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/AssociateKmsKey +func (c *CloudWatchLogs) AssociateKmsKey(input *AssociateKmsKeyInput) (*AssociateKmsKeyOutput, error) { + req, out := c.AssociateKmsKeyRequest(input) + return out, req.Send() +} + +// AssociateKmsKeyWithContext is the same as AssociateKmsKey with the addition of +// the ability to pass a context and additional request options. +// +// See AssociateKmsKey for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) AssociateKmsKeyWithContext(ctx aws.Context, input *AssociateKmsKeyInput, opts ...request.Option) (*AssociateKmsKeyOutput, error) { + req, out := c.AssociateKmsKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCancelExportTask = "CancelExportTask" + +// CancelExportTaskRequest generates a "aws/request.Request" representing the +// client's request for the CancelExportTask operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CancelExportTask for more information on using the CancelExportTask +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the CancelExportTaskRequest method. +// req, resp := client.CancelExportTaskRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CancelExportTask +func (c *CloudWatchLogs) CancelExportTaskRequest(input *CancelExportTaskInput) (req *request.Request, output *CancelExportTaskOutput) { + op := &request.Operation{ + Name: opCancelExportTask, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CancelExportTaskInput{} + } + + output = &CancelExportTaskOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// CancelExportTask API operation for Amazon CloudWatch Logs. +// +// Cancels the specified export task. +// +// The task must be in the PENDING or RUNNING state. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation CancelExportTask for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - InvalidOperationException +// The operation is not valid on the specified resource. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CancelExportTask +func (c *CloudWatchLogs) CancelExportTask(input *CancelExportTaskInput) (*CancelExportTaskOutput, error) { + req, out := c.CancelExportTaskRequest(input) + return out, req.Send() +} + +// CancelExportTaskWithContext is the same as CancelExportTask with the addition of +// the ability to pass a context and additional request options. +// +// See CancelExportTask for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) CancelExportTaskWithContext(ctx aws.Context, input *CancelExportTaskInput, opts ...request.Option) (*CancelExportTaskOutput, error) { + req, out := c.CancelExportTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateDelivery = "CreateDelivery" + +// CreateDeliveryRequest generates a "aws/request.Request" representing the +// client's request for the CreateDelivery operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateDelivery for more information on using the CreateDelivery +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the CreateDeliveryRequest method. +// req, resp := client.CreateDeliveryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateDelivery +func (c *CloudWatchLogs) CreateDeliveryRequest(input *CreateDeliveryInput) (req *request.Request, output *CreateDeliveryOutput) { + op := &request.Operation{ + Name: opCreateDelivery, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateDeliveryInput{} + } + + output = &CreateDeliveryOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateDelivery API operation for Amazon CloudWatch Logs. +// +// Creates a delivery. A delivery is a connection between a logical delivery +// source and a logical delivery destination that you have already created. +// +// Only some Amazon Web Services services support being configured as a delivery +// source using this operation. These services are listed as Supported [V2 Permissions] +// in the table at Enabling logging from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html) +// +// A delivery destination can represent a log group in CloudWatch Logs, an Amazon +// S3 bucket, or a delivery stream in Firehose. +// +// To configure logs delivery between a supported Amazon Web Services service +// and a destination, you must do the following: +// +// - Create a delivery source, which is a logical object that represents +// the resource that is actually sending the logs. For more information, +// see PutDeliverySource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html). +// +// - Create a delivery destination, which is a logical object that represents +// the actual delivery destination. For more information, see PutDeliveryDestination +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html). +// +// - If you are delivering logs cross-account, you must use PutDeliveryDestinationPolicy +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html) +// in the destination account to assign an IAM policy to the destination. +// This policy allows delivery to that destination. +// +// - Use CreateDelivery to create a delivery by pairing exactly one delivery +// source and one delivery destination. +// +// You can configure a single delivery source to send logs to multiple destinations +// by creating multiple deliveries. You can also create multiple deliveries +// to configure multiple delivery sources to send logs to the same delivery +// destination. +// +// You can't update an existing delivery. You can only create and delete deliveries. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation CreateDelivery for usage and error information. +// +// Returned Error Types: +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ConflictException +// This operation attempted to create a resource that already exists. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - AccessDeniedException +// You don't have sufficient permissions to perform this action. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateDelivery +func (c *CloudWatchLogs) CreateDelivery(input *CreateDeliveryInput) (*CreateDeliveryOutput, error) { + req, out := c.CreateDeliveryRequest(input) + return out, req.Send() +} + +// CreateDeliveryWithContext is the same as CreateDelivery with the addition of +// the ability to pass a context and additional request options. +// +// See CreateDelivery for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) CreateDeliveryWithContext(ctx aws.Context, input *CreateDeliveryInput, opts ...request.Option) (*CreateDeliveryOutput, error) { + req, out := c.CreateDeliveryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateExportTask = "CreateExportTask" + +// CreateExportTaskRequest generates a "aws/request.Request" representing the +// client's request for the CreateExportTask operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateExportTask for more information on using the CreateExportTask +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the CreateExportTaskRequest method. +// req, resp := client.CreateExportTaskRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateExportTask +func (c *CloudWatchLogs) CreateExportTaskRequest(input *CreateExportTaskInput) (req *request.Request, output *CreateExportTaskOutput) { + op := &request.Operation{ + Name: opCreateExportTask, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateExportTaskInput{} + } + + output = &CreateExportTaskOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateExportTask API operation for Amazon CloudWatch Logs. +// +// Creates an export task so that you can efficiently export data from a log +// group to an Amazon S3 bucket. When you perform a CreateExportTask operation, +// you must use credentials that have permission to write to the S3 bucket that +// you specify as the destination. +// +// Exporting log data to S3 buckets that are encrypted by KMS is supported. +// Exporting log data to Amazon S3 buckets that have S3 Object Lock enabled +// with a retention period is also supported. +// +// Exporting to S3 buckets that are encrypted with AES-256 is supported. +// +// This is an asynchronous call. If all the required information is provided, +// this operation initiates an export task and responds with the ID of the task. +// After the task has started, you can use DescribeExportTasks (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeExportTasks.html) +// to get the status of the export task. Each account can only have one active +// (RUNNING or PENDING) export task at a time. To cancel an export task, use +// CancelExportTask (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CancelExportTask.html). +// +// You can export logs from multiple log groups or multiple time ranges to the +// same S3 bucket. To separate log data for each export task, specify a prefix +// to be used as the Amazon S3 key prefix for all exported objects. +// +// Time-based sorting on chunks of log data inside an exported file is not guaranteed. +// You can sort the exported log field data by using Linux utilities. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation CreateExportTask for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ResourceAlreadyExistsException +// The specified resource already exists. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateExportTask +func (c *CloudWatchLogs) CreateExportTask(input *CreateExportTaskInput) (*CreateExportTaskOutput, error) { + req, out := c.CreateExportTaskRequest(input) + return out, req.Send() +} + +// CreateExportTaskWithContext is the same as CreateExportTask with the addition of +// the ability to pass a context and additional request options. +// +// See CreateExportTask for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) CreateExportTaskWithContext(ctx aws.Context, input *CreateExportTaskInput, opts ...request.Option) (*CreateExportTaskOutput, error) { + req, out := c.CreateExportTaskRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateLogAnomalyDetector = "CreateLogAnomalyDetector" + +// CreateLogAnomalyDetectorRequest generates a "aws/request.Request" representing the +// client's request for the CreateLogAnomalyDetector operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateLogAnomalyDetector for more information on using the CreateLogAnomalyDetector +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the CreateLogAnomalyDetectorRequest method. +// req, resp := client.CreateLogAnomalyDetectorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogAnomalyDetector +func (c *CloudWatchLogs) CreateLogAnomalyDetectorRequest(input *CreateLogAnomalyDetectorInput) (req *request.Request, output *CreateLogAnomalyDetectorOutput) { + op := &request.Operation{ + Name: opCreateLogAnomalyDetector, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateLogAnomalyDetectorInput{} + } + + output = &CreateLogAnomalyDetectorOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateLogAnomalyDetector API operation for Amazon CloudWatch Logs. +// +// Creates an anomaly detector that regularly scans one or more log groups and +// look for patterns and anomalies in the logs. +// +// An anomaly detector can help surface issues by automatically discovering +// anomalies in your log event traffic. An anomaly detector uses machine learning +// algorithms to scan log events and find patterns. A pattern is a shared text +// structure that recurs among your log fields. Patterns provide a useful tool +// for analyzing large sets of logs because a large number of log events can +// often be compressed into a few patterns. +// +// The anomaly detector uses pattern recognition to find anomalies, which are +// unusual log events. It uses the evaluationFrequency to compare current log +// events and patterns with trained baselines. +// +// Fields within a pattern are called tokens. Fields that vary within a pattern, +// such as a request ID or timestamp, are referred to as dynamic tokens and +// represented by <*>. +// +// The following is an example of a pattern: +// +// [INFO] Request time: <*> ms +// +// This pattern represents log events like [INFO] Request time: 327 ms and other +// similar log events that differ only by the number, in this csse 327. When +// the pattern is displayed, the different numbers are replaced by <*> +// +// Any parts of log events that are masked as sensitive data are not scanned +// for anomalies. For more information about masking sensitive data, see Help +// protect sensitive log data with masking (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation CreateLogAnomalyDetector for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogAnomalyDetector +func (c *CloudWatchLogs) CreateLogAnomalyDetector(input *CreateLogAnomalyDetectorInput) (*CreateLogAnomalyDetectorOutput, error) { + req, out := c.CreateLogAnomalyDetectorRequest(input) + return out, req.Send() +} + +// CreateLogAnomalyDetectorWithContext is the same as CreateLogAnomalyDetector with the addition of +// the ability to pass a context and additional request options. +// +// See CreateLogAnomalyDetector for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) CreateLogAnomalyDetectorWithContext(ctx aws.Context, input *CreateLogAnomalyDetectorInput, opts ...request.Option) (*CreateLogAnomalyDetectorOutput, error) { + req, out := c.CreateLogAnomalyDetectorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateLogGroup = "CreateLogGroup" + +// CreateLogGroupRequest generates a "aws/request.Request" representing the +// client's request for the CreateLogGroup operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateLogGroup for more information on using the CreateLogGroup +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the CreateLogGroupRequest method. +// req, resp := client.CreateLogGroupRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogGroup +func (c *CloudWatchLogs) CreateLogGroupRequest(input *CreateLogGroupInput) (req *request.Request, output *CreateLogGroupOutput) { + op := &request.Operation{ + Name: opCreateLogGroup, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateLogGroupInput{} + } + + output = &CreateLogGroupOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// CreateLogGroup API operation for Amazon CloudWatch Logs. +// +// Creates a log group with the specified name. You can create up to 1,000,000 +// log groups per Region per account. +// +// You must use the following guidelines when naming a log group: +// +// - Log group names must be unique within a Region for an Amazon Web Services +// account. +// +// - Log group names can be between 1 and 512 characters long. +// +// - Log group names consist of the following characters: a-z, A-Z, 0-9, +// '_' (underscore), '-' (hyphen), '/' (forward slash), '.' (period), and +// '#' (number sign) +// +// - Log group names can't start with the string aws/ +// +// When you create a log group, by default the log events in the log group do +// not expire. To set a retention policy so that events expire and are deleted +// after a specified time, use PutRetentionPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutRetentionPolicy.html). +// +// If you associate an KMS key with the log group, ingested data is encrypted +// using the KMS key. This association is stored as long as the data encrypted +// with the KMS key is still within CloudWatch Logs. This enables CloudWatch +// Logs to decrypt this data whenever it is requested. +// +// If you attempt to associate a KMS key with the log group but the KMS key +// does not exist or the KMS key is disabled, you receive an InvalidParameterException +// error. +// +// CloudWatch Logs supports only symmetric KMS keys. Do not associate an asymmetric +// KMS key with your log group. For more information, see Using Symmetric and +// Asymmetric Keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation CreateLogGroup for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceAlreadyExistsException +// The specified resource already exists. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogGroup +func (c *CloudWatchLogs) CreateLogGroup(input *CreateLogGroupInput) (*CreateLogGroupOutput, error) { + req, out := c.CreateLogGroupRequest(input) + return out, req.Send() +} + +// CreateLogGroupWithContext is the same as CreateLogGroup with the addition of +// the ability to pass a context and additional request options. +// +// See CreateLogGroup for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) CreateLogGroupWithContext(ctx aws.Context, input *CreateLogGroupInput, opts ...request.Option) (*CreateLogGroupOutput, error) { + req, out := c.CreateLogGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateLogStream = "CreateLogStream" + +// CreateLogStreamRequest generates a "aws/request.Request" representing the +// client's request for the CreateLogStream operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateLogStream for more information on using the CreateLogStream +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the CreateLogStreamRequest method. +// req, resp := client.CreateLogStreamRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogStream +func (c *CloudWatchLogs) CreateLogStreamRequest(input *CreateLogStreamInput) (req *request.Request, output *CreateLogStreamOutput) { + op := &request.Operation{ + Name: opCreateLogStream, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateLogStreamInput{} + } + + output = &CreateLogStreamOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// CreateLogStream API operation for Amazon CloudWatch Logs. +// +// Creates a log stream for the specified log group. A log stream is a sequence +// of log events that originate from a single source, such as an application +// instance or a resource that is being monitored. +// +// There is no limit on the number of log streams that you can create for a +// log group. There is a limit of 50 TPS on CreateLogStream operations, after +// which transactions are throttled. +// +// You must use the following guidelines when naming a log stream: +// +// - Log stream names must be unique within the log group. +// +// - Log stream names can be between 1 and 512 characters long. +// +// - Don't use ':' (colon) or '*' (asterisk) characters. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation CreateLogStream for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceAlreadyExistsException +// The specified resource already exists. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogStream +func (c *CloudWatchLogs) CreateLogStream(input *CreateLogStreamInput) (*CreateLogStreamOutput, error) { + req, out := c.CreateLogStreamRequest(input) + return out, req.Send() +} + +// CreateLogStreamWithContext is the same as CreateLogStream with the addition of +// the ability to pass a context and additional request options. +// +// See CreateLogStream for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) CreateLogStreamWithContext(ctx aws.Context, input *CreateLogStreamInput, opts ...request.Option) (*CreateLogStreamOutput, error) { + req, out := c.CreateLogStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteAccountPolicy = "DeleteAccountPolicy" + +// DeleteAccountPolicyRequest generates a "aws/request.Request" representing the +// client's request for the DeleteAccountPolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteAccountPolicy for more information on using the DeleteAccountPolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteAccountPolicyRequest method. +// req, resp := client.DeleteAccountPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteAccountPolicy +func (c *CloudWatchLogs) DeleteAccountPolicyRequest(input *DeleteAccountPolicyInput) (req *request.Request, output *DeleteAccountPolicyOutput) { + op := &request.Operation{ + Name: opDeleteAccountPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteAccountPolicyInput{} + } + + output = &DeleteAccountPolicyOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteAccountPolicy API operation for Amazon CloudWatch Logs. +// +// Deletes a CloudWatch Logs account policy. This stops the policy from applying +// to all log groups or a subset of log groups in the account. Log-group level +// policies will still be in effect. +// +// To use this operation, you must be signed on with the correct permissions +// depending on the type of policy that you are deleting. +// +// - To delete a data protection policy, you must have the logs:DeleteDataProtectionPolicy +// and logs:DeleteAccountPolicy permissions. +// +// - To delete a subscription filter policy, you must have the logs:DeleteSubscriptionFilter +// and logs:DeleteAccountPolicy permissions. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteAccountPolicy for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteAccountPolicy +func (c *CloudWatchLogs) DeleteAccountPolicy(input *DeleteAccountPolicyInput) (*DeleteAccountPolicyOutput, error) { + req, out := c.DeleteAccountPolicyRequest(input) + return out, req.Send() +} + +// DeleteAccountPolicyWithContext is the same as DeleteAccountPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteAccountPolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteAccountPolicyWithContext(ctx aws.Context, input *DeleteAccountPolicyInput, opts ...request.Option) (*DeleteAccountPolicyOutput, error) { + req, out := c.DeleteAccountPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteDataProtectionPolicy = "DeleteDataProtectionPolicy" + +// DeleteDataProtectionPolicyRequest generates a "aws/request.Request" representing the +// client's request for the DeleteDataProtectionPolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteDataProtectionPolicy for more information on using the DeleteDataProtectionPolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteDataProtectionPolicyRequest method. +// req, resp := client.DeleteDataProtectionPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDataProtectionPolicy +func (c *CloudWatchLogs) DeleteDataProtectionPolicyRequest(input *DeleteDataProtectionPolicyInput) (req *request.Request, output *DeleteDataProtectionPolicyOutput) { + op := &request.Operation{ + Name: opDeleteDataProtectionPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteDataProtectionPolicyInput{} + } + + output = &DeleteDataProtectionPolicyOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteDataProtectionPolicy API operation for Amazon CloudWatch Logs. +// +// Deletes the data protection policy from the specified log group. +// +// For more information about data protection policies, see PutDataProtectionPolicy +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDataProtectionPolicy.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteDataProtectionPolicy for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDataProtectionPolicy +func (c *CloudWatchLogs) DeleteDataProtectionPolicy(input *DeleteDataProtectionPolicyInput) (*DeleteDataProtectionPolicyOutput, error) { + req, out := c.DeleteDataProtectionPolicyRequest(input) + return out, req.Send() +} + +// DeleteDataProtectionPolicyWithContext is the same as DeleteDataProtectionPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDataProtectionPolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteDataProtectionPolicyWithContext(ctx aws.Context, input *DeleteDataProtectionPolicyInput, opts ...request.Option) (*DeleteDataProtectionPolicyOutput, error) { + req, out := c.DeleteDataProtectionPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteDelivery = "DeleteDelivery" + +// DeleteDeliveryRequest generates a "aws/request.Request" representing the +// client's request for the DeleteDelivery operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteDelivery for more information on using the DeleteDelivery +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteDeliveryRequest method. +// req, resp := client.DeleteDeliveryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDelivery +func (c *CloudWatchLogs) DeleteDeliveryRequest(input *DeleteDeliveryInput) (req *request.Request, output *DeleteDeliveryOutput) { + op := &request.Operation{ + Name: opDeleteDelivery, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteDeliveryInput{} + } + + output = &DeleteDeliveryOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteDelivery API operation for Amazon CloudWatch Logs. +// +// Deletes s delivery. A delivery is a connection between a logical delivery +// source and a logical delivery destination. Deleting a delivery only deletes +// the connection between the delivery source and delivery destination. It does +// not delete the delivery destination or the delivery source. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteDelivery for usage and error information. +// +// Returned Error Types: +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ConflictException +// This operation attempted to create a resource that already exists. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDelivery +func (c *CloudWatchLogs) DeleteDelivery(input *DeleteDeliveryInput) (*DeleteDeliveryOutput, error) { + req, out := c.DeleteDeliveryRequest(input) + return out, req.Send() +} + +// DeleteDeliveryWithContext is the same as DeleteDelivery with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDelivery for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteDeliveryWithContext(ctx aws.Context, input *DeleteDeliveryInput, opts ...request.Option) (*DeleteDeliveryOutput, error) { + req, out := c.DeleteDeliveryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteDeliveryDestination = "DeleteDeliveryDestination" + +// DeleteDeliveryDestinationRequest generates a "aws/request.Request" representing the +// client's request for the DeleteDeliveryDestination operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteDeliveryDestination for more information on using the DeleteDeliveryDestination +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteDeliveryDestinationRequest method. +// req, resp := client.DeleteDeliveryDestinationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDeliveryDestination +func (c *CloudWatchLogs) DeleteDeliveryDestinationRequest(input *DeleteDeliveryDestinationInput) (req *request.Request, output *DeleteDeliveryDestinationOutput) { + op := &request.Operation{ + Name: opDeleteDeliveryDestination, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteDeliveryDestinationInput{} + } + + output = &DeleteDeliveryDestinationOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteDeliveryDestination API operation for Amazon CloudWatch Logs. +// +// Deletes a delivery destination. A delivery is a connection between a logical +// delivery source and a logical delivery destination. +// +// You can't delete a delivery destination if any current deliveries are associated +// with it. To find whether any deliveries are associated with this delivery +// destination, use the DescribeDeliveries (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeDeliveries.html) +// operation and check the deliveryDestinationArn field in the results. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteDeliveryDestination for usage and error information. +// +// Returned Error Types: +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ConflictException +// This operation attempted to create a resource that already exists. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDeliveryDestination +func (c *CloudWatchLogs) DeleteDeliveryDestination(input *DeleteDeliveryDestinationInput) (*DeleteDeliveryDestinationOutput, error) { + req, out := c.DeleteDeliveryDestinationRequest(input) + return out, req.Send() +} + +// DeleteDeliveryDestinationWithContext is the same as DeleteDeliveryDestination with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDeliveryDestination for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteDeliveryDestinationWithContext(ctx aws.Context, input *DeleteDeliveryDestinationInput, opts ...request.Option) (*DeleteDeliveryDestinationOutput, error) { + req, out := c.DeleteDeliveryDestinationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteDeliveryDestinationPolicy = "DeleteDeliveryDestinationPolicy" + +// DeleteDeliveryDestinationPolicyRequest generates a "aws/request.Request" representing the +// client's request for the DeleteDeliveryDestinationPolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteDeliveryDestinationPolicy for more information on using the DeleteDeliveryDestinationPolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteDeliveryDestinationPolicyRequest method. +// req, resp := client.DeleteDeliveryDestinationPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDeliveryDestinationPolicy +func (c *CloudWatchLogs) DeleteDeliveryDestinationPolicyRequest(input *DeleteDeliveryDestinationPolicyInput) (req *request.Request, output *DeleteDeliveryDestinationPolicyOutput) { + op := &request.Operation{ + Name: opDeleteDeliveryDestinationPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteDeliveryDestinationPolicyInput{} + } + + output = &DeleteDeliveryDestinationPolicyOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteDeliveryDestinationPolicy API operation for Amazon CloudWatch Logs. +// +// Deletes a delivery destination policy. For more information about these policies, +// see PutDeliveryDestinationPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteDeliveryDestinationPolicy for usage and error information. +// +// Returned Error Types: +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ConflictException +// This operation attempted to create a resource that already exists. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDeliveryDestinationPolicy +func (c *CloudWatchLogs) DeleteDeliveryDestinationPolicy(input *DeleteDeliveryDestinationPolicyInput) (*DeleteDeliveryDestinationPolicyOutput, error) { + req, out := c.DeleteDeliveryDestinationPolicyRequest(input) + return out, req.Send() +} + +// DeleteDeliveryDestinationPolicyWithContext is the same as DeleteDeliveryDestinationPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDeliveryDestinationPolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteDeliveryDestinationPolicyWithContext(ctx aws.Context, input *DeleteDeliveryDestinationPolicyInput, opts ...request.Option) (*DeleteDeliveryDestinationPolicyOutput, error) { + req, out := c.DeleteDeliveryDestinationPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteDeliverySource = "DeleteDeliverySource" + +// DeleteDeliverySourceRequest generates a "aws/request.Request" representing the +// client's request for the DeleteDeliverySource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteDeliverySource for more information on using the DeleteDeliverySource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteDeliverySourceRequest method. +// req, resp := client.DeleteDeliverySourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDeliverySource +func (c *CloudWatchLogs) DeleteDeliverySourceRequest(input *DeleteDeliverySourceInput) (req *request.Request, output *DeleteDeliverySourceOutput) { + op := &request.Operation{ + Name: opDeleteDeliverySource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteDeliverySourceInput{} + } + + output = &DeleteDeliverySourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteDeliverySource API operation for Amazon CloudWatch Logs. +// +// Deletes a delivery source. A delivery is a connection between a logical delivery +// source and a logical delivery destination. +// +// You can't delete a delivery source if any current deliveries are associated +// with it. To find whether any deliveries are associated with this delivery +// source, use the DescribeDeliveries (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeDeliveries.html) +// operation and check the deliverySourceName field in the results. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteDeliverySource for usage and error information. +// +// Returned Error Types: +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ConflictException +// This operation attempted to create a resource that already exists. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDeliverySource +func (c *CloudWatchLogs) DeleteDeliverySource(input *DeleteDeliverySourceInput) (*DeleteDeliverySourceOutput, error) { + req, out := c.DeleteDeliverySourceRequest(input) + return out, req.Send() +} + +// DeleteDeliverySourceWithContext is the same as DeleteDeliverySource with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDeliverySource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteDeliverySourceWithContext(ctx aws.Context, input *DeleteDeliverySourceInput, opts ...request.Option) (*DeleteDeliverySourceOutput, error) { + req, out := c.DeleteDeliverySourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteDestination = "DeleteDestination" + +// DeleteDestinationRequest generates a "aws/request.Request" representing the +// client's request for the DeleteDestination operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteDestination for more information on using the DeleteDestination +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteDestinationRequest method. +// req, resp := client.DeleteDestinationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDestination +func (c *CloudWatchLogs) DeleteDestinationRequest(input *DeleteDestinationInput) (req *request.Request, output *DeleteDestinationOutput) { + op := &request.Operation{ + Name: opDeleteDestination, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteDestinationInput{} + } + + output = &DeleteDestinationOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteDestination API operation for Amazon CloudWatch Logs. +// +// Deletes the specified destination, and eventually disables all the subscription +// filters that publish to it. This operation does not delete the physical resource +// encapsulated by the destination. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteDestination for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDestination +func (c *CloudWatchLogs) DeleteDestination(input *DeleteDestinationInput) (*DeleteDestinationOutput, error) { + req, out := c.DeleteDestinationRequest(input) + return out, req.Send() +} + +// DeleteDestinationWithContext is the same as DeleteDestination with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteDestination for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteDestinationWithContext(ctx aws.Context, input *DeleteDestinationInput, opts ...request.Option) (*DeleteDestinationOutput, error) { + req, out := c.DeleteDestinationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteLogAnomalyDetector = "DeleteLogAnomalyDetector" + +// DeleteLogAnomalyDetectorRequest generates a "aws/request.Request" representing the +// client's request for the DeleteLogAnomalyDetector operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteLogAnomalyDetector for more information on using the DeleteLogAnomalyDetector +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteLogAnomalyDetectorRequest method. +// req, resp := client.DeleteLogAnomalyDetectorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogAnomalyDetector +func (c *CloudWatchLogs) DeleteLogAnomalyDetectorRequest(input *DeleteLogAnomalyDetectorInput) (req *request.Request, output *DeleteLogAnomalyDetectorOutput) { + op := &request.Operation{ + Name: opDeleteLogAnomalyDetector, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteLogAnomalyDetectorInput{} + } + + output = &DeleteLogAnomalyDetectorOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteLogAnomalyDetector API operation for Amazon CloudWatch Logs. +// +// Deletes the specified CloudWatch Logs anomaly detector. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteLogAnomalyDetector for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogAnomalyDetector +func (c *CloudWatchLogs) DeleteLogAnomalyDetector(input *DeleteLogAnomalyDetectorInput) (*DeleteLogAnomalyDetectorOutput, error) { + req, out := c.DeleteLogAnomalyDetectorRequest(input) + return out, req.Send() +} + +// DeleteLogAnomalyDetectorWithContext is the same as DeleteLogAnomalyDetector with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteLogAnomalyDetector for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteLogAnomalyDetectorWithContext(ctx aws.Context, input *DeleteLogAnomalyDetectorInput, opts ...request.Option) (*DeleteLogAnomalyDetectorOutput, error) { + req, out := c.DeleteLogAnomalyDetectorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteLogGroup = "DeleteLogGroup" + +// DeleteLogGroupRequest generates a "aws/request.Request" representing the +// client's request for the DeleteLogGroup operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteLogGroup for more information on using the DeleteLogGroup +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteLogGroupRequest method. +// req, resp := client.DeleteLogGroupRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogGroup +func (c *CloudWatchLogs) DeleteLogGroupRequest(input *DeleteLogGroupInput) (req *request.Request, output *DeleteLogGroupOutput) { + op := &request.Operation{ + Name: opDeleteLogGroup, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteLogGroupInput{} + } + + output = &DeleteLogGroupOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteLogGroup API operation for Amazon CloudWatch Logs. +// +// Deletes the specified log group and permanently deletes all the archived +// log events associated with the log group. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteLogGroup for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogGroup +func (c *CloudWatchLogs) DeleteLogGroup(input *DeleteLogGroupInput) (*DeleteLogGroupOutput, error) { + req, out := c.DeleteLogGroupRequest(input) + return out, req.Send() +} + +// DeleteLogGroupWithContext is the same as DeleteLogGroup with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteLogGroup for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteLogGroupWithContext(ctx aws.Context, input *DeleteLogGroupInput, opts ...request.Option) (*DeleteLogGroupOutput, error) { + req, out := c.DeleteLogGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteLogStream = "DeleteLogStream" + +// DeleteLogStreamRequest generates a "aws/request.Request" representing the +// client's request for the DeleteLogStream operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteLogStream for more information on using the DeleteLogStream +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteLogStreamRequest method. +// req, resp := client.DeleteLogStreamRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogStream +func (c *CloudWatchLogs) DeleteLogStreamRequest(input *DeleteLogStreamInput) (req *request.Request, output *DeleteLogStreamOutput) { + op := &request.Operation{ + Name: opDeleteLogStream, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteLogStreamInput{} + } + + output = &DeleteLogStreamOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteLogStream API operation for Amazon CloudWatch Logs. +// +// Deletes the specified log stream and permanently deletes all the archived +// log events associated with the log stream. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteLogStream for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogStream +func (c *CloudWatchLogs) DeleteLogStream(input *DeleteLogStreamInput) (*DeleteLogStreamOutput, error) { + req, out := c.DeleteLogStreamRequest(input) + return out, req.Send() +} + +// DeleteLogStreamWithContext is the same as DeleteLogStream with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteLogStream for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteLogStreamWithContext(ctx aws.Context, input *DeleteLogStreamInput, opts ...request.Option) (*DeleteLogStreamOutput, error) { + req, out := c.DeleteLogStreamRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteMetricFilter = "DeleteMetricFilter" + +// DeleteMetricFilterRequest generates a "aws/request.Request" representing the +// client's request for the DeleteMetricFilter operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteMetricFilter for more information on using the DeleteMetricFilter +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteMetricFilterRequest method. +// req, resp := client.DeleteMetricFilterRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteMetricFilter +func (c *CloudWatchLogs) DeleteMetricFilterRequest(input *DeleteMetricFilterInput) (req *request.Request, output *DeleteMetricFilterOutput) { + op := &request.Operation{ + Name: opDeleteMetricFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteMetricFilterInput{} + } + + output = &DeleteMetricFilterOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteMetricFilter API operation for Amazon CloudWatch Logs. +// +// Deletes the specified metric filter. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteMetricFilter for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteMetricFilter +func (c *CloudWatchLogs) DeleteMetricFilter(input *DeleteMetricFilterInput) (*DeleteMetricFilterOutput, error) { + req, out := c.DeleteMetricFilterRequest(input) + return out, req.Send() +} + +// DeleteMetricFilterWithContext is the same as DeleteMetricFilter with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteMetricFilter for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteMetricFilterWithContext(ctx aws.Context, input *DeleteMetricFilterInput, opts ...request.Option) (*DeleteMetricFilterOutput, error) { + req, out := c.DeleteMetricFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteQueryDefinition = "DeleteQueryDefinition" + +// DeleteQueryDefinitionRequest generates a "aws/request.Request" representing the +// client's request for the DeleteQueryDefinition operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteQueryDefinition for more information on using the DeleteQueryDefinition +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteQueryDefinitionRequest method. +// req, resp := client.DeleteQueryDefinitionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteQueryDefinition +func (c *CloudWatchLogs) DeleteQueryDefinitionRequest(input *DeleteQueryDefinitionInput) (req *request.Request, output *DeleteQueryDefinitionOutput) { + op := &request.Operation{ + Name: opDeleteQueryDefinition, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteQueryDefinitionInput{} + } + + output = &DeleteQueryDefinitionOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteQueryDefinition API operation for Amazon CloudWatch Logs. +// +// Deletes a saved CloudWatch Logs Insights query definition. A query definition +// contains details about a saved CloudWatch Logs Insights query. +// +// Each DeleteQueryDefinition operation can delete one query definition. +// +// You must have the logs:DeleteQueryDefinition permission to be able to perform +// this operation. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteQueryDefinition for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteQueryDefinition +func (c *CloudWatchLogs) DeleteQueryDefinition(input *DeleteQueryDefinitionInput) (*DeleteQueryDefinitionOutput, error) { + req, out := c.DeleteQueryDefinitionRequest(input) + return out, req.Send() +} + +// DeleteQueryDefinitionWithContext is the same as DeleteQueryDefinition with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteQueryDefinition for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteQueryDefinitionWithContext(ctx aws.Context, input *DeleteQueryDefinitionInput, opts ...request.Option) (*DeleteQueryDefinitionOutput, error) { + req, out := c.DeleteQueryDefinitionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteResourcePolicy = "DeleteResourcePolicy" + +// DeleteResourcePolicyRequest generates a "aws/request.Request" representing the +// client's request for the DeleteResourcePolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteResourcePolicy for more information on using the DeleteResourcePolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteResourcePolicyRequest method. +// req, resp := client.DeleteResourcePolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteResourcePolicy +func (c *CloudWatchLogs) DeleteResourcePolicyRequest(input *DeleteResourcePolicyInput) (req *request.Request, output *DeleteResourcePolicyOutput) { + op := &request.Operation{ + Name: opDeleteResourcePolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteResourcePolicyInput{} + } + + output = &DeleteResourcePolicyOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteResourcePolicy API operation for Amazon CloudWatch Logs. +// +// Deletes a resource policy from this account. This revokes the access of the +// identities in that policy to put log events to this account. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteResourcePolicy for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteResourcePolicy +func (c *CloudWatchLogs) DeleteResourcePolicy(input *DeleteResourcePolicyInput) (*DeleteResourcePolicyOutput, error) { + req, out := c.DeleteResourcePolicyRequest(input) + return out, req.Send() +} + +// DeleteResourcePolicyWithContext is the same as DeleteResourcePolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteResourcePolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteResourcePolicyWithContext(ctx aws.Context, input *DeleteResourcePolicyInput, opts ...request.Option) (*DeleteResourcePolicyOutput, error) { + req, out := c.DeleteResourcePolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteRetentionPolicy = "DeleteRetentionPolicy" + +// DeleteRetentionPolicyRequest generates a "aws/request.Request" representing the +// client's request for the DeleteRetentionPolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteRetentionPolicy for more information on using the DeleteRetentionPolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteRetentionPolicyRequest method. +// req, resp := client.DeleteRetentionPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteRetentionPolicy +func (c *CloudWatchLogs) DeleteRetentionPolicyRequest(input *DeleteRetentionPolicyInput) (req *request.Request, output *DeleteRetentionPolicyOutput) { + op := &request.Operation{ + Name: opDeleteRetentionPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteRetentionPolicyInput{} + } + + output = &DeleteRetentionPolicyOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteRetentionPolicy API operation for Amazon CloudWatch Logs. +// +// Deletes the specified retention policy. +// +// Log events do not expire if they belong to log groups without a retention +// policy. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteRetentionPolicy for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteRetentionPolicy +func (c *CloudWatchLogs) DeleteRetentionPolicy(input *DeleteRetentionPolicyInput) (*DeleteRetentionPolicyOutput, error) { + req, out := c.DeleteRetentionPolicyRequest(input) + return out, req.Send() +} + +// DeleteRetentionPolicyWithContext is the same as DeleteRetentionPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRetentionPolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteRetentionPolicyWithContext(ctx aws.Context, input *DeleteRetentionPolicyInput, opts ...request.Option) (*DeleteRetentionPolicyOutput, error) { + req, out := c.DeleteRetentionPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteSubscriptionFilter = "DeleteSubscriptionFilter" + +// DeleteSubscriptionFilterRequest generates a "aws/request.Request" representing the +// client's request for the DeleteSubscriptionFilter operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteSubscriptionFilter for more information on using the DeleteSubscriptionFilter +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DeleteSubscriptionFilterRequest method. +// req, resp := client.DeleteSubscriptionFilterRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteSubscriptionFilter +func (c *CloudWatchLogs) DeleteSubscriptionFilterRequest(input *DeleteSubscriptionFilterInput) (req *request.Request, output *DeleteSubscriptionFilterOutput) { + op := &request.Operation{ + Name: opDeleteSubscriptionFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteSubscriptionFilterInput{} + } + + output = &DeleteSubscriptionFilterOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DeleteSubscriptionFilter API operation for Amazon CloudWatch Logs. +// +// Deletes the specified subscription filter. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DeleteSubscriptionFilter for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteSubscriptionFilter +func (c *CloudWatchLogs) DeleteSubscriptionFilter(input *DeleteSubscriptionFilterInput) (*DeleteSubscriptionFilterOutput, error) { + req, out := c.DeleteSubscriptionFilterRequest(input) + return out, req.Send() +} + +// DeleteSubscriptionFilterWithContext is the same as DeleteSubscriptionFilter with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteSubscriptionFilter for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DeleteSubscriptionFilterWithContext(ctx aws.Context, input *DeleteSubscriptionFilterInput, opts ...request.Option) (*DeleteSubscriptionFilterOutput, error) { + req, out := c.DeleteSubscriptionFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeAccountPolicies = "DescribeAccountPolicies" + +// DescribeAccountPoliciesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeAccountPolicies operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeAccountPolicies for more information on using the DescribeAccountPolicies +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeAccountPoliciesRequest method. +// req, resp := client.DescribeAccountPoliciesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeAccountPolicies +func (c *CloudWatchLogs) DescribeAccountPoliciesRequest(input *DescribeAccountPoliciesInput) (req *request.Request, output *DescribeAccountPoliciesOutput) { + op := &request.Operation{ + Name: opDescribeAccountPolicies, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeAccountPoliciesInput{} + } + + output = &DescribeAccountPoliciesOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeAccountPolicies API operation for Amazon CloudWatch Logs. +// +// Returns a list of all CloudWatch Logs account policies in the account. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeAccountPolicies for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeAccountPolicies +func (c *CloudWatchLogs) DescribeAccountPolicies(input *DescribeAccountPoliciesInput) (*DescribeAccountPoliciesOutput, error) { + req, out := c.DescribeAccountPoliciesRequest(input) + return out, req.Send() +} + +// DescribeAccountPoliciesWithContext is the same as DescribeAccountPolicies with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeAccountPolicies for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeAccountPoliciesWithContext(ctx aws.Context, input *DescribeAccountPoliciesInput, opts ...request.Option) (*DescribeAccountPoliciesOutput, error) { + req, out := c.DescribeAccountPoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeDeliveries = "DescribeDeliveries" + +// DescribeDeliveriesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeDeliveries operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeDeliveries for more information on using the DescribeDeliveries +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeDeliveriesRequest method. +// req, resp := client.DescribeDeliveriesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDeliveries +func (c *CloudWatchLogs) DescribeDeliveriesRequest(input *DescribeDeliveriesInput) (req *request.Request, output *DescribeDeliveriesOutput) { + op := &request.Operation{ + Name: opDescribeDeliveries, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeDeliveriesInput{} + } + + output = &DescribeDeliveriesOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeDeliveries API operation for Amazon CloudWatch Logs. +// +// Retrieves a list of the deliveries that have been created in the account. +// +// A delivery is a connection between a delivery source (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html) +// and a delivery destination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html). +// +// A delivery source represents an Amazon Web Services resource that sends logs +// to an logs delivery destination. The destination can be CloudWatch Logs, +// Amazon S3, or Firehose. Only some Amazon Web Services services support being +// configured as a delivery source. These services are listed in Enable logging +// from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html) +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeDeliveries for usage and error information. +// +// Returned Error Types: +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDeliveries +func (c *CloudWatchLogs) DescribeDeliveries(input *DescribeDeliveriesInput) (*DescribeDeliveriesOutput, error) { + req, out := c.DescribeDeliveriesRequest(input) + return out, req.Send() +} + +// DescribeDeliveriesWithContext is the same as DescribeDeliveries with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDeliveries for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeDeliveriesWithContext(ctx aws.Context, input *DescribeDeliveriesInput, opts ...request.Option) (*DescribeDeliveriesOutput, error) { + req, out := c.DescribeDeliveriesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeDeliveriesPages iterates over the pages of a DescribeDeliveries operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeDeliveries method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeDeliveries operation. +// pageNum := 0 +// err := client.DescribeDeliveriesPages(params, +// func(page *cloudwatchlogs.DescribeDeliveriesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) DescribeDeliveriesPages(input *DescribeDeliveriesInput, fn func(*DescribeDeliveriesOutput, bool) bool) error { + return c.DescribeDeliveriesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDeliveriesPagesWithContext same as DescribeDeliveriesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeDeliveriesPagesWithContext(ctx aws.Context, input *DescribeDeliveriesInput, fn func(*DescribeDeliveriesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDeliveriesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDeliveriesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeDeliveriesOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDescribeDeliveryDestinations = "DescribeDeliveryDestinations" + +// DescribeDeliveryDestinationsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeDeliveryDestinations operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeDeliveryDestinations for more information on using the DescribeDeliveryDestinations +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeDeliveryDestinationsRequest method. +// req, resp := client.DescribeDeliveryDestinationsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDeliveryDestinations +func (c *CloudWatchLogs) DescribeDeliveryDestinationsRequest(input *DescribeDeliveryDestinationsInput) (req *request.Request, output *DescribeDeliveryDestinationsOutput) { + op := &request.Operation{ + Name: opDescribeDeliveryDestinations, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeDeliveryDestinationsInput{} + } + + output = &DescribeDeliveryDestinationsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeDeliveryDestinations API operation for Amazon CloudWatch Logs. +// +// Retrieves a list of the delivery destinations that have been created in the +// account. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeDeliveryDestinations for usage and error information. +// +// Returned Error Types: +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDeliveryDestinations +func (c *CloudWatchLogs) DescribeDeliveryDestinations(input *DescribeDeliveryDestinationsInput) (*DescribeDeliveryDestinationsOutput, error) { + req, out := c.DescribeDeliveryDestinationsRequest(input) + return out, req.Send() +} + +// DescribeDeliveryDestinationsWithContext is the same as DescribeDeliveryDestinations with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDeliveryDestinations for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeDeliveryDestinationsWithContext(ctx aws.Context, input *DescribeDeliveryDestinationsInput, opts ...request.Option) (*DescribeDeliveryDestinationsOutput, error) { + req, out := c.DescribeDeliveryDestinationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeDeliveryDestinationsPages iterates over the pages of a DescribeDeliveryDestinations operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeDeliveryDestinations method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeDeliveryDestinations operation. +// pageNum := 0 +// err := client.DescribeDeliveryDestinationsPages(params, +// func(page *cloudwatchlogs.DescribeDeliveryDestinationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) DescribeDeliveryDestinationsPages(input *DescribeDeliveryDestinationsInput, fn func(*DescribeDeliveryDestinationsOutput, bool) bool) error { + return c.DescribeDeliveryDestinationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDeliveryDestinationsPagesWithContext same as DescribeDeliveryDestinationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeDeliveryDestinationsPagesWithContext(ctx aws.Context, input *DescribeDeliveryDestinationsInput, fn func(*DescribeDeliveryDestinationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDeliveryDestinationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDeliveryDestinationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeDeliveryDestinationsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDescribeDeliverySources = "DescribeDeliverySources" + +// DescribeDeliverySourcesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeDeliverySources operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeDeliverySources for more information on using the DescribeDeliverySources +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeDeliverySourcesRequest method. +// req, resp := client.DescribeDeliverySourcesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDeliverySources +func (c *CloudWatchLogs) DescribeDeliverySourcesRequest(input *DescribeDeliverySourcesInput) (req *request.Request, output *DescribeDeliverySourcesOutput) { + op := &request.Operation{ + Name: opDescribeDeliverySources, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeDeliverySourcesInput{} + } + + output = &DescribeDeliverySourcesOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeDeliverySources API operation for Amazon CloudWatch Logs. +// +// Retrieves a list of the delivery sources that have been created in the account. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeDeliverySources for usage and error information. +// +// Returned Error Types: +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDeliverySources +func (c *CloudWatchLogs) DescribeDeliverySources(input *DescribeDeliverySourcesInput) (*DescribeDeliverySourcesOutput, error) { + req, out := c.DescribeDeliverySourcesRequest(input) + return out, req.Send() +} + +// DescribeDeliverySourcesWithContext is the same as DescribeDeliverySources with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDeliverySources for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeDeliverySourcesWithContext(ctx aws.Context, input *DescribeDeliverySourcesInput, opts ...request.Option) (*DescribeDeliverySourcesOutput, error) { + req, out := c.DescribeDeliverySourcesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeDeliverySourcesPages iterates over the pages of a DescribeDeliverySources operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeDeliverySources method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeDeliverySources operation. +// pageNum := 0 +// err := client.DescribeDeliverySourcesPages(params, +// func(page *cloudwatchlogs.DescribeDeliverySourcesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) DescribeDeliverySourcesPages(input *DescribeDeliverySourcesInput, fn func(*DescribeDeliverySourcesOutput, bool) bool) error { + return c.DescribeDeliverySourcesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDeliverySourcesPagesWithContext same as DescribeDeliverySourcesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeDeliverySourcesPagesWithContext(ctx aws.Context, input *DescribeDeliverySourcesInput, fn func(*DescribeDeliverySourcesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDeliverySourcesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDeliverySourcesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeDeliverySourcesOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDescribeDestinations = "DescribeDestinations" + +// DescribeDestinationsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeDestinations operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeDestinations for more information on using the DescribeDestinations +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeDestinationsRequest method. +// req, resp := client.DescribeDestinationsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDestinations +func (c *CloudWatchLogs) DescribeDestinationsRequest(input *DescribeDestinationsInput) (req *request.Request, output *DescribeDestinationsOutput) { + op := &request.Operation{ + Name: opDescribeDestinations, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeDestinationsInput{} + } + + output = &DescribeDestinationsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeDestinations API operation for Amazon CloudWatch Logs. +// +// Lists all your destinations. The results are ASCII-sorted by destination +// name. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeDestinations for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDestinations +func (c *CloudWatchLogs) DescribeDestinations(input *DescribeDestinationsInput) (*DescribeDestinationsOutput, error) { + req, out := c.DescribeDestinationsRequest(input) + return out, req.Send() +} + +// DescribeDestinationsWithContext is the same as DescribeDestinations with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeDestinations for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeDestinationsWithContext(ctx aws.Context, input *DescribeDestinationsInput, opts ...request.Option) (*DescribeDestinationsOutput, error) { + req, out := c.DescribeDestinationsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeDestinationsPages iterates over the pages of a DescribeDestinations operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeDestinations method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeDestinations operation. +// pageNum := 0 +// err := client.DescribeDestinationsPages(params, +// func(page *cloudwatchlogs.DescribeDestinationsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) DescribeDestinationsPages(input *DescribeDestinationsInput, fn func(*DescribeDestinationsOutput, bool) bool) error { + return c.DescribeDestinationsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeDestinationsPagesWithContext same as DescribeDestinationsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeDestinationsPagesWithContext(ctx aws.Context, input *DescribeDestinationsInput, fn func(*DescribeDestinationsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeDestinationsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeDestinationsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeDestinationsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDescribeExportTasks = "DescribeExportTasks" + +// DescribeExportTasksRequest generates a "aws/request.Request" representing the +// client's request for the DescribeExportTasks operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeExportTasks for more information on using the DescribeExportTasks +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeExportTasksRequest method. +// req, resp := client.DescribeExportTasksRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeExportTasks +func (c *CloudWatchLogs) DescribeExportTasksRequest(input *DescribeExportTasksInput) (req *request.Request, output *DescribeExportTasksOutput) { + op := &request.Operation{ + Name: opDescribeExportTasks, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeExportTasksInput{} + } + + output = &DescribeExportTasksOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeExportTasks API operation for Amazon CloudWatch Logs. +// +// Lists the specified export tasks. You can list all your export tasks or filter +// the results based on task ID or task status. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeExportTasks for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeExportTasks +func (c *CloudWatchLogs) DescribeExportTasks(input *DescribeExportTasksInput) (*DescribeExportTasksOutput, error) { + req, out := c.DescribeExportTasksRequest(input) + return out, req.Send() +} + +// DescribeExportTasksWithContext is the same as DescribeExportTasks with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeExportTasks for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeExportTasksWithContext(ctx aws.Context, input *DescribeExportTasksInput, opts ...request.Option) (*DescribeExportTasksOutput, error) { + req, out := c.DescribeExportTasksRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeLogGroups = "DescribeLogGroups" + +// DescribeLogGroupsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeLogGroups operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeLogGroups for more information on using the DescribeLogGroups +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeLogGroupsRequest method. +// req, resp := client.DescribeLogGroupsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogGroups +func (c *CloudWatchLogs) DescribeLogGroupsRequest(input *DescribeLogGroupsInput) (req *request.Request, output *DescribeLogGroupsOutput) { + op := &request.Operation{ + Name: opDescribeLogGroups, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeLogGroupsInput{} + } + + output = &DescribeLogGroupsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeLogGroups API operation for Amazon CloudWatch Logs. +// +// Lists the specified log groups. You can list all your log groups or filter +// the results by prefix. The results are ASCII-sorted by log group name. +// +// CloudWatch Logs doesn’t support IAM policies that control access to the +// DescribeLogGroups action by using the aws:ResourceTag/key-name condition +// key. Other CloudWatch Logs actions do support the use of the aws:ResourceTag/key-name +// condition key to control access. For more information about using tags to +// control access, see Controlling access to Amazon Web Services resources using +// tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html). +// +// If you are using CloudWatch cross-account observability, you can use this +// operation in a monitoring account and view data from the linked source accounts. +// For more information, see CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeLogGroups for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogGroups +func (c *CloudWatchLogs) DescribeLogGroups(input *DescribeLogGroupsInput) (*DescribeLogGroupsOutput, error) { + req, out := c.DescribeLogGroupsRequest(input) + return out, req.Send() +} + +// DescribeLogGroupsWithContext is the same as DescribeLogGroups with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeLogGroups for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeLogGroupsWithContext(ctx aws.Context, input *DescribeLogGroupsInput, opts ...request.Option) (*DescribeLogGroupsOutput, error) { + req, out := c.DescribeLogGroupsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeLogGroupsPages iterates over the pages of a DescribeLogGroups operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeLogGroups method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeLogGroups operation. +// pageNum := 0 +// err := client.DescribeLogGroupsPages(params, +// func(page *cloudwatchlogs.DescribeLogGroupsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) DescribeLogGroupsPages(input *DescribeLogGroupsInput, fn func(*DescribeLogGroupsOutput, bool) bool) error { + return c.DescribeLogGroupsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeLogGroupsPagesWithContext same as DescribeLogGroupsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeLogGroupsPagesWithContext(ctx aws.Context, input *DescribeLogGroupsInput, fn func(*DescribeLogGroupsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeLogGroupsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeLogGroupsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeLogGroupsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDescribeLogStreams = "DescribeLogStreams" + +// DescribeLogStreamsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeLogStreams operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeLogStreams for more information on using the DescribeLogStreams +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeLogStreamsRequest method. +// req, resp := client.DescribeLogStreamsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogStreams +func (c *CloudWatchLogs) DescribeLogStreamsRequest(input *DescribeLogStreamsInput) (req *request.Request, output *DescribeLogStreamsOutput) { + op := &request.Operation{ + Name: opDescribeLogStreams, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeLogStreamsInput{} + } + + output = &DescribeLogStreamsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeLogStreams API operation for Amazon CloudWatch Logs. +// +// Lists the log streams for the specified log group. You can list all the log +// streams or filter the results by prefix. You can also control how the results +// are ordered. +// +// You can specify the log group to search by using either logGroupIdentifier +// or logGroupName. You must include one of these two parameters, but you can't +// include both. +// +// This operation has a limit of five transactions per second, after which transactions +// are throttled. +// +// If you are using CloudWatch cross-account observability, you can use this +// operation in a monitoring account and view data from the linked source accounts. +// For more information, see CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeLogStreams for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogStreams +func (c *CloudWatchLogs) DescribeLogStreams(input *DescribeLogStreamsInput) (*DescribeLogStreamsOutput, error) { + req, out := c.DescribeLogStreamsRequest(input) + return out, req.Send() +} + +// DescribeLogStreamsWithContext is the same as DescribeLogStreams with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeLogStreams for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeLogStreamsWithContext(ctx aws.Context, input *DescribeLogStreamsInput, opts ...request.Option) (*DescribeLogStreamsOutput, error) { + req, out := c.DescribeLogStreamsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeLogStreamsPages iterates over the pages of a DescribeLogStreams operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeLogStreams method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeLogStreams operation. +// pageNum := 0 +// err := client.DescribeLogStreamsPages(params, +// func(page *cloudwatchlogs.DescribeLogStreamsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) DescribeLogStreamsPages(input *DescribeLogStreamsInput, fn func(*DescribeLogStreamsOutput, bool) bool) error { + return c.DescribeLogStreamsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeLogStreamsPagesWithContext same as DescribeLogStreamsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeLogStreamsPagesWithContext(ctx aws.Context, input *DescribeLogStreamsInput, fn func(*DescribeLogStreamsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeLogStreamsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeLogStreamsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeLogStreamsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDescribeMetricFilters = "DescribeMetricFilters" + +// DescribeMetricFiltersRequest generates a "aws/request.Request" representing the +// client's request for the DescribeMetricFilters operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeMetricFilters for more information on using the DescribeMetricFilters +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeMetricFiltersRequest method. +// req, resp := client.DescribeMetricFiltersRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeMetricFilters +func (c *CloudWatchLogs) DescribeMetricFiltersRequest(input *DescribeMetricFiltersInput) (req *request.Request, output *DescribeMetricFiltersOutput) { + op := &request.Operation{ + Name: opDescribeMetricFilters, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeMetricFiltersInput{} + } + + output = &DescribeMetricFiltersOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeMetricFilters API operation for Amazon CloudWatch Logs. +// +// Lists the specified metric filters. You can list all of the metric filters +// or filter the results by log name, prefix, metric name, or metric namespace. +// The results are ASCII-sorted by filter name. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeMetricFilters for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeMetricFilters +func (c *CloudWatchLogs) DescribeMetricFilters(input *DescribeMetricFiltersInput) (*DescribeMetricFiltersOutput, error) { + req, out := c.DescribeMetricFiltersRequest(input) + return out, req.Send() +} + +// DescribeMetricFiltersWithContext is the same as DescribeMetricFilters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMetricFilters for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeMetricFiltersWithContext(ctx aws.Context, input *DescribeMetricFiltersInput, opts ...request.Option) (*DescribeMetricFiltersOutput, error) { + req, out := c.DescribeMetricFiltersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeMetricFiltersPages iterates over the pages of a DescribeMetricFilters operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeMetricFilters method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeMetricFilters operation. +// pageNum := 0 +// err := client.DescribeMetricFiltersPages(params, +// func(page *cloudwatchlogs.DescribeMetricFiltersOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) DescribeMetricFiltersPages(input *DescribeMetricFiltersInput, fn func(*DescribeMetricFiltersOutput, bool) bool) error { + return c.DescribeMetricFiltersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeMetricFiltersPagesWithContext same as DescribeMetricFiltersPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeMetricFiltersPagesWithContext(ctx aws.Context, input *DescribeMetricFiltersInput, fn func(*DescribeMetricFiltersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeMetricFiltersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeMetricFiltersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeMetricFiltersOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDescribeQueries = "DescribeQueries" + +// DescribeQueriesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeQueries operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeQueries for more information on using the DescribeQueries +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeQueriesRequest method. +// req, resp := client.DescribeQueriesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeQueries +func (c *CloudWatchLogs) DescribeQueriesRequest(input *DescribeQueriesInput) (req *request.Request, output *DescribeQueriesOutput) { + op := &request.Operation{ + Name: opDescribeQueries, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeQueriesInput{} + } + + output = &DescribeQueriesOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeQueries API operation for Amazon CloudWatch Logs. +// +// Returns a list of CloudWatch Logs Insights queries that are scheduled, running, +// or have been run recently in this account. You can request all queries or +// limit it to queries of a specific log group or queries with a certain status. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeQueries for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeQueries +func (c *CloudWatchLogs) DescribeQueries(input *DescribeQueriesInput) (*DescribeQueriesOutput, error) { + req, out := c.DescribeQueriesRequest(input) + return out, req.Send() +} + +// DescribeQueriesWithContext is the same as DescribeQueries with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeQueries for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeQueriesWithContext(ctx aws.Context, input *DescribeQueriesInput, opts ...request.Option) (*DescribeQueriesOutput, error) { + req, out := c.DescribeQueriesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeQueryDefinitions = "DescribeQueryDefinitions" + +// DescribeQueryDefinitionsRequest generates a "aws/request.Request" representing the +// client's request for the DescribeQueryDefinitions operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeQueryDefinitions for more information on using the DescribeQueryDefinitions +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeQueryDefinitionsRequest method. +// req, resp := client.DescribeQueryDefinitionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeQueryDefinitions +func (c *CloudWatchLogs) DescribeQueryDefinitionsRequest(input *DescribeQueryDefinitionsInput) (req *request.Request, output *DescribeQueryDefinitionsOutput) { + op := &request.Operation{ + Name: opDescribeQueryDefinitions, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeQueryDefinitionsInput{} + } + + output = &DescribeQueryDefinitionsOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeQueryDefinitions API operation for Amazon CloudWatch Logs. +// +// This operation returns a paginated list of your saved CloudWatch Logs Insights +// query definitions. You can retrieve query definitions from the current account +// or from a source account that is linked to the current account. +// +// You can use the queryDefinitionNamePrefix parameter to limit the results +// to only the query definitions that have names that start with a certain string. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeQueryDefinitions for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeQueryDefinitions +func (c *CloudWatchLogs) DescribeQueryDefinitions(input *DescribeQueryDefinitionsInput) (*DescribeQueryDefinitionsOutput, error) { + req, out := c.DescribeQueryDefinitionsRequest(input) + return out, req.Send() +} + +// DescribeQueryDefinitionsWithContext is the same as DescribeQueryDefinitions with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeQueryDefinitions for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeQueryDefinitionsWithContext(ctx aws.Context, input *DescribeQueryDefinitionsInput, opts ...request.Option) (*DescribeQueryDefinitionsOutput, error) { + req, out := c.DescribeQueryDefinitionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeResourcePolicies = "DescribeResourcePolicies" + +// DescribeResourcePoliciesRequest generates a "aws/request.Request" representing the +// client's request for the DescribeResourcePolicies operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeResourcePolicies for more information on using the DescribeResourcePolicies +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeResourcePoliciesRequest method. +// req, resp := client.DescribeResourcePoliciesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeResourcePolicies +func (c *CloudWatchLogs) DescribeResourcePoliciesRequest(input *DescribeResourcePoliciesInput) (req *request.Request, output *DescribeResourcePoliciesOutput) { + op := &request.Operation{ + Name: opDescribeResourcePolicies, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeResourcePoliciesInput{} + } + + output = &DescribeResourcePoliciesOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeResourcePolicies API operation for Amazon CloudWatch Logs. +// +// Lists the resource policies in this account. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeResourcePolicies for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeResourcePolicies +func (c *CloudWatchLogs) DescribeResourcePolicies(input *DescribeResourcePoliciesInput) (*DescribeResourcePoliciesOutput, error) { + req, out := c.DescribeResourcePoliciesRequest(input) + return out, req.Send() +} + +// DescribeResourcePoliciesWithContext is the same as DescribeResourcePolicies with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeResourcePolicies for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeResourcePoliciesWithContext(ctx aws.Context, input *DescribeResourcePoliciesInput, opts ...request.Option) (*DescribeResourcePoliciesOutput, error) { + req, out := c.DescribeResourcePoliciesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeSubscriptionFilters = "DescribeSubscriptionFilters" + +// DescribeSubscriptionFiltersRequest generates a "aws/request.Request" representing the +// client's request for the DescribeSubscriptionFilters operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeSubscriptionFilters for more information on using the DescribeSubscriptionFilters +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DescribeSubscriptionFiltersRequest method. +// req, resp := client.DescribeSubscriptionFiltersRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeSubscriptionFilters +func (c *CloudWatchLogs) DescribeSubscriptionFiltersRequest(input *DescribeSubscriptionFiltersInput) (req *request.Request, output *DescribeSubscriptionFiltersOutput) { + op := &request.Operation{ + Name: opDescribeSubscriptionFilters, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeSubscriptionFiltersInput{} + } + + output = &DescribeSubscriptionFiltersOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeSubscriptionFilters API operation for Amazon CloudWatch Logs. +// +// Lists the subscription filters for the specified log group. You can list +// all the subscription filters or filter the results by prefix. The results +// are ASCII-sorted by filter name. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DescribeSubscriptionFilters for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeSubscriptionFilters +func (c *CloudWatchLogs) DescribeSubscriptionFilters(input *DescribeSubscriptionFiltersInput) (*DescribeSubscriptionFiltersOutput, error) { + req, out := c.DescribeSubscriptionFiltersRequest(input) + return out, req.Send() +} + +// DescribeSubscriptionFiltersWithContext is the same as DescribeSubscriptionFilters with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeSubscriptionFilters for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeSubscriptionFiltersWithContext(ctx aws.Context, input *DescribeSubscriptionFiltersInput, opts ...request.Option) (*DescribeSubscriptionFiltersOutput, error) { + req, out := c.DescribeSubscriptionFiltersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// DescribeSubscriptionFiltersPages iterates over the pages of a DescribeSubscriptionFilters operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See DescribeSubscriptionFilters method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeSubscriptionFilters operation. +// pageNum := 0 +// err := client.DescribeSubscriptionFiltersPages(params, +// func(page *cloudwatchlogs.DescribeSubscriptionFiltersOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) DescribeSubscriptionFiltersPages(input *DescribeSubscriptionFiltersInput, fn func(*DescribeSubscriptionFiltersOutput, bool) bool) error { + return c.DescribeSubscriptionFiltersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// DescribeSubscriptionFiltersPagesWithContext same as DescribeSubscriptionFiltersPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DescribeSubscriptionFiltersPagesWithContext(ctx aws.Context, input *DescribeSubscriptionFiltersInput, fn func(*DescribeSubscriptionFiltersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeSubscriptionFiltersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeSubscriptionFiltersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*DescribeSubscriptionFiltersOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opDisassociateKmsKey = "DisassociateKmsKey" + +// DisassociateKmsKeyRequest generates a "aws/request.Request" representing the +// client's request for the DisassociateKmsKey operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DisassociateKmsKey for more information on using the DisassociateKmsKey +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the DisassociateKmsKeyRequest method. +// req, resp := client.DisassociateKmsKeyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DisassociateKmsKey +func (c *CloudWatchLogs) DisassociateKmsKeyRequest(input *DisassociateKmsKeyInput) (req *request.Request, output *DisassociateKmsKeyOutput) { + op := &request.Operation{ + Name: opDisassociateKmsKey, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DisassociateKmsKeyInput{} + } + + output = &DisassociateKmsKeyOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// DisassociateKmsKey API operation for Amazon CloudWatch Logs. +// +// Disassociates the specified KMS key from the specified log group or from +// all CloudWatch Logs Insights query results in the account. +// +// When you use DisassociateKmsKey, you specify either the logGroupName parameter +// or the resourceIdentifier parameter. You can't specify both of those parameters +// in the same operation. +// +// - Specify the logGroupName parameter to stop using the KMS key to encrypt +// future log events ingested and stored in the log group. Instead, they +// will be encrypted with the default CloudWatch Logs method. The log events +// that were ingested while the key was associated with the log group are +// still encrypted with that key. Therefore, CloudWatch Logs will need permissions +// for the key whenever that data is accessed. +// +// - Specify the resourceIdentifier parameter with the query-result resource +// to stop using the KMS key to encrypt the results of all future StartQuery +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html) +// operations in the account. They will instead be encrypted with the default +// CloudWatch Logs method. The results from queries that ran while the key +// was associated with the account are still encrypted with that key. Therefore, +// CloudWatch Logs will need permissions for the key whenever that data is +// accessed. +// +// It can take up to 5 minutes for this operation to take effect. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation DisassociateKmsKey for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DisassociateKmsKey +func (c *CloudWatchLogs) DisassociateKmsKey(input *DisassociateKmsKeyInput) (*DisassociateKmsKeyOutput, error) { + req, out := c.DisassociateKmsKeyRequest(input) + return out, req.Send() +} + +// DisassociateKmsKeyWithContext is the same as DisassociateKmsKey with the addition of +// the ability to pass a context and additional request options. +// +// See DisassociateKmsKey for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) DisassociateKmsKeyWithContext(ctx aws.Context, input *DisassociateKmsKeyInput, opts ...request.Option) (*DisassociateKmsKeyOutput, error) { + req, out := c.DisassociateKmsKeyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opFilterLogEvents = "FilterLogEvents" + +// FilterLogEventsRequest generates a "aws/request.Request" representing the +// client's request for the FilterLogEvents operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See FilterLogEvents for more information on using the FilterLogEvents +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the FilterLogEventsRequest method. +// req, resp := client.FilterLogEventsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/FilterLogEvents +func (c *CloudWatchLogs) FilterLogEventsRequest(input *FilterLogEventsInput) (req *request.Request, output *FilterLogEventsOutput) { + op := &request.Operation{ + Name: opFilterLogEvents, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &FilterLogEventsInput{} + } + + output = &FilterLogEventsOutput{} + req = c.newRequest(op, input, output) + return +} + +// FilterLogEvents API operation for Amazon CloudWatch Logs. +// +// Lists log events from the specified log group. You can list all the log events +// or filter the results using a filter pattern, a time range, and the name +// of the log stream. +// +// You must have the logs:FilterLogEvents permission to perform this operation. +// +// You can specify the log group to search by using either logGroupIdentifier +// or logGroupName. You must include one of these two parameters, but you can't +// include both. +// +// By default, this operation returns as many log events as can fit in 1 MB +// (up to 10,000 log events) or all the events found within the specified time +// range. If the results include a token, that means there are more log events +// available. You can get additional results by specifying the token in a subsequent +// call. This operation can return empty results while there are more log events +// available through the token. +// +// The returned log events are sorted by event timestamp, the timestamp when +// the event was ingested by CloudWatch Logs, and the ID of the PutLogEvents +// request. +// +// If you are using CloudWatch cross-account observability, you can use this +// operation in a monitoring account and view data from the linked source accounts. +// For more information, see CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation FilterLogEvents for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/FilterLogEvents +func (c *CloudWatchLogs) FilterLogEvents(input *FilterLogEventsInput) (*FilterLogEventsOutput, error) { + req, out := c.FilterLogEventsRequest(input) + return out, req.Send() +} + +// FilterLogEventsWithContext is the same as FilterLogEvents with the addition of +// the ability to pass a context and additional request options. +// +// See FilterLogEvents for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) FilterLogEventsWithContext(ctx aws.Context, input *FilterLogEventsInput, opts ...request.Option) (*FilterLogEventsOutput, error) { + req, out := c.FilterLogEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// FilterLogEventsPages iterates over the pages of a FilterLogEvents operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See FilterLogEvents method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a FilterLogEvents operation. +// pageNum := 0 +// err := client.FilterLogEventsPages(params, +// func(page *cloudwatchlogs.FilterLogEventsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) FilterLogEventsPages(input *FilterLogEventsInput, fn func(*FilterLogEventsOutput, bool) bool) error { + return c.FilterLogEventsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// FilterLogEventsPagesWithContext same as FilterLogEventsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) FilterLogEventsPagesWithContext(ctx aws.Context, input *FilterLogEventsInput, fn func(*FilterLogEventsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *FilterLogEventsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.FilterLogEventsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*FilterLogEventsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opGetDataProtectionPolicy = "GetDataProtectionPolicy" + +// GetDataProtectionPolicyRequest generates a "aws/request.Request" representing the +// client's request for the GetDataProtectionPolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetDataProtectionPolicy for more information on using the GetDataProtectionPolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetDataProtectionPolicyRequest method. +// req, resp := client.GetDataProtectionPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetDataProtectionPolicy +func (c *CloudWatchLogs) GetDataProtectionPolicyRequest(input *GetDataProtectionPolicyInput) (req *request.Request, output *GetDataProtectionPolicyOutput) { + op := &request.Operation{ + Name: opGetDataProtectionPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetDataProtectionPolicyInput{} + } + + output = &GetDataProtectionPolicyOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetDataProtectionPolicy API operation for Amazon CloudWatch Logs. +// +// Returns information about a log group data protection policy. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation GetDataProtectionPolicy for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetDataProtectionPolicy +func (c *CloudWatchLogs) GetDataProtectionPolicy(input *GetDataProtectionPolicyInput) (*GetDataProtectionPolicyOutput, error) { + req, out := c.GetDataProtectionPolicyRequest(input) + return out, req.Send() +} + +// GetDataProtectionPolicyWithContext is the same as GetDataProtectionPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetDataProtectionPolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) GetDataProtectionPolicyWithContext(ctx aws.Context, input *GetDataProtectionPolicyInput, opts ...request.Option) (*GetDataProtectionPolicyOutput, error) { + req, out := c.GetDataProtectionPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetDelivery = "GetDelivery" + +// GetDeliveryRequest generates a "aws/request.Request" representing the +// client's request for the GetDelivery operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetDelivery for more information on using the GetDelivery +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetDeliveryRequest method. +// req, resp := client.GetDeliveryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetDelivery +func (c *CloudWatchLogs) GetDeliveryRequest(input *GetDeliveryInput) (req *request.Request, output *GetDeliveryOutput) { + op := &request.Operation{ + Name: opGetDelivery, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetDeliveryInput{} + } + + output = &GetDeliveryOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetDelivery API operation for Amazon CloudWatch Logs. +// +// Returns complete information about one logical delivery. A delivery is a +// connection between a delivery source (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html) +// and a delivery destination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html). +// +// A delivery source represents an Amazon Web Services resource that sends logs +// to an logs delivery destination. The destination can be CloudWatch Logs, +// Amazon S3, or Firehose. Only some Amazon Web Services services support being +// configured as a delivery source. These services are listed in Enable logging +// from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html) +// +// You need to specify the delivery id in this operation. You can find the IDs +// of the deliveries in your account with the DescribeDeliveries (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeDeliveries.html) +// operation. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation GetDelivery for usage and error information. +// +// Returned Error Types: +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetDelivery +func (c *CloudWatchLogs) GetDelivery(input *GetDeliveryInput) (*GetDeliveryOutput, error) { + req, out := c.GetDeliveryRequest(input) + return out, req.Send() +} + +// GetDeliveryWithContext is the same as GetDelivery with the addition of +// the ability to pass a context and additional request options. +// +// See GetDelivery for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) GetDeliveryWithContext(ctx aws.Context, input *GetDeliveryInput, opts ...request.Option) (*GetDeliveryOutput, error) { + req, out := c.GetDeliveryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetDeliveryDestination = "GetDeliveryDestination" + +// GetDeliveryDestinationRequest generates a "aws/request.Request" representing the +// client's request for the GetDeliveryDestination operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetDeliveryDestination for more information on using the GetDeliveryDestination +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetDeliveryDestinationRequest method. +// req, resp := client.GetDeliveryDestinationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetDeliveryDestination +func (c *CloudWatchLogs) GetDeliveryDestinationRequest(input *GetDeliveryDestinationInput) (req *request.Request, output *GetDeliveryDestinationOutput) { + op := &request.Operation{ + Name: opGetDeliveryDestination, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetDeliveryDestinationInput{} + } + + output = &GetDeliveryDestinationOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetDeliveryDestination API operation for Amazon CloudWatch Logs. +// +// Retrieves complete information about one delivery destination. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation GetDeliveryDestination for usage and error information. +// +// Returned Error Types: +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetDeliveryDestination +func (c *CloudWatchLogs) GetDeliveryDestination(input *GetDeliveryDestinationInput) (*GetDeliveryDestinationOutput, error) { + req, out := c.GetDeliveryDestinationRequest(input) + return out, req.Send() +} + +// GetDeliveryDestinationWithContext is the same as GetDeliveryDestination with the addition of +// the ability to pass a context and additional request options. +// +// See GetDeliveryDestination for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) GetDeliveryDestinationWithContext(ctx aws.Context, input *GetDeliveryDestinationInput, opts ...request.Option) (*GetDeliveryDestinationOutput, error) { + req, out := c.GetDeliveryDestinationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetDeliveryDestinationPolicy = "GetDeliveryDestinationPolicy" + +// GetDeliveryDestinationPolicyRequest generates a "aws/request.Request" representing the +// client's request for the GetDeliveryDestinationPolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetDeliveryDestinationPolicy for more information on using the GetDeliveryDestinationPolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetDeliveryDestinationPolicyRequest method. +// req, resp := client.GetDeliveryDestinationPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetDeliveryDestinationPolicy +func (c *CloudWatchLogs) GetDeliveryDestinationPolicyRequest(input *GetDeliveryDestinationPolicyInput) (req *request.Request, output *GetDeliveryDestinationPolicyOutput) { + op := &request.Operation{ + Name: opGetDeliveryDestinationPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetDeliveryDestinationPolicyInput{} + } + + output = &GetDeliveryDestinationPolicyOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetDeliveryDestinationPolicy API operation for Amazon CloudWatch Logs. +// +// Retrieves the delivery destination policy assigned to the delivery destination +// that you specify. For more information about delivery destinations and their +// policies, see PutDeliveryDestinationPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation GetDeliveryDestinationPolicy for usage and error information. +// +// Returned Error Types: +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetDeliveryDestinationPolicy +func (c *CloudWatchLogs) GetDeliveryDestinationPolicy(input *GetDeliveryDestinationPolicyInput) (*GetDeliveryDestinationPolicyOutput, error) { + req, out := c.GetDeliveryDestinationPolicyRequest(input) + return out, req.Send() +} + +// GetDeliveryDestinationPolicyWithContext is the same as GetDeliveryDestinationPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See GetDeliveryDestinationPolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) GetDeliveryDestinationPolicyWithContext(ctx aws.Context, input *GetDeliveryDestinationPolicyInput, opts ...request.Option) (*GetDeliveryDestinationPolicyOutput, error) { + req, out := c.GetDeliveryDestinationPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetDeliverySource = "GetDeliverySource" + +// GetDeliverySourceRequest generates a "aws/request.Request" representing the +// client's request for the GetDeliverySource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetDeliverySource for more information on using the GetDeliverySource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetDeliverySourceRequest method. +// req, resp := client.GetDeliverySourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetDeliverySource +func (c *CloudWatchLogs) GetDeliverySourceRequest(input *GetDeliverySourceInput) (req *request.Request, output *GetDeliverySourceOutput) { + op := &request.Operation{ + Name: opGetDeliverySource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetDeliverySourceInput{} + } + + output = &GetDeliverySourceOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetDeliverySource API operation for Amazon CloudWatch Logs. +// +// Retrieves complete information about one delivery source. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation GetDeliverySource for usage and error information. +// +// Returned Error Types: +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetDeliverySource +func (c *CloudWatchLogs) GetDeliverySource(input *GetDeliverySourceInput) (*GetDeliverySourceOutput, error) { + req, out := c.GetDeliverySourceRequest(input) + return out, req.Send() +} + +// GetDeliverySourceWithContext is the same as GetDeliverySource with the addition of +// the ability to pass a context and additional request options. +// +// See GetDeliverySource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) GetDeliverySourceWithContext(ctx aws.Context, input *GetDeliverySourceInput, opts ...request.Option) (*GetDeliverySourceOutput, error) { + req, out := c.GetDeliverySourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetLogAnomalyDetector = "GetLogAnomalyDetector" + +// GetLogAnomalyDetectorRequest generates a "aws/request.Request" representing the +// client's request for the GetLogAnomalyDetector operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetLogAnomalyDetector for more information on using the GetLogAnomalyDetector +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetLogAnomalyDetectorRequest method. +// req, resp := client.GetLogAnomalyDetectorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogAnomalyDetector +func (c *CloudWatchLogs) GetLogAnomalyDetectorRequest(input *GetLogAnomalyDetectorInput) (req *request.Request, output *GetLogAnomalyDetectorOutput) { + op := &request.Operation{ + Name: opGetLogAnomalyDetector, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetLogAnomalyDetectorInput{} + } + + output = &GetLogAnomalyDetectorOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetLogAnomalyDetector API operation for Amazon CloudWatch Logs. +// +// Retrieves information about the log anomaly detector that you specify. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation GetLogAnomalyDetector for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogAnomalyDetector +func (c *CloudWatchLogs) GetLogAnomalyDetector(input *GetLogAnomalyDetectorInput) (*GetLogAnomalyDetectorOutput, error) { + req, out := c.GetLogAnomalyDetectorRequest(input) + return out, req.Send() +} + +// GetLogAnomalyDetectorWithContext is the same as GetLogAnomalyDetector with the addition of +// the ability to pass a context and additional request options. +// +// See GetLogAnomalyDetector for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) GetLogAnomalyDetectorWithContext(ctx aws.Context, input *GetLogAnomalyDetectorInput, opts ...request.Option) (*GetLogAnomalyDetectorOutput, error) { + req, out := c.GetLogAnomalyDetectorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetLogEvents = "GetLogEvents" + +// GetLogEventsRequest generates a "aws/request.Request" representing the +// client's request for the GetLogEvents operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetLogEvents for more information on using the GetLogEvents +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetLogEventsRequest method. +// req, resp := client.GetLogEventsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogEvents +func (c *CloudWatchLogs) GetLogEventsRequest(input *GetLogEventsInput) (req *request.Request, output *GetLogEventsOutput) { + op := &request.Operation{ + Name: opGetLogEvents, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextForwardToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &GetLogEventsInput{} + } + + output = &GetLogEventsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetLogEvents API operation for Amazon CloudWatch Logs. +// +// Lists log events from the specified log stream. You can list all of the log +// events or filter using a time range. +// +// By default, this operation returns as many log events as can fit in a response +// size of 1MB (up to 10,000 log events). You can get additional log events +// by specifying one of the tokens in a subsequent call. This operation can +// return empty results while there are more log events available through the +// token. +// +// If you are using CloudWatch cross-account observability, you can use this +// operation in a monitoring account and view data from the linked source accounts. +// For more information, see CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html). +// +// You can specify the log group to search by using either logGroupIdentifier +// or logGroupName. You must include one of these two parameters, but you can't +// include both. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation GetLogEvents for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogEvents +func (c *CloudWatchLogs) GetLogEvents(input *GetLogEventsInput) (*GetLogEventsOutput, error) { + req, out := c.GetLogEventsRequest(input) + return out, req.Send() +} + +// GetLogEventsWithContext is the same as GetLogEvents with the addition of +// the ability to pass a context and additional request options. +// +// See GetLogEvents for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) GetLogEventsWithContext(ctx aws.Context, input *GetLogEventsInput, opts ...request.Option) (*GetLogEventsOutput, error) { + req, out := c.GetLogEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// GetLogEventsPages iterates over the pages of a GetLogEvents operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See GetLogEvents method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a GetLogEvents operation. +// pageNum := 0 +// err := client.GetLogEventsPages(params, +// func(page *cloudwatchlogs.GetLogEventsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) GetLogEventsPages(input *GetLogEventsInput, fn func(*GetLogEventsOutput, bool) bool) error { + return c.GetLogEventsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetLogEventsPagesWithContext same as GetLogEventsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) GetLogEventsPagesWithContext(ctx aws.Context, input *GetLogEventsInput, fn func(*GetLogEventsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *GetLogEventsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetLogEventsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*GetLogEventsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opGetLogGroupFields = "GetLogGroupFields" + +// GetLogGroupFieldsRequest generates a "aws/request.Request" representing the +// client's request for the GetLogGroupFields operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetLogGroupFields for more information on using the GetLogGroupFields +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetLogGroupFieldsRequest method. +// req, resp := client.GetLogGroupFieldsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogGroupFields +func (c *CloudWatchLogs) GetLogGroupFieldsRequest(input *GetLogGroupFieldsInput) (req *request.Request, output *GetLogGroupFieldsOutput) { + op := &request.Operation{ + Name: opGetLogGroupFields, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetLogGroupFieldsInput{} + } + + output = &GetLogGroupFieldsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetLogGroupFields API operation for Amazon CloudWatch Logs. +// +// Returns a list of the fields that are included in log events in the specified +// log group. Includes the percentage of log events that contain each field. +// The search is limited to a time period that you specify. +// +// You can specify the log group to search by using either logGroupIdentifier +// or logGroupName. You must specify one of these parameters, but you can't +// specify both. +// +// In the results, fields that start with @ are fields generated by CloudWatch +// Logs. For example, @timestamp is the timestamp of each log event. For more +// information about the fields that are generated by CloudWatch logs, see Supported +// Logs and Discovered Fields (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData-discoverable-fields.html). +// +// The response results are sorted by the frequency percentage, starting with +// the highest percentage. +// +// If you are using CloudWatch cross-account observability, you can use this +// operation in a monitoring account and view data from the linked source accounts. +// For more information, see CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation GetLogGroupFields for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogGroupFields +func (c *CloudWatchLogs) GetLogGroupFields(input *GetLogGroupFieldsInput) (*GetLogGroupFieldsOutput, error) { + req, out := c.GetLogGroupFieldsRequest(input) + return out, req.Send() +} + +// GetLogGroupFieldsWithContext is the same as GetLogGroupFields with the addition of +// the ability to pass a context and additional request options. +// +// See GetLogGroupFields for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) GetLogGroupFieldsWithContext(ctx aws.Context, input *GetLogGroupFieldsInput, opts ...request.Option) (*GetLogGroupFieldsOutput, error) { + req, out := c.GetLogGroupFieldsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetLogRecord = "GetLogRecord" + +// GetLogRecordRequest generates a "aws/request.Request" representing the +// client's request for the GetLogRecord operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetLogRecord for more information on using the GetLogRecord +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetLogRecordRequest method. +// req, resp := client.GetLogRecordRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogRecord +func (c *CloudWatchLogs) GetLogRecordRequest(input *GetLogRecordInput) (req *request.Request, output *GetLogRecordOutput) { + op := &request.Operation{ + Name: opGetLogRecord, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetLogRecordInput{} + } + + output = &GetLogRecordOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetLogRecord API operation for Amazon CloudWatch Logs. +// +// Retrieves all of the fields and values of a single log event. All fields +// are retrieved, even if the original query that produced the logRecordPointer +// retrieved only a subset of fields. Fields are returned as field name/field +// value pairs. +// +// The full unparsed log event is returned within @message. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation GetLogRecord for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogRecord +func (c *CloudWatchLogs) GetLogRecord(input *GetLogRecordInput) (*GetLogRecordOutput, error) { + req, out := c.GetLogRecordRequest(input) + return out, req.Send() +} + +// GetLogRecordWithContext is the same as GetLogRecord with the addition of +// the ability to pass a context and additional request options. +// +// See GetLogRecord for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) GetLogRecordWithContext(ctx aws.Context, input *GetLogRecordInput, opts ...request.Option) (*GetLogRecordOutput, error) { + req, out := c.GetLogRecordRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetQueryResults = "GetQueryResults" + +// GetQueryResultsRequest generates a "aws/request.Request" representing the +// client's request for the GetQueryResults operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetQueryResults for more information on using the GetQueryResults +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the GetQueryResultsRequest method. +// req, resp := client.GetQueryResultsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetQueryResults +func (c *CloudWatchLogs) GetQueryResultsRequest(input *GetQueryResultsInput) (req *request.Request, output *GetQueryResultsOutput) { + op := &request.Operation{ + Name: opGetQueryResults, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetQueryResultsInput{} + } + + output = &GetQueryResultsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetQueryResults API operation for Amazon CloudWatch Logs. +// +// Returns the results from the specified query. +// +// Only the fields requested in the query are returned, along with a @ptr field, +// which is the identifier for the log record. You can use the value of @ptr +// in a GetLogRecord (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogRecord.html) +// operation to get the full log record. +// +// GetQueryResults does not start running a query. To run a query, use StartQuery +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html). +// For more information about how long results of previous queries are available, +// see CloudWatch Logs quotas (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/cloudwatch_limits_cwl.html). +// +// If the value of the Status field in the output is Running, this operation +// returns only partial results. If you see a value of Scheduled or Running +// for the status, you can retry the operation later to see the final results. +// +// If you are using CloudWatch cross-account observability, you can use this +// operation in a monitoring account to start queries in linked source accounts. +// For more information, see CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation GetQueryResults for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetQueryResults +func (c *CloudWatchLogs) GetQueryResults(input *GetQueryResultsInput) (*GetQueryResultsOutput, error) { + req, out := c.GetQueryResultsRequest(input) + return out, req.Send() +} + +// GetQueryResultsWithContext is the same as GetQueryResults with the addition of +// the ability to pass a context and additional request options. +// +// See GetQueryResults for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) GetQueryResultsWithContext(ctx aws.Context, input *GetQueryResultsInput, opts ...request.Option) (*GetQueryResultsOutput, error) { + req, out := c.GetQueryResultsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListAnomalies = "ListAnomalies" + +// ListAnomaliesRequest generates a "aws/request.Request" representing the +// client's request for the ListAnomalies operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListAnomalies for more information on using the ListAnomalies +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the ListAnomaliesRequest method. +// req, resp := client.ListAnomaliesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListAnomalies +func (c *CloudWatchLogs) ListAnomaliesRequest(input *ListAnomaliesInput) (req *request.Request, output *ListAnomaliesOutput) { + op := &request.Operation{ + Name: opListAnomalies, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListAnomaliesInput{} + } + + output = &ListAnomaliesOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListAnomalies API operation for Amazon CloudWatch Logs. +// +// Returns a list of anomalies that log anomaly detectors have found. For details +// about the structure format of each anomaly object that is returned, see the +// example in this section. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation ListAnomalies for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListAnomalies +func (c *CloudWatchLogs) ListAnomalies(input *ListAnomaliesInput) (*ListAnomaliesOutput, error) { + req, out := c.ListAnomaliesRequest(input) + return out, req.Send() +} + +// ListAnomaliesWithContext is the same as ListAnomalies with the addition of +// the ability to pass a context and additional request options. +// +// See ListAnomalies for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) ListAnomaliesWithContext(ctx aws.Context, input *ListAnomaliesInput, opts ...request.Option) (*ListAnomaliesOutput, error) { + req, out := c.ListAnomaliesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListAnomaliesPages iterates over the pages of a ListAnomalies operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListAnomalies method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListAnomalies operation. +// pageNum := 0 +// err := client.ListAnomaliesPages(params, +// func(page *cloudwatchlogs.ListAnomaliesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) ListAnomaliesPages(input *ListAnomaliesInput, fn func(*ListAnomaliesOutput, bool) bool) error { + return c.ListAnomaliesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListAnomaliesPagesWithContext same as ListAnomaliesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) ListAnomaliesPagesWithContext(ctx aws.Context, input *ListAnomaliesInput, fn func(*ListAnomaliesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *ListAnomaliesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListAnomaliesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*ListAnomaliesOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opListLogAnomalyDetectors = "ListLogAnomalyDetectors" + +// ListLogAnomalyDetectorsRequest generates a "aws/request.Request" representing the +// client's request for the ListLogAnomalyDetectors operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListLogAnomalyDetectors for more information on using the ListLogAnomalyDetectors +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the ListLogAnomalyDetectorsRequest method. +// req, resp := client.ListLogAnomalyDetectorsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListLogAnomalyDetectors +func (c *CloudWatchLogs) ListLogAnomalyDetectorsRequest(input *ListLogAnomalyDetectorsInput) (req *request.Request, output *ListLogAnomalyDetectorsOutput) { + op := &request.Operation{ + Name: opListLogAnomalyDetectors, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListLogAnomalyDetectorsInput{} + } + + output = &ListLogAnomalyDetectorsOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListLogAnomalyDetectors API operation for Amazon CloudWatch Logs. +// +// Retrieves a list of the log anomaly detectors in the account. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation ListLogAnomalyDetectors for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListLogAnomalyDetectors +func (c *CloudWatchLogs) ListLogAnomalyDetectors(input *ListLogAnomalyDetectorsInput) (*ListLogAnomalyDetectorsOutput, error) { + req, out := c.ListLogAnomalyDetectorsRequest(input) + return out, req.Send() +} + +// ListLogAnomalyDetectorsWithContext is the same as ListLogAnomalyDetectors with the addition of +// the ability to pass a context and additional request options. +// +// See ListLogAnomalyDetectors for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) ListLogAnomalyDetectorsWithContext(ctx aws.Context, input *ListLogAnomalyDetectorsInput, opts ...request.Option) (*ListLogAnomalyDetectorsOutput, error) { + req, out := c.ListLogAnomalyDetectorsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListLogAnomalyDetectorsPages iterates over the pages of a ListLogAnomalyDetectors operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListLogAnomalyDetectors method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListLogAnomalyDetectors operation. +// pageNum := 0 +// err := client.ListLogAnomalyDetectorsPages(params, +// func(page *cloudwatchlogs.ListLogAnomalyDetectorsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +func (c *CloudWatchLogs) ListLogAnomalyDetectorsPages(input *ListLogAnomalyDetectorsInput, fn func(*ListLogAnomalyDetectorsOutput, bool) bool) error { + return c.ListLogAnomalyDetectorsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListLogAnomalyDetectorsPagesWithContext same as ListLogAnomalyDetectorsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) ListLogAnomalyDetectorsPagesWithContext(ctx aws.Context, input *ListLogAnomalyDetectorsInput, fn func(*ListLogAnomalyDetectorsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + EndPageOnSameToken: true, + NewRequest: func() (*request.Request, error) { + var inCpy *ListLogAnomalyDetectorsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListLogAnomalyDetectorsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + for p.Next() { + if !fn(p.Page().(*ListLogAnomalyDetectorsOutput), !p.HasNextPage()) { + break + } + } + + return p.Err() +} + +const opListTagsForResource = "ListTagsForResource" + +// ListTagsForResourceRequest generates a "aws/request.Request" representing the +// client's request for the ListTagsForResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListTagsForResource for more information on using the ListTagsForResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the ListTagsForResourceRequest method. +// req, resp := client.ListTagsForResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListTagsForResource +func (c *CloudWatchLogs) ListTagsForResourceRequest(input *ListTagsForResourceInput) (req *request.Request, output *ListTagsForResourceOutput) { + op := &request.Operation{ + Name: opListTagsForResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListTagsForResourceInput{} + } + + output = &ListTagsForResourceOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListTagsForResource API operation for Amazon CloudWatch Logs. +// +// Displays the tags associated with a CloudWatch Logs resource. Currently, +// log groups and destinations support tagging. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation ListTagsForResource for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListTagsForResource +func (c *CloudWatchLogs) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListTagsLogGroup = "ListTagsLogGroup" + +// ListTagsLogGroupRequest generates a "aws/request.Request" representing the +// client's request for the ListTagsLogGroup operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListTagsLogGroup for more information on using the ListTagsLogGroup +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the ListTagsLogGroupRequest method. +// req, resp := client.ListTagsLogGroupRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListTagsLogGroup +// +// Deprecated: Please use the generic tagging API ListTagsForResource +func (c *CloudWatchLogs) ListTagsLogGroupRequest(input *ListTagsLogGroupInput) (req *request.Request, output *ListTagsLogGroupOutput) { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, ListTagsLogGroup, has been deprecated") + } + op := &request.Operation{ + Name: opListTagsLogGroup, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListTagsLogGroupInput{} + } + + output = &ListTagsLogGroupOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListTagsLogGroup API operation for Amazon CloudWatch Logs. +// +// The ListTagsLogGroup operation is on the path to deprecation. We recommend +// that you use ListTagsForResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html) +// instead. +// +// Lists the tags for the specified log group. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation ListTagsLogGroup for usage and error information. +// +// Returned Error Types: +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListTagsLogGroup +// +// Deprecated: Please use the generic tagging API ListTagsForResource +func (c *CloudWatchLogs) ListTagsLogGroup(input *ListTagsLogGroupInput) (*ListTagsLogGroupOutput, error) { + req, out := c.ListTagsLogGroupRequest(input) + return out, req.Send() +} + +// ListTagsLogGroupWithContext is the same as ListTagsLogGroup with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsLogGroup for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +// +// Deprecated: Please use the generic tagging API ListTagsForResource +func (c *CloudWatchLogs) ListTagsLogGroupWithContext(ctx aws.Context, input *ListTagsLogGroupInput, opts ...request.Option) (*ListTagsLogGroupOutput, error) { + req, out := c.ListTagsLogGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutAccountPolicy = "PutAccountPolicy" + +// PutAccountPolicyRequest generates a "aws/request.Request" representing the +// client's request for the PutAccountPolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutAccountPolicy for more information on using the PutAccountPolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutAccountPolicyRequest method. +// req, resp := client.PutAccountPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutAccountPolicy +func (c *CloudWatchLogs) PutAccountPolicyRequest(input *PutAccountPolicyInput) (req *request.Request, output *PutAccountPolicyOutput) { + op := &request.Operation{ + Name: opPutAccountPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutAccountPolicyInput{} + } + + output = &PutAccountPolicyOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutAccountPolicy API operation for Amazon CloudWatch Logs. +// +// Creates an account-level data protection policy or subscription filter policy +// that applies to all log groups or a subset of log groups in the account. +// +// # Data protection policy +// +// A data protection policy can help safeguard sensitive data that's ingested +// by your log groups by auditing and masking the sensitive log data. Each account +// can have only one account-level data protection policy. +// +// Sensitive data is detected and masked when it is ingested into a log group. +// When you set a data protection policy, log events ingested into the log groups +// before that time are not masked. +// +// If you use PutAccountPolicy to create a data protection policy for your whole +// account, it applies to both existing log groups and all log groups that are +// created later in this account. The account-level policy is applied to existing +// log groups with eventual consistency. It might take up to 5 minutes before +// sensitive data in existing log groups begins to be masked. +// +// By default, when a user views a log event that includes masked data, the +// sensitive data is replaced by asterisks. A user who has the logs:Unmask permission +// can use a GetLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogEvents.html) +// or FilterLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_FilterLogEvents.html) +// operation with the unmask parameter set to true to view the unmasked log +// events. Users with the logs:Unmask can also view unmasked data in the CloudWatch +// Logs console by running a CloudWatch Logs Insights query with the unmask +// query command. +// +// For more information, including a list of types of data that can be audited +// and masked, see Protect sensitive log data with masking (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data.html). +// +// To use the PutAccountPolicy operation for a data protection policy, you must +// be signed on with the logs:PutDataProtectionPolicy and logs:PutAccountPolicy +// permissions. +// +// The PutAccountPolicy operation applies to all log groups in the account. +// You can use PutDataProtectionPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDataProtectionPolicy.html) +// to create a data protection policy that applies to just one log group. If +// a log group has its own data protection policy and the account also has an +// account-level data protection policy, then the two policies are cumulative. +// Any sensitive term specified in either policy is masked. +// +// # Subscription filter policy +// +// A subscription filter policy sets up a real-time feed of log events from +// CloudWatch Logs to other Amazon Web Services services. Account-level subscription +// filter policies apply to both existing log groups and log groups that are +// created later in this account. Supported destinations are Kinesis Data Streams, +// Firehose, and Lambda. When log events are sent to the receiving service, +// they are Base64 encoded and compressed with the GZIP format. +// +// The following destinations are supported for subscription filters: +// +// - An Kinesis Data Streams data stream in the same account as the subscription +// policy, for same-account delivery. +// +// - An Firehose data stream in the same account as the subscription policy, +// for same-account delivery. +// +// - A Lambda function in the same account as the subscription policy, for +// same-account delivery. +// +// - A logical destination in a different account created with PutDestination +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestination.html), +// for cross-account delivery. Kinesis Data Streams and Firehose are supported +// as logical destinations. +// +// Each account can have one account-level subscription filter policy per Region. +// If you are updating an existing filter, you must specify the correct name +// in PolicyName. To perform a PutAccountPolicy subscription filter operation +// for any destination except a Lambda function, you must also have the iam:PassRole +// permission. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutAccountPolicy for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutAccountPolicy +func (c *CloudWatchLogs) PutAccountPolicy(input *PutAccountPolicyInput) (*PutAccountPolicyOutput, error) { + req, out := c.PutAccountPolicyRequest(input) + return out, req.Send() +} + +// PutAccountPolicyWithContext is the same as PutAccountPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutAccountPolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutAccountPolicyWithContext(ctx aws.Context, input *PutAccountPolicyInput, opts ...request.Option) (*PutAccountPolicyOutput, error) { + req, out := c.PutAccountPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutDataProtectionPolicy = "PutDataProtectionPolicy" + +// PutDataProtectionPolicyRequest generates a "aws/request.Request" representing the +// client's request for the PutDataProtectionPolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutDataProtectionPolicy for more information on using the PutDataProtectionPolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutDataProtectionPolicyRequest method. +// req, resp := client.PutDataProtectionPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDataProtectionPolicy +func (c *CloudWatchLogs) PutDataProtectionPolicyRequest(input *PutDataProtectionPolicyInput) (req *request.Request, output *PutDataProtectionPolicyOutput) { + op := &request.Operation{ + Name: opPutDataProtectionPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutDataProtectionPolicyInput{} + } + + output = &PutDataProtectionPolicyOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutDataProtectionPolicy API operation for Amazon CloudWatch Logs. +// +// Creates a data protection policy for the specified log group. A data protection +// policy can help safeguard sensitive data that's ingested by the log group +// by auditing and masking the sensitive log data. +// +// Sensitive data is detected and masked when it is ingested into the log group. +// When you set a data protection policy, log events ingested into the log group +// before that time are not masked. +// +// By default, when a user views a log event that includes masked data, the +// sensitive data is replaced by asterisks. A user who has the logs:Unmask permission +// can use a GetLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogEvents.html) +// or FilterLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_FilterLogEvents.html) +// operation with the unmask parameter set to true to view the unmasked log +// events. Users with the logs:Unmask can also view unmasked data in the CloudWatch +// Logs console by running a CloudWatch Logs Insights query with the unmask +// query command. +// +// For more information, including a list of types of data that can be audited +// and masked, see Protect sensitive log data with masking (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data.html). +// +// The PutDataProtectionPolicy operation applies to only the specified log group. +// You can also use PutAccountPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutAccountPolicy.html) +// to create an account-level data protection policy that applies to all log +// groups in the account, including both existing log groups and log groups +// that are created level. If a log group has its own data protection policy +// and the account also has an account-level data protection policy, then the +// two policies are cumulative. Any sensitive term specified in either policy +// is masked. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutDataProtectionPolicy for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDataProtectionPolicy +func (c *CloudWatchLogs) PutDataProtectionPolicy(input *PutDataProtectionPolicyInput) (*PutDataProtectionPolicyOutput, error) { + req, out := c.PutDataProtectionPolicyRequest(input) + return out, req.Send() +} + +// PutDataProtectionPolicyWithContext is the same as PutDataProtectionPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutDataProtectionPolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutDataProtectionPolicyWithContext(ctx aws.Context, input *PutDataProtectionPolicyInput, opts ...request.Option) (*PutDataProtectionPolicyOutput, error) { + req, out := c.PutDataProtectionPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutDeliveryDestination = "PutDeliveryDestination" + +// PutDeliveryDestinationRequest generates a "aws/request.Request" representing the +// client's request for the PutDeliveryDestination operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutDeliveryDestination for more information on using the PutDeliveryDestination +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutDeliveryDestinationRequest method. +// req, resp := client.PutDeliveryDestinationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDeliveryDestination +func (c *CloudWatchLogs) PutDeliveryDestinationRequest(input *PutDeliveryDestinationInput) (req *request.Request, output *PutDeliveryDestinationOutput) { + op := &request.Operation{ + Name: opPutDeliveryDestination, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutDeliveryDestinationInput{} + } + + output = &PutDeliveryDestinationOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutDeliveryDestination API operation for Amazon CloudWatch Logs. +// +// Creates or updates a logical delivery destination. A delivery destination +// is an Amazon Web Services resource that represents an Amazon Web Services +// service that logs can be sent to. CloudWatch Logs, Amazon S3, and Firehose +// are supported as logs delivery destinations. +// +// To configure logs delivery between a supported Amazon Web Services service +// and a destination, you must do the following: +// +// - Create a delivery source, which is a logical object that represents +// the resource that is actually sending the logs. For more information, +// see PutDeliverySource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html). +// +// - Use PutDeliveryDestination to create a delivery destination, which is +// a logical object that represents the actual delivery destination. +// +// - If you are delivering logs cross-account, you must use PutDeliveryDestinationPolicy +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html) +// in the destination account to assign an IAM policy to the destination. +// This policy allows delivery to that destination. +// +// - Use CreateDelivery to create a delivery by pairing exactly one delivery +// source and one delivery destination. For more information, see CreateDelivery +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html). +// +// You can configure a single delivery source to send logs to multiple destinations +// by creating multiple deliveries. You can also create multiple deliveries +// to configure multiple delivery sources to send logs to the same delivery +// destination. +// +// Only some Amazon Web Services services support being configured as a delivery +// source. These services are listed as Supported [V2 Permissions] in the table +// at Enabling logging from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html) +// +// If you use this operation to update an existing delivery destination, all +// the current delivery destination parameters are overwritten with the new +// parameter values that you specify. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutDeliveryDestination for usage and error information. +// +// Returned Error Types: +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ConflictException +// This operation attempted to create a resource that already exists. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDeliveryDestination +func (c *CloudWatchLogs) PutDeliveryDestination(input *PutDeliveryDestinationInput) (*PutDeliveryDestinationOutput, error) { + req, out := c.PutDeliveryDestinationRequest(input) + return out, req.Send() +} + +// PutDeliveryDestinationWithContext is the same as PutDeliveryDestination with the addition of +// the ability to pass a context and additional request options. +// +// See PutDeliveryDestination for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutDeliveryDestinationWithContext(ctx aws.Context, input *PutDeliveryDestinationInput, opts ...request.Option) (*PutDeliveryDestinationOutput, error) { + req, out := c.PutDeliveryDestinationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutDeliveryDestinationPolicy = "PutDeliveryDestinationPolicy" + +// PutDeliveryDestinationPolicyRequest generates a "aws/request.Request" representing the +// client's request for the PutDeliveryDestinationPolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutDeliveryDestinationPolicy for more information on using the PutDeliveryDestinationPolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutDeliveryDestinationPolicyRequest method. +// req, resp := client.PutDeliveryDestinationPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDeliveryDestinationPolicy +func (c *CloudWatchLogs) PutDeliveryDestinationPolicyRequest(input *PutDeliveryDestinationPolicyInput) (req *request.Request, output *PutDeliveryDestinationPolicyOutput) { + op := &request.Operation{ + Name: opPutDeliveryDestinationPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutDeliveryDestinationPolicyInput{} + } + + output = &PutDeliveryDestinationPolicyOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutDeliveryDestinationPolicy API operation for Amazon CloudWatch Logs. +// +// Creates and assigns an IAM policy that grants permissions to CloudWatch Logs +// to deliver logs cross-account to a specified destination in this account. +// To configure the delivery of logs from an Amazon Web Services service in +// another account to a logs delivery destination in the current account, you +// must do the following: +// +// - Create a delivery source, which is a logical object that represents +// the resource that is actually sending the logs. For more information, +// see PutDeliverySource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html). +// +// - Create a delivery destination, which is a logical object that represents +// the actual delivery destination. For more information, see PutDeliveryDestination +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html). +// +// - Use this operation in the destination account to assign an IAM policy +// to the destination. This policy allows delivery to that destination. +// +// - Create a delivery by pairing exactly one delivery source and one delivery +// destination. For more information, see CreateDelivery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html). +// +// Only some Amazon Web Services services support being configured as a delivery +// source. These services are listed as Supported [V2 Permissions] in the table +// at Enabling logging from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html) +// +// The contents of the policy must include two statements. One statement enables +// general logs delivery, and the other allows delivery to the chosen destination. +// See the examples for the needed policies. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutDeliveryDestinationPolicy for usage and error information. +// +// Returned Error Types: +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ConflictException +// This operation attempted to create a resource that already exists. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDeliveryDestinationPolicy +func (c *CloudWatchLogs) PutDeliveryDestinationPolicy(input *PutDeliveryDestinationPolicyInput) (*PutDeliveryDestinationPolicyOutput, error) { + req, out := c.PutDeliveryDestinationPolicyRequest(input) + return out, req.Send() +} + +// PutDeliveryDestinationPolicyWithContext is the same as PutDeliveryDestinationPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutDeliveryDestinationPolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutDeliveryDestinationPolicyWithContext(ctx aws.Context, input *PutDeliveryDestinationPolicyInput, opts ...request.Option) (*PutDeliveryDestinationPolicyOutput, error) { + req, out := c.PutDeliveryDestinationPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutDeliverySource = "PutDeliverySource" + +// PutDeliverySourceRequest generates a "aws/request.Request" representing the +// client's request for the PutDeliverySource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutDeliverySource for more information on using the PutDeliverySource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutDeliverySourceRequest method. +// req, resp := client.PutDeliverySourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDeliverySource +func (c *CloudWatchLogs) PutDeliverySourceRequest(input *PutDeliverySourceInput) (req *request.Request, output *PutDeliverySourceOutput) { + op := &request.Operation{ + Name: opPutDeliverySource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutDeliverySourceInput{} + } + + output = &PutDeliverySourceOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutDeliverySource API operation for Amazon CloudWatch Logs. +// +// Creates or updates a logical delivery source. A delivery source represents +// an Amazon Web Services resource that sends logs to an logs delivery destination. +// The destination can be CloudWatch Logs, Amazon S3, or Firehose. +// +// To configure logs delivery between a delivery destination and an Amazon Web +// Services service that is supported as a delivery source, you must do the +// following: +// +// - Use PutDeliverySource to create a delivery source, which is a logical +// object that represents the resource that is actually sending the logs. +// +// - Use PutDeliveryDestination to create a delivery destination, which is +// a logical object that represents the actual delivery destination. For +// more information, see PutDeliveryDestination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html). +// +// - If you are delivering logs cross-account, you must use PutDeliveryDestinationPolicy +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html) +// in the destination account to assign an IAM policy to the destination. +// This policy allows delivery to that destination. +// +// - Use CreateDelivery to create a delivery by pairing exactly one delivery +// source and one delivery destination. For more information, see CreateDelivery +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html). +// +// You can configure a single delivery source to send logs to multiple destinations +// by creating multiple deliveries. You can also create multiple deliveries +// to configure multiple delivery sources to send logs to the same delivery +// destination. +// +// Only some Amazon Web Services services support being configured as a delivery +// source. These services are listed as Supported [V2 Permissions] in the table +// at Enabling logging from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html) +// +// If you use this operation to update an existing delivery source, all the +// current delivery source parameters are overwritten with the new parameter +// values that you specify. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutDeliverySource for usage and error information. +// +// Returned Error Types: +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - ConflictException +// This operation attempted to create a resource that already exists. +// +// - ValidationException +// One of the parameters for the request is not valid. +// +// - ServiceQuotaExceededException +// This request exceeds a service quota. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ThrottlingException +// The request was throttled because of quota limits. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDeliverySource +func (c *CloudWatchLogs) PutDeliverySource(input *PutDeliverySourceInput) (*PutDeliverySourceOutput, error) { + req, out := c.PutDeliverySourceRequest(input) + return out, req.Send() +} + +// PutDeliverySourceWithContext is the same as PutDeliverySource with the addition of +// the ability to pass a context and additional request options. +// +// See PutDeliverySource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutDeliverySourceWithContext(ctx aws.Context, input *PutDeliverySourceInput, opts ...request.Option) (*PutDeliverySourceOutput, error) { + req, out := c.PutDeliverySourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutDestination = "PutDestination" + +// PutDestinationRequest generates a "aws/request.Request" representing the +// client's request for the PutDestination operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutDestination for more information on using the PutDestination +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutDestinationRequest method. +// req, resp := client.PutDestinationRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestination +func (c *CloudWatchLogs) PutDestinationRequest(input *PutDestinationInput) (req *request.Request, output *PutDestinationOutput) { + op := &request.Operation{ + Name: opPutDestination, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutDestinationInput{} + } + + output = &PutDestinationOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutDestination API operation for Amazon CloudWatch Logs. +// +// Creates or updates a destination. This operation is used only to create destinations +// for cross-account subscriptions. +// +// A destination encapsulates a physical resource (such as an Amazon Kinesis +// stream). With a destination, you can subscribe to a real-time stream of log +// events for a different account, ingested using PutLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html). +// +// Through an access policy, a destination controls what is written to it. By +// default, PutDestination does not set any access policy with the destination, +// which means a cross-account user cannot call PutSubscriptionFilter (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutSubscriptionFilter.html) +// against this destination. To enable this, the destination owner must call +// PutDestinationPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestinationPolicy.html) +// after PutDestination. +// +// To perform a PutDestination operation, you must also have the iam:PassRole +// permission. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutDestination for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestination +func (c *CloudWatchLogs) PutDestination(input *PutDestinationInput) (*PutDestinationOutput, error) { + req, out := c.PutDestinationRequest(input) + return out, req.Send() +} + +// PutDestinationWithContext is the same as PutDestination with the addition of +// the ability to pass a context and additional request options. +// +// See PutDestination for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutDestinationWithContext(ctx aws.Context, input *PutDestinationInput, opts ...request.Option) (*PutDestinationOutput, error) { + req, out := c.PutDestinationRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutDestinationPolicy = "PutDestinationPolicy" + +// PutDestinationPolicyRequest generates a "aws/request.Request" representing the +// client's request for the PutDestinationPolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutDestinationPolicy for more information on using the PutDestinationPolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutDestinationPolicyRequest method. +// req, resp := client.PutDestinationPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestinationPolicy +func (c *CloudWatchLogs) PutDestinationPolicyRequest(input *PutDestinationPolicyInput) (req *request.Request, output *PutDestinationPolicyOutput) { + op := &request.Operation{ + Name: opPutDestinationPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutDestinationPolicyInput{} + } + + output = &PutDestinationPolicyOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// PutDestinationPolicy API operation for Amazon CloudWatch Logs. +// +// Creates or updates an access policy associated with an existing destination. +// An access policy is an IAM policy document (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies_overview.html) +// that is used to authorize claims to register a subscription filter against +// a given destination. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutDestinationPolicy for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestinationPolicy +func (c *CloudWatchLogs) PutDestinationPolicy(input *PutDestinationPolicyInput) (*PutDestinationPolicyOutput, error) { + req, out := c.PutDestinationPolicyRequest(input) + return out, req.Send() +} + +// PutDestinationPolicyWithContext is the same as PutDestinationPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutDestinationPolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutDestinationPolicyWithContext(ctx aws.Context, input *PutDestinationPolicyInput, opts ...request.Option) (*PutDestinationPolicyOutput, error) { + req, out := c.PutDestinationPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutLogEvents = "PutLogEvents" + +// PutLogEventsRequest generates a "aws/request.Request" representing the +// client's request for the PutLogEvents operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutLogEvents for more information on using the PutLogEvents +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutLogEventsRequest method. +// req, resp := client.PutLogEventsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutLogEvents +func (c *CloudWatchLogs) PutLogEventsRequest(input *PutLogEventsInput) (req *request.Request, output *PutLogEventsOutput) { + op := &request.Operation{ + Name: opPutLogEvents, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutLogEventsInput{} + } + + output = &PutLogEventsOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutLogEvents API operation for Amazon CloudWatch Logs. +// +// Uploads a batch of log events to the specified log stream. +// +// The sequence token is now ignored in PutLogEvents actions. PutLogEvents actions +// are always accepted and never return InvalidSequenceTokenException or DataAlreadyAcceptedException +// even if the sequence token is not valid. You can use parallel PutLogEvents +// actions on the same log stream. +// +// The batch of events must satisfy the following constraints: +// +// - The maximum batch size is 1,048,576 bytes. This size is calculated as +// the sum of all event messages in UTF-8, plus 26 bytes for each log event. +// +// - None of the log events in the batch can be more than 2 hours in the +// future. +// +// - None of the log events in the batch can be more than 14 days in the +// past. Also, none of the log events can be from earlier than the retention +// period of the log group. +// +// - The log events in the batch must be in chronological order by their +// timestamp. The timestamp is the time that the event occurred, expressed +// as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. (In Amazon +// Web Services Tools for PowerShell and the Amazon Web Services SDK for +// .NET, the timestamp is specified in .NET format: yyyy-mm-ddThh:mm:ss. +// For example, 2017-09-15T13:45:30.) +// +// - A batch of log events in a single request cannot span more than 24 hours. +// Otherwise, the operation fails. +// +// - Each log event can be no larger than 256 KB. +// +// - The maximum number of log events in a batch is 10,000. +// +// - The quota of five requests per second per log stream has been removed. +// Instead, PutLogEvents actions are throttled based on a per-second per-account +// quota. You can request an increase to the per-second throttling quota +// by using the Service Quotas service. +// +// If a call to PutLogEvents returns "UnrecognizedClientException" the most +// likely cause is a non-valid Amazon Web Services access key ID or secret key. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutLogEvents for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - InvalidSequenceTokenException +// The sequence token is not valid. You can get the correct sequence token in +// the expectedSequenceToken field in the InvalidSequenceTokenException message. +// +// PutLogEvents actions are now always accepted and never return InvalidSequenceTokenException +// regardless of receiving an invalid sequence token. +// +// - DataAlreadyAcceptedException +// The event was already logged. +// +// PutLogEvents actions are now always accepted and never return DataAlreadyAcceptedException +// regardless of whether a given batch of log events has already been accepted. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - UnrecognizedClientException +// The most likely cause is an Amazon Web Services access key ID or secret key +// that's not valid. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutLogEvents +func (c *CloudWatchLogs) PutLogEvents(input *PutLogEventsInput) (*PutLogEventsOutput, error) { + req, out := c.PutLogEventsRequest(input) + return out, req.Send() +} + +// PutLogEventsWithContext is the same as PutLogEvents with the addition of +// the ability to pass a context and additional request options. +// +// See PutLogEvents for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutLogEventsWithContext(ctx aws.Context, input *PutLogEventsInput, opts ...request.Option) (*PutLogEventsOutput, error) { + req, out := c.PutLogEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutMetricFilter = "PutMetricFilter" + +// PutMetricFilterRequest generates a "aws/request.Request" representing the +// client's request for the PutMetricFilter operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutMetricFilter for more information on using the PutMetricFilter +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutMetricFilterRequest method. +// req, resp := client.PutMetricFilterRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutMetricFilter +func (c *CloudWatchLogs) PutMetricFilterRequest(input *PutMetricFilterInput) (req *request.Request, output *PutMetricFilterOutput) { + op := &request.Operation{ + Name: opPutMetricFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutMetricFilterInput{} + } + + output = &PutMetricFilterOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// PutMetricFilter API operation for Amazon CloudWatch Logs. +// +// Creates or updates a metric filter and associates it with the specified log +// group. With metric filters, you can configure rules to extract metric data +// from log events ingested through PutLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html). +// +// The maximum number of metric filters that can be associated with a log group +// is 100. +// +// Using regular expressions to create metric filters is supported. For these +// filters, there is a quotas of quota of two regular expression patterns within +// a single filter pattern. There is also a quota of five regular expression +// patterns per log group. For more information about using regular expressions +// in metric filters, see Filter pattern syntax for metric filters, subscription +// filters, filter log events, and Live Tail (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html). +// +// When you create a metric filter, you can also optionally assign a unit and +// dimensions to the metric that is created. +// +// Metrics extracted from log events are charged as custom metrics. To prevent +// unexpected high charges, do not specify high-cardinality fields such as IPAddress +// or requestID as dimensions. Each different value found for a dimension is +// treated as a separate metric and accrues charges as a separate custom metric. +// +// CloudWatch Logs might disable a metric filter if it generates 1,000 different +// name/value pairs for your specified dimensions within one hour. +// +// You can also set up a billing alarm to alert you if your charges are higher +// than expected. For more information, see Creating a Billing Alarm to Monitor +// Your Estimated Amazon Web Services Charges (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutMetricFilter for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutMetricFilter +func (c *CloudWatchLogs) PutMetricFilter(input *PutMetricFilterInput) (*PutMetricFilterOutput, error) { + req, out := c.PutMetricFilterRequest(input) + return out, req.Send() +} + +// PutMetricFilterWithContext is the same as PutMetricFilter with the addition of +// the ability to pass a context and additional request options. +// +// See PutMetricFilter for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutMetricFilterWithContext(ctx aws.Context, input *PutMetricFilterInput, opts ...request.Option) (*PutMetricFilterOutput, error) { + req, out := c.PutMetricFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutQueryDefinition = "PutQueryDefinition" + +// PutQueryDefinitionRequest generates a "aws/request.Request" representing the +// client's request for the PutQueryDefinition operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutQueryDefinition for more information on using the PutQueryDefinition +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutQueryDefinitionRequest method. +// req, resp := client.PutQueryDefinitionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutQueryDefinition +func (c *CloudWatchLogs) PutQueryDefinitionRequest(input *PutQueryDefinitionInput) (req *request.Request, output *PutQueryDefinitionOutput) { + op := &request.Operation{ + Name: opPutQueryDefinition, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutQueryDefinitionInput{} + } + + output = &PutQueryDefinitionOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutQueryDefinition API operation for Amazon CloudWatch Logs. +// +// Creates or updates a query definition for CloudWatch Logs Insights. For more +// information, see Analyzing Log Data with CloudWatch Logs Insights (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html). +// +// To update a query definition, specify its queryDefinitionId in your request. +// The values of name, queryString, and logGroupNames are changed to the values +// that you specify in your update operation. No current values are retained +// from the current query definition. For example, imagine updating a current +// query definition that includes log groups. If you don't specify the logGroupNames +// parameter in your update operation, the query definition changes to contain +// no log groups. +// +// You must have the logs:PutQueryDefinition permission to be able to perform +// this operation. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutQueryDefinition for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutQueryDefinition +func (c *CloudWatchLogs) PutQueryDefinition(input *PutQueryDefinitionInput) (*PutQueryDefinitionOutput, error) { + req, out := c.PutQueryDefinitionRequest(input) + return out, req.Send() +} + +// PutQueryDefinitionWithContext is the same as PutQueryDefinition with the addition of +// the ability to pass a context and additional request options. +// +// See PutQueryDefinition for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutQueryDefinitionWithContext(ctx aws.Context, input *PutQueryDefinitionInput, opts ...request.Option) (*PutQueryDefinitionOutput, error) { + req, out := c.PutQueryDefinitionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutResourcePolicy = "PutResourcePolicy" + +// PutResourcePolicyRequest generates a "aws/request.Request" representing the +// client's request for the PutResourcePolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutResourcePolicy for more information on using the PutResourcePolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutResourcePolicyRequest method. +// req, resp := client.PutResourcePolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutResourcePolicy +func (c *CloudWatchLogs) PutResourcePolicyRequest(input *PutResourcePolicyInput) (req *request.Request, output *PutResourcePolicyOutput) { + op := &request.Operation{ + Name: opPutResourcePolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutResourcePolicyInput{} + } + + output = &PutResourcePolicyOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutResourcePolicy API operation for Amazon CloudWatch Logs. +// +// Creates or updates a resource policy allowing other Amazon Web Services services +// to put log events to this account, such as Amazon Route 53. An account can +// have up to 10 resource policies per Amazon Web Services Region. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutResourcePolicy for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutResourcePolicy +func (c *CloudWatchLogs) PutResourcePolicy(input *PutResourcePolicyInput) (*PutResourcePolicyOutput, error) { + req, out := c.PutResourcePolicyRequest(input) + return out, req.Send() +} + +// PutResourcePolicyWithContext is the same as PutResourcePolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutResourcePolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutResourcePolicyWithContext(ctx aws.Context, input *PutResourcePolicyInput, opts ...request.Option) (*PutResourcePolicyOutput, error) { + req, out := c.PutResourcePolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutRetentionPolicy = "PutRetentionPolicy" + +// PutRetentionPolicyRequest generates a "aws/request.Request" representing the +// client's request for the PutRetentionPolicy operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutRetentionPolicy for more information on using the PutRetentionPolicy +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutRetentionPolicyRequest method. +// req, resp := client.PutRetentionPolicyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutRetentionPolicy +func (c *CloudWatchLogs) PutRetentionPolicyRequest(input *PutRetentionPolicyInput) (req *request.Request, output *PutRetentionPolicyOutput) { + op := &request.Operation{ + Name: opPutRetentionPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutRetentionPolicyInput{} + } + + output = &PutRetentionPolicyOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// PutRetentionPolicy API operation for Amazon CloudWatch Logs. +// +// Sets the retention of the specified log group. With a retention policy, you +// can configure the number of days for which to retain log events in the specified +// log group. +// +// CloudWatch Logs doesn’t immediately delete log events when they reach their +// retention setting. It typically takes up to 72 hours after that before log +// events are deleted, but in rare situations might take longer. +// +// To illustrate, imagine that you change a log group to have a longer retention +// setting when it contains log events that are past the expiration date, but +// haven’t been deleted. Those log events will take up to 72 hours to be deleted +// after the new retention date is reached. To make sure that log data is deleted +// permanently, keep a log group at its lower retention setting until 72 hours +// after the previous retention period ends. Alternatively, wait to change the +// retention setting until you confirm that the earlier log events are deleted. +// +// When log events reach their retention setting they are marked for deletion. +// After they are marked for deletion, they do not add to your archival storage +// costs anymore, even if they are not actually deleted until later. These log +// events marked for deletion are also not included when you use an API to retrieve +// the storedBytes value to see how many bytes a log group is storing. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutRetentionPolicy for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutRetentionPolicy +func (c *CloudWatchLogs) PutRetentionPolicy(input *PutRetentionPolicyInput) (*PutRetentionPolicyOutput, error) { + req, out := c.PutRetentionPolicyRequest(input) + return out, req.Send() +} + +// PutRetentionPolicyWithContext is the same as PutRetentionPolicy with the addition of +// the ability to pass a context and additional request options. +// +// See PutRetentionPolicy for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutRetentionPolicyWithContext(ctx aws.Context, input *PutRetentionPolicyInput, opts ...request.Option) (*PutRetentionPolicyOutput, error) { + req, out := c.PutRetentionPolicyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opPutSubscriptionFilter = "PutSubscriptionFilter" + +// PutSubscriptionFilterRequest generates a "aws/request.Request" representing the +// client's request for the PutSubscriptionFilter operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See PutSubscriptionFilter for more information on using the PutSubscriptionFilter +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the PutSubscriptionFilterRequest method. +// req, resp := client.PutSubscriptionFilterRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutSubscriptionFilter +func (c *CloudWatchLogs) PutSubscriptionFilterRequest(input *PutSubscriptionFilterInput) (req *request.Request, output *PutSubscriptionFilterOutput) { + op := &request.Operation{ + Name: opPutSubscriptionFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutSubscriptionFilterInput{} + } + + output = &PutSubscriptionFilterOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// PutSubscriptionFilter API operation for Amazon CloudWatch Logs. +// +// Creates or updates a subscription filter and associates it with the specified +// log group. With subscription filters, you can subscribe to a real-time stream +// of log events ingested through PutLogEvents (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html) +// and have them delivered to a specific destination. When log events are sent +// to the receiving service, they are Base64 encoded and compressed with the +// GZIP format. +// +// The following destinations are supported for subscription filters: +// +// - An Amazon Kinesis data stream belonging to the same account as the subscription +// filter, for same-account delivery. +// +// - A logical destination created with PutDestination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestination.html) +// that belongs to a different account, for cross-account delivery. We currently +// support Kinesis Data Streams and Firehose as logical destinations. +// +// - An Amazon Kinesis Data Firehose delivery stream that belongs to the +// same account as the subscription filter, for same-account delivery. +// +// - An Lambda function that belongs to the same account as the subscription +// filter, for same-account delivery. +// +// Each log group can have up to two subscription filters associated with it. +// If you are updating an existing filter, you must specify the correct name +// in filterName. +// +// Using regular expressions to create subscription filters is supported. For +// these filters, there is a quotas of quota of two regular expression patterns +// within a single filter pattern. There is also a quota of five regular expression +// patterns per log group. For more information about using regular expressions +// in subscription filters, see Filter pattern syntax for metric filters, subscription +// filters, filter log events, and Live Tail (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html). +// +// To perform a PutSubscriptionFilter operation for any destination except a +// Lambda function, you must also have the iam:PassRole permission. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation PutSubscriptionFilter for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutSubscriptionFilter +func (c *CloudWatchLogs) PutSubscriptionFilter(input *PutSubscriptionFilterInput) (*PutSubscriptionFilterOutput, error) { + req, out := c.PutSubscriptionFilterRequest(input) + return out, req.Send() +} + +// PutSubscriptionFilterWithContext is the same as PutSubscriptionFilter with the addition of +// the ability to pass a context and additional request options. +// +// See PutSubscriptionFilter for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) PutSubscriptionFilterWithContext(ctx aws.Context, input *PutSubscriptionFilterInput, opts ...request.Option) (*PutSubscriptionFilterOutput, error) { + req, out := c.PutSubscriptionFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opStartLiveTail = "StartLiveTail" + +// StartLiveTailRequest generates a "aws/request.Request" representing the +// client's request for the StartLiveTail operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See StartLiveTail for more information on using the StartLiveTail +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the StartLiveTailRequest method. +// req, resp := client.StartLiveTailRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/StartLiveTail +func (c *CloudWatchLogs) StartLiveTailRequest(input *StartLiveTailInput) (req *request.Request, output *StartLiveTailOutput) { + op := &request.Operation{ + Name: opStartLiveTail, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &StartLiveTailInput{} + } + + output = &StartLiveTailOutput{} + req = c.newRequest(op, input, output) + + es := NewStartLiveTailEventStream() + output.eventStream = es + + req.Handlers.Send.Swap(client.LogHTTPResponseHandler.Name, client.LogHTTPResponseHeaderHandler) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, rest.UnmarshalHandler) + req.Handlers.Unmarshal.PushBack(es.runOutputStream) + es.output = output + req.Handlers.Unmarshal.PushBack(es.recvInitialEvent) + req.Handlers.Unmarshal.PushBack(es.runOnStreamPartClose) + req.Handlers.Build.PushBackNamed(protocol.NewHostPrefixHandler("streaming-", nil)) + req.Handlers.Build.PushBackNamed(protocol.ValidateEndpointHostHandler) + return +} + +// StartLiveTail API operation for Amazon CloudWatch Logs. +// +// Starts a Live Tail streaming session for one or more log groups. A Live Tail +// session returns a stream of log events that have been recently ingested in +// the log groups. For more information, see Use Live Tail to view logs in near +// real time (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatchLogs_LiveTail.html). +// +// The response to this operation is a response stream, over which the server +// sends live log events and the client receives them. +// +// The following objects are sent over the stream: +// +// - A single LiveTailSessionStart (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_LiveTailSessionStart.html) +// object is sent at the start of the session. +// +// - Every second, a LiveTailSessionUpdate (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_LiveTailSessionUpdate.html) +// object is sent. Each of these objects contains an array of the actual +// log events. If no new log events were ingested in the past second, the +// LiveTailSessionUpdate object will contain an empty array. The array of +// log events contained in a LiveTailSessionUpdate can include as many as +// 500 log events. If the number of log events matching the request exceeds +// 500 per second, the log events are sampled down to 500 log events to be +// included in each LiveTailSessionUpdate object. If your client consumes +// the log events slower than the server produces them, CloudWatch Logs buffers +// up to 10 LiveTailSessionUpdate events or 5000 log events, after which +// it starts dropping the oldest events. +// +// - A SessionStreamingException (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartLiveTailResponseStream.html#CWL-Type-StartLiveTailResponseStream-SessionStreamingException) +// object is returned if an unknown error occurs on the server side. +// +// - A SessionTimeoutException (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartLiveTailResponseStream.html#CWL-Type-StartLiveTailResponseStream-SessionTimeoutException) +// object is returned when the session times out, after it has been kept +// open for three hours. +// +// You can end a session before it times out by closing the session stream or +// by closing the client that is receiving the stream. The session also ends +// if the established connection between the client and the server breaks. +// +// For examples of using an SDK to start a Live Tail session, see Start a Live +// Tail session using an Amazon Web Services SDK (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/example_cloudwatch-logs_StartLiveTail_section.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation StartLiveTail for usage and error information. +// +// Returned Error Types: +// +// - AccessDeniedException +// You don't have sufficient permissions to perform this action. +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// - InvalidOperationException +// The operation is not valid on the specified resource. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/StartLiveTail +func (c *CloudWatchLogs) StartLiveTail(input *StartLiveTailInput) (*StartLiveTailOutput, error) { + req, out := c.StartLiveTailRequest(input) + return out, req.Send() +} + +// StartLiveTailWithContext is the same as StartLiveTail with the addition of +// the ability to pass a context and additional request options. +// +// See StartLiveTail for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) StartLiveTailWithContext(ctx aws.Context, input *StartLiveTailInput, opts ...request.Option) (*StartLiveTailOutput, error) { + req, out := c.StartLiveTailRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +var _ awserr.Error +var _ time.Time + +// StartLiveTailEventStream provides the event stream handling for the StartLiveTail. +// +// For testing and mocking the event stream this type should be initialized via +// the NewStartLiveTailEventStream constructor function. Using the functional options +// to pass in nested mock behavior. +type StartLiveTailEventStream struct { + + // Reader is the EventStream reader for the StartLiveTailResponseStream + // events. This value is automatically set by the SDK when the API call is made + // Use this member when unit testing your code with the SDK to mock out the + // EventStream Reader. + // + // Must not be nil. + Reader StartLiveTailResponseStreamReader + + outputReader io.ReadCloser + output *StartLiveTailOutput + + done chan struct{} + closeOnce sync.Once + err *eventstreamapi.OnceError +} + +// NewStartLiveTailEventStream initializes an StartLiveTailEventStream. +// This function should only be used for testing and mocking the StartLiveTailEventStream +// stream within your application. +// +// The Reader member must be set before reading events from the stream. +// +// es := NewStartLiveTailEventStream(func(o *StartLiveTailEventStream){ +// es.Reader = myMockStreamReader +// }) +func NewStartLiveTailEventStream(opts ...func(*StartLiveTailEventStream)) *StartLiveTailEventStream { + es := &StartLiveTailEventStream{ + done: make(chan struct{}), + err: eventstreamapi.NewOnceError(), + } + + for _, fn := range opts { + fn(es) + } + + return es +} + +func (es *StartLiveTailEventStream) runOnStreamPartClose(r *request.Request) { + if es.done == nil { + return + } + go es.waitStreamPartClose() + +} + +func (es *StartLiveTailEventStream) waitStreamPartClose() { + var outputErrCh <-chan struct{} + if v, ok := es.Reader.(interface{ ErrorSet() <-chan struct{} }); ok { + outputErrCh = v.ErrorSet() + } + var outputClosedCh <-chan struct{} + if v, ok := es.Reader.(interface{ Closed() <-chan struct{} }); ok { + outputClosedCh = v.Closed() + } + + select { + case <-es.done: + case <-outputErrCh: + es.err.SetError(es.Reader.Err()) + es.Close() + case <-outputClosedCh: + if err := es.Reader.Err(); err != nil { + es.err.SetError(es.Reader.Err()) + } + es.Close() + } +} + +type eventTypeForStartLiveTailEventStreamOutputEvent struct { + unmarshalerForEvent func(string) (eventstreamapi.Unmarshaler, error) + output *StartLiveTailOutput +} + +func (e eventTypeForStartLiveTailEventStreamOutputEvent) UnmarshalerForEventName(eventType string) (eventstreamapi.Unmarshaler, error) { + if eventType == "initial-response" { + return e.output, nil + } + return e.unmarshalerForEvent(eventType) +} + +// Events returns a channel to read events from. +// +// These events are: +// +// - LiveTailSessionStart +// - LiveTailSessionUpdate +// - StartLiveTailResponseStreamUnknownEvent +func (es *StartLiveTailEventStream) Events() <-chan StartLiveTailResponseStreamEvent { + return es.Reader.Events() +} + +func (es *StartLiveTailEventStream) runOutputStream(r *request.Request) { + var opts []func(*eventstream.Decoder) + if r.Config.Logger != nil && r.Config.LogLevel.Matches(aws.LogDebugWithEventStreamBody) { + opts = append(opts, eventstream.DecodeWithLogger(r.Config.Logger)) + } + + unmarshalerForEvent := unmarshalerForStartLiveTailResponseStreamEvent{ + metadata: protocol.ResponseMetadata{ + StatusCode: r.HTTPResponse.StatusCode, + RequestID: r.RequestID, + }, + }.UnmarshalerForEventName + unmarshalerForEvent = eventTypeForStartLiveTailEventStreamOutputEvent{ + unmarshalerForEvent: unmarshalerForEvent, + output: es.output, + }.UnmarshalerForEventName + + decoder := eventstream.NewDecoder(r.HTTPResponse.Body, opts...) + eventReader := eventstreamapi.NewEventReader(decoder, + protocol.HandlerPayloadUnmarshal{ + Unmarshalers: r.Handlers.UnmarshalStream, + }, + unmarshalerForEvent, + ) + + es.outputReader = r.HTTPResponse.Body + es.Reader = newReadStartLiveTailResponseStream(eventReader) +} +func (es *StartLiveTailEventStream) recvInitialEvent(r *request.Request) { + // Wait for the initial response event, which must be the first + // event to be received from the API. + select { + case event, ok := <-es.Events(): + if !ok { + return + } + + v, ok := event.(*StartLiveTailOutput) + if !ok || v == nil { + r.Error = awserr.New( + request.ErrCodeSerialization, + fmt.Sprintf("invalid event, %T, expect %T, %v", + event, (*StartLiveTailOutput)(nil), v), + nil, + ) + return + } + + *es.output = *v + es.output.eventStream = es + } +} + +// Close closes the stream. This will also cause the stream to be closed. +// Close must be called when done using the stream API. Not calling Close +// may result in resource leaks. +// +// You can use the closing of the Reader's Events channel to terminate your +// application's read from the API's stream. +func (es *StartLiveTailEventStream) Close() (err error) { + es.closeOnce.Do(es.safeClose) + return es.Err() +} + +func (es *StartLiveTailEventStream) safeClose() { + if es.done != nil { + close(es.done) + } + + es.Reader.Close() + if es.outputReader != nil { + es.outputReader.Close() + } +} + +// Err returns any error that occurred while reading or writing EventStream +// Events from the service API's response. Returns nil if there were no errors. +func (es *StartLiveTailEventStream) Err() error { + if err := es.err.Err(); err != nil { + return err + } + if err := es.Reader.Err(); err != nil { + return err + } + + return nil +} + +const opStartQuery = "StartQuery" + +// StartQueryRequest generates a "aws/request.Request" representing the +// client's request for the StartQuery operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See StartQuery for more information on using the StartQuery +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the StartQueryRequest method. +// req, resp := client.StartQueryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/StartQuery +func (c *CloudWatchLogs) StartQueryRequest(input *StartQueryInput) (req *request.Request, output *StartQueryOutput) { + op := &request.Operation{ + Name: opStartQuery, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &StartQueryInput{} + } + + output = &StartQueryOutput{} + req = c.newRequest(op, input, output) + return +} + +// StartQuery API operation for Amazon CloudWatch Logs. +// +// Schedules a query of a log group using CloudWatch Logs Insights. You specify +// the log group and time range to query and the query string to use. +// +// For more information, see CloudWatch Logs Insights Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html). +// +// After you run a query using StartQuery, the query results are stored by CloudWatch +// Logs. You can use GetQueryResults (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetQueryResults.html) +// to retrieve the results of a query, using the queryId that StartQuery returns. +// +// If you have associated a KMS key with the query results in this account, +// then StartQuery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html) +// uses that key to encrypt the results when it stores them. If no key is associated +// with query results, the query results are encrypted with the default CloudWatch +// Logs encryption method. +// +// Queries time out after 60 minutes of runtime. If your queries are timing +// out, reduce the time range being searched or partition your query into a +// number of queries. +// +// If you are using CloudWatch cross-account observability, you can use this +// operation in a monitoring account to start a query in a linked source account. +// For more information, see CloudWatch cross-account observability (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html). +// For a cross-account StartQuery operation, the query definition must be defined +// in the monitoring account. +// +// You can have up to 30 concurrent CloudWatch Logs insights queries, including +// queries that have been added to dashboards. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation StartQuery for usage and error information. +// +// Returned Error Types: +// +// - MalformedQueryException +// The query string is not valid. Details about this error are displayed in +// a QueryCompileError object. For more information, see QueryCompileError (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_QueryCompileError.html). +// +// For more information about valid query syntax, see CloudWatch Logs Insights +// Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html). +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - LimitExceededException +// You have reached the maximum number of resources that can be created. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/StartQuery +func (c *CloudWatchLogs) StartQuery(input *StartQueryInput) (*StartQueryOutput, error) { + req, out := c.StartQueryRequest(input) + return out, req.Send() +} + +// StartQueryWithContext is the same as StartQuery with the addition of +// the ability to pass a context and additional request options. +// +// See StartQuery for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) StartQueryWithContext(ctx aws.Context, input *StartQueryInput, opts ...request.Option) (*StartQueryOutput, error) { + req, out := c.StartQueryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opStopQuery = "StopQuery" + +// StopQueryRequest generates a "aws/request.Request" representing the +// client's request for the StopQuery operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See StopQuery for more information on using the StopQuery +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the StopQueryRequest method. +// req, resp := client.StopQueryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/StopQuery +func (c *CloudWatchLogs) StopQueryRequest(input *StopQueryInput) (req *request.Request, output *StopQueryOutput) { + op := &request.Operation{ + Name: opStopQuery, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &StopQueryInput{} + } + + output = &StopQueryOutput{} + req = c.newRequest(op, input, output) + return +} + +// StopQuery API operation for Amazon CloudWatch Logs. +// +// Stops a CloudWatch Logs Insights query that is in progress. If the query +// has already ended, the operation returns an error indicating that the specified +// query is not running. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation StopQuery for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/StopQuery +func (c *CloudWatchLogs) StopQuery(input *StopQueryInput) (*StopQueryOutput, error) { + req, out := c.StopQueryRequest(input) + return out, req.Send() +} + +// StopQueryWithContext is the same as StopQuery with the addition of +// the ability to pass a context and additional request options. +// +// See StopQuery for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) StopQueryWithContext(ctx aws.Context, input *StopQueryInput, opts ...request.Option) (*StopQueryOutput, error) { + req, out := c.StopQueryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opTagLogGroup = "TagLogGroup" + +// TagLogGroupRequest generates a "aws/request.Request" representing the +// client's request for the TagLogGroup operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See TagLogGroup for more information on using the TagLogGroup +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the TagLogGroupRequest method. +// req, resp := client.TagLogGroupRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TagLogGroup +// +// Deprecated: Please use the generic tagging API TagResource +func (c *CloudWatchLogs) TagLogGroupRequest(input *TagLogGroupInput) (req *request.Request, output *TagLogGroupOutput) { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, TagLogGroup, has been deprecated") + } + op := &request.Operation{ + Name: opTagLogGroup, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &TagLogGroupInput{} + } + + output = &TagLogGroupOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// TagLogGroup API operation for Amazon CloudWatch Logs. +// +// The TagLogGroup operation is on the path to deprecation. We recommend that +// you use TagResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_TagResource.html) +// instead. +// +// Adds or updates the specified tags for the specified log group. +// +// To list the tags for a log group, use ListTagsForResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html). +// To remove tags, use UntagResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UntagResource.html). +// +// For more information about tags, see Tag Log Groups in Amazon CloudWatch +// Logs (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html#log-group-tagging) +// in the Amazon CloudWatch Logs User Guide. +// +// CloudWatch Logs doesn’t support IAM policies that prevent users from assigning +// specified tags to log groups using the aws:Resource/key-name or aws:TagKeys +// condition keys. For more information about using tags to control access, +// see Controlling access to Amazon Web Services resources using tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html). +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation TagLogGroup for usage and error information. +// +// Returned Error Types: +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TagLogGroup +// +// Deprecated: Please use the generic tagging API TagResource +func (c *CloudWatchLogs) TagLogGroup(input *TagLogGroupInput) (*TagLogGroupOutput, error) { + req, out := c.TagLogGroupRequest(input) + return out, req.Send() +} + +// TagLogGroupWithContext is the same as TagLogGroup with the addition of +// the ability to pass a context and additional request options. +// +// See TagLogGroup for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +// +// Deprecated: Please use the generic tagging API TagResource +func (c *CloudWatchLogs) TagLogGroupWithContext(ctx aws.Context, input *TagLogGroupInput, opts ...request.Option) (*TagLogGroupOutput, error) { + req, out := c.TagLogGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opTagResource = "TagResource" + +// TagResourceRequest generates a "aws/request.Request" representing the +// client's request for the TagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See TagResource for more information on using the TagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the TagResourceRequest method. +// req, resp := client.TagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TagResource +func (c *CloudWatchLogs) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) { + op := &request.Operation{ + Name: opTagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &TagResourceInput{} + } + + output = &TagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// TagResource API operation for Amazon CloudWatch Logs. +// +// Assigns one or more tags (key-value pairs) to the specified CloudWatch Logs +// resource. Currently, the only CloudWatch Logs resources that can be tagged +// are log groups and destinations. +// +// Tags can help you organize and categorize your resources. You can also use +// them to scope user permissions by granting a user permission to access or +// change only resources with certain tag values. +// +// Tags don't have any semantic meaning to Amazon Web Services and are interpreted +// strictly as strings of characters. +// +// You can use the TagResource action with a resource that already has tags. +// If you specify a new tag key for the alarm, this tag is appended to the list +// of tags associated with the alarm. If you specify a tag key that is already +// associated with the alarm, the new tag value that you specify replaces the +// previous value for that tag. +// +// You can associate as many as 50 tags with a CloudWatch Logs resource. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation TagResource for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - TooManyTagsException +// A resource can have no more than 50 tags. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TagResource +func (c *CloudWatchLogs) TagResource(input *TagResourceInput) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + return out, req.Send() +} + +// TagResourceWithContext is the same as TagResource with the addition of +// the ability to pass a context and additional request options. +// +// See TagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) TagResourceWithContext(ctx aws.Context, input *TagResourceInput, opts ...request.Option) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opTestMetricFilter = "TestMetricFilter" + +// TestMetricFilterRequest generates a "aws/request.Request" representing the +// client's request for the TestMetricFilter operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See TestMetricFilter for more information on using the TestMetricFilter +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the TestMetricFilterRequest method. +// req, resp := client.TestMetricFilterRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TestMetricFilter +func (c *CloudWatchLogs) TestMetricFilterRequest(input *TestMetricFilterInput) (req *request.Request, output *TestMetricFilterOutput) { + op := &request.Operation{ + Name: opTestMetricFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &TestMetricFilterInput{} + } + + output = &TestMetricFilterOutput{} + req = c.newRequest(op, input, output) + return +} + +// TestMetricFilter API operation for Amazon CloudWatch Logs. +// +// Tests the filter pattern of a metric filter against a sample of log event +// messages. You can use this operation to validate the correctness of a metric +// filter pattern. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation TestMetricFilter for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TestMetricFilter +func (c *CloudWatchLogs) TestMetricFilter(input *TestMetricFilterInput) (*TestMetricFilterOutput, error) { + req, out := c.TestMetricFilterRequest(input) + return out, req.Send() +} + +// TestMetricFilterWithContext is the same as TestMetricFilter with the addition of +// the ability to pass a context and additional request options. +// +// See TestMetricFilter for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) TestMetricFilterWithContext(ctx aws.Context, input *TestMetricFilterInput, opts ...request.Option) (*TestMetricFilterOutput, error) { + req, out := c.TestMetricFilterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUntagLogGroup = "UntagLogGroup" + +// UntagLogGroupRequest generates a "aws/request.Request" representing the +// client's request for the UntagLogGroup operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UntagLogGroup for more information on using the UntagLogGroup +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the UntagLogGroupRequest method. +// req, resp := client.UntagLogGroupRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UntagLogGroup +// +// Deprecated: Please use the generic tagging API UntagResource +func (c *CloudWatchLogs) UntagLogGroupRequest(input *UntagLogGroupInput) (req *request.Request, output *UntagLogGroupOutput) { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, UntagLogGroup, has been deprecated") + } + op := &request.Operation{ + Name: opUntagLogGroup, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UntagLogGroupInput{} + } + + output = &UntagLogGroupOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// UntagLogGroup API operation for Amazon CloudWatch Logs. +// +// The UntagLogGroup operation is on the path to deprecation. We recommend that +// you use UntagResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UntagResource.html) +// instead. +// +// Removes the specified tags from the specified log group. +// +// To list the tags for a log group, use ListTagsForResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html). +// To add tags, use TagResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_TagResource.html). +// +// CloudWatch Logs doesn’t support IAM policies that prevent users from assigning +// specified tags to log groups using the aws:Resource/key-name or aws:TagKeys +// condition keys. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation UntagLogGroup for usage and error information. +// +// Returned Error Types: +// - ResourceNotFoundException +// The specified resource does not exist. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UntagLogGroup +// +// Deprecated: Please use the generic tagging API UntagResource +func (c *CloudWatchLogs) UntagLogGroup(input *UntagLogGroupInput) (*UntagLogGroupOutput, error) { + req, out := c.UntagLogGroupRequest(input) + return out, req.Send() +} + +// UntagLogGroupWithContext is the same as UntagLogGroup with the addition of +// the ability to pass a context and additional request options. +// +// See UntagLogGroup for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +// +// Deprecated: Please use the generic tagging API UntagResource +func (c *CloudWatchLogs) UntagLogGroupWithContext(ctx aws.Context, input *UntagLogGroupInput, opts ...request.Option) (*UntagLogGroupOutput, error) { + req, out := c.UntagLogGroupRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUntagResource = "UntagResource" + +// UntagResourceRequest generates a "aws/request.Request" representing the +// client's request for the UntagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UntagResource for more information on using the UntagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the UntagResourceRequest method. +// req, resp := client.UntagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UntagResource +func (c *CloudWatchLogs) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) { + op := &request.Operation{ + Name: opUntagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UntagResourceInput{} + } + + output = &UntagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// UntagResource API operation for Amazon CloudWatch Logs. +// +// Removes one or more tags from the specified resource. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation UntagResource for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UntagResource +func (c *CloudWatchLogs) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + return out, req.Send() +} + +// UntagResourceWithContext is the same as UntagResource with the addition of +// the ability to pass a context and additional request options. +// +// See UntagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) UntagResourceWithContext(ctx aws.Context, input *UntagResourceInput, opts ...request.Option) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateAnomaly = "UpdateAnomaly" + +// UpdateAnomalyRequest generates a "aws/request.Request" representing the +// client's request for the UpdateAnomaly operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UpdateAnomaly for more information on using the UpdateAnomaly +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the UpdateAnomalyRequest method. +// req, resp := client.UpdateAnomalyRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UpdateAnomaly +func (c *CloudWatchLogs) UpdateAnomalyRequest(input *UpdateAnomalyInput) (req *request.Request, output *UpdateAnomalyOutput) { + op := &request.Operation{ + Name: opUpdateAnomaly, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UpdateAnomalyInput{} + } + + output = &UpdateAnomalyOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// UpdateAnomaly API operation for Amazon CloudWatch Logs. +// +// Use this operation to suppress anomaly detection for a specified anomaly +// or pattern. If you suppress an anomaly, CloudWatch Logs won’t report new +// occurrences of that anomaly and won't update that anomaly with new data. +// If you suppress a pattern, CloudWatch Logs won’t report any anomalies related +// to that pattern. +// +// You must specify either anomalyId or patternId, but you can't specify both +// parameters in the same operation. +// +// If you have previously used this operation to suppress detection of a pattern +// or anomaly, you can use it again to cause CloudWatch Logs to end the suppression. +// To do this, use this operation and specify the anomaly or pattern to stop +// suppressing, and omit the suppressionType and suppressionPeriod parameters. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation UpdateAnomaly for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UpdateAnomaly +func (c *CloudWatchLogs) UpdateAnomaly(input *UpdateAnomalyInput) (*UpdateAnomalyOutput, error) { + req, out := c.UpdateAnomalyRequest(input) + return out, req.Send() +} + +// UpdateAnomalyWithContext is the same as UpdateAnomaly with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateAnomaly for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) UpdateAnomalyWithContext(ctx aws.Context, input *UpdateAnomalyInput, opts ...request.Option) (*UpdateAnomalyOutput, error) { + req, out := c.UpdateAnomalyRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateLogAnomalyDetector = "UpdateLogAnomalyDetector" + +// UpdateLogAnomalyDetectorRequest generates a "aws/request.Request" representing the +// client's request for the UpdateLogAnomalyDetector operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UpdateLogAnomalyDetector for more information on using the UpdateLogAnomalyDetector +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// // Example sending a request using the UpdateLogAnomalyDetectorRequest method. +// req, resp := client.UpdateLogAnomalyDetectorRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UpdateLogAnomalyDetector +func (c *CloudWatchLogs) UpdateLogAnomalyDetectorRequest(input *UpdateLogAnomalyDetectorInput) (req *request.Request, output *UpdateLogAnomalyDetectorOutput) { + op := &request.Operation{ + Name: opUpdateLogAnomalyDetector, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UpdateLogAnomalyDetectorInput{} + } + + output = &UpdateLogAnomalyDetectorOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// UpdateLogAnomalyDetector API operation for Amazon CloudWatch Logs. +// +// Updates an existing log anomaly detector. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon CloudWatch Logs's +// API operation UpdateLogAnomalyDetector for usage and error information. +// +// Returned Error Types: +// +// - InvalidParameterException +// A parameter is specified incorrectly. +// +// - ResourceNotFoundException +// The specified resource does not exist. +// +// - ServiceUnavailableException +// The service cannot complete the request. +// +// - OperationAbortedException +// Multiple concurrent requests to update the same resource were in conflict. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UpdateLogAnomalyDetector +func (c *CloudWatchLogs) UpdateLogAnomalyDetector(input *UpdateLogAnomalyDetectorInput) (*UpdateLogAnomalyDetectorOutput, error) { + req, out := c.UpdateLogAnomalyDetectorRequest(input) + return out, req.Send() +} + +// UpdateLogAnomalyDetectorWithContext is the same as UpdateLogAnomalyDetector with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateLogAnomalyDetector for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudWatchLogs) UpdateLogAnomalyDetectorWithContext(ctx aws.Context, input *UpdateLogAnomalyDetectorInput, opts ...request.Option) (*UpdateLogAnomalyDetectorOutput, error) { + req, out := c.UpdateLogAnomalyDetectorRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// You don't have sufficient permissions to perform this action. +type AccessDeniedException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AccessDeniedException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AccessDeniedException) GoString() string { + return s.String() +} + +func newErrorAccessDeniedException(v protocol.ResponseMetadata) error { + return &AccessDeniedException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *AccessDeniedException) Code() string { + return "AccessDeniedException" +} + +// Message returns the exception's message. +func (s *AccessDeniedException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *AccessDeniedException) OrigErr() error { + return nil +} + +func (s *AccessDeniedException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *AccessDeniedException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *AccessDeniedException) RequestID() string { + return s.RespMetadata.RequestID +} + +// A structure that contains information about one CloudWatch Logs account policy. +type AccountPolicy struct { + _ struct{} `type:"structure"` + + // The Amazon Web Services account ID that the policy applies to. + AccountId *string `locationName:"accountId" min:"12" type:"string"` + + // The date and time that this policy was most recently updated. + LastUpdatedTime *int64 `locationName:"lastUpdatedTime" type:"long"` + + // The policy document for this account policy. + // + // The JSON specified in policyDocument can be up to 30,720 characters. + PolicyDocument *string `locationName:"policyDocument" type:"string"` + + // The name of the account policy. + PolicyName *string `locationName:"policyName" type:"string"` + + // The type of policy for this account policy. + PolicyType *string `locationName:"policyType" type:"string" enum:"PolicyType"` + + // The scope of the account policy. + Scope *string `locationName:"scope" type:"string" enum:"Scope"` + + // The log group selection criteria for this subscription filter policy. + SelectionCriteria *string `locationName:"selectionCriteria" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AccountPolicy) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AccountPolicy) GoString() string { + return s.String() +} + +// SetAccountId sets the AccountId field's value. +func (s *AccountPolicy) SetAccountId(v string) *AccountPolicy { + s.AccountId = &v + return s +} + +// SetLastUpdatedTime sets the LastUpdatedTime field's value. +func (s *AccountPolicy) SetLastUpdatedTime(v int64) *AccountPolicy { + s.LastUpdatedTime = &v + return s +} + +// SetPolicyDocument sets the PolicyDocument field's value. +func (s *AccountPolicy) SetPolicyDocument(v string) *AccountPolicy { + s.PolicyDocument = &v + return s +} + +// SetPolicyName sets the PolicyName field's value. +func (s *AccountPolicy) SetPolicyName(v string) *AccountPolicy { + s.PolicyName = &v + return s +} + +// SetPolicyType sets the PolicyType field's value. +func (s *AccountPolicy) SetPolicyType(v string) *AccountPolicy { + s.PolicyType = &v + return s +} + +// SetScope sets the Scope field's value. +func (s *AccountPolicy) SetScope(v string) *AccountPolicy { + s.Scope = &v + return s +} + +// SetSelectionCriteria sets the SelectionCriteria field's value. +func (s *AccountPolicy) SetSelectionCriteria(v string) *AccountPolicy { + s.SelectionCriteria = &v + return s +} + +// This structure represents one anomaly that has been found by a logs anomaly +// detector. +// +// For more information about patterns and anomalies, see CreateLogAnomalyDetector +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateLogAnomalyDetector.html). +type Anomaly struct { + _ struct{} `type:"structure"` + + // Specifies whether this anomaly is still ongoing. + // + // Active is a required field + Active *bool `locationName:"active" type:"boolean" required:"true"` + + // The ARN of the anomaly detector that identified this anomaly. + // + // AnomalyDetectorArn is a required field + AnomalyDetectorArn *string `locationName:"anomalyDetectorArn" min:"1" type:"string" required:"true"` + + // The unique ID that CloudWatch Logs assigned to this anomaly. + // + // AnomalyId is a required field + AnomalyId *string `locationName:"anomalyId" min:"36" type:"string" required:"true"` + + // A human-readable description of the anomaly. This description is generated + // by CloudWatch Logs. + // + // Description is a required field + Description *string `locationName:"description" min:"1" type:"string" required:"true"` + + // The date and time when the anomaly detector first saw this anomaly. It is + // specified as epoch time, which is the number of seconds since January 1, + // 1970, 00:00:00 UTC. + // + // FirstSeen is a required field + FirstSeen *int64 `locationName:"firstSeen" type:"long" required:"true"` + + // A map showing times when the anomaly detector ran, and the number of occurrences + // of this anomaly that were detected at each of those runs. The times are specified + // in epoch time, which is the number of seconds since January 1, 1970, 00:00:00 + // UTC. + // + // Histogram is a required field + Histogram map[string]*int64 `locationName:"histogram" type:"map" required:"true"` + + // If this anomaly is suppressed, this field is true if the suppression is because + // the pattern is suppressed. If false, then only this particular anomaly is + // suppressed. + IsPatternLevelSuppression *bool `locationName:"isPatternLevelSuppression" type:"boolean"` + + // The date and time when the anomaly detector most recently saw this anomaly. + // It is specified as epoch time, which is the number of seconds since January + // 1, 1970, 00:00:00 UTC. + // + // LastSeen is a required field + LastSeen *int64 `locationName:"lastSeen" type:"long" required:"true"` + + // An array of ARNS of the log groups that contained log events considered to + // be part of this anomaly. + // + // LogGroupArnList is a required field + LogGroupArnList []*string `locationName:"logGroupArnList" type:"list" required:"true"` + + // An array of sample log event messages that are considered to be part of this + // anomaly. + // + // LogSamples is a required field + LogSamples []*LogEvent `locationName:"logSamples" type:"list" required:"true"` + + // The ID of the pattern used to help identify this anomaly. + // + // PatternId is a required field + PatternId *string `locationName:"patternId" min:"32" type:"string" required:"true"` + + // The pattern used to help identify this anomaly, in regular expression format. + PatternRegex *string `locationName:"patternRegex" min:"1" type:"string"` + + // The pattern used to help identify this anomaly, in string format. + // + // PatternString is a required field + PatternString *string `locationName:"patternString" min:"1" type:"string" required:"true"` + + // An array of structures where each structure contains information about one + // token that makes up the pattern. + // + // PatternTokens is a required field + PatternTokens []*PatternToken `locationName:"patternTokens" type:"list" required:"true"` + + // The priority level of this anomaly, as determined by CloudWatch Logs. Priority + // is computed based on log severity labels such as FATAL and ERROR and the + // amount of deviation from the baseline. Possible values are HIGH, MEDIUM, + // and LOW. + Priority *string `locationName:"priority" min:"1" type:"string"` + + // Indicates the current state of this anomaly. If it is still being treated + // as an anomaly, the value is Active. If you have suppressed this anomaly by + // using the UpdateAnomaly (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UpdateAnomaly.html) + // operation, the value is Suppressed. If this behavior is now considered to + // be normal, the value is Baseline. + // + // State is a required field + State *string `locationName:"state" type:"string" required:"true" enum:"State"` + + // Indicates whether this anomaly is currently suppressed. To suppress an anomaly, + // use UpdateAnomaly (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UpdateAnomaly.html). + Suppressed *bool `locationName:"suppressed" type:"boolean"` + + // If the anomaly is suppressed, this indicates when it was suppressed. + SuppressedDate *int64 `locationName:"suppressedDate" type:"long"` + + // If the anomaly is suppressed, this indicates when the suppression will end. + // If this value is 0, the anomaly was suppressed with no expiration, with the + // INFINITE value. + SuppressedUntil *int64 `locationName:"suppressedUntil" type:"long"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Anomaly) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Anomaly) GoString() string { + return s.String() +} + +// SetActive sets the Active field's value. +func (s *Anomaly) SetActive(v bool) *Anomaly { + s.Active = &v + return s +} + +// SetAnomalyDetectorArn sets the AnomalyDetectorArn field's value. +func (s *Anomaly) SetAnomalyDetectorArn(v string) *Anomaly { + s.AnomalyDetectorArn = &v + return s +} + +// SetAnomalyId sets the AnomalyId field's value. +func (s *Anomaly) SetAnomalyId(v string) *Anomaly { + s.AnomalyId = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *Anomaly) SetDescription(v string) *Anomaly { + s.Description = &v + return s +} + +// SetFirstSeen sets the FirstSeen field's value. +func (s *Anomaly) SetFirstSeen(v int64) *Anomaly { + s.FirstSeen = &v + return s +} + +// SetHistogram sets the Histogram field's value. +func (s *Anomaly) SetHistogram(v map[string]*int64) *Anomaly { + s.Histogram = v + return s +} + +// SetIsPatternLevelSuppression sets the IsPatternLevelSuppression field's value. +func (s *Anomaly) SetIsPatternLevelSuppression(v bool) *Anomaly { + s.IsPatternLevelSuppression = &v + return s +} + +// SetLastSeen sets the LastSeen field's value. +func (s *Anomaly) SetLastSeen(v int64) *Anomaly { + s.LastSeen = &v + return s +} + +// SetLogGroupArnList sets the LogGroupArnList field's value. +func (s *Anomaly) SetLogGroupArnList(v []*string) *Anomaly { + s.LogGroupArnList = v + return s +} + +// SetLogSamples sets the LogSamples field's value. +func (s *Anomaly) SetLogSamples(v []*LogEvent) *Anomaly { + s.LogSamples = v + return s +} + +// SetPatternId sets the PatternId field's value. +func (s *Anomaly) SetPatternId(v string) *Anomaly { + s.PatternId = &v + return s +} + +// SetPatternRegex sets the PatternRegex field's value. +func (s *Anomaly) SetPatternRegex(v string) *Anomaly { + s.PatternRegex = &v + return s +} + +// SetPatternString sets the PatternString field's value. +func (s *Anomaly) SetPatternString(v string) *Anomaly { + s.PatternString = &v + return s +} + +// SetPatternTokens sets the PatternTokens field's value. +func (s *Anomaly) SetPatternTokens(v []*PatternToken) *Anomaly { + s.PatternTokens = v + return s +} + +// SetPriority sets the Priority field's value. +func (s *Anomaly) SetPriority(v string) *Anomaly { + s.Priority = &v + return s +} + +// SetState sets the State field's value. +func (s *Anomaly) SetState(v string) *Anomaly { + s.State = &v + return s +} + +// SetSuppressed sets the Suppressed field's value. +func (s *Anomaly) SetSuppressed(v bool) *Anomaly { + s.Suppressed = &v + return s +} + +// SetSuppressedDate sets the SuppressedDate field's value. +func (s *Anomaly) SetSuppressedDate(v int64) *Anomaly { + s.SuppressedDate = &v + return s +} + +// SetSuppressedUntil sets the SuppressedUntil field's value. +func (s *Anomaly) SetSuppressedUntil(v int64) *Anomaly { + s.SuppressedUntil = &v + return s +} + +// Contains information about one anomaly detector in the account. +type AnomalyDetector struct { + _ struct{} `type:"structure"` + + // The ARN of the anomaly detector. + AnomalyDetectorArn *string `locationName:"anomalyDetectorArn" min:"1" type:"string"` + + // Specifies the current status of the anomaly detector. To pause an anomaly + // detector, use the enabled parameter in the UpdateLogAnomalyDetector (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UpdateLogAnomalyDetector.html) + // operation. + AnomalyDetectorStatus *string `locationName:"anomalyDetectorStatus" type:"string" enum:"AnomalyDetectorStatus"` + + // The number of days used as the life cycle of anomalies. After this time, + // anomalies are automatically baselined and the anomaly detector model will + // treat new occurrences of similar event as normal. + AnomalyVisibilityTime *int64 `locationName:"anomalyVisibilityTime" min:"7" type:"long"` + + // The date and time when this anomaly detector was created. + CreationTimeStamp *int64 `locationName:"creationTimeStamp" type:"long"` + + // The name of the anomaly detector. + DetectorName *string `locationName:"detectorName" min:"1" type:"string"` + + // Specifies how often the anomaly detector runs and look for anomalies. + EvaluationFrequency *string `locationName:"evaluationFrequency" type:"string" enum:"EvaluationFrequency"` + + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event can contain timestamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. + FilterPattern *string `locationName:"filterPattern" type:"string"` + + // The ID of the KMS key assigned to this anomaly detector, if any. + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` + + // The date and time when this anomaly detector was most recently modified. + LastModifiedTimeStamp *int64 `locationName:"lastModifiedTimeStamp" type:"long"` + + // A list of the ARNs of the log groups that this anomaly detector watches. + LogGroupArnList []*string `locationName:"logGroupArnList" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AnomalyDetector) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AnomalyDetector) GoString() string { + return s.String() +} + +// SetAnomalyDetectorArn sets the AnomalyDetectorArn field's value. +func (s *AnomalyDetector) SetAnomalyDetectorArn(v string) *AnomalyDetector { + s.AnomalyDetectorArn = &v + return s +} + +// SetAnomalyDetectorStatus sets the AnomalyDetectorStatus field's value. +func (s *AnomalyDetector) SetAnomalyDetectorStatus(v string) *AnomalyDetector { + s.AnomalyDetectorStatus = &v + return s +} + +// SetAnomalyVisibilityTime sets the AnomalyVisibilityTime field's value. +func (s *AnomalyDetector) SetAnomalyVisibilityTime(v int64) *AnomalyDetector { + s.AnomalyVisibilityTime = &v + return s +} + +// SetCreationTimeStamp sets the CreationTimeStamp field's value. +func (s *AnomalyDetector) SetCreationTimeStamp(v int64) *AnomalyDetector { + s.CreationTimeStamp = &v + return s +} + +// SetDetectorName sets the DetectorName field's value. +func (s *AnomalyDetector) SetDetectorName(v string) *AnomalyDetector { + s.DetectorName = &v + return s +} + +// SetEvaluationFrequency sets the EvaluationFrequency field's value. +func (s *AnomalyDetector) SetEvaluationFrequency(v string) *AnomalyDetector { + s.EvaluationFrequency = &v + return s +} + +// SetFilterPattern sets the FilterPattern field's value. +func (s *AnomalyDetector) SetFilterPattern(v string) *AnomalyDetector { + s.FilterPattern = &v + return s +} + +// SetKmsKeyId sets the KmsKeyId field's value. +func (s *AnomalyDetector) SetKmsKeyId(v string) *AnomalyDetector { + s.KmsKeyId = &v + return s +} + +// SetLastModifiedTimeStamp sets the LastModifiedTimeStamp field's value. +func (s *AnomalyDetector) SetLastModifiedTimeStamp(v int64) *AnomalyDetector { + s.LastModifiedTimeStamp = &v + return s +} + +// SetLogGroupArnList sets the LogGroupArnList field's value. +func (s *AnomalyDetector) SetLogGroupArnList(v []*string) *AnomalyDetector { + s.LogGroupArnList = v + return s +} + +type AssociateKmsKeyInput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the KMS key to use when encrypting log + // data. This must be a symmetric KMS key. For more information, see Amazon + // Resource Names (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kms) + // and Using Symmetric and Asymmetric Keys (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html). + // + // KmsKeyId is a required field + KmsKeyId *string `locationName:"kmsKeyId" type:"string" required:"true"` + + // The name of the log group. + // + // In your AssociateKmsKey operation, you must specify either the resourceIdentifier + // parameter or the logGroup parameter, but you can't specify both. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // Specifies the target for this operation. You must specify one of the following: + // + // * Specify the following ARN to have future GetQueryResults (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetQueryResults.html) + // operations in this account encrypt the results with the specified KMS + // key. Replace REGION and ACCOUNT_ID with your Region and account ID. arn:aws:logs:REGION:ACCOUNT_ID:query-result:* + // + // * Specify the ARN of a log group to have CloudWatch Logs use the KMS key + // to encrypt log events that are ingested and stored by that log group. + // The log group ARN must be in the following format. Replace REGION and + // ACCOUNT_ID with your Region and account ID. arn:aws:logs:REGION:ACCOUNT_ID:log-group:LOG_GROUP_NAME + // + // In your AssociateKmsKey operation, you must specify either the resourceIdentifier + // parameter or the logGroup parameter, but you can't specify both. + ResourceIdentifier *string `locationName:"resourceIdentifier" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AssociateKmsKeyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AssociateKmsKeyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssociateKmsKeyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AssociateKmsKeyInput"} + if s.KmsKeyId == nil { + invalidParams.Add(request.NewErrParamRequired("KmsKeyId")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.ResourceIdentifier != nil && len(*s.ResourceIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceIdentifier", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetKmsKeyId sets the KmsKeyId field's value. +func (s *AssociateKmsKeyInput) SetKmsKeyId(v string) *AssociateKmsKeyInput { + s.KmsKeyId = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *AssociateKmsKeyInput) SetLogGroupName(v string) *AssociateKmsKeyInput { + s.LogGroupName = &v + return s +} + +// SetResourceIdentifier sets the ResourceIdentifier field's value. +func (s *AssociateKmsKeyInput) SetResourceIdentifier(v string) *AssociateKmsKeyInput { + s.ResourceIdentifier = &v + return s +} + +type AssociateKmsKeyOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AssociateKmsKeyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s AssociateKmsKeyOutput) GoString() string { + return s.String() +} + +type CancelExportTaskInput struct { + _ struct{} `type:"structure"` + + // The ID of the export task. + // + // TaskId is a required field + TaskId *string `locationName:"taskId" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CancelExportTaskInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CancelExportTaskInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CancelExportTaskInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CancelExportTaskInput"} + if s.TaskId == nil { + invalidParams.Add(request.NewErrParamRequired("TaskId")) + } + if s.TaskId != nil && len(*s.TaskId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TaskId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetTaskId sets the TaskId field's value. +func (s *CancelExportTaskInput) SetTaskId(v string) *CancelExportTaskInput { + s.TaskId = &v + return s +} + +type CancelExportTaskOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CancelExportTaskOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CancelExportTaskOutput) GoString() string { + return s.String() +} + +// This operation attempted to create a resource that already exists. +type ConflictException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ConflictException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ConflictException) GoString() string { + return s.String() +} + +func newErrorConflictException(v protocol.ResponseMetadata) error { + return &ConflictException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *ConflictException) Code() string { + return "ConflictException" +} + +// Message returns the exception's message. +func (s *ConflictException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *ConflictException) OrigErr() error { + return nil +} + +func (s *ConflictException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *ConflictException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *ConflictException) RequestID() string { + return s.RespMetadata.RequestID +} + +type CreateDeliveryInput struct { + _ struct{} `type:"structure"` + + // The ARN of the delivery destination to use for this delivery. + // + // DeliveryDestinationArn is a required field + DeliveryDestinationArn *string `locationName:"deliveryDestinationArn" type:"string" required:"true"` + + // The name of the delivery source to use for this delivery. + // + // DeliverySourceName is a required field + DeliverySourceName *string `locationName:"deliverySourceName" min:"1" type:"string" required:"true"` + + // An optional list of key-value pairs to associate with the resource. + // + // For more information about tagging, see Tagging Amazon Web Services resources + // (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) + Tags map[string]*string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateDeliveryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateDeliveryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateDeliveryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateDeliveryInput"} + if s.DeliveryDestinationArn == nil { + invalidParams.Add(request.NewErrParamRequired("DeliveryDestinationArn")) + } + if s.DeliverySourceName == nil { + invalidParams.Add(request.NewErrParamRequired("DeliverySourceName")) + } + if s.DeliverySourceName != nil && len(*s.DeliverySourceName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DeliverySourceName", 1)) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDeliveryDestinationArn sets the DeliveryDestinationArn field's value. +func (s *CreateDeliveryInput) SetDeliveryDestinationArn(v string) *CreateDeliveryInput { + s.DeliveryDestinationArn = &v + return s +} + +// SetDeliverySourceName sets the DeliverySourceName field's value. +func (s *CreateDeliveryInput) SetDeliverySourceName(v string) *CreateDeliveryInput { + s.DeliverySourceName = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateDeliveryInput) SetTags(v map[string]*string) *CreateDeliveryInput { + s.Tags = v + return s +} + +type CreateDeliveryOutput struct { + _ struct{} `type:"structure"` + + // A structure that contains information about the delivery that you just created. + Delivery *Delivery `locationName:"delivery" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateDeliveryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateDeliveryOutput) GoString() string { + return s.String() +} + +// SetDelivery sets the Delivery field's value. +func (s *CreateDeliveryOutput) SetDelivery(v *Delivery) *CreateDeliveryOutput { + s.Delivery = v + return s +} + +type CreateExportTaskInput struct { + _ struct{} `type:"structure"` + + // The name of S3 bucket for the exported log data. The bucket must be in the + // same Amazon Web Services Region. + // + // Destination is a required field + Destination *string `locationName:"destination" min:"1" type:"string" required:"true"` + + // The prefix used as the start of the key for every object exported. If you + // don't specify a value, the default is exportedlogs. + DestinationPrefix *string `locationName:"destinationPrefix" type:"string"` + + // The start time of the range for the request, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. Events with a timestamp earlier than this + // time are not exported. + // + // From is a required field + From *int64 `locationName:"from" type:"long" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // Export only log streams that match the provided prefix. If you don't specify + // a value, no prefix filter is applied. + LogStreamNamePrefix *string `locationName:"logStreamNamePrefix" min:"1" type:"string"` + + // The name of the export task. + TaskName *string `locationName:"taskName" min:"1" type:"string"` + + // The end time of the range for the request, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time + // are not exported. + // + // You must specify a time that is not earlier than when this log group was + // created. + // + // To is a required field + To *int64 `locationName:"to" type:"long" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateExportTaskInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateExportTaskInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateExportTaskInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateExportTaskInput"} + if s.Destination == nil { + invalidParams.Add(request.NewErrParamRequired("Destination")) + } + if s.Destination != nil && len(*s.Destination) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Destination", 1)) + } + if s.From == nil { + invalidParams.Add(request.NewErrParamRequired("From")) + } + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.LogStreamNamePrefix != nil && len(*s.LogStreamNamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogStreamNamePrefix", 1)) + } + if s.TaskName != nil && len(*s.TaskName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TaskName", 1)) + } + if s.To == nil { + invalidParams.Add(request.NewErrParamRequired("To")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDestination sets the Destination field's value. +func (s *CreateExportTaskInput) SetDestination(v string) *CreateExportTaskInput { + s.Destination = &v + return s +} + +// SetDestinationPrefix sets the DestinationPrefix field's value. +func (s *CreateExportTaskInput) SetDestinationPrefix(v string) *CreateExportTaskInput { + s.DestinationPrefix = &v + return s +} + +// SetFrom sets the From field's value. +func (s *CreateExportTaskInput) SetFrom(v int64) *CreateExportTaskInput { + s.From = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *CreateExportTaskInput) SetLogGroupName(v string) *CreateExportTaskInput { + s.LogGroupName = &v + return s +} + +// SetLogStreamNamePrefix sets the LogStreamNamePrefix field's value. +func (s *CreateExportTaskInput) SetLogStreamNamePrefix(v string) *CreateExportTaskInput { + s.LogStreamNamePrefix = &v + return s +} + +// SetTaskName sets the TaskName field's value. +func (s *CreateExportTaskInput) SetTaskName(v string) *CreateExportTaskInput { + s.TaskName = &v + return s +} + +// SetTo sets the To field's value. +func (s *CreateExportTaskInput) SetTo(v int64) *CreateExportTaskInput { + s.To = &v + return s +} + +type CreateExportTaskOutput struct { + _ struct{} `type:"structure"` + + // The ID of the export task. + TaskId *string `locationName:"taskId" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateExportTaskOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateExportTaskOutput) GoString() string { + return s.String() +} + +// SetTaskId sets the TaskId field's value. +func (s *CreateExportTaskOutput) SetTaskId(v string) *CreateExportTaskOutput { + s.TaskId = &v + return s +} + +type CreateLogAnomalyDetectorInput struct { + _ struct{} `type:"structure"` + + // The number of days to have visibility on an anomaly. After this time period + // has elapsed for an anomaly, it will be automatically baselined and the anomaly + // detector will treat new occurrences of a similar anomaly as normal. Therefore, + // if you do not correct the cause of an anomaly during the time period specified + // in anomalyVisibilityTime, it will be considered normal going forward and + // will not be detected as an anomaly. + AnomalyVisibilityTime *int64 `locationName:"anomalyVisibilityTime" min:"7" type:"long"` + + // A name for this anomaly detector. + DetectorName *string `locationName:"detectorName" min:"1" type:"string"` + + // Specifies how often the anomaly detector is to run and look for anomalies. + // Set this value according to the frequency that the log group receives new + // logs. For example, if the log group receives new log events every 10 minutes, + // then 15 minutes might be a good setting for evaluationFrequency . + EvaluationFrequency *string `locationName:"evaluationFrequency" type:"string" enum:"EvaluationFrequency"` + + // You can use this parameter to limit the anomaly detection model to examine + // only log events that match the pattern you specify here. For more information, + // see Filter and Pattern Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html). + FilterPattern *string `locationName:"filterPattern" type:"string"` + + // Optionally assigns a KMS key to secure this anomaly detector and its findings. + // If a key is assigned, the anomalies found and the model used by this detector + // are encrypted at rest with the key. If a key is assigned to an anomaly detector, + // a user must have permissions for both this key and for the anomaly detector + // to retrieve information about the anomalies that it finds. + // + // For more information about using a KMS key and to see the required IAM policy, + // see Use a KMS key with an anomaly detector (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/LogsAnomalyDetection-KMS.html). + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` + + // An array containing the ARN of the log group that this anomaly detector will + // watch. You can specify only one log group ARN. + // + // LogGroupArnList is a required field + LogGroupArnList []*string `locationName:"logGroupArnList" type:"list" required:"true"` + + // An optional list of key-value pairs to associate with the resource. + // + // For more information about tagging, see Tagging Amazon Web Services resources + // (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) + Tags map[string]*string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogAnomalyDetectorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogAnomalyDetectorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateLogAnomalyDetectorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateLogAnomalyDetectorInput"} + if s.AnomalyVisibilityTime != nil && *s.AnomalyVisibilityTime < 7 { + invalidParams.Add(request.NewErrParamMinValue("AnomalyVisibilityTime", 7)) + } + if s.DetectorName != nil && len(*s.DetectorName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DetectorName", 1)) + } + if s.LogGroupArnList == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupArnList")) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAnomalyVisibilityTime sets the AnomalyVisibilityTime field's value. +func (s *CreateLogAnomalyDetectorInput) SetAnomalyVisibilityTime(v int64) *CreateLogAnomalyDetectorInput { + s.AnomalyVisibilityTime = &v + return s +} + +// SetDetectorName sets the DetectorName field's value. +func (s *CreateLogAnomalyDetectorInput) SetDetectorName(v string) *CreateLogAnomalyDetectorInput { + s.DetectorName = &v + return s +} + +// SetEvaluationFrequency sets the EvaluationFrequency field's value. +func (s *CreateLogAnomalyDetectorInput) SetEvaluationFrequency(v string) *CreateLogAnomalyDetectorInput { + s.EvaluationFrequency = &v + return s +} + +// SetFilterPattern sets the FilterPattern field's value. +func (s *CreateLogAnomalyDetectorInput) SetFilterPattern(v string) *CreateLogAnomalyDetectorInput { + s.FilterPattern = &v + return s +} + +// SetKmsKeyId sets the KmsKeyId field's value. +func (s *CreateLogAnomalyDetectorInput) SetKmsKeyId(v string) *CreateLogAnomalyDetectorInput { + s.KmsKeyId = &v + return s +} + +// SetLogGroupArnList sets the LogGroupArnList field's value. +func (s *CreateLogAnomalyDetectorInput) SetLogGroupArnList(v []*string) *CreateLogAnomalyDetectorInput { + s.LogGroupArnList = v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateLogAnomalyDetectorInput) SetTags(v map[string]*string) *CreateLogAnomalyDetectorInput { + s.Tags = v + return s +} + +type CreateLogAnomalyDetectorOutput struct { + _ struct{} `type:"structure"` + + // The ARN of the log anomaly detector that you just created. + AnomalyDetectorArn *string `locationName:"anomalyDetectorArn" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogAnomalyDetectorOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogAnomalyDetectorOutput) GoString() string { + return s.String() +} + +// SetAnomalyDetectorArn sets the AnomalyDetectorArn field's value. +func (s *CreateLogAnomalyDetectorOutput) SetAnomalyDetectorArn(v string) *CreateLogAnomalyDetectorOutput { + s.AnomalyDetectorArn = &v + return s +} + +type CreateLogGroupInput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the KMS key to use when encrypting log + // data. For more information, see Amazon Resource Names (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kms). + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` + + // Use this parameter to specify the log group class for this log group. There + // are two classes: + // + // * The Standard log class supports all CloudWatch Logs features. + // + // * The Infrequent Access log class supports a subset of CloudWatch Logs + // features and incurs lower costs. + // + // If you omit this parameter, the default of STANDARD is used. + // + // The value of logGroupClass can't be changed after a log group is created. + // + // For details about the features supported by each class, see Log classes (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch_Logs_Log_Classes.html) + LogGroupClass *string `locationName:"logGroupClass" type:"string" enum:"LogGroupClass"` + + // A name for the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The key-value pairs to use for the tags. + // + // You can grant users access to certain log groups while preventing them from + // accessing other log groups. To do so, tag your groups and use IAM policies + // that refer to those tags. To assign tags when you create a log group, you + // must have either the logs:TagResource or logs:TagLogGroup permission. For + // more information about tagging, see Tagging Amazon Web Services resources + // (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html). For more + // information about using tags to control access, see Controlling access to + // Amazon Web Services resources using tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html). + Tags map[string]*string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogGroupInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogGroupInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateLogGroupInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateLogGroupInput"} + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetKmsKeyId sets the KmsKeyId field's value. +func (s *CreateLogGroupInput) SetKmsKeyId(v string) *CreateLogGroupInput { + s.KmsKeyId = &v + return s +} + +// SetLogGroupClass sets the LogGroupClass field's value. +func (s *CreateLogGroupInput) SetLogGroupClass(v string) *CreateLogGroupInput { + s.LogGroupClass = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *CreateLogGroupInput) SetLogGroupName(v string) *CreateLogGroupInput { + s.LogGroupName = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateLogGroupInput) SetTags(v map[string]*string) *CreateLogGroupInput { + s.Tags = v + return s +} + +type CreateLogGroupOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogGroupOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogGroupOutput) GoString() string { + return s.String() +} + +type CreateLogStreamInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The name of the log stream. + // + // LogStreamName is a required field + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogStreamInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogStreamInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateLogStreamInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateLogStreamInput"} + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.LogStreamName == nil { + invalidParams.Add(request.NewErrParamRequired("LogStreamName")) + } + if s.LogStreamName != nil && len(*s.LogStreamName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogStreamName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *CreateLogStreamInput) SetLogGroupName(v string) *CreateLogStreamInput { + s.LogGroupName = &v + return s +} + +// SetLogStreamName sets the LogStreamName field's value. +func (s *CreateLogStreamInput) SetLogStreamName(v string) *CreateLogStreamInput { + s.LogStreamName = &v + return s +} + +type CreateLogStreamOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogStreamOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s CreateLogStreamOutput) GoString() string { + return s.String() +} + +// The event was already logged. +// +// PutLogEvents actions are now always accepted and never return DataAlreadyAcceptedException +// regardless of whether a given batch of log events has already been accepted. +type DataAlreadyAcceptedException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + ExpectedSequenceToken *string `locationName:"expectedSequenceToken" min:"1" type:"string"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DataAlreadyAcceptedException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DataAlreadyAcceptedException) GoString() string { + return s.String() +} + +func newErrorDataAlreadyAcceptedException(v protocol.ResponseMetadata) error { + return &DataAlreadyAcceptedException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *DataAlreadyAcceptedException) Code() string { + return "DataAlreadyAcceptedException" +} + +// Message returns the exception's message. +func (s *DataAlreadyAcceptedException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *DataAlreadyAcceptedException) OrigErr() error { + return nil +} + +func (s *DataAlreadyAcceptedException) Error() string { + return fmt.Sprintf("%s: %s\n%s", s.Code(), s.Message(), s.String()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *DataAlreadyAcceptedException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *DataAlreadyAcceptedException) RequestID() string { + return s.RespMetadata.RequestID +} + +type DeleteAccountPolicyInput struct { + _ struct{} `type:"structure"` + + // The name of the policy to delete. + // + // PolicyName is a required field + PolicyName *string `locationName:"policyName" type:"string" required:"true"` + + // The type of policy to delete. + // + // PolicyType is a required field + PolicyType *string `locationName:"policyType" type:"string" required:"true" enum:"PolicyType"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAccountPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAccountPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteAccountPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteAccountPolicyInput"} + if s.PolicyName == nil { + invalidParams.Add(request.NewErrParamRequired("PolicyName")) + } + if s.PolicyType == nil { + invalidParams.Add(request.NewErrParamRequired("PolicyType")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetPolicyName sets the PolicyName field's value. +func (s *DeleteAccountPolicyInput) SetPolicyName(v string) *DeleteAccountPolicyInput { + s.PolicyName = &v + return s +} + +// SetPolicyType sets the PolicyType field's value. +func (s *DeleteAccountPolicyInput) SetPolicyType(v string) *DeleteAccountPolicyInput { + s.PolicyType = &v + return s +} + +type DeleteAccountPolicyOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAccountPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteAccountPolicyOutput) GoString() string { + return s.String() +} + +type DeleteDataProtectionPolicyInput struct { + _ struct{} `type:"structure"` + + // The name or ARN of the log group that you want to delete the data protection + // policy for. + // + // LogGroupIdentifier is a required field + LogGroupIdentifier *string `locationName:"logGroupIdentifier" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDataProtectionPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDataProtectionPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteDataProtectionPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteDataProtectionPolicyInput"} + if s.LogGroupIdentifier == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupIdentifier")) + } + if s.LogGroupIdentifier != nil && len(*s.LogGroupIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupIdentifier", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupIdentifier sets the LogGroupIdentifier field's value. +func (s *DeleteDataProtectionPolicyInput) SetLogGroupIdentifier(v string) *DeleteDataProtectionPolicyInput { + s.LogGroupIdentifier = &v + return s +} + +type DeleteDataProtectionPolicyOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDataProtectionPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDataProtectionPolicyOutput) GoString() string { + return s.String() +} + +type DeleteDeliveryDestinationInput struct { + _ struct{} `type:"structure"` + + // The name of the delivery destination that you want to delete. You can find + // a list of delivery destionation names by using the DescribeDeliveryDestinations + // (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeDeliveryDestinations.html) + // operation. + // + // Name is a required field + Name *string `locationName:"name" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryDestinationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryDestinationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteDeliveryDestinationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteDeliveryDestinationInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *DeleteDeliveryDestinationInput) SetName(v string) *DeleteDeliveryDestinationInput { + s.Name = &v + return s +} + +type DeleteDeliveryDestinationOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryDestinationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryDestinationOutput) GoString() string { + return s.String() +} + +type DeleteDeliveryDestinationPolicyInput struct { + _ struct{} `type:"structure"` + + // The name of the delivery destination that you want to delete the policy for. + // + // DeliveryDestinationName is a required field + DeliveryDestinationName *string `locationName:"deliveryDestinationName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryDestinationPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryDestinationPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteDeliveryDestinationPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteDeliveryDestinationPolicyInput"} + if s.DeliveryDestinationName == nil { + invalidParams.Add(request.NewErrParamRequired("DeliveryDestinationName")) + } + if s.DeliveryDestinationName != nil && len(*s.DeliveryDestinationName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DeliveryDestinationName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDeliveryDestinationName sets the DeliveryDestinationName field's value. +func (s *DeleteDeliveryDestinationPolicyInput) SetDeliveryDestinationName(v string) *DeleteDeliveryDestinationPolicyInput { + s.DeliveryDestinationName = &v + return s +} + +type DeleteDeliveryDestinationPolicyOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryDestinationPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryDestinationPolicyOutput) GoString() string { + return s.String() +} + +type DeleteDeliveryInput struct { + _ struct{} `type:"structure"` + + // The unique ID of the delivery to delete. You can find the ID of a delivery + // with the DescribeDeliveries (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeDeliveries.html) + // operation. + // + // Id is a required field + Id *string `locationName:"id" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteDeliveryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteDeliveryInput"} + if s.Id == nil { + invalidParams.Add(request.NewErrParamRequired("Id")) + } + if s.Id != nil && len(*s.Id) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Id", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetId sets the Id field's value. +func (s *DeleteDeliveryInput) SetId(v string) *DeleteDeliveryInput { + s.Id = &v + return s +} + +type DeleteDeliveryOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliveryOutput) GoString() string { + return s.String() +} + +type DeleteDeliverySourceInput struct { + _ struct{} `type:"structure"` + + // The name of the delivery source that you want to delete. + // + // Name is a required field + Name *string `locationName:"name" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliverySourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliverySourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteDeliverySourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteDeliverySourceInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *DeleteDeliverySourceInput) SetName(v string) *DeleteDeliverySourceInput { + s.Name = &v + return s +} + +type DeleteDeliverySourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliverySourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDeliverySourceOutput) GoString() string { + return s.String() +} + +type DeleteDestinationInput struct { + _ struct{} `type:"structure"` + + // The name of the destination. + // + // DestinationName is a required field + DestinationName *string `locationName:"destinationName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDestinationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDestinationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteDestinationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteDestinationInput"} + if s.DestinationName == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationName")) + } + if s.DestinationName != nil && len(*s.DestinationName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DestinationName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDestinationName sets the DestinationName field's value. +func (s *DeleteDestinationInput) SetDestinationName(v string) *DeleteDestinationInput { + s.DestinationName = &v + return s +} + +type DeleteDestinationOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDestinationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteDestinationOutput) GoString() string { + return s.String() +} + +type DeleteLogAnomalyDetectorInput struct { + _ struct{} `type:"structure"` + + // The ARN of the anomaly detector to delete. You can find the ARNs of log anomaly + // detectors in your account by using the ListLogAnomalyDetectors (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListLogAnomalyDetectors.html) + // operation. + // + // AnomalyDetectorArn is a required field + AnomalyDetectorArn *string `locationName:"anomalyDetectorArn" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogAnomalyDetectorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogAnomalyDetectorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteLogAnomalyDetectorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteLogAnomalyDetectorInput"} + if s.AnomalyDetectorArn == nil { + invalidParams.Add(request.NewErrParamRequired("AnomalyDetectorArn")) + } + if s.AnomalyDetectorArn != nil && len(*s.AnomalyDetectorArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AnomalyDetectorArn", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAnomalyDetectorArn sets the AnomalyDetectorArn field's value. +func (s *DeleteLogAnomalyDetectorInput) SetAnomalyDetectorArn(v string) *DeleteLogAnomalyDetectorInput { + s.AnomalyDetectorArn = &v + return s +} + +type DeleteLogAnomalyDetectorOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogAnomalyDetectorOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogAnomalyDetectorOutput) GoString() string { + return s.String() +} + +type DeleteLogGroupInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogGroupInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogGroupInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteLogGroupInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteLogGroupInput"} + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *DeleteLogGroupInput) SetLogGroupName(v string) *DeleteLogGroupInput { + s.LogGroupName = &v + return s +} + +type DeleteLogGroupOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogGroupOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogGroupOutput) GoString() string { + return s.String() +} + +type DeleteLogStreamInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The name of the log stream. + // + // LogStreamName is a required field + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogStreamInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogStreamInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteLogStreamInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteLogStreamInput"} + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.LogStreamName == nil { + invalidParams.Add(request.NewErrParamRequired("LogStreamName")) + } + if s.LogStreamName != nil && len(*s.LogStreamName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogStreamName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *DeleteLogStreamInput) SetLogGroupName(v string) *DeleteLogStreamInput { + s.LogGroupName = &v + return s +} + +// SetLogStreamName sets the LogStreamName field's value. +func (s *DeleteLogStreamInput) SetLogStreamName(v string) *DeleteLogStreamInput { + s.LogStreamName = &v + return s +} + +type DeleteLogStreamOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogStreamOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteLogStreamOutput) GoString() string { + return s.String() +} + +type DeleteMetricFilterInput struct { + _ struct{} `type:"structure"` + + // The name of the metric filter. + // + // FilterName is a required field + FilterName *string `locationName:"filterName" min:"1" type:"string" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteMetricFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteMetricFilterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteMetricFilterInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteMetricFilterInput"} + if s.FilterName == nil { + invalidParams.Add(request.NewErrParamRequired("FilterName")) + } + if s.FilterName != nil && len(*s.FilterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("FilterName", 1)) + } + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetFilterName sets the FilterName field's value. +func (s *DeleteMetricFilterInput) SetFilterName(v string) *DeleteMetricFilterInput { + s.FilterName = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *DeleteMetricFilterInput) SetLogGroupName(v string) *DeleteMetricFilterInput { + s.LogGroupName = &v + return s +} + +type DeleteMetricFilterOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteMetricFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteMetricFilterOutput) GoString() string { + return s.String() +} + +type DeleteQueryDefinitionInput struct { + _ struct{} `type:"structure"` + + // The ID of the query definition that you want to delete. You can use DescribeQueryDefinitions + // (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html) + // to retrieve the IDs of your saved query definitions. + // + // QueryDefinitionId is a required field + QueryDefinitionId *string `locationName:"queryDefinitionId" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteQueryDefinitionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteQueryDefinitionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteQueryDefinitionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteQueryDefinitionInput"} + if s.QueryDefinitionId == nil { + invalidParams.Add(request.NewErrParamRequired("QueryDefinitionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetQueryDefinitionId sets the QueryDefinitionId field's value. +func (s *DeleteQueryDefinitionInput) SetQueryDefinitionId(v string) *DeleteQueryDefinitionInput { + s.QueryDefinitionId = &v + return s +} + +type DeleteQueryDefinitionOutput struct { + _ struct{} `type:"structure"` + + // A value of TRUE indicates that the operation succeeded. FALSE indicates that + // the operation failed. + Success *bool `locationName:"success" type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteQueryDefinitionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteQueryDefinitionOutput) GoString() string { + return s.String() +} + +// SetSuccess sets the Success field's value. +func (s *DeleteQueryDefinitionOutput) SetSuccess(v bool) *DeleteQueryDefinitionOutput { + s.Success = &v + return s +} + +type DeleteResourcePolicyInput struct { + _ struct{} `type:"structure"` + + // The name of the policy to be revoked. This parameter is required. + PolicyName *string `locationName:"policyName" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteResourcePolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteResourcePolicyInput) GoString() string { + return s.String() +} + +// SetPolicyName sets the PolicyName field's value. +func (s *DeleteResourcePolicyInput) SetPolicyName(v string) *DeleteResourcePolicyInput { + s.PolicyName = &v + return s +} + +type DeleteResourcePolicyOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteResourcePolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteResourcePolicyOutput) GoString() string { + return s.String() +} + +type DeleteRetentionPolicyInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteRetentionPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteRetentionPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteRetentionPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteRetentionPolicyInput"} + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *DeleteRetentionPolicyInput) SetLogGroupName(v string) *DeleteRetentionPolicyInput { + s.LogGroupName = &v + return s +} + +type DeleteRetentionPolicyOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteRetentionPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteRetentionPolicyOutput) GoString() string { + return s.String() +} + +type DeleteSubscriptionFilterInput struct { + _ struct{} `type:"structure"` + + // The name of the subscription filter. + // + // FilterName is a required field + FilterName *string `locationName:"filterName" min:"1" type:"string" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteSubscriptionFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteSubscriptionFilterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteSubscriptionFilterInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteSubscriptionFilterInput"} + if s.FilterName == nil { + invalidParams.Add(request.NewErrParamRequired("FilterName")) + } + if s.FilterName != nil && len(*s.FilterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("FilterName", 1)) + } + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetFilterName sets the FilterName field's value. +func (s *DeleteSubscriptionFilterInput) SetFilterName(v string) *DeleteSubscriptionFilterInput { + s.FilterName = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *DeleteSubscriptionFilterInput) SetLogGroupName(v string) *DeleteSubscriptionFilterInput { + s.LogGroupName = &v + return s +} + +type DeleteSubscriptionFilterOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteSubscriptionFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeleteSubscriptionFilterOutput) GoString() string { + return s.String() +} + +// This structure contains information about one delivery in your account. +// +// A delivery is a connection between a logical delivery source and a logical +// delivery destination. +// +// For more information, see CreateDelivery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html). +// +// You can't update an existing delivery. You can only create and delete deliveries. +type Delivery struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) that uniquely identifies this delivery. + Arn *string `locationName:"arn" type:"string"` + + // The ARN of the delivery destination that is associated with this delivery. + DeliveryDestinationArn *string `locationName:"deliveryDestinationArn" type:"string"` + + // Displays whether the delivery destination associated with this delivery is + // CloudWatch Logs, Amazon S3, or Firehose. + DeliveryDestinationType *string `locationName:"deliveryDestinationType" type:"string" enum:"DeliveryDestinationType"` + + // The name of the delivery source that is associated with this delivery. + DeliverySourceName *string `locationName:"deliverySourceName" min:"1" type:"string"` + + // The unique ID that identifies this delivery in your account. + Id *string `locationName:"id" min:"1" type:"string"` + + // The tags that have been assigned to this delivery. + Tags map[string]*string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Delivery) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Delivery) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *Delivery) SetArn(v string) *Delivery { + s.Arn = &v + return s +} + +// SetDeliveryDestinationArn sets the DeliveryDestinationArn field's value. +func (s *Delivery) SetDeliveryDestinationArn(v string) *Delivery { + s.DeliveryDestinationArn = &v + return s +} + +// SetDeliveryDestinationType sets the DeliveryDestinationType field's value. +func (s *Delivery) SetDeliveryDestinationType(v string) *Delivery { + s.DeliveryDestinationType = &v + return s +} + +// SetDeliverySourceName sets the DeliverySourceName field's value. +func (s *Delivery) SetDeliverySourceName(v string) *Delivery { + s.DeliverySourceName = &v + return s +} + +// SetId sets the Id field's value. +func (s *Delivery) SetId(v string) *Delivery { + s.Id = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *Delivery) SetTags(v map[string]*string) *Delivery { + s.Tags = v + return s +} + +// This structure contains information about one delivery destination in your +// account. A delivery destination is an Amazon Web Services resource that represents +// an Amazon Web Services service that logs can be sent to. CloudWatch Logs, +// Amazon S3, are supported as Firehose delivery destinations. +// +// To configure logs delivery between a supported Amazon Web Services service +// and a destination, you must do the following: +// +// - Create a delivery source, which is a logical object that represents +// the resource that is actually sending the logs. For more information, +// see PutDeliverySource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html). +// +// - Create a delivery destination, which is a logical object that represents +// the actual delivery destination. +// +// - If you are delivering logs cross-account, you must use PutDeliveryDestinationPolicy +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html) +// in the destination account to assign an IAM policy to the destination. +// This policy allows delivery to that destination. +// +// - Create a delivery by pairing exactly one delivery source and one delivery +// destination. For more information, see CreateDelivery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html). +// +// You can configure a single delivery source to send logs to multiple destinations +// by creating multiple deliveries. You can also create multiple deliveries +// to configure multiple delivery sources to send logs to the same delivery +// destination. +type DeliveryDestination struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) that uniquely identifies this delivery destination. + Arn *string `locationName:"arn" type:"string"` + + // A structure that contains the ARN of the Amazon Web Services resource that + // will receive the logs. + DeliveryDestinationConfiguration *DeliveryDestinationConfiguration `locationName:"deliveryDestinationConfiguration" type:"structure"` + + // Displays whether this delivery destination is CloudWatch Logs, Amazon S3, + // or Firehose. + DeliveryDestinationType *string `locationName:"deliveryDestinationType" type:"string" enum:"DeliveryDestinationType"` + + // The name of this delivery destination. + Name *string `locationName:"name" min:"1" type:"string"` + + // The format of the logs that are sent to this delivery destination. + OutputFormat *string `locationName:"outputFormat" type:"string" enum:"OutputFormat"` + + // The tags that have been assigned to this delivery destination. + Tags map[string]*string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeliveryDestination) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeliveryDestination) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *DeliveryDestination) SetArn(v string) *DeliveryDestination { + s.Arn = &v + return s +} + +// SetDeliveryDestinationConfiguration sets the DeliveryDestinationConfiguration field's value. +func (s *DeliveryDestination) SetDeliveryDestinationConfiguration(v *DeliveryDestinationConfiguration) *DeliveryDestination { + s.DeliveryDestinationConfiguration = v + return s +} + +// SetDeliveryDestinationType sets the DeliveryDestinationType field's value. +func (s *DeliveryDestination) SetDeliveryDestinationType(v string) *DeliveryDestination { + s.DeliveryDestinationType = &v + return s +} + +// SetName sets the Name field's value. +func (s *DeliveryDestination) SetName(v string) *DeliveryDestination { + s.Name = &v + return s +} + +// SetOutputFormat sets the OutputFormat field's value. +func (s *DeliveryDestination) SetOutputFormat(v string) *DeliveryDestination { + s.OutputFormat = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *DeliveryDestination) SetTags(v map[string]*string) *DeliveryDestination { + s.Tags = v + return s +} + +// A structure that contains information about one logs delivery destination. +type DeliveryDestinationConfiguration struct { + _ struct{} `type:"structure"` + + // The ARN of the Amazon Web Services destination that this delivery destination + // represents. That Amazon Web Services destination can be a log group in CloudWatch + // Logs, an Amazon S3 bucket, or a delivery stream in Firehose. + // + // DestinationResourceArn is a required field + DestinationResourceArn *string `locationName:"destinationResourceArn" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeliveryDestinationConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeliveryDestinationConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeliveryDestinationConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeliveryDestinationConfiguration"} + if s.DestinationResourceArn == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationResourceArn")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDestinationResourceArn sets the DestinationResourceArn field's value. +func (s *DeliveryDestinationConfiguration) SetDestinationResourceArn(v string) *DeliveryDestinationConfiguration { + s.DestinationResourceArn = &v + return s +} + +// This structure contains information about one delivery source in your account. +// A delivery source is an Amazon Web Services resource that sends logs to an +// Amazon Web Services destination. The destination can be CloudWatch Logs, +// Amazon S3, or Firehose. +// +// Only some Amazon Web Services services support being configured as a delivery +// source. These services are listed as Supported [V2 Permissions] in the table +// at Enabling logging from Amazon Web Services services. (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html) +// +// To configure logs delivery between a supported Amazon Web Services service +// and a destination, you must do the following: +// +// - Create a delivery source, which is a logical object that represents +// the resource that is actually sending the logs. For more information, +// see PutDeliverySource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliverySource.html). +// +// - Create a delivery destination, which is a logical object that represents +// the actual delivery destination. For more information, see PutDeliveryDestination +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestination.html). +// +// - If you are delivering logs cross-account, you must use PutDeliveryDestinationPolicy +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDeliveryDestinationPolicy.html) +// in the destination account to assign an IAM policy to the destination. +// This policy allows delivery to that destination. +// +// - Create a delivery by pairing exactly one delivery source and one delivery +// destination. For more information, see CreateDelivery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateDelivery.html). +// +// You can configure a single delivery source to send logs to multiple destinations +// by creating multiple deliveries. You can also create multiple deliveries +// to configure multiple delivery sources to send logs to the same delivery +// destination. +type DeliverySource struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) that uniquely identifies this delivery source. + Arn *string `locationName:"arn" type:"string"` + + // The type of log that the source is sending. For valid values for this parameter, + // see the documentation for the source service. + LogType *string `locationName:"logType" min:"1" type:"string"` + + // The unique name of the delivery source. + Name *string `locationName:"name" min:"1" type:"string"` + + // This array contains the ARN of the Amazon Web Services resource that sends + // logs and is represented by this delivery source. Currently, only one ARN + // can be in the array. + ResourceArns []*string `locationName:"resourceArns" type:"list"` + + // The Amazon Web Services service that is sending logs. + Service *string `locationName:"service" min:"1" type:"string"` + + // The tags that have been assigned to this delivery source. + Tags map[string]*string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeliverySource) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DeliverySource) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *DeliverySource) SetArn(v string) *DeliverySource { + s.Arn = &v + return s +} + +// SetLogType sets the LogType field's value. +func (s *DeliverySource) SetLogType(v string) *DeliverySource { + s.LogType = &v + return s +} + +// SetName sets the Name field's value. +func (s *DeliverySource) SetName(v string) *DeliverySource { + s.Name = &v + return s +} + +// SetResourceArns sets the ResourceArns field's value. +func (s *DeliverySource) SetResourceArns(v []*string) *DeliverySource { + s.ResourceArns = v + return s +} + +// SetService sets the Service field's value. +func (s *DeliverySource) SetService(v string) *DeliverySource { + s.Service = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *DeliverySource) SetTags(v map[string]*string) *DeliverySource { + s.Tags = v + return s +} + +type DescribeAccountPoliciesInput struct { + _ struct{} `type:"structure"` + + // If you are using an account that is set up as a monitoring account for CloudWatch + // unified cross-account observability, you can use this to specify the account + // ID of a source account. If you do, the operation returns the account policy + // for the specified account. Currently, you can specify only one account ID + // in this parameter. + // + // If you omit this parameter, only the policy in the current account is returned. + AccountIdentifiers []*string `locationName:"accountIdentifiers" type:"list"` + + // Use this parameter to limit the returned policies to only the policy with + // the name that you specify. + PolicyName *string `locationName:"policyName" type:"string"` + + // Use this parameter to limit the returned policies to only the policies that + // match the policy type that you specify. + // + // PolicyType is a required field + PolicyType *string `locationName:"policyType" type:"string" required:"true" enum:"PolicyType"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAccountPoliciesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAccountPoliciesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeAccountPoliciesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeAccountPoliciesInput"} + if s.PolicyType == nil { + invalidParams.Add(request.NewErrParamRequired("PolicyType")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAccountIdentifiers sets the AccountIdentifiers field's value. +func (s *DescribeAccountPoliciesInput) SetAccountIdentifiers(v []*string) *DescribeAccountPoliciesInput { + s.AccountIdentifiers = v + return s +} + +// SetPolicyName sets the PolicyName field's value. +func (s *DescribeAccountPoliciesInput) SetPolicyName(v string) *DescribeAccountPoliciesInput { + s.PolicyName = &v + return s +} + +// SetPolicyType sets the PolicyType field's value. +func (s *DescribeAccountPoliciesInput) SetPolicyType(v string) *DescribeAccountPoliciesInput { + s.PolicyType = &v + return s +} + +type DescribeAccountPoliciesOutput struct { + _ struct{} `type:"structure"` + + // An array of structures that contain information about the CloudWatch Logs + // account policies that match the specified filters. + AccountPolicies []*AccountPolicy `locationName:"accountPolicies" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAccountPoliciesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeAccountPoliciesOutput) GoString() string { + return s.String() +} + +// SetAccountPolicies sets the AccountPolicies field's value. +func (s *DescribeAccountPoliciesOutput) SetAccountPolicies(v []*AccountPolicy) *DescribeAccountPoliciesOutput { + s.AccountPolicies = v + return s +} + +type DescribeDeliveriesInput struct { + _ struct{} `type:"structure"` + + // Optionally specify the maximum number of deliveries to return in the response. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliveriesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliveriesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeDeliveriesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeDeliveriesInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *DescribeDeliveriesInput) SetLimit(v int64) *DescribeDeliveriesInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeDeliveriesInput) SetNextToken(v string) *DescribeDeliveriesInput { + s.NextToken = &v + return s +} + +type DescribeDeliveriesOutput struct { + _ struct{} `type:"structure"` + + // An array of structures. Each structure contains information about one delivery + // in the account. + Deliveries []*Delivery `locationName:"deliveries" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliveriesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliveriesOutput) GoString() string { + return s.String() +} + +// SetDeliveries sets the Deliveries field's value. +func (s *DescribeDeliveriesOutput) SetDeliveries(v []*Delivery) *DescribeDeliveriesOutput { + s.Deliveries = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeDeliveriesOutput) SetNextToken(v string) *DescribeDeliveriesOutput { + s.NextToken = &v + return s +} + +type DescribeDeliveryDestinationsInput struct { + _ struct{} `type:"structure"` + + // Optionally specify the maximum number of delivery destinations to return + // in the response. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliveryDestinationsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliveryDestinationsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeDeliveryDestinationsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeDeliveryDestinationsInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *DescribeDeliveryDestinationsInput) SetLimit(v int64) *DescribeDeliveryDestinationsInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeDeliveryDestinationsInput) SetNextToken(v string) *DescribeDeliveryDestinationsInput { + s.NextToken = &v + return s +} + +type DescribeDeliveryDestinationsOutput struct { + _ struct{} `type:"structure"` + + // An array of structures. Each structure contains information about one delivery + // destination in the account. + DeliveryDestinations []*DeliveryDestination `locationName:"deliveryDestinations" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliveryDestinationsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliveryDestinationsOutput) GoString() string { + return s.String() +} + +// SetDeliveryDestinations sets the DeliveryDestinations field's value. +func (s *DescribeDeliveryDestinationsOutput) SetDeliveryDestinations(v []*DeliveryDestination) *DescribeDeliveryDestinationsOutput { + s.DeliveryDestinations = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeDeliveryDestinationsOutput) SetNextToken(v string) *DescribeDeliveryDestinationsOutput { + s.NextToken = &v + return s +} + +type DescribeDeliverySourcesInput struct { + _ struct{} `type:"structure"` + + // Optionally specify the maximum number of delivery sources to return in the + // response. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliverySourcesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliverySourcesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeDeliverySourcesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeDeliverySourcesInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *DescribeDeliverySourcesInput) SetLimit(v int64) *DescribeDeliverySourcesInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeDeliverySourcesInput) SetNextToken(v string) *DescribeDeliverySourcesInput { + s.NextToken = &v + return s +} + +type DescribeDeliverySourcesOutput struct { + _ struct{} `type:"structure"` + + // An array of structures. Each structure contains information about one delivery + // source in the account. + DeliverySources []*DeliverySource `locationName:"deliverySources" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliverySourcesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDeliverySourcesOutput) GoString() string { + return s.String() +} + +// SetDeliverySources sets the DeliverySources field's value. +func (s *DescribeDeliverySourcesOutput) SetDeliverySources(v []*DeliverySource) *DescribeDeliverySourcesOutput { + s.DeliverySources = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeDeliverySourcesOutput) SetNextToken(v string) *DescribeDeliverySourcesOutput { + s.NextToken = &v + return s +} + +type DescribeDestinationsInput struct { + _ struct{} `type:"structure"` + + // The prefix to match. If you don't specify a value, no prefix filter is applied. + DestinationNamePrefix *string `min:"1" type:"string"` + + // The maximum number of items returned. If you don't specify a value, the default + // maximum value of 50 items is used. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDestinationsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDestinationsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeDestinationsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeDestinationsInput"} + if s.DestinationNamePrefix != nil && len(*s.DestinationNamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DestinationNamePrefix", 1)) + } + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDestinationNamePrefix sets the DestinationNamePrefix field's value. +func (s *DescribeDestinationsInput) SetDestinationNamePrefix(v string) *DescribeDestinationsInput { + s.DestinationNamePrefix = &v + return s +} + +// SetLimit sets the Limit field's value. +func (s *DescribeDestinationsInput) SetLimit(v int64) *DescribeDestinationsInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeDestinationsInput) SetNextToken(v string) *DescribeDestinationsInput { + s.NextToken = &v + return s +} + +type DescribeDestinationsOutput struct { + _ struct{} `type:"structure"` + + // The destinations. + Destinations []*Destination `locationName:"destinations" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDestinationsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeDestinationsOutput) GoString() string { + return s.String() +} + +// SetDestinations sets the Destinations field's value. +func (s *DescribeDestinationsOutput) SetDestinations(v []*Destination) *DescribeDestinationsOutput { + s.Destinations = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeDestinationsOutput) SetNextToken(v string) *DescribeDestinationsOutput { + s.NextToken = &v + return s +} + +type DescribeExportTasksInput struct { + _ struct{} `type:"structure"` + + // The maximum number of items returned. If you don't specify a value, the default + // is up to 50 items. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // The status code of the export task. Specifying a status code filters the + // results to zero or more export tasks. + StatusCode *string `locationName:"statusCode" type:"string" enum:"ExportTaskStatusCode"` + + // The ID of the export task. Specifying a task ID filters the results to one + // or zero export tasks. + TaskId *string `locationName:"taskId" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeExportTasksInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeExportTasksInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeExportTasksInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeExportTasksInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + if s.TaskId != nil && len(*s.TaskId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TaskId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *DescribeExportTasksInput) SetLimit(v int64) *DescribeExportTasksInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeExportTasksInput) SetNextToken(v string) *DescribeExportTasksInput { + s.NextToken = &v + return s +} + +// SetStatusCode sets the StatusCode field's value. +func (s *DescribeExportTasksInput) SetStatusCode(v string) *DescribeExportTasksInput { + s.StatusCode = &v + return s +} + +// SetTaskId sets the TaskId field's value. +func (s *DescribeExportTasksInput) SetTaskId(v string) *DescribeExportTasksInput { + s.TaskId = &v + return s +} + +type DescribeExportTasksOutput struct { + _ struct{} `type:"structure"` + + // The export tasks. + ExportTasks []*ExportTask `locationName:"exportTasks" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeExportTasksOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeExportTasksOutput) GoString() string { + return s.String() +} + +// SetExportTasks sets the ExportTasks field's value. +func (s *DescribeExportTasksOutput) SetExportTasks(v []*ExportTask) *DescribeExportTasksOutput { + s.ExportTasks = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeExportTasksOutput) SetNextToken(v string) *DescribeExportTasksOutput { + s.NextToken = &v + return s +} + +type DescribeLogGroupsInput struct { + _ struct{} `type:"structure"` + + // When includeLinkedAccounts is set to True, use this parameter to specify + // the list of accounts to search. You can specify as many as 20 account IDs + // in the array. + AccountIdentifiers []*string `locationName:"accountIdentifiers" type:"list"` + + // If you are using a monitoring account, set this to True to have the operation + // return log groups in the accounts listed in accountIdentifiers. + // + // If this parameter is set to true and accountIdentifiers contains a null value, + // the operation returns all log groups in the monitoring account and all log + // groups in all source accounts that are linked to the monitoring account. + IncludeLinkedAccounts *bool `locationName:"includeLinkedAccounts" type:"boolean"` + + // The maximum number of items returned. If you don't specify a value, the default + // is up to 50 items. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // Specifies the log group class for this log group. There are two classes: + // + // * The Standard log class supports all CloudWatch Logs features. + // + // * The Infrequent Access log class supports a subset of CloudWatch Logs + // features and incurs lower costs. + // + // For details about the features supported by each class, see Log classes (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch_Logs_Log_Classes.html) + LogGroupClass *string `locationName:"logGroupClass" type:"string" enum:"LogGroupClass"` + + // If you specify a string for this parameter, the operation returns only log + // groups that have names that match the string based on a case-sensitive substring + // search. For example, if you specify Foo, log groups named FooBar, aws/Foo, + // and GroupFoo would match, but foo, F/o/o and Froo would not match. + // + // If you specify logGroupNamePattern in your request, then only arn, creationTime, + // and logGroupName are included in the response. + // + // logGroupNamePattern and logGroupNamePrefix are mutually exclusive. Only one + // of these parameters can be passed. + LogGroupNamePattern *string `locationName:"logGroupNamePattern" type:"string"` + + // The prefix to match. + // + // logGroupNamePrefix and logGroupNamePattern are mutually exclusive. Only one + // of these parameters can be passed. + LogGroupNamePrefix *string `locationName:"logGroupNamePrefix" min:"1" type:"string"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeLogGroupsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeLogGroupsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeLogGroupsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeLogGroupsInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.LogGroupNamePrefix != nil && len(*s.LogGroupNamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupNamePrefix", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAccountIdentifiers sets the AccountIdentifiers field's value. +func (s *DescribeLogGroupsInput) SetAccountIdentifiers(v []*string) *DescribeLogGroupsInput { + s.AccountIdentifiers = v + return s +} + +// SetIncludeLinkedAccounts sets the IncludeLinkedAccounts field's value. +func (s *DescribeLogGroupsInput) SetIncludeLinkedAccounts(v bool) *DescribeLogGroupsInput { + s.IncludeLinkedAccounts = &v + return s +} + +// SetLimit sets the Limit field's value. +func (s *DescribeLogGroupsInput) SetLimit(v int64) *DescribeLogGroupsInput { + s.Limit = &v + return s +} + +// SetLogGroupClass sets the LogGroupClass field's value. +func (s *DescribeLogGroupsInput) SetLogGroupClass(v string) *DescribeLogGroupsInput { + s.LogGroupClass = &v + return s +} + +// SetLogGroupNamePattern sets the LogGroupNamePattern field's value. +func (s *DescribeLogGroupsInput) SetLogGroupNamePattern(v string) *DescribeLogGroupsInput { + s.LogGroupNamePattern = &v + return s +} + +// SetLogGroupNamePrefix sets the LogGroupNamePrefix field's value. +func (s *DescribeLogGroupsInput) SetLogGroupNamePrefix(v string) *DescribeLogGroupsInput { + s.LogGroupNamePrefix = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeLogGroupsInput) SetNextToken(v string) *DescribeLogGroupsInput { + s.NextToken = &v + return s +} + +type DescribeLogGroupsOutput struct { + _ struct{} `type:"structure"` + + // The log groups. + // + // If the retentionInDays value is not included for a log group, then that log + // group's events do not expire. + LogGroups []*LogGroup `locationName:"logGroups" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeLogGroupsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeLogGroupsOutput) GoString() string { + return s.String() +} + +// SetLogGroups sets the LogGroups field's value. +func (s *DescribeLogGroupsOutput) SetLogGroups(v []*LogGroup) *DescribeLogGroupsOutput { + s.LogGroups = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeLogGroupsOutput) SetNextToken(v string) *DescribeLogGroupsOutput { + s.NextToken = &v + return s +} + +type DescribeLogStreamsInput struct { + _ struct{} `type:"structure"` + + // If the value is true, results are returned in descending order. If the value + // is to false, results are returned in ascending order. The default value is + // false. + Descending *bool `locationName:"descending" type:"boolean"` + + // The maximum number of items returned. If you don't specify a value, the default + // is up to 50 items. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // Specify either the name or ARN of the log group to view. If the log group + // is in a source account and you are using a monitoring account, you must use + // the log group ARN. + // + // You must include either logGroupIdentifier or logGroupName, but not both. + LogGroupIdentifier *string `locationName:"logGroupIdentifier" min:"1" type:"string"` + + // The name of the log group. + // + // You must include either logGroupIdentifier or logGroupName, but not both. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // The prefix to match. + // + // If orderBy is LastEventTime, you cannot specify this parameter. + LogStreamNamePrefix *string `locationName:"logStreamNamePrefix" min:"1" type:"string"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // If the value is LogStreamName, the results are ordered by log stream name. + // If the value is LastEventTime, the results are ordered by the event time. + // The default value is LogStreamName. + // + // If you order the results by event time, you cannot specify the logStreamNamePrefix + // parameter. + // + // lastEventTimestamp represents the time of the most recent log event in the + // log stream in CloudWatch Logs. This number is expressed as the number of + // milliseconds after Jan 1, 1970 00:00:00 UTC. lastEventTimestamp updates on + // an eventual consistency basis. It typically updates in less than an hour + // from ingestion, but in rare situations might take longer. + OrderBy *string `locationName:"orderBy" type:"string" enum:"OrderBy"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeLogStreamsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeLogStreamsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeLogStreamsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeLogStreamsInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.LogGroupIdentifier != nil && len(*s.LogGroupIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupIdentifier", 1)) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.LogStreamNamePrefix != nil && len(*s.LogStreamNamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogStreamNamePrefix", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDescending sets the Descending field's value. +func (s *DescribeLogStreamsInput) SetDescending(v bool) *DescribeLogStreamsInput { + s.Descending = &v + return s +} + +// SetLimit sets the Limit field's value. +func (s *DescribeLogStreamsInput) SetLimit(v int64) *DescribeLogStreamsInput { + s.Limit = &v + return s +} + +// SetLogGroupIdentifier sets the LogGroupIdentifier field's value. +func (s *DescribeLogStreamsInput) SetLogGroupIdentifier(v string) *DescribeLogStreamsInput { + s.LogGroupIdentifier = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *DescribeLogStreamsInput) SetLogGroupName(v string) *DescribeLogStreamsInput { + s.LogGroupName = &v + return s +} + +// SetLogStreamNamePrefix sets the LogStreamNamePrefix field's value. +func (s *DescribeLogStreamsInput) SetLogStreamNamePrefix(v string) *DescribeLogStreamsInput { + s.LogStreamNamePrefix = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeLogStreamsInput) SetNextToken(v string) *DescribeLogStreamsInput { + s.NextToken = &v + return s +} + +// SetOrderBy sets the OrderBy field's value. +func (s *DescribeLogStreamsInput) SetOrderBy(v string) *DescribeLogStreamsInput { + s.OrderBy = &v + return s +} + +type DescribeLogStreamsOutput struct { + _ struct{} `type:"structure"` + + // The log streams. + LogStreams []*LogStream `locationName:"logStreams" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeLogStreamsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeLogStreamsOutput) GoString() string { + return s.String() +} + +// SetLogStreams sets the LogStreams field's value. +func (s *DescribeLogStreamsOutput) SetLogStreams(v []*LogStream) *DescribeLogStreamsOutput { + s.LogStreams = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeLogStreamsOutput) SetNextToken(v string) *DescribeLogStreamsOutput { + s.NextToken = &v + return s +} + +type DescribeMetricFiltersInput struct { + _ struct{} `type:"structure"` + + // The prefix to match. CloudWatch Logs uses the value that you set here only + // if you also include the logGroupName parameter in your request. + FilterNamePrefix *string `locationName:"filterNamePrefix" min:"1" type:"string"` + + // The maximum number of items returned. If you don't specify a value, the default + // is up to 50 items. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The name of the log group. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // Filters results to include only those with the specified metric name. If + // you include this parameter in your request, you must also include the metricNamespace + // parameter. + MetricName *string `locationName:"metricName" type:"string"` + + // Filters results to include only those in the specified namespace. If you + // include this parameter in your request, you must also include the metricName + // parameter. + MetricNamespace *string `locationName:"metricNamespace" type:"string"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeMetricFiltersInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeMetricFiltersInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeMetricFiltersInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeMetricFiltersInput"} + if s.FilterNamePrefix != nil && len(*s.FilterNamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("FilterNamePrefix", 1)) + } + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetFilterNamePrefix sets the FilterNamePrefix field's value. +func (s *DescribeMetricFiltersInput) SetFilterNamePrefix(v string) *DescribeMetricFiltersInput { + s.FilterNamePrefix = &v + return s +} + +// SetLimit sets the Limit field's value. +func (s *DescribeMetricFiltersInput) SetLimit(v int64) *DescribeMetricFiltersInput { + s.Limit = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *DescribeMetricFiltersInput) SetLogGroupName(v string) *DescribeMetricFiltersInput { + s.LogGroupName = &v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *DescribeMetricFiltersInput) SetMetricName(v string) *DescribeMetricFiltersInput { + s.MetricName = &v + return s +} + +// SetMetricNamespace sets the MetricNamespace field's value. +func (s *DescribeMetricFiltersInput) SetMetricNamespace(v string) *DescribeMetricFiltersInput { + s.MetricNamespace = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeMetricFiltersInput) SetNextToken(v string) *DescribeMetricFiltersInput { + s.NextToken = &v + return s +} + +type DescribeMetricFiltersOutput struct { + _ struct{} `type:"structure"` + + // The metric filters. + MetricFilters []*MetricFilter `locationName:"metricFilters" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeMetricFiltersOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeMetricFiltersOutput) GoString() string { + return s.String() +} + +// SetMetricFilters sets the MetricFilters field's value. +func (s *DescribeMetricFiltersOutput) SetMetricFilters(v []*MetricFilter) *DescribeMetricFiltersOutput { + s.MetricFilters = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeMetricFiltersOutput) SetNextToken(v string) *DescribeMetricFiltersOutput { + s.NextToken = &v + return s +} + +type DescribeQueriesInput struct { + _ struct{} `type:"structure"` + + // Limits the returned queries to only those for the specified log group. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // Limits the number of returned queries to the specified number. + MaxResults *int64 `locationName:"maxResults" min:"1" type:"integer"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // Limits the returned queries to only those that have the specified status. + // Valid values are Cancelled, Complete, Failed, Running, and Scheduled. + Status *string `locationName:"status" type:"string" enum:"QueryStatus"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeQueriesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeQueriesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeQueriesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeQueriesInput"} + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *DescribeQueriesInput) SetLogGroupName(v string) *DescribeQueriesInput { + s.LogGroupName = &v + return s +} + +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeQueriesInput) SetMaxResults(v int64) *DescribeQueriesInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeQueriesInput) SetNextToken(v string) *DescribeQueriesInput { + s.NextToken = &v + return s +} + +// SetStatus sets the Status field's value. +func (s *DescribeQueriesInput) SetStatus(v string) *DescribeQueriesInput { + s.Status = &v + return s +} + +type DescribeQueriesOutput struct { + _ struct{} `type:"structure"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // The list of queries that match the request. + Queries []*QueryInfo `locationName:"queries" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeQueriesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeQueriesOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeQueriesOutput) SetNextToken(v string) *DescribeQueriesOutput { + s.NextToken = &v + return s +} + +// SetQueries sets the Queries field's value. +func (s *DescribeQueriesOutput) SetQueries(v []*QueryInfo) *DescribeQueriesOutput { + s.Queries = v + return s +} + +type DescribeQueryDefinitionsInput struct { + _ struct{} `type:"structure"` + + // Limits the number of returned query definitions to the specified number. + MaxResults *int64 `locationName:"maxResults" min:"1" type:"integer"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // Use this parameter to filter your results to only the query definitions that + // have names that start with the prefix you specify. + QueryDefinitionNamePrefix *string `locationName:"queryDefinitionNamePrefix" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeQueryDefinitionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeQueryDefinitionsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeQueryDefinitionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeQueryDefinitionsInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + if s.QueryDefinitionNamePrefix != nil && len(*s.QueryDefinitionNamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("QueryDefinitionNamePrefix", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeQueryDefinitionsInput) SetMaxResults(v int64) *DescribeQueryDefinitionsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeQueryDefinitionsInput) SetNextToken(v string) *DescribeQueryDefinitionsInput { + s.NextToken = &v + return s +} + +// SetQueryDefinitionNamePrefix sets the QueryDefinitionNamePrefix field's value. +func (s *DescribeQueryDefinitionsInput) SetQueryDefinitionNamePrefix(v string) *DescribeQueryDefinitionsInput { + s.QueryDefinitionNamePrefix = &v + return s +} + +type DescribeQueryDefinitionsOutput struct { + _ struct{} `type:"structure"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // The list of query definitions that match your request. + QueryDefinitions []*QueryDefinition `locationName:"queryDefinitions" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeQueryDefinitionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeQueryDefinitionsOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeQueryDefinitionsOutput) SetNextToken(v string) *DescribeQueryDefinitionsOutput { + s.NextToken = &v + return s +} + +// SetQueryDefinitions sets the QueryDefinitions field's value. +func (s *DescribeQueryDefinitionsOutput) SetQueryDefinitions(v []*QueryDefinition) *DescribeQueryDefinitionsOutput { + s.QueryDefinitions = v + return s +} + +type DescribeResourcePoliciesInput struct { + _ struct{} `type:"structure"` + + // The maximum number of resource policies to be displayed with one call of + // this API. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeResourcePoliciesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeResourcePoliciesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeResourcePoliciesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeResourcePoliciesInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *DescribeResourcePoliciesInput) SetLimit(v int64) *DescribeResourcePoliciesInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeResourcePoliciesInput) SetNextToken(v string) *DescribeResourcePoliciesInput { + s.NextToken = &v + return s +} + +type DescribeResourcePoliciesOutput struct { + _ struct{} `type:"structure"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // The resource policies that exist in this account. + ResourcePolicies []*ResourcePolicy `locationName:"resourcePolicies" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeResourcePoliciesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeResourcePoliciesOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeResourcePoliciesOutput) SetNextToken(v string) *DescribeResourcePoliciesOutput { + s.NextToken = &v + return s +} + +// SetResourcePolicies sets the ResourcePolicies field's value. +func (s *DescribeResourcePoliciesOutput) SetResourcePolicies(v []*ResourcePolicy) *DescribeResourcePoliciesOutput { + s.ResourcePolicies = v + return s +} + +type DescribeSubscriptionFiltersInput struct { + _ struct{} `type:"structure"` + + // The prefix to match. If you don't specify a value, no prefix filter is applied. + FilterNamePrefix *string `locationName:"filterNamePrefix" min:"1" type:"string"` + + // The maximum number of items returned. If you don't specify a value, the default + // is up to 50 items. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeSubscriptionFiltersInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeSubscriptionFiltersInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeSubscriptionFiltersInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeSubscriptionFiltersInput"} + if s.FilterNamePrefix != nil && len(*s.FilterNamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("FilterNamePrefix", 1)) + } + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetFilterNamePrefix sets the FilterNamePrefix field's value. +func (s *DescribeSubscriptionFiltersInput) SetFilterNamePrefix(v string) *DescribeSubscriptionFiltersInput { + s.FilterNamePrefix = &v + return s +} + +// SetLimit sets the Limit field's value. +func (s *DescribeSubscriptionFiltersInput) SetLimit(v int64) *DescribeSubscriptionFiltersInput { + s.Limit = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *DescribeSubscriptionFiltersInput) SetLogGroupName(v string) *DescribeSubscriptionFiltersInput { + s.LogGroupName = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeSubscriptionFiltersInput) SetNextToken(v string) *DescribeSubscriptionFiltersInput { + s.NextToken = &v + return s +} + +type DescribeSubscriptionFiltersOutput struct { + _ struct{} `type:"structure"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // The subscription filters. + SubscriptionFilters []*SubscriptionFilter `locationName:"subscriptionFilters" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeSubscriptionFiltersOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DescribeSubscriptionFiltersOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeSubscriptionFiltersOutput) SetNextToken(v string) *DescribeSubscriptionFiltersOutput { + s.NextToken = &v + return s +} + +// SetSubscriptionFilters sets the SubscriptionFilters field's value. +func (s *DescribeSubscriptionFiltersOutput) SetSubscriptionFilters(v []*SubscriptionFilter) *DescribeSubscriptionFiltersOutput { + s.SubscriptionFilters = v + return s +} + +// Represents a cross-account destination that receives subscription log events. +type Destination struct { + _ struct{} `type:"structure"` + + // An IAM policy document that governs which Amazon Web Services accounts can + // create subscription filters against this destination. + AccessPolicy *string `locationName:"accessPolicy" min:"1" type:"string"` + + // The ARN of this destination. + Arn *string `locationName:"arn" type:"string"` + + // The creation time of the destination, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` + + // The name of the destination. + DestinationName *string `locationName:"destinationName" min:"1" type:"string"` + + // A role for impersonation, used when delivering log events to the target. + RoleArn *string `locationName:"roleArn" min:"1" type:"string"` + + // The Amazon Resource Name (ARN) of the physical target where the log events + // are delivered (for example, a Kinesis stream). + TargetArn *string `locationName:"targetArn" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Destination) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Destination) GoString() string { + return s.String() +} + +// SetAccessPolicy sets the AccessPolicy field's value. +func (s *Destination) SetAccessPolicy(v string) *Destination { + s.AccessPolicy = &v + return s +} + +// SetArn sets the Arn field's value. +func (s *Destination) SetArn(v string) *Destination { + s.Arn = &v + return s +} + +// SetCreationTime sets the CreationTime field's value. +func (s *Destination) SetCreationTime(v int64) *Destination { + s.CreationTime = &v + return s +} + +// SetDestinationName sets the DestinationName field's value. +func (s *Destination) SetDestinationName(v string) *Destination { + s.DestinationName = &v + return s +} + +// SetRoleArn sets the RoleArn field's value. +func (s *Destination) SetRoleArn(v string) *Destination { + s.RoleArn = &v + return s +} + +// SetTargetArn sets the TargetArn field's value. +func (s *Destination) SetTargetArn(v string) *Destination { + s.TargetArn = &v + return s +} + +type DisassociateKmsKeyInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // In your DisassociateKmsKey operation, you must specify either the resourceIdentifier + // parameter or the logGroup parameter, but you can't specify both. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // Specifies the target for this operation. You must specify one of the following: + // + // * Specify the ARN of a log group to stop having CloudWatch Logs use the + // KMS key to encrypt log events that are ingested and stored by that log + // group. After you run this operation, CloudWatch Logs encrypts ingested + // log events with the default CloudWatch Logs method. The log group ARN + // must be in the following format. Replace REGION and ACCOUNT_ID with your + // Region and account ID. arn:aws:logs:REGION:ACCOUNT_ID:log-group:LOG_GROUP_NAME + // + // * Specify the following ARN to stop using this key to encrypt the results + // of future StartQuery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html) + // operations in this account. Replace REGION and ACCOUNT_ID with your Region + // and account ID. arn:aws:logs:REGION:ACCOUNT_ID:query-result:* + // + // In your DisssociateKmsKey operation, you must specify either the resourceIdentifier + // parameter or the logGroup parameter, but you can't specify both. + ResourceIdentifier *string `locationName:"resourceIdentifier" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisassociateKmsKeyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisassociateKmsKeyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DisassociateKmsKeyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DisassociateKmsKeyInput"} + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.ResourceIdentifier != nil && len(*s.ResourceIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceIdentifier", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *DisassociateKmsKeyInput) SetLogGroupName(v string) *DisassociateKmsKeyInput { + s.LogGroupName = &v + return s +} + +// SetResourceIdentifier sets the ResourceIdentifier field's value. +func (s *DisassociateKmsKeyInput) SetResourceIdentifier(v string) *DisassociateKmsKeyInput { + s.ResourceIdentifier = &v + return s +} + +type DisassociateKmsKeyOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisassociateKmsKeyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s DisassociateKmsKeyOutput) GoString() string { + return s.String() +} + +type Entity struct { + _ struct{} `type:"structure"` + + Attributes map[string]*string `locationName:"attributes" type:"map"` + + KeyAttributes map[string]*string `locationName:"keyAttributes" min:"2" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Entity) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Entity) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Entity) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Entity"} + if s.KeyAttributes != nil && len(s.KeyAttributes) < 2 { + invalidParams.Add(request.NewErrParamMinLen("KeyAttributes", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAttributes sets the Attributes field's value. +func (s *Entity) SetAttributes(v map[string]*string) *Entity { + s.Attributes = v + return s +} + +// SetKeyAttributes sets the KeyAttributes field's value. +func (s *Entity) SetKeyAttributes(v map[string]*string) *Entity { + s.KeyAttributes = v + return s +} + +// Represents an export task. +type ExportTask struct { + _ struct{} `type:"structure"` + + // The name of the S3 bucket to which the log data was exported. + Destination *string `locationName:"destination" min:"1" type:"string"` + + // The prefix that was used as the start of Amazon S3 key for every object exported. + DestinationPrefix *string `locationName:"destinationPrefix" type:"string"` + + // Execution information about the export task. + ExecutionInfo *ExportTaskExecutionInfo `locationName:"executionInfo" type:"structure"` + + // The start time, expressed as the number of milliseconds after Jan 1, 1970 + // 00:00:00 UTC. Events with a timestamp before this time are not exported. + From *int64 `locationName:"from" type:"long"` + + // The name of the log group from which logs data was exported. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // The status of the export task. + Status *ExportTaskStatus `locationName:"status" type:"structure"` + + // The ID of the export task. + TaskId *string `locationName:"taskId" min:"1" type:"string"` + + // The name of the export task. + TaskName *string `locationName:"taskName" min:"1" type:"string"` + + // The end time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 + // UTC. Events with a timestamp later than this time are not exported. + To *int64 `locationName:"to" type:"long"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ExportTask) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ExportTask) GoString() string { + return s.String() +} + +// SetDestination sets the Destination field's value. +func (s *ExportTask) SetDestination(v string) *ExportTask { + s.Destination = &v + return s +} + +// SetDestinationPrefix sets the DestinationPrefix field's value. +func (s *ExportTask) SetDestinationPrefix(v string) *ExportTask { + s.DestinationPrefix = &v + return s +} + +// SetExecutionInfo sets the ExecutionInfo field's value. +func (s *ExportTask) SetExecutionInfo(v *ExportTaskExecutionInfo) *ExportTask { + s.ExecutionInfo = v + return s +} + +// SetFrom sets the From field's value. +func (s *ExportTask) SetFrom(v int64) *ExportTask { + s.From = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *ExportTask) SetLogGroupName(v string) *ExportTask { + s.LogGroupName = &v + return s +} + +// SetStatus sets the Status field's value. +func (s *ExportTask) SetStatus(v *ExportTaskStatus) *ExportTask { + s.Status = v + return s +} + +// SetTaskId sets the TaskId field's value. +func (s *ExportTask) SetTaskId(v string) *ExportTask { + s.TaskId = &v + return s +} + +// SetTaskName sets the TaskName field's value. +func (s *ExportTask) SetTaskName(v string) *ExportTask { + s.TaskName = &v + return s +} + +// SetTo sets the To field's value. +func (s *ExportTask) SetTo(v int64) *ExportTask { + s.To = &v + return s +} + +// Represents the status of an export task. +type ExportTaskExecutionInfo struct { + _ struct{} `type:"structure"` + + // The completion time of the export task, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CompletionTime *int64 `locationName:"completionTime" type:"long"` + + // The creation time of the export task, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ExportTaskExecutionInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ExportTaskExecutionInfo) GoString() string { + return s.String() +} + +// SetCompletionTime sets the CompletionTime field's value. +func (s *ExportTaskExecutionInfo) SetCompletionTime(v int64) *ExportTaskExecutionInfo { + s.CompletionTime = &v + return s +} + +// SetCreationTime sets the CreationTime field's value. +func (s *ExportTaskExecutionInfo) SetCreationTime(v int64) *ExportTaskExecutionInfo { + s.CreationTime = &v + return s +} + +// Represents the status of an export task. +type ExportTaskStatus struct { + _ struct{} `type:"structure"` + + // The status code of the export task. + Code *string `locationName:"code" type:"string" enum:"ExportTaskStatusCode"` + + // The status message related to the status code. + Message *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ExportTaskStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ExportTaskStatus) GoString() string { + return s.String() +} + +// SetCode sets the Code field's value. +func (s *ExportTaskStatus) SetCode(v string) *ExportTaskStatus { + s.Code = &v + return s +} + +// SetMessage sets the Message field's value. +func (s *ExportTaskStatus) SetMessage(v string) *ExportTaskStatus { + s.Message = &v + return s +} + +type FilterLogEventsInput struct { + _ struct{} `type:"structure"` + + // The end of the time range, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are + // not returned. + EndTime *int64 `locationName:"endTime" type:"long"` + + // The filter pattern to use. For more information, see Filter and Pattern Syntax + // (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html). + // + // If not provided, all the events are matched. + FilterPattern *string `locationName:"filterPattern" type:"string"` + + // If the value is true, the operation attempts to provide responses that contain + // events from multiple log streams within the log group, interleaved in a single + // response. If the value is false, all the matched log events in the first + // log stream are searched first, then those in the next log stream, and so + // on. + // + // Important As of June 17, 2019, this parameter is ignored and the value is + // assumed to be true. The response from this operation always interleaves events + // from multiple log streams within a log group. + // + // Deprecated: Starting on June 17, 2019, this parameter will be ignored and the value will be assumed to be true. The response from this operation will always interleave events from multiple log streams within a log group. + Interleaved *bool `locationName:"interleaved" deprecated:"true" type:"boolean"` + + // The maximum number of events to return. The default is 10,000 events. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // Specify either the name or ARN of the log group to view log events from. + // If the log group is in a source account and you are using a monitoring account, + // you must use the log group ARN. + // + // You must include either logGroupIdentifier or logGroupName, but not both. + LogGroupIdentifier *string `locationName:"logGroupIdentifier" min:"1" type:"string"` + + // The name of the log group to search. + // + // You must include either logGroupIdentifier or logGroupName, but not both. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // Filters the results to include only events from log streams that have names + // starting with this prefix. + // + // If you specify a value for both logStreamNamePrefix and logStreamNames, the + // action returns an InvalidParameterException error. + LogStreamNamePrefix *string `locationName:"logStreamNamePrefix" min:"1" type:"string"` + + // Filters the results to only logs from the log streams in this list. + // + // If you specify a value for both logStreamNames and logStreamNamePrefix, the + // action returns an InvalidParameterException error. + LogStreamNames []*string `locationName:"logStreamNames" min:"1" type:"list"` + + // The token for the next set of events to return. (You received this token + // from a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // The start of the time range, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. Events with a timestamp before this time are not + // returned. + StartTime *int64 `locationName:"startTime" type:"long"` + + // Specify true to display the log event fields with all sensitive data unmasked + // and visible. The default is false. + // + // To use this operation with this parameter, you must be signed into an account + // with the logs:Unmask permission. + Unmask *bool `locationName:"unmask" type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s FilterLogEventsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s FilterLogEventsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *FilterLogEventsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "FilterLogEventsInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.LogGroupIdentifier != nil && len(*s.LogGroupIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupIdentifier", 1)) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.LogStreamNamePrefix != nil && len(*s.LogStreamNamePrefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogStreamNamePrefix", 1)) + } + if s.LogStreamNames != nil && len(s.LogStreamNames) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogStreamNames", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEndTime sets the EndTime field's value. +func (s *FilterLogEventsInput) SetEndTime(v int64) *FilterLogEventsInput { + s.EndTime = &v + return s +} + +// SetFilterPattern sets the FilterPattern field's value. +func (s *FilterLogEventsInput) SetFilterPattern(v string) *FilterLogEventsInput { + s.FilterPattern = &v + return s +} + +// SetInterleaved sets the Interleaved field's value. +func (s *FilterLogEventsInput) SetInterleaved(v bool) *FilterLogEventsInput { + s.Interleaved = &v + return s +} + +// SetLimit sets the Limit field's value. +func (s *FilterLogEventsInput) SetLimit(v int64) *FilterLogEventsInput { + s.Limit = &v + return s +} + +// SetLogGroupIdentifier sets the LogGroupIdentifier field's value. +func (s *FilterLogEventsInput) SetLogGroupIdentifier(v string) *FilterLogEventsInput { + s.LogGroupIdentifier = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *FilterLogEventsInput) SetLogGroupName(v string) *FilterLogEventsInput { + s.LogGroupName = &v + return s +} + +// SetLogStreamNamePrefix sets the LogStreamNamePrefix field's value. +func (s *FilterLogEventsInput) SetLogStreamNamePrefix(v string) *FilterLogEventsInput { + s.LogStreamNamePrefix = &v + return s +} + +// SetLogStreamNames sets the LogStreamNames field's value. +func (s *FilterLogEventsInput) SetLogStreamNames(v []*string) *FilterLogEventsInput { + s.LogStreamNames = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *FilterLogEventsInput) SetNextToken(v string) *FilterLogEventsInput { + s.NextToken = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *FilterLogEventsInput) SetStartTime(v int64) *FilterLogEventsInput { + s.StartTime = &v + return s +} + +// SetUnmask sets the Unmask field's value. +func (s *FilterLogEventsInput) SetUnmask(v bool) *FilterLogEventsInput { + s.Unmask = &v + return s +} + +type FilterLogEventsOutput struct { + _ struct{} `type:"structure"` + + // The matched events. + Events []*FilteredLogEvent `locationName:"events" type:"list"` + + // The token to use when requesting the next set of items. The token expires + // after 24 hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // Important As of May 15, 2020, this parameter is no longer supported. This + // parameter returns an empty list. + // + // Indicates which log streams have been searched and whether each has been + // searched completely. + SearchedLogStreams []*SearchedLogStream `locationName:"searchedLogStreams" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s FilterLogEventsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s FilterLogEventsOutput) GoString() string { + return s.String() +} + +// SetEvents sets the Events field's value. +func (s *FilterLogEventsOutput) SetEvents(v []*FilteredLogEvent) *FilterLogEventsOutput { + s.Events = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *FilterLogEventsOutput) SetNextToken(v string) *FilterLogEventsOutput { + s.NextToken = &v + return s +} + +// SetSearchedLogStreams sets the SearchedLogStreams field's value. +func (s *FilterLogEventsOutput) SetSearchedLogStreams(v []*SearchedLogStream) *FilterLogEventsOutput { + s.SearchedLogStreams = v + return s +} + +// Represents a matched event. +type FilteredLogEvent struct { + _ struct{} `type:"structure"` + + // The ID of the event. + EventId *string `locationName:"eventId" type:"string"` + + // The time the event was ingested, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + IngestionTime *int64 `locationName:"ingestionTime" type:"long"` + + // The name of the log stream to which this event belongs. + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string"` + + // The data contained in the log event. + Message *string `locationName:"message" min:"1" type:"string"` + + // The time the event occurred, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. + Timestamp *int64 `locationName:"timestamp" type:"long"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s FilteredLogEvent) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s FilteredLogEvent) GoString() string { + return s.String() +} + +// SetEventId sets the EventId field's value. +func (s *FilteredLogEvent) SetEventId(v string) *FilteredLogEvent { + s.EventId = &v + return s +} + +// SetIngestionTime sets the IngestionTime field's value. +func (s *FilteredLogEvent) SetIngestionTime(v int64) *FilteredLogEvent { + s.IngestionTime = &v + return s +} + +// SetLogStreamName sets the LogStreamName field's value. +func (s *FilteredLogEvent) SetLogStreamName(v string) *FilteredLogEvent { + s.LogStreamName = &v + return s +} + +// SetMessage sets the Message field's value. +func (s *FilteredLogEvent) SetMessage(v string) *FilteredLogEvent { + s.Message = &v + return s +} + +// SetTimestamp sets the Timestamp field's value. +func (s *FilteredLogEvent) SetTimestamp(v int64) *FilteredLogEvent { + s.Timestamp = &v + return s +} + +type GetDataProtectionPolicyInput struct { + _ struct{} `type:"structure"` + + // The name or ARN of the log group that contains the data protection policy + // that you want to see. + // + // LogGroupIdentifier is a required field + LogGroupIdentifier *string `locationName:"logGroupIdentifier" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDataProtectionPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDataProtectionPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetDataProtectionPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetDataProtectionPolicyInput"} + if s.LogGroupIdentifier == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupIdentifier")) + } + if s.LogGroupIdentifier != nil && len(*s.LogGroupIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupIdentifier", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupIdentifier sets the LogGroupIdentifier field's value. +func (s *GetDataProtectionPolicyInput) SetLogGroupIdentifier(v string) *GetDataProtectionPolicyInput { + s.LogGroupIdentifier = &v + return s +} + +type GetDataProtectionPolicyOutput struct { + _ struct{} `type:"structure"` + + // The date and time that this policy was most recently updated. + LastUpdatedTime *int64 `locationName:"lastUpdatedTime" type:"long"` + + // The log group name or ARN that you specified in your request. + LogGroupIdentifier *string `locationName:"logGroupIdentifier" min:"1" type:"string"` + + // The data protection policy document for this log group. + PolicyDocument *string `locationName:"policyDocument" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDataProtectionPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDataProtectionPolicyOutput) GoString() string { + return s.String() +} + +// SetLastUpdatedTime sets the LastUpdatedTime field's value. +func (s *GetDataProtectionPolicyOutput) SetLastUpdatedTime(v int64) *GetDataProtectionPolicyOutput { + s.LastUpdatedTime = &v + return s +} + +// SetLogGroupIdentifier sets the LogGroupIdentifier field's value. +func (s *GetDataProtectionPolicyOutput) SetLogGroupIdentifier(v string) *GetDataProtectionPolicyOutput { + s.LogGroupIdentifier = &v + return s +} + +// SetPolicyDocument sets the PolicyDocument field's value. +func (s *GetDataProtectionPolicyOutput) SetPolicyDocument(v string) *GetDataProtectionPolicyOutput { + s.PolicyDocument = &v + return s +} + +type GetDeliveryDestinationInput struct { + _ struct{} `type:"structure"` + + // The name of the delivery destination that you want to retrieve. + // + // Name is a required field + Name *string `locationName:"name" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryDestinationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryDestinationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetDeliveryDestinationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetDeliveryDestinationInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *GetDeliveryDestinationInput) SetName(v string) *GetDeliveryDestinationInput { + s.Name = &v + return s +} + +type GetDeliveryDestinationOutput struct { + _ struct{} `type:"structure"` + + // A structure containing information about the delivery destination. + DeliveryDestination *DeliveryDestination `locationName:"deliveryDestination" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryDestinationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryDestinationOutput) GoString() string { + return s.String() +} + +// SetDeliveryDestination sets the DeliveryDestination field's value. +func (s *GetDeliveryDestinationOutput) SetDeliveryDestination(v *DeliveryDestination) *GetDeliveryDestinationOutput { + s.DeliveryDestination = v + return s +} + +type GetDeliveryDestinationPolicyInput struct { + _ struct{} `type:"structure"` + + // The name of the delivery destination that you want to retrieve the policy + // of. + // + // DeliveryDestinationName is a required field + DeliveryDestinationName *string `locationName:"deliveryDestinationName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryDestinationPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryDestinationPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetDeliveryDestinationPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetDeliveryDestinationPolicyInput"} + if s.DeliveryDestinationName == nil { + invalidParams.Add(request.NewErrParamRequired("DeliveryDestinationName")) + } + if s.DeliveryDestinationName != nil && len(*s.DeliveryDestinationName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DeliveryDestinationName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDeliveryDestinationName sets the DeliveryDestinationName field's value. +func (s *GetDeliveryDestinationPolicyInput) SetDeliveryDestinationName(v string) *GetDeliveryDestinationPolicyInput { + s.DeliveryDestinationName = &v + return s +} + +type GetDeliveryDestinationPolicyOutput struct { + _ struct{} `type:"structure"` + + // The IAM policy for this delivery destination. + Policy *Policy `locationName:"policy" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryDestinationPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryDestinationPolicyOutput) GoString() string { + return s.String() +} + +// SetPolicy sets the Policy field's value. +func (s *GetDeliveryDestinationPolicyOutput) SetPolicy(v *Policy) *GetDeliveryDestinationPolicyOutput { + s.Policy = v + return s +} + +type GetDeliveryInput struct { + _ struct{} `type:"structure"` + + // The ID of the delivery that you want to retrieve. + // + // Id is a required field + Id *string `locationName:"id" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetDeliveryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetDeliveryInput"} + if s.Id == nil { + invalidParams.Add(request.NewErrParamRequired("Id")) + } + if s.Id != nil && len(*s.Id) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Id", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetId sets the Id field's value. +func (s *GetDeliveryInput) SetId(v string) *GetDeliveryInput { + s.Id = &v + return s +} + +type GetDeliveryOutput struct { + _ struct{} `type:"structure"` + + // A structure that contains information about the delivery. + Delivery *Delivery `locationName:"delivery" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliveryOutput) GoString() string { + return s.String() +} + +// SetDelivery sets the Delivery field's value. +func (s *GetDeliveryOutput) SetDelivery(v *Delivery) *GetDeliveryOutput { + s.Delivery = v + return s +} + +type GetDeliverySourceInput struct { + _ struct{} `type:"structure"` + + // The name of the delivery source that you want to retrieve. + // + // Name is a required field + Name *string `locationName:"name" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliverySourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliverySourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetDeliverySourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetDeliverySourceInput"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetName sets the Name field's value. +func (s *GetDeliverySourceInput) SetName(v string) *GetDeliverySourceInput { + s.Name = &v + return s +} + +type GetDeliverySourceOutput struct { + _ struct{} `type:"structure"` + + // A structure containing information about the delivery source. + DeliverySource *DeliverySource `locationName:"deliverySource" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliverySourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetDeliverySourceOutput) GoString() string { + return s.String() +} + +// SetDeliverySource sets the DeliverySource field's value. +func (s *GetDeliverySourceOutput) SetDeliverySource(v *DeliverySource) *GetDeliverySourceOutput { + s.DeliverySource = v + return s +} + +type GetLogAnomalyDetectorInput struct { + _ struct{} `type:"structure"` + + // The ARN of the anomaly detector to retrieve information about. You can find + // the ARNs of log anomaly detectors in your account by using the ListLogAnomalyDetectors + // (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListLogAnomalyDetectors.html) + // operation. + // + // AnomalyDetectorArn is a required field + AnomalyDetectorArn *string `locationName:"anomalyDetectorArn" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogAnomalyDetectorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogAnomalyDetectorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetLogAnomalyDetectorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetLogAnomalyDetectorInput"} + if s.AnomalyDetectorArn == nil { + invalidParams.Add(request.NewErrParamRequired("AnomalyDetectorArn")) + } + if s.AnomalyDetectorArn != nil && len(*s.AnomalyDetectorArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AnomalyDetectorArn", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAnomalyDetectorArn sets the AnomalyDetectorArn field's value. +func (s *GetLogAnomalyDetectorInput) SetAnomalyDetectorArn(v string) *GetLogAnomalyDetectorInput { + s.AnomalyDetectorArn = &v + return s +} + +type GetLogAnomalyDetectorOutput struct { + _ struct{} `type:"structure"` + + // Specifies whether the anomaly detector is currently active. To change its + // status, use the enabled parameter in the UpdateLogAnomalyDetector (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UpdateLogAnomalyDetector.html) + // operation. + AnomalyDetectorStatus *string `locationName:"anomalyDetectorStatus" type:"string" enum:"AnomalyDetectorStatus"` + + // The number of days used as the life cycle of anomalies. After this time, + // anomalies are automatically baselined and the anomaly detector model will + // treat new occurrences of similar event as normal. + AnomalyVisibilityTime *int64 `locationName:"anomalyVisibilityTime" min:"7" type:"long"` + + // The date and time when this anomaly detector was created. + CreationTimeStamp *int64 `locationName:"creationTimeStamp" type:"long"` + + // The name of the log anomaly detector + DetectorName *string `locationName:"detectorName" min:"1" type:"string"` + + // Specifies how often the anomaly detector runs and look for anomalies. Set + // this value according to the frequency that the log group receives new logs. + // For example, if the log group receives new log events every 10 minutes, then + // setting evaluationFrequency to FIFTEEN_MIN might be appropriate. + EvaluationFrequency *string `locationName:"evaluationFrequency" type:"string" enum:"EvaluationFrequency"` + + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event can contain timestamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. + FilterPattern *string `locationName:"filterPattern" type:"string"` + + // The ID of the KMS key assigned to this anomaly detector, if any. + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` + + // The date and time when this anomaly detector was most recently modified. + LastModifiedTimeStamp *int64 `locationName:"lastModifiedTimeStamp" type:"long"` + + // An array of structures, where each structure contains the ARN of a log group + // associated with this anomaly detector. + LogGroupArnList []*string `locationName:"logGroupArnList" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogAnomalyDetectorOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogAnomalyDetectorOutput) GoString() string { + return s.String() +} + +// SetAnomalyDetectorStatus sets the AnomalyDetectorStatus field's value. +func (s *GetLogAnomalyDetectorOutput) SetAnomalyDetectorStatus(v string) *GetLogAnomalyDetectorOutput { + s.AnomalyDetectorStatus = &v + return s +} + +// SetAnomalyVisibilityTime sets the AnomalyVisibilityTime field's value. +func (s *GetLogAnomalyDetectorOutput) SetAnomalyVisibilityTime(v int64) *GetLogAnomalyDetectorOutput { + s.AnomalyVisibilityTime = &v + return s +} + +// SetCreationTimeStamp sets the CreationTimeStamp field's value. +func (s *GetLogAnomalyDetectorOutput) SetCreationTimeStamp(v int64) *GetLogAnomalyDetectorOutput { + s.CreationTimeStamp = &v + return s +} + +// SetDetectorName sets the DetectorName field's value. +func (s *GetLogAnomalyDetectorOutput) SetDetectorName(v string) *GetLogAnomalyDetectorOutput { + s.DetectorName = &v + return s +} + +// SetEvaluationFrequency sets the EvaluationFrequency field's value. +func (s *GetLogAnomalyDetectorOutput) SetEvaluationFrequency(v string) *GetLogAnomalyDetectorOutput { + s.EvaluationFrequency = &v + return s +} + +// SetFilterPattern sets the FilterPattern field's value. +func (s *GetLogAnomalyDetectorOutput) SetFilterPattern(v string) *GetLogAnomalyDetectorOutput { + s.FilterPattern = &v + return s +} + +// SetKmsKeyId sets the KmsKeyId field's value. +func (s *GetLogAnomalyDetectorOutput) SetKmsKeyId(v string) *GetLogAnomalyDetectorOutput { + s.KmsKeyId = &v + return s +} + +// SetLastModifiedTimeStamp sets the LastModifiedTimeStamp field's value. +func (s *GetLogAnomalyDetectorOutput) SetLastModifiedTimeStamp(v int64) *GetLogAnomalyDetectorOutput { + s.LastModifiedTimeStamp = &v + return s +} + +// SetLogGroupArnList sets the LogGroupArnList field's value. +func (s *GetLogAnomalyDetectorOutput) SetLogGroupArnList(v []*string) *GetLogAnomalyDetectorOutput { + s.LogGroupArnList = v + return s +} + +type GetLogEventsInput struct { + _ struct{} `type:"structure"` + + // The end of the time range, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. Events with a timestamp equal to or later than + // this time are not included. + EndTime *int64 `locationName:"endTime" type:"long"` + + // The maximum number of log events returned. If you don't specify a limit, + // the default is as many log events as can fit in a response size of 1 MB (up + // to 10,000 log events). + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // Specify either the name or ARN of the log group to view events from. If the + // log group is in a source account and you are using a monitoring account, + // you must use the log group ARN. + // + // You must include either logGroupIdentifier or logGroupName, but not both. + LogGroupIdentifier *string `locationName:"logGroupIdentifier" min:"1" type:"string"` + + // The name of the log group. + // + // You must include either logGroupIdentifier or logGroupName, but not both. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // The name of the log stream. + // + // LogStreamName is a required field + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string" required:"true"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // If the value is true, the earliest log events are returned first. If the + // value is false, the latest log events are returned first. The default value + // is false. + // + // If you are using a previous nextForwardToken value as the nextToken in this + // operation, you must specify true for startFromHead. + StartFromHead *bool `locationName:"startFromHead" type:"boolean"` + + // The start of the time range, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. Events with a timestamp equal to this time or later + // than this time are included. Events with a timestamp earlier than this time + // are not included. + StartTime *int64 `locationName:"startTime" type:"long"` + + // Specify true to display the log event fields with all sensitive data unmasked + // and visible. The default is false. + // + // To use this operation with this parameter, you must be signed into an account + // with the logs:Unmask permission. + Unmask *bool `locationName:"unmask" type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogEventsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogEventsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetLogEventsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetLogEventsInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.LogGroupIdentifier != nil && len(*s.LogGroupIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupIdentifier", 1)) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.LogStreamName == nil { + invalidParams.Add(request.NewErrParamRequired("LogStreamName")) + } + if s.LogStreamName != nil && len(*s.LogStreamName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogStreamName", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEndTime sets the EndTime field's value. +func (s *GetLogEventsInput) SetEndTime(v int64) *GetLogEventsInput { + s.EndTime = &v + return s +} + +// SetLimit sets the Limit field's value. +func (s *GetLogEventsInput) SetLimit(v int64) *GetLogEventsInput { + s.Limit = &v + return s +} + +// SetLogGroupIdentifier sets the LogGroupIdentifier field's value. +func (s *GetLogEventsInput) SetLogGroupIdentifier(v string) *GetLogEventsInput { + s.LogGroupIdentifier = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *GetLogEventsInput) SetLogGroupName(v string) *GetLogEventsInput { + s.LogGroupName = &v + return s +} + +// SetLogStreamName sets the LogStreamName field's value. +func (s *GetLogEventsInput) SetLogStreamName(v string) *GetLogEventsInput { + s.LogStreamName = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *GetLogEventsInput) SetNextToken(v string) *GetLogEventsInput { + s.NextToken = &v + return s +} + +// SetStartFromHead sets the StartFromHead field's value. +func (s *GetLogEventsInput) SetStartFromHead(v bool) *GetLogEventsInput { + s.StartFromHead = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *GetLogEventsInput) SetStartTime(v int64) *GetLogEventsInput { + s.StartTime = &v + return s +} + +// SetUnmask sets the Unmask field's value. +func (s *GetLogEventsInput) SetUnmask(v bool) *GetLogEventsInput { + s.Unmask = &v + return s +} + +type GetLogEventsOutput struct { + _ struct{} `type:"structure"` + + // The events. + Events []*OutputLogEvent `locationName:"events" type:"list"` + + // The token for the next set of items in the backward direction. The token + // expires after 24 hours. This token is not null. If you have reached the end + // of the stream, it returns the same token you passed in. + NextBackwardToken *string `locationName:"nextBackwardToken" min:"1" type:"string"` + + // The token for the next set of items in the forward direction. The token expires + // after 24 hours. If you have reached the end of the stream, it returns the + // same token you passed in. + NextForwardToken *string `locationName:"nextForwardToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogEventsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogEventsOutput) GoString() string { + return s.String() +} + +// SetEvents sets the Events field's value. +func (s *GetLogEventsOutput) SetEvents(v []*OutputLogEvent) *GetLogEventsOutput { + s.Events = v + return s +} + +// SetNextBackwardToken sets the NextBackwardToken field's value. +func (s *GetLogEventsOutput) SetNextBackwardToken(v string) *GetLogEventsOutput { + s.NextBackwardToken = &v + return s +} + +// SetNextForwardToken sets the NextForwardToken field's value. +func (s *GetLogEventsOutput) SetNextForwardToken(v string) *GetLogEventsOutput { + s.NextForwardToken = &v + return s +} + +type GetLogGroupFieldsInput struct { + _ struct{} `type:"structure"` + + // Specify either the name or ARN of the log group to view. If the log group + // is in a source account and you are using a monitoring account, you must specify + // the ARN. + // + // You must include either logGroupIdentifier or logGroupName, but not both. + LogGroupIdentifier *string `locationName:"logGroupIdentifier" min:"1" type:"string"` + + // The name of the log group to search. + // + // You must include either logGroupIdentifier or logGroupName, but not both. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // The time to set as the center of the query. If you specify time, the 8 minutes + // before and 8 minutes after this time are searched. If you omit time, the + // most recent 15 minutes up to the current time are searched. + // + // The time value is specified as epoch time, which is the number of seconds + // since January 1, 1970, 00:00:00 UTC. + Time *int64 `locationName:"time" type:"long"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogGroupFieldsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogGroupFieldsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetLogGroupFieldsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetLogGroupFieldsInput"} + if s.LogGroupIdentifier != nil && len(*s.LogGroupIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupIdentifier", 1)) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupIdentifier sets the LogGroupIdentifier field's value. +func (s *GetLogGroupFieldsInput) SetLogGroupIdentifier(v string) *GetLogGroupFieldsInput { + s.LogGroupIdentifier = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *GetLogGroupFieldsInput) SetLogGroupName(v string) *GetLogGroupFieldsInput { + s.LogGroupName = &v + return s +} + +// SetTime sets the Time field's value. +func (s *GetLogGroupFieldsInput) SetTime(v int64) *GetLogGroupFieldsInput { + s.Time = &v + return s +} + +type GetLogGroupFieldsOutput struct { + _ struct{} `type:"structure"` + + // The array of fields found in the query. Each object in the array contains + // the name of the field, along with the percentage of time it appeared in the + // log events that were queried. + LogGroupFields []*LogGroupField `locationName:"logGroupFields" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogGroupFieldsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogGroupFieldsOutput) GoString() string { + return s.String() +} + +// SetLogGroupFields sets the LogGroupFields field's value. +func (s *GetLogGroupFieldsOutput) SetLogGroupFields(v []*LogGroupField) *GetLogGroupFieldsOutput { + s.LogGroupFields = v + return s +} + +type GetLogRecordInput struct { + _ struct{} `type:"structure"` + + // The pointer corresponding to the log event record you want to retrieve. You + // get this from the response of a GetQueryResults operation. In that response, + // the value of the @ptr field for a log event is the value to use as logRecordPointer + // to retrieve that complete log event record. + // + // LogRecordPointer is a required field + LogRecordPointer *string `locationName:"logRecordPointer" type:"string" required:"true"` + + // Specify true to display the log event fields with all sensitive data unmasked + // and visible. The default is false. + // + // To use this operation with this parameter, you must be signed into an account + // with the logs:Unmask permission. + Unmask *bool `locationName:"unmask" type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogRecordInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogRecordInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetLogRecordInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetLogRecordInput"} + if s.LogRecordPointer == nil { + invalidParams.Add(request.NewErrParamRequired("LogRecordPointer")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogRecordPointer sets the LogRecordPointer field's value. +func (s *GetLogRecordInput) SetLogRecordPointer(v string) *GetLogRecordInput { + s.LogRecordPointer = &v + return s +} + +// SetUnmask sets the Unmask field's value. +func (s *GetLogRecordInput) SetUnmask(v bool) *GetLogRecordInput { + s.Unmask = &v + return s +} + +type GetLogRecordOutput struct { + _ struct{} `type:"structure"` + + // The requested log event, as a JSON string. + LogRecord map[string]*string `locationName:"logRecord" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogRecordOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetLogRecordOutput) GoString() string { + return s.String() +} + +// SetLogRecord sets the LogRecord field's value. +func (s *GetLogRecordOutput) SetLogRecord(v map[string]*string) *GetLogRecordOutput { + s.LogRecord = v + return s +} + +type GetQueryResultsInput struct { + _ struct{} `type:"structure"` + + // The ID number of the query. + // + // QueryId is a required field + QueryId *string `locationName:"queryId" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetQueryResultsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetQueryResultsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetQueryResultsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetQueryResultsInput"} + if s.QueryId == nil { + invalidParams.Add(request.NewErrParamRequired("QueryId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetQueryId sets the QueryId field's value. +func (s *GetQueryResultsInput) SetQueryId(v string) *GetQueryResultsInput { + s.QueryId = &v + return s +} + +type GetQueryResultsOutput struct { + _ struct{} `type:"structure"` + + // If you associated an KMS key with the CloudWatch Logs Insights query results + // in this account, this field displays the ARN of the key that's used to encrypt + // the query results when StartQuery (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html) + // stores them. + EncryptionKey *string `locationName:"encryptionKey" type:"string"` + + // The log events that matched the query criteria during the most recent time + // it ran. + // + // The results value is an array of arrays. Each log event is one object in + // the top-level array. Each of these log event objects is an array of field/value + // pairs. + Results [][]*ResultField `locationName:"results" type:"list"` + + // Includes the number of log events scanned by the query, the number of log + // events that matched the query criteria, and the total number of bytes in + // the scanned log events. These values reflect the full raw results of the + // query. + Statistics *QueryStatistics `locationName:"statistics" type:"structure"` + + // The status of the most recent running of the query. Possible values are Cancelled, + // Complete, Failed, Running, Scheduled, Timeout, and Unknown. + // + // Queries time out after 60 minutes of runtime. To avoid having your queries + // time out, reduce the time range being searched or partition your query into + // a number of queries. + Status *string `locationName:"status" type:"string" enum:"QueryStatus"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetQueryResultsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s GetQueryResultsOutput) GoString() string { + return s.String() +} + +// SetEncryptionKey sets the EncryptionKey field's value. +func (s *GetQueryResultsOutput) SetEncryptionKey(v string) *GetQueryResultsOutput { + s.EncryptionKey = &v + return s +} + +// SetResults sets the Results field's value. +func (s *GetQueryResultsOutput) SetResults(v [][]*ResultField) *GetQueryResultsOutput { + s.Results = v + return s +} + +// SetStatistics sets the Statistics field's value. +func (s *GetQueryResultsOutput) SetStatistics(v *QueryStatistics) *GetQueryResultsOutput { + s.Statistics = v + return s +} + +// SetStatus sets the Status field's value. +func (s *GetQueryResultsOutput) SetStatus(v string) *GetQueryResultsOutput { + s.Status = &v + return s +} + +// Represents a log event, which is a record of activity that was recorded by +// the application or resource being monitored. +type InputLogEvent struct { + _ struct{} `type:"structure"` + + // The raw event message. Each log event can be no larger than 256 KB. + // + // Message is a required field + Message *string `locationName:"message" min:"1" type:"string" required:"true"` + + // The time the event occurred, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. + // + // Timestamp is a required field + Timestamp *int64 `locationName:"timestamp" type:"long" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InputLogEvent) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InputLogEvent) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InputLogEvent) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "InputLogEvent"} + if s.Message == nil { + invalidParams.Add(request.NewErrParamRequired("Message")) + } + if s.Message != nil && len(*s.Message) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Message", 1)) + } + if s.Timestamp == nil { + invalidParams.Add(request.NewErrParamRequired("Timestamp")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMessage sets the Message field's value. +func (s *InputLogEvent) SetMessage(v string) *InputLogEvent { + s.Message = &v + return s +} + +// SetTimestamp sets the Timestamp field's value. +func (s *InputLogEvent) SetTimestamp(v int64) *InputLogEvent { + s.Timestamp = &v + return s +} + +// The operation is not valid on the specified resource. +type InvalidOperationException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InvalidOperationException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InvalidOperationException) GoString() string { + return s.String() +} + +func newErrorInvalidOperationException(v protocol.ResponseMetadata) error { + return &InvalidOperationException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *InvalidOperationException) Code() string { + return "InvalidOperationException" +} + +// Message returns the exception's message. +func (s *InvalidOperationException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *InvalidOperationException) OrigErr() error { + return nil +} + +func (s *InvalidOperationException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *InvalidOperationException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *InvalidOperationException) RequestID() string { + return s.RespMetadata.RequestID +} + +// A parameter is specified incorrectly. +type InvalidParameterException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InvalidParameterException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InvalidParameterException) GoString() string { + return s.String() +} + +func newErrorInvalidParameterException(v protocol.ResponseMetadata) error { + return &InvalidParameterException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *InvalidParameterException) Code() string { + return "InvalidParameterException" +} + +// Message returns the exception's message. +func (s *InvalidParameterException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *InvalidParameterException) OrigErr() error { + return nil +} + +func (s *InvalidParameterException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *InvalidParameterException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *InvalidParameterException) RequestID() string { + return s.RespMetadata.RequestID +} + +// The sequence token is not valid. You can get the correct sequence token in +// the expectedSequenceToken field in the InvalidSequenceTokenException message. +// +// PutLogEvents actions are now always accepted and never return InvalidSequenceTokenException +// regardless of receiving an invalid sequence token. +type InvalidSequenceTokenException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + ExpectedSequenceToken *string `locationName:"expectedSequenceToken" min:"1" type:"string"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InvalidSequenceTokenException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s InvalidSequenceTokenException) GoString() string { + return s.String() +} + +func newErrorInvalidSequenceTokenException(v protocol.ResponseMetadata) error { + return &InvalidSequenceTokenException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *InvalidSequenceTokenException) Code() string { + return "InvalidSequenceTokenException" +} + +// Message returns the exception's message. +func (s *InvalidSequenceTokenException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *InvalidSequenceTokenException) OrigErr() error { + return nil +} + +func (s *InvalidSequenceTokenException) Error() string { + return fmt.Sprintf("%s: %s\n%s", s.Code(), s.Message(), s.String()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *InvalidSequenceTokenException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *InvalidSequenceTokenException) RequestID() string { + return s.RespMetadata.RequestID +} + +// You have reached the maximum number of resources that can be created. +type LimitExceededException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LimitExceededException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LimitExceededException) GoString() string { + return s.String() +} + +func newErrorLimitExceededException(v protocol.ResponseMetadata) error { + return &LimitExceededException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *LimitExceededException) Code() string { + return "LimitExceededException" +} + +// Message returns the exception's message. +func (s *LimitExceededException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *LimitExceededException) OrigErr() error { + return nil +} + +func (s *LimitExceededException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *LimitExceededException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *LimitExceededException) RequestID() string { + return s.RespMetadata.RequestID +} + +type ListAnomaliesInput struct { + _ struct{} `type:"structure"` + + // Use this to optionally limit the results to only the anomalies found by a + // certain anomaly detector. + AnomalyDetectorArn *string `locationName:"anomalyDetectorArn" min:"1" type:"string"` + + // The maximum number of items to return. If you don't specify a value, the + // default maximum value of 50 items is used. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // You can specify this parameter if you want to the operation to return only + // anomalies that are currently either suppressed or unsuppressed. + SuppressionState *string `locationName:"suppressionState" type:"string" enum:"SuppressionState"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListAnomaliesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListAnomaliesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListAnomaliesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListAnomaliesInput"} + if s.AnomalyDetectorArn != nil && len(*s.AnomalyDetectorArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AnomalyDetectorArn", 1)) + } + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAnomalyDetectorArn sets the AnomalyDetectorArn field's value. +func (s *ListAnomaliesInput) SetAnomalyDetectorArn(v string) *ListAnomaliesInput { + s.AnomalyDetectorArn = &v + return s +} + +// SetLimit sets the Limit field's value. +func (s *ListAnomaliesInput) SetLimit(v int64) *ListAnomaliesInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListAnomaliesInput) SetNextToken(v string) *ListAnomaliesInput { + s.NextToken = &v + return s +} + +// SetSuppressionState sets the SuppressionState field's value. +func (s *ListAnomaliesInput) SetSuppressionState(v string) *ListAnomaliesInput { + s.SuppressionState = &v + return s +} + +type ListAnomaliesOutput struct { + _ struct{} `type:"structure"` + + // An array of structures, where each structure contains information about one + // anomaly that a log anomaly detector has found. + Anomalies []*Anomaly `locationName:"anomalies" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListAnomaliesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListAnomaliesOutput) GoString() string { + return s.String() +} + +// SetAnomalies sets the Anomalies field's value. +func (s *ListAnomaliesOutput) SetAnomalies(v []*Anomaly) *ListAnomaliesOutput { + s.Anomalies = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListAnomaliesOutput) SetNextToken(v string) *ListAnomaliesOutput { + s.NextToken = &v + return s +} + +type ListLogAnomalyDetectorsInput struct { + _ struct{} `type:"structure"` + + // Use this to optionally filter the results to only include anomaly detectors + // that are associated with the specified log group. + FilterLogGroupArn *string `locationName:"filterLogGroupArn" min:"1" type:"string"` + + // The maximum number of items to return. If you don't specify a value, the + // default maximum value of 50 items is used. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListLogAnomalyDetectorsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListLogAnomalyDetectorsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListLogAnomalyDetectorsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListLogAnomalyDetectorsInput"} + if s.FilterLogGroupArn != nil && len(*s.FilterLogGroupArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("FilterLogGroupArn", 1)) + } + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetFilterLogGroupArn sets the FilterLogGroupArn field's value. +func (s *ListLogAnomalyDetectorsInput) SetFilterLogGroupArn(v string) *ListLogAnomalyDetectorsInput { + s.FilterLogGroupArn = &v + return s +} + +// SetLimit sets the Limit field's value. +func (s *ListLogAnomalyDetectorsInput) SetLimit(v int64) *ListLogAnomalyDetectorsInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListLogAnomalyDetectorsInput) SetNextToken(v string) *ListLogAnomalyDetectorsInput { + s.NextToken = &v + return s +} + +type ListLogAnomalyDetectorsOutput struct { + _ struct{} `type:"structure"` + + // An array of structures, where each structure in the array contains information + // about one anomaly detector. + AnomalyDetectors []*AnomalyDetector `locationName:"anomalyDetectors" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListLogAnomalyDetectorsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListLogAnomalyDetectorsOutput) GoString() string { + return s.String() +} + +// SetAnomalyDetectors sets the AnomalyDetectors field's value. +func (s *ListLogAnomalyDetectorsOutput) SetAnomalyDetectors(v []*AnomalyDetector) *ListLogAnomalyDetectorsOutput { + s.AnomalyDetectors = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListLogAnomalyDetectorsOutput) SetNextToken(v string) *ListLogAnomalyDetectorsOutput { + s.NextToken = &v + return s +} + +type ListTagsForResourceInput struct { + _ struct{} `type:"structure"` + + // The ARN of the resource that you want to view tags for. + // + // The ARN format of a log group is arn:aws:logs:Region:account-id:log-group:log-group-name + // + // The ARN format of a destination is arn:aws:logs:Region:account-id:destination:destination-name + // + // For more information about ARN format, see CloudWatch Logs resources and + // operations (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html). + // + // ResourceArn is a required field + ResourceArn *string `locationName:"resourceArn" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsForResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsForResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListTagsForResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListTagsForResourceInput"} + if s.ResourceArn == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceArn")) + } + if s.ResourceArn != nil && len(*s.ResourceArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceArn", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceArn sets the ResourceArn field's value. +func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput { + s.ResourceArn = &v + return s +} + +type ListTagsForResourceOutput struct { + _ struct{} `type:"structure"` + + // The list of tags associated with the requested resource.> + Tags map[string]*string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsForResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsForResourceOutput) GoString() string { + return s.String() +} + +// SetTags sets the Tags field's value. +func (s *ListTagsForResourceOutput) SetTags(v map[string]*string) *ListTagsForResourceOutput { + s.Tags = v + return s +} + +// Deprecated: Please use the generic tagging API model ListTagsForResourceRequest and ListTagsForResourceResponse +type ListTagsLogGroupInput struct { + _ struct{} `deprecated:"true" type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsLogGroupInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsLogGroupInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListTagsLogGroupInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListTagsLogGroupInput"} + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *ListTagsLogGroupInput) SetLogGroupName(v string) *ListTagsLogGroupInput { + s.LogGroupName = &v + return s +} + +// Deprecated: Please use the generic tagging API model ListTagsForResourceRequest and ListTagsForResourceResponse +type ListTagsLogGroupOutput struct { + _ struct{} `deprecated:"true" type:"structure"` + + // The tags for the log group. + Tags map[string]*string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsLogGroupOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ListTagsLogGroupOutput) GoString() string { + return s.String() +} + +// SetTags sets the Tags field's value. +func (s *ListTagsLogGroupOutput) SetTags(v map[string]*string) *ListTagsLogGroupOutput { + s.Tags = v + return s +} + +// This object contains the information for one log event returned in a Live +// Tail stream. +type LiveTailSessionLogEvent struct { + _ struct{} `type:"structure"` + + // The timestamp specifying when this log event was ingested into the log group. + IngestionTime *int64 `locationName:"ingestionTime" type:"long"` + + // The name or ARN of the log group that ingested this log event. + LogGroupIdentifier *string `locationName:"logGroupIdentifier" min:"1" type:"string"` + + // The name of the log stream that ingested this log event. + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string"` + + // The log event message text. + Message *string `locationName:"message" min:"1" type:"string"` + + // The timestamp specifying when this log event was created. + Timestamp *int64 `locationName:"timestamp" type:"long"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LiveTailSessionLogEvent) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LiveTailSessionLogEvent) GoString() string { + return s.String() +} + +// SetIngestionTime sets the IngestionTime field's value. +func (s *LiveTailSessionLogEvent) SetIngestionTime(v int64) *LiveTailSessionLogEvent { + s.IngestionTime = &v + return s +} + +// SetLogGroupIdentifier sets the LogGroupIdentifier field's value. +func (s *LiveTailSessionLogEvent) SetLogGroupIdentifier(v string) *LiveTailSessionLogEvent { + s.LogGroupIdentifier = &v + return s +} + +// SetLogStreamName sets the LogStreamName field's value. +func (s *LiveTailSessionLogEvent) SetLogStreamName(v string) *LiveTailSessionLogEvent { + s.LogStreamName = &v + return s +} + +// SetMessage sets the Message field's value. +func (s *LiveTailSessionLogEvent) SetMessage(v string) *LiveTailSessionLogEvent { + s.Message = &v + return s +} + +// SetTimestamp sets the Timestamp field's value. +func (s *LiveTailSessionLogEvent) SetTimestamp(v int64) *LiveTailSessionLogEvent { + s.Timestamp = &v + return s +} + +// This object contains the metadata for one LiveTailSessionUpdate structure. +// It indicates whether that update includes only a sample of 500 log events +// out of a larger number of ingested log events, or if it contains all of the +// matching log events ingested during that second of time. +type LiveTailSessionMetadata struct { + _ struct{} `type:"structure"` + + // If this is true, then more than 500 log events matched the request for this + // update, and the sessionResults includes a sample of 500 of those events. + // + // If this is false, then 500 or fewer log events matched the request for this + // update, so no sampling was necessary. In this case, the sessionResults array + // includes all log events that matched your request during this time. + Sampled *bool `locationName:"sampled" type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LiveTailSessionMetadata) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LiveTailSessionMetadata) GoString() string { + return s.String() +} + +// SetSampled sets the Sampled field's value. +func (s *LiveTailSessionMetadata) SetSampled(v bool) *LiveTailSessionMetadata { + s.Sampled = &v + return s +} + +// This object contains information about this Live Tail session, including +// the log groups included and the log stream filters, if any. +type LiveTailSessionStart struct { + _ struct{} `type:"structure"` + + // An optional pattern to filter the results to include only log events that + // match the pattern. For example, a filter pattern of error 404 displays only + // log events that include both error and 404. + // + // For more information about filter pattern syntax, see Filter and Pattern + // Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html). + LogEventFilterPattern *string `locationName:"logEventFilterPattern" type:"string"` + + // An array of the names and ARNs of the log groups included in this Live Tail + // session. + LogGroupIdentifiers []*string `locationName:"logGroupIdentifiers" min:"1" type:"list"` + + // If your StartLiveTail operation request included a logStreamNamePrefixes + // parameter that filtered the session to only include log streams that have + // names that start with certain prefixes, these prefixes are listed here. + LogStreamNamePrefixes []*string `locationName:"logStreamNamePrefixes" min:"1" type:"list"` + + // If your StartLiveTail operation request included a logStreamNames parameter + // that filtered the session to only include certain log streams, these streams + // are listed here. + LogStreamNames []*string `locationName:"logStreamNames" min:"1" type:"list"` + + // The unique ID generated by CloudWatch Logs to identify this Live Tail session + // request. + RequestId *string `locationName:"requestId" type:"string"` + + // The unique ID generated by CloudWatch Logs to identify this Live Tail session. + SessionId *string `locationName:"sessionId" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LiveTailSessionStart) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LiveTailSessionStart) GoString() string { + return s.String() +} + +// SetLogEventFilterPattern sets the LogEventFilterPattern field's value. +func (s *LiveTailSessionStart) SetLogEventFilterPattern(v string) *LiveTailSessionStart { + s.LogEventFilterPattern = &v + return s +} + +// SetLogGroupIdentifiers sets the LogGroupIdentifiers field's value. +func (s *LiveTailSessionStart) SetLogGroupIdentifiers(v []*string) *LiveTailSessionStart { + s.LogGroupIdentifiers = v + return s +} + +// SetLogStreamNamePrefixes sets the LogStreamNamePrefixes field's value. +func (s *LiveTailSessionStart) SetLogStreamNamePrefixes(v []*string) *LiveTailSessionStart { + s.LogStreamNamePrefixes = v + return s +} + +// SetLogStreamNames sets the LogStreamNames field's value. +func (s *LiveTailSessionStart) SetLogStreamNames(v []*string) *LiveTailSessionStart { + s.LogStreamNames = v + return s +} + +// SetRequestId sets the RequestId field's value. +func (s *LiveTailSessionStart) SetRequestId(v string) *LiveTailSessionStart { + s.RequestId = &v + return s +} + +// SetSessionId sets the SessionId field's value. +func (s *LiveTailSessionStart) SetSessionId(v string) *LiveTailSessionStart { + s.SessionId = &v + return s +} + +// The LiveTailSessionStart is and event in the StartLiveTailResponseStream group of events. +func (s *LiveTailSessionStart) eventStartLiveTailResponseStream() {} + +// UnmarshalEvent unmarshals the EventStream Message into the LiveTailSessionStart value. +// This method is only used internally within the SDK's EventStream handling. +func (s *LiveTailSessionStart) UnmarshalEvent( + payloadUnmarshaler protocol.PayloadUnmarshaler, + msg eventstream.Message, +) error { + if err := payloadUnmarshaler.UnmarshalPayload( + bytes.NewReader(msg.Payload), s, + ); err != nil { + return err + } + return nil +} + +// MarshalEvent marshals the type into an stream event value. This method +// should only used internally within the SDK's EventStream handling. +func (s *LiveTailSessionStart) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { + msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) + var buf bytes.Buffer + if err = pm.MarshalPayload(&buf, s); err != nil { + return eventstream.Message{}, err + } + msg.Payload = buf.Bytes() + return msg, err +} + +// This object contains the log events and metadata for a Live Tail session. +type LiveTailSessionUpdate struct { + _ struct{} `type:"structure"` + + // This object contains the session metadata for a Live Tail session. + SessionMetadata *LiveTailSessionMetadata `locationName:"sessionMetadata" type:"structure"` + + // An array, where each member of the array includes the information for one + // log event in the Live Tail session. + // + // A sessionResults array can include as many as 500 log events. If the number + // of log events matching the request exceeds 500 per second, the log events + // are sampled down to 500 log events to be included in each sessionUpdate structure. + SessionResults []*LiveTailSessionLogEvent `locationName:"sessionResults" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LiveTailSessionUpdate) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LiveTailSessionUpdate) GoString() string { + return s.String() +} + +// SetSessionMetadata sets the SessionMetadata field's value. +func (s *LiveTailSessionUpdate) SetSessionMetadata(v *LiveTailSessionMetadata) *LiveTailSessionUpdate { + s.SessionMetadata = v + return s +} + +// SetSessionResults sets the SessionResults field's value. +func (s *LiveTailSessionUpdate) SetSessionResults(v []*LiveTailSessionLogEvent) *LiveTailSessionUpdate { + s.SessionResults = v + return s +} + +// The LiveTailSessionUpdate is and event in the StartLiveTailResponseStream group of events. +func (s *LiveTailSessionUpdate) eventStartLiveTailResponseStream() {} + +// UnmarshalEvent unmarshals the EventStream Message into the LiveTailSessionUpdate value. +// This method is only used internally within the SDK's EventStream handling. +func (s *LiveTailSessionUpdate) UnmarshalEvent( + payloadUnmarshaler protocol.PayloadUnmarshaler, + msg eventstream.Message, +) error { + if err := payloadUnmarshaler.UnmarshalPayload( + bytes.NewReader(msg.Payload), s, + ); err != nil { + return err + } + return nil +} + +// MarshalEvent marshals the type into an stream event value. This method +// should only used internally within the SDK's EventStream handling. +func (s *LiveTailSessionUpdate) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { + msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) + var buf bytes.Buffer + if err = pm.MarshalPayload(&buf, s); err != nil { + return eventstream.Message{}, err + } + msg.Payload = buf.Bytes() + return msg, err +} + +// This structure contains the information for one sample log event that is +// associated with an anomaly found by a log anomaly detector. +type LogEvent struct { + _ struct{} `type:"structure"` + + // The message content of the log event. + Message *string `locationName:"message" min:"1" type:"string"` + + // The time stamp of the log event. + Timestamp *int64 `locationName:"timestamp" type:"long"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LogEvent) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LogEvent) GoString() string { + return s.String() +} + +// SetMessage sets the Message field's value. +func (s *LogEvent) SetMessage(v string) *LogEvent { + s.Message = &v + return s +} + +// SetTimestamp sets the Timestamp field's value. +func (s *LogEvent) SetTimestamp(v int64) *LogEvent { + s.Timestamp = &v + return s +} + +// Represents a log group. +type LogGroup struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the log group. This version of the ARN + // includes a trailing :* after the log group name. + // + // Use this version to refer to the ARN in IAM policies when specifying permissions + // for most API actions. The exception is when specifying permissions for TagResource + // (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_TagResource.html), + // UntagResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UntagResource.html), + // and ListTagsForResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html). + // The permissions for those three actions require the ARN version that doesn't + // include a trailing :*. + Arn *string `locationName:"arn" type:"string"` + + // The creation time of the log group, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` + + // Displays whether this log group has a protection policy, or whether it had + // one in the past. For more information, see PutDataProtectionPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDataProtectionPolicy.html). + DataProtectionStatus *string `locationName:"dataProtectionStatus" type:"string" enum:"DataProtectionStatus"` + + // Displays all the properties that this log group has inherited from account-level + // settings. + InheritedProperties []*string `locationName:"inheritedProperties" type:"list" enum:"InheritedProperty"` + + // The Amazon Resource Name (ARN) of the KMS key to use when encrypting log + // data. + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` + + // The Amazon Resource Name (ARN) of the log group. This version of the ARN + // doesn't include a trailing :* after the log group name. + // + // Use this version to refer to the ARN in the following situations: + // + // * In the logGroupIdentifier input field in many CloudWatch Logs APIs. + // + // * In the resourceArn field in tagging APIs + // + // * In IAM policies, when specifying permissions for TagResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_TagResource.html), + // UntagResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_UntagResource.html), + // and ListTagsForResource (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListTagsForResource.html). + LogGroupArn *string `locationName:"logGroupArn" type:"string"` + + // This specifies the log group class for this log group. There are two classes: + // + // * The Standard log class supports all CloudWatch Logs features. + // + // * The Infrequent Access log class supports a subset of CloudWatch Logs + // features and incurs lower costs. + // + // For details about the features supported by each class, see Log classes (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatch_Logs_Log_Classes.html) + LogGroupClass *string `locationName:"logGroupClass" type:"string" enum:"LogGroupClass"` + + // The name of the log group. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // The number of metric filters. + MetricFilterCount *int64 `locationName:"metricFilterCount" type:"integer"` + + // The number of days to retain the log events in the specified log group. Possible + // values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, + // 1096, 1827, 2192, 2557, 2922, 3288, and 3653. + // + // To set a log group so that its log events do not expire, use DeleteRetentionPolicy + // (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DeleteRetentionPolicy.html). + RetentionInDays *int64 `locationName:"retentionInDays" type:"integer"` + + // The number of bytes stored. + StoredBytes *int64 `locationName:"storedBytes" type:"long"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LogGroup) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LogGroup) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *LogGroup) SetArn(v string) *LogGroup { + s.Arn = &v + return s +} + +// SetCreationTime sets the CreationTime field's value. +func (s *LogGroup) SetCreationTime(v int64) *LogGroup { + s.CreationTime = &v + return s +} + +// SetDataProtectionStatus sets the DataProtectionStatus field's value. +func (s *LogGroup) SetDataProtectionStatus(v string) *LogGroup { + s.DataProtectionStatus = &v + return s +} + +// SetInheritedProperties sets the InheritedProperties field's value. +func (s *LogGroup) SetInheritedProperties(v []*string) *LogGroup { + s.InheritedProperties = v + return s +} + +// SetKmsKeyId sets the KmsKeyId field's value. +func (s *LogGroup) SetKmsKeyId(v string) *LogGroup { + s.KmsKeyId = &v + return s +} + +// SetLogGroupArn sets the LogGroupArn field's value. +func (s *LogGroup) SetLogGroupArn(v string) *LogGroup { + s.LogGroupArn = &v + return s +} + +// SetLogGroupClass sets the LogGroupClass field's value. +func (s *LogGroup) SetLogGroupClass(v string) *LogGroup { + s.LogGroupClass = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *LogGroup) SetLogGroupName(v string) *LogGroup { + s.LogGroupName = &v + return s +} + +// SetMetricFilterCount sets the MetricFilterCount field's value. +func (s *LogGroup) SetMetricFilterCount(v int64) *LogGroup { + s.MetricFilterCount = &v + return s +} + +// SetRetentionInDays sets the RetentionInDays field's value. +func (s *LogGroup) SetRetentionInDays(v int64) *LogGroup { + s.RetentionInDays = &v + return s +} + +// SetStoredBytes sets the StoredBytes field's value. +func (s *LogGroup) SetStoredBytes(v int64) *LogGroup { + s.StoredBytes = &v + return s +} + +// The fields contained in log events found by a GetLogGroupFields operation, +// along with the percentage of queried log events in which each field appears. +type LogGroupField struct { + _ struct{} `type:"structure"` + + // The name of a log field. + Name *string `locationName:"name" type:"string"` + + // The percentage of log events queried that contained the field. + Percent *int64 `locationName:"percent" type:"integer"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LogGroupField) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LogGroupField) GoString() string { + return s.String() +} + +// SetName sets the Name field's value. +func (s *LogGroupField) SetName(v string) *LogGroupField { + s.Name = &v + return s +} + +// SetPercent sets the Percent field's value. +func (s *LogGroupField) SetPercent(v int64) *LogGroupField { + s.Percent = &v + return s +} + +// Represents a log stream, which is a sequence of log events from a single +// emitter of logs. +type LogStream struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the log stream. + Arn *string `locationName:"arn" type:"string"` + + // The creation time of the stream, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` + + // The time of the first event, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. + FirstEventTimestamp *int64 `locationName:"firstEventTimestamp" type:"long"` + + // The time of the most recent log event in the log stream in CloudWatch Logs. + // This number is expressed as the number of milliseconds after Jan 1, 1970 + // 00:00:00 UTC. The lastEventTime value updates on an eventual consistency + // basis. It typically updates in less than an hour from ingestion, but in rare + // situations might take longer. + LastEventTimestamp *int64 `locationName:"lastEventTimestamp" type:"long"` + + // The ingestion time, expressed as the number of milliseconds after Jan 1, + // 1970 00:00:00 UTC The lastIngestionTime value updates on an eventual consistency + // basis. It typically updates in less than an hour after ingestion, but in + // rare situations might take longer. + LastIngestionTime *int64 `locationName:"lastIngestionTime" type:"long"` + + // The name of the log stream. + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string"` + + // The number of bytes stored. + // + // Important: As of June 17, 2019, this parameter is no longer supported for + // log streams, and is always reported as zero. This change applies only to + // log streams. The storedBytes parameter for log groups is not affected. + // + // Deprecated: Starting on June 17, 2019, this parameter will be deprecated for log streams, and will be reported as zero. This change applies only to log streams. The storedBytes parameter for log groups is not affected. + StoredBytes *int64 `locationName:"storedBytes" deprecated:"true" type:"long"` + + // The sequence token. + // + // The sequence token is now ignored in PutLogEvents actions. PutLogEvents actions + // are always accepted regardless of receiving an invalid sequence token. You + // don't need to obtain uploadSequenceToken to use a PutLogEvents action. + UploadSequenceToken *string `locationName:"uploadSequenceToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LogStream) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s LogStream) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *LogStream) SetArn(v string) *LogStream { + s.Arn = &v + return s +} + +// SetCreationTime sets the CreationTime field's value. +func (s *LogStream) SetCreationTime(v int64) *LogStream { + s.CreationTime = &v + return s +} + +// SetFirstEventTimestamp sets the FirstEventTimestamp field's value. +func (s *LogStream) SetFirstEventTimestamp(v int64) *LogStream { + s.FirstEventTimestamp = &v + return s +} + +// SetLastEventTimestamp sets the LastEventTimestamp field's value. +func (s *LogStream) SetLastEventTimestamp(v int64) *LogStream { + s.LastEventTimestamp = &v + return s +} + +// SetLastIngestionTime sets the LastIngestionTime field's value. +func (s *LogStream) SetLastIngestionTime(v int64) *LogStream { + s.LastIngestionTime = &v + return s +} + +// SetLogStreamName sets the LogStreamName field's value. +func (s *LogStream) SetLogStreamName(v string) *LogStream { + s.LogStreamName = &v + return s +} + +// SetStoredBytes sets the StoredBytes field's value. +func (s *LogStream) SetStoredBytes(v int64) *LogStream { + s.StoredBytes = &v + return s +} + +// SetUploadSequenceToken sets the UploadSequenceToken field's value. +func (s *LogStream) SetUploadSequenceToken(v string) *LogStream { + s.UploadSequenceToken = &v + return s +} + +// The query string is not valid. Details about this error are displayed in +// a QueryCompileError object. For more information, see QueryCompileError (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_QueryCompileError.html). +// +// For more information about valid query syntax, see CloudWatch Logs Insights +// Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html). +type MalformedQueryException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` + + // Reserved. + QueryCompileError *QueryCompileError `locationName:"queryCompileError" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MalformedQueryException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MalformedQueryException) GoString() string { + return s.String() +} + +func newErrorMalformedQueryException(v protocol.ResponseMetadata) error { + return &MalformedQueryException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *MalformedQueryException) Code() string { + return "MalformedQueryException" +} + +// Message returns the exception's message. +func (s *MalformedQueryException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *MalformedQueryException) OrigErr() error { + return nil +} + +func (s *MalformedQueryException) Error() string { + return fmt.Sprintf("%s: %s\n%s", s.Code(), s.Message(), s.String()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *MalformedQueryException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *MalformedQueryException) RequestID() string { + return s.RespMetadata.RequestID +} + +// Metric filters express how CloudWatch Logs would extract metric observations +// from ingested log events and transform them into metric data in a CloudWatch +// metric. +type MetricFilter struct { + _ struct{} `type:"structure"` + + // The creation time of the metric filter, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` + + // The name of the metric filter. + FilterName *string `locationName:"filterName" min:"1" type:"string"` + + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event can contain timestamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. + FilterPattern *string `locationName:"filterPattern" type:"string"` + + // The name of the log group. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // The metric transformations. + MetricTransformations []*MetricTransformation `locationName:"metricTransformations" min:"1" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricFilter) GoString() string { + return s.String() +} + +// SetCreationTime sets the CreationTime field's value. +func (s *MetricFilter) SetCreationTime(v int64) *MetricFilter { + s.CreationTime = &v + return s +} + +// SetFilterName sets the FilterName field's value. +func (s *MetricFilter) SetFilterName(v string) *MetricFilter { + s.FilterName = &v + return s +} + +// SetFilterPattern sets the FilterPattern field's value. +func (s *MetricFilter) SetFilterPattern(v string) *MetricFilter { + s.FilterPattern = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *MetricFilter) SetLogGroupName(v string) *MetricFilter { + s.LogGroupName = &v + return s +} + +// SetMetricTransformations sets the MetricTransformations field's value. +func (s *MetricFilter) SetMetricTransformations(v []*MetricTransformation) *MetricFilter { + s.MetricTransformations = v + return s +} + +// Represents a matched event. +type MetricFilterMatchRecord struct { + _ struct{} `type:"structure"` + + // The raw event data. + EventMessage *string `locationName:"eventMessage" min:"1" type:"string"` + + // The event number. + EventNumber *int64 `locationName:"eventNumber" type:"long"` + + // The values extracted from the event data by the filter. + ExtractedValues map[string]*string `locationName:"extractedValues" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricFilterMatchRecord) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricFilterMatchRecord) GoString() string { + return s.String() +} + +// SetEventMessage sets the EventMessage field's value. +func (s *MetricFilterMatchRecord) SetEventMessage(v string) *MetricFilterMatchRecord { + s.EventMessage = &v + return s +} + +// SetEventNumber sets the EventNumber field's value. +func (s *MetricFilterMatchRecord) SetEventNumber(v int64) *MetricFilterMatchRecord { + s.EventNumber = &v + return s +} + +// SetExtractedValues sets the ExtractedValues field's value. +func (s *MetricFilterMatchRecord) SetExtractedValues(v map[string]*string) *MetricFilterMatchRecord { + s.ExtractedValues = v + return s +} + +// Indicates how to transform ingested log events to metric data in a CloudWatch +// metric. +type MetricTransformation struct { + _ struct{} `type:"structure"` + + // (Optional) The value to emit when a filter pattern does not match a log event. + // This value can be null. + DefaultValue *float64 `locationName:"defaultValue" type:"double"` + + // The fields to use as dimensions for the metric. One metric filter can include + // as many as three dimensions. + // + // Metrics extracted from log events are charged as custom metrics. To prevent + // unexpected high charges, do not specify high-cardinality fields such as IPAddress + // or requestID as dimensions. Each different value found for a dimension is + // treated as a separate metric and accrues charges as a separate custom metric. + // + // CloudWatch Logs disables a metric filter if it generates 1000 different name/value + // pairs for your specified dimensions within a certain amount of time. This + // helps to prevent accidental high charges. + // + // You can also set up a billing alarm to alert you if your charges are higher + // than expected. For more information, see Creating a Billing Alarm to Monitor + // Your Estimated Amazon Web Services Charges (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html). + Dimensions map[string]*string `locationName:"dimensions" type:"map"` + + // The name of the CloudWatch metric. + // + // MetricName is a required field + MetricName *string `locationName:"metricName" type:"string" required:"true"` + + // A custom namespace to contain your metric in CloudWatch. Use namespaces to + // group together metrics that are similar. For more information, see Namespaces + // (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace). + // + // MetricNamespace is a required field + MetricNamespace *string `locationName:"metricNamespace" type:"string" required:"true"` + + // The value to publish to the CloudWatch metric when a filter pattern matches + // a log event. + // + // MetricValue is a required field + MetricValue *string `locationName:"metricValue" type:"string" required:"true"` + + // The unit to assign to the metric. If you omit this, the unit is set as None. + Unit *string `locationName:"unit" type:"string" enum:"StandardUnit"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricTransformation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s MetricTransformation) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricTransformation) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MetricTransformation"} + if s.MetricName == nil { + invalidParams.Add(request.NewErrParamRequired("MetricName")) + } + if s.MetricNamespace == nil { + invalidParams.Add(request.NewErrParamRequired("MetricNamespace")) + } + if s.MetricValue == nil { + invalidParams.Add(request.NewErrParamRequired("MetricValue")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDefaultValue sets the DefaultValue field's value. +func (s *MetricTransformation) SetDefaultValue(v float64) *MetricTransformation { + s.DefaultValue = &v + return s +} + +// SetDimensions sets the Dimensions field's value. +func (s *MetricTransformation) SetDimensions(v map[string]*string) *MetricTransformation { + s.Dimensions = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *MetricTransformation) SetMetricName(v string) *MetricTransformation { + s.MetricName = &v + return s +} + +// SetMetricNamespace sets the MetricNamespace field's value. +func (s *MetricTransformation) SetMetricNamespace(v string) *MetricTransformation { + s.MetricNamespace = &v + return s +} + +// SetMetricValue sets the MetricValue field's value. +func (s *MetricTransformation) SetMetricValue(v string) *MetricTransformation { + s.MetricValue = &v + return s +} + +// SetUnit sets the Unit field's value. +func (s *MetricTransformation) SetUnit(v string) *MetricTransformation { + s.Unit = &v + return s +} + +// Multiple concurrent requests to update the same resource were in conflict. +type OperationAbortedException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s OperationAbortedException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s OperationAbortedException) GoString() string { + return s.String() +} + +func newErrorOperationAbortedException(v protocol.ResponseMetadata) error { + return &OperationAbortedException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *OperationAbortedException) Code() string { + return "OperationAbortedException" +} + +// Message returns the exception's message. +func (s *OperationAbortedException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *OperationAbortedException) OrigErr() error { + return nil +} + +func (s *OperationAbortedException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *OperationAbortedException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *OperationAbortedException) RequestID() string { + return s.RespMetadata.RequestID +} + +// Represents a log event. +type OutputLogEvent struct { + _ struct{} `type:"structure"` + + // The time the event was ingested, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + IngestionTime *int64 `locationName:"ingestionTime" type:"long"` + + // The data contained in the log event. + Message *string `locationName:"message" min:"1" type:"string"` + + // The time the event occurred, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. + Timestamp *int64 `locationName:"timestamp" type:"long"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s OutputLogEvent) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s OutputLogEvent) GoString() string { + return s.String() +} + +// SetIngestionTime sets the IngestionTime field's value. +func (s *OutputLogEvent) SetIngestionTime(v int64) *OutputLogEvent { + s.IngestionTime = &v + return s +} + +// SetMessage sets the Message field's value. +func (s *OutputLogEvent) SetMessage(v string) *OutputLogEvent { + s.Message = &v + return s +} + +// SetTimestamp sets the Timestamp field's value. +func (s *OutputLogEvent) SetTimestamp(v int64) *OutputLogEvent { + s.Timestamp = &v + return s +} + +// A tructures that contains information about one pattern token related to +// an anomaly. +// +// For more information about patterns and tokens, see CreateLogAnomalyDetector +// (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateLogAnomalyDetector.html). +type PatternToken struct { + _ struct{} `type:"structure"` + + // For a dynamic token, this indicates where in the pattern that this token + // appears, related to other dynamic tokens. The dynamic token that appears + // first has a value of 1, the one that appears second is 2, and so on. + DynamicTokenPosition *int64 `locationName:"dynamicTokenPosition" type:"integer"` + + // Contains the values found for a dynamic token, and the number of times each + // value was found. + Enumerations map[string]*int64 `locationName:"enumerations" type:"map"` + + // Specifies whether this is a dynamic token. + IsDynamic *bool `locationName:"isDynamic" type:"boolean"` + + // The string represented by this token. If this is a dynamic token, the value + // will be <*> + TokenString *string `locationName:"tokenString" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PatternToken) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PatternToken) GoString() string { + return s.String() +} + +// SetDynamicTokenPosition sets the DynamicTokenPosition field's value. +func (s *PatternToken) SetDynamicTokenPosition(v int64) *PatternToken { + s.DynamicTokenPosition = &v + return s +} + +// SetEnumerations sets the Enumerations field's value. +func (s *PatternToken) SetEnumerations(v map[string]*int64) *PatternToken { + s.Enumerations = v + return s +} + +// SetIsDynamic sets the IsDynamic field's value. +func (s *PatternToken) SetIsDynamic(v bool) *PatternToken { + s.IsDynamic = &v + return s +} + +// SetTokenString sets the TokenString field's value. +func (s *PatternToken) SetTokenString(v string) *PatternToken { + s.TokenString = &v + return s +} + +// A structure that contains information about one delivery destination policy. +type Policy struct { + _ struct{} `type:"structure"` + + // The contents of the delivery destination policy. + DeliveryDestinationPolicy *string `locationName:"deliveryDestinationPolicy" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Policy) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s Policy) GoString() string { + return s.String() +} + +// SetDeliveryDestinationPolicy sets the DeliveryDestinationPolicy field's value. +func (s *Policy) SetDeliveryDestinationPolicy(v string) *Policy { + s.DeliveryDestinationPolicy = &v + return s +} + +type PutAccountPolicyInput struct { + _ struct{} `type:"structure"` + + // Specify the policy, in JSON. + // + // Data protection policy + // + // A data protection policy must include two JSON blocks: + // + // * The first block must include both a DataIdentifer array and an Operation + // property with an Audit action. The DataIdentifer array lists the types + // of sensitive data that you want to mask. For more information about the + // available options, see Types of data that you can mask (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data-types.html). + // The Operation property with an Audit action is required to find the sensitive + // data terms. This Audit action must contain a FindingsDestination object. + // You can optionally use that FindingsDestination object to list one or + // more destinations to send audit findings to. If you specify destinations + // such as log groups, Firehose streams, and S3 buckets, they must already + // exist. + // + // * The second block must include both a DataIdentifer array and an Operation + // property with an Deidentify action. The DataIdentifer array must exactly + // match the DataIdentifer array in the first block of the policy. The Operation + // property with the Deidentify action is what actually masks the data, and + // it must contain the "MaskConfig": {} object. The "MaskConfig": {} object + // must be empty. + // + // For an example data protection policy, see the Examples section on this page. + // + // The contents of the two DataIdentifer arrays must match exactly. + // + // In addition to the two JSON blocks, the policyDocument can also include Name, + // Description, and Version fields. The Name is different than the operation's + // policyName parameter, and is used as a dimension when CloudWatch Logs reports + // audit findings metrics to CloudWatch. + // + // The JSON specified in policyDocument can be up to 30,720 characters long. + // + // Subscription filter policy + // + // A subscription filter policy can include the following attributes in a JSON + // block: + // + // * DestinationArn The ARN of the destination to deliver log events to. + // Supported destinations are: An Kinesis Data Streams data stream in the + // same account as the subscription policy, for same-account delivery. An + // Firehose data stream in the same account as the subscription policy, for + // same-account delivery. A Lambda function in the same account as the subscription + // policy, for same-account delivery. A logical destination in a different + // account created with PutDestination (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestination.html), + // for cross-account delivery. Kinesis Data Streams and Firehose are supported + // as logical destinations. + // + // * RoleArn The ARN of an IAM role that grants CloudWatch Logs permissions + // to deliver ingested log events to the destination stream. You don't need + // to provide the ARN when you are working with a logical destination for + // cross-account delivery. + // + // * FilterPattern A filter pattern for subscribing to a filtered stream + // of log events. + // + // * Distribution The method used to distribute log data to the destination. + // By default, log data is grouped by log stream, but the grouping can be + // set to Random for a more even distribution. This property is only applicable + // when the destination is an Kinesis Data Streams data stream. + // + // PolicyDocument is a required field + PolicyDocument *string `locationName:"policyDocument" type:"string" required:"true"` + + // A name for the policy. This must be unique within the account. + // + // PolicyName is a required field + PolicyName *string `locationName:"policyName" type:"string" required:"true"` + + // The type of policy that you're creating or updating. + // + // PolicyType is a required field + PolicyType *string `locationName:"policyType" type:"string" required:"true" enum:"PolicyType"` + + // Currently the only valid value for this parameter is ALL, which specifies + // that the data protection policy applies to all log groups in the account. + // If you omit this parameter, the default of ALL is used. + Scope *string `locationName:"scope" type:"string" enum:"Scope"` + + // Use this parameter to apply the subscription filter policy to a subset of + // log groups in the account. Currently, the only supported filter is LogGroupName + // NOT IN []. The selectionCriteria string can be up to 25KB in length. The + // length is determined by using its UTF-8 bytes. + // + // Using the selectionCriteria parameter is useful to help prevent infinite + // loops. For more information, see Log recursion prevention (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Subscriptions-recursion-prevention.html). + // + // Specifing selectionCriteria is valid only when you specify SUBSCRIPTION_FILTER_POLICY + // for policyType. + SelectionCriteria *string `locationName:"selectionCriteria" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutAccountPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutAccountPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutAccountPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutAccountPolicyInput"} + if s.PolicyDocument == nil { + invalidParams.Add(request.NewErrParamRequired("PolicyDocument")) + } + if s.PolicyName == nil { + invalidParams.Add(request.NewErrParamRequired("PolicyName")) + } + if s.PolicyType == nil { + invalidParams.Add(request.NewErrParamRequired("PolicyType")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetPolicyDocument sets the PolicyDocument field's value. +func (s *PutAccountPolicyInput) SetPolicyDocument(v string) *PutAccountPolicyInput { + s.PolicyDocument = &v + return s +} + +// SetPolicyName sets the PolicyName field's value. +func (s *PutAccountPolicyInput) SetPolicyName(v string) *PutAccountPolicyInput { + s.PolicyName = &v + return s +} + +// SetPolicyType sets the PolicyType field's value. +func (s *PutAccountPolicyInput) SetPolicyType(v string) *PutAccountPolicyInput { + s.PolicyType = &v + return s +} + +// SetScope sets the Scope field's value. +func (s *PutAccountPolicyInput) SetScope(v string) *PutAccountPolicyInput { + s.Scope = &v + return s +} + +// SetSelectionCriteria sets the SelectionCriteria field's value. +func (s *PutAccountPolicyInput) SetSelectionCriteria(v string) *PutAccountPolicyInput { + s.SelectionCriteria = &v + return s +} + +type PutAccountPolicyOutput struct { + _ struct{} `type:"structure"` + + // The account policy that you created. + AccountPolicy *AccountPolicy `locationName:"accountPolicy" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutAccountPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutAccountPolicyOutput) GoString() string { + return s.String() +} + +// SetAccountPolicy sets the AccountPolicy field's value. +func (s *PutAccountPolicyOutput) SetAccountPolicy(v *AccountPolicy) *PutAccountPolicyOutput { + s.AccountPolicy = v + return s +} + +type PutDataProtectionPolicyInput struct { + _ struct{} `type:"structure"` + + // Specify either the log group name or log group ARN. + // + // LogGroupIdentifier is a required field + LogGroupIdentifier *string `locationName:"logGroupIdentifier" min:"1" type:"string" required:"true"` + + // Specify the data protection policy, in JSON. + // + // This policy must include two JSON blocks: + // + // * The first block must include both a DataIdentifer array and an Operation + // property with an Audit action. The DataIdentifer array lists the types + // of sensitive data that you want to mask. For more information about the + // available options, see Types of data that you can mask (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data-types.html). + // The Operation property with an Audit action is required to find the sensitive + // data terms. This Audit action must contain a FindingsDestination object. + // You can optionally use that FindingsDestination object to list one or + // more destinations to send audit findings to. If you specify destinations + // such as log groups, Firehose streams, and S3 buckets, they must already + // exist. + // + // * The second block must include both a DataIdentifer array and an Operation + // property with an Deidentify action. The DataIdentifer array must exactly + // match the DataIdentifer array in the first block of the policy. The Operation + // property with the Deidentify action is what actually masks the data, and + // it must contain the "MaskConfig": {} object. The "MaskConfig": {} object + // must be empty. + // + // For an example data protection policy, see the Examples section on this page. + // + // The contents of the two DataIdentifer arrays must match exactly. + // + // In addition to the two JSON blocks, the policyDocument can also include Name, + // Description, and Version fields. The Name is used as a dimension when CloudWatch + // Logs reports audit findings metrics to CloudWatch. + // + // The JSON specified in policyDocument can be up to 30,720 characters. + // + // PolicyDocument is a required field + PolicyDocument *string `locationName:"policyDocument" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDataProtectionPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDataProtectionPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutDataProtectionPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutDataProtectionPolicyInput"} + if s.LogGroupIdentifier == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupIdentifier")) + } + if s.LogGroupIdentifier != nil && len(*s.LogGroupIdentifier) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupIdentifier", 1)) + } + if s.PolicyDocument == nil { + invalidParams.Add(request.NewErrParamRequired("PolicyDocument")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupIdentifier sets the LogGroupIdentifier field's value. +func (s *PutDataProtectionPolicyInput) SetLogGroupIdentifier(v string) *PutDataProtectionPolicyInput { + s.LogGroupIdentifier = &v + return s +} + +// SetPolicyDocument sets the PolicyDocument field's value. +func (s *PutDataProtectionPolicyInput) SetPolicyDocument(v string) *PutDataProtectionPolicyInput { + s.PolicyDocument = &v + return s +} + +type PutDataProtectionPolicyOutput struct { + _ struct{} `type:"structure"` + + // The date and time that this policy was most recently updated. + LastUpdatedTime *int64 `locationName:"lastUpdatedTime" type:"long"` + + // The log group name or ARN that you specified in your request. + LogGroupIdentifier *string `locationName:"logGroupIdentifier" min:"1" type:"string"` + + // The data protection policy used for this log group. + PolicyDocument *string `locationName:"policyDocument" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDataProtectionPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDataProtectionPolicyOutput) GoString() string { + return s.String() +} + +// SetLastUpdatedTime sets the LastUpdatedTime field's value. +func (s *PutDataProtectionPolicyOutput) SetLastUpdatedTime(v int64) *PutDataProtectionPolicyOutput { + s.LastUpdatedTime = &v + return s +} + +// SetLogGroupIdentifier sets the LogGroupIdentifier field's value. +func (s *PutDataProtectionPolicyOutput) SetLogGroupIdentifier(v string) *PutDataProtectionPolicyOutput { + s.LogGroupIdentifier = &v + return s +} + +// SetPolicyDocument sets the PolicyDocument field's value. +func (s *PutDataProtectionPolicyOutput) SetPolicyDocument(v string) *PutDataProtectionPolicyOutput { + s.PolicyDocument = &v + return s +} + +type PutDeliveryDestinationInput struct { + _ struct{} `type:"structure"` + + // A structure that contains the ARN of the Amazon Web Services resource that + // will receive the logs. + // + // DeliveryDestinationConfiguration is a required field + DeliveryDestinationConfiguration *DeliveryDestinationConfiguration `locationName:"deliveryDestinationConfiguration" type:"structure" required:"true"` + + // A name for this delivery destination. This name must be unique for all delivery + // destinations in your account. + // + // Name is a required field + Name *string `locationName:"name" min:"1" type:"string" required:"true"` + + // The format for the logs that this delivery destination will receive. + OutputFormat *string `locationName:"outputFormat" type:"string" enum:"OutputFormat"` + + // An optional list of key-value pairs to associate with the resource. + // + // For more information about tagging, see Tagging Amazon Web Services resources + // (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) + Tags map[string]*string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliveryDestinationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliveryDestinationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutDeliveryDestinationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutDeliveryDestinationInput"} + if s.DeliveryDestinationConfiguration == nil { + invalidParams.Add(request.NewErrParamRequired("DeliveryDestinationConfiguration")) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + if s.DeliveryDestinationConfiguration != nil { + if err := s.DeliveryDestinationConfiguration.Validate(); err != nil { + invalidParams.AddNested("DeliveryDestinationConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDeliveryDestinationConfiguration sets the DeliveryDestinationConfiguration field's value. +func (s *PutDeliveryDestinationInput) SetDeliveryDestinationConfiguration(v *DeliveryDestinationConfiguration) *PutDeliveryDestinationInput { + s.DeliveryDestinationConfiguration = v + return s +} + +// SetName sets the Name field's value. +func (s *PutDeliveryDestinationInput) SetName(v string) *PutDeliveryDestinationInput { + s.Name = &v + return s +} + +// SetOutputFormat sets the OutputFormat field's value. +func (s *PutDeliveryDestinationInput) SetOutputFormat(v string) *PutDeliveryDestinationInput { + s.OutputFormat = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *PutDeliveryDestinationInput) SetTags(v map[string]*string) *PutDeliveryDestinationInput { + s.Tags = v + return s +} + +type PutDeliveryDestinationOutput struct { + _ struct{} `type:"structure"` + + // A structure containing information about the delivery destination that you + // just created or updated. + DeliveryDestination *DeliveryDestination `locationName:"deliveryDestination" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliveryDestinationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliveryDestinationOutput) GoString() string { + return s.String() +} + +// SetDeliveryDestination sets the DeliveryDestination field's value. +func (s *PutDeliveryDestinationOutput) SetDeliveryDestination(v *DeliveryDestination) *PutDeliveryDestinationOutput { + s.DeliveryDestination = v + return s +} + +type PutDeliveryDestinationPolicyInput struct { + _ struct{} `type:"structure"` + + // The name of the delivery destination to assign this policy to. + // + // DeliveryDestinationName is a required field + DeliveryDestinationName *string `locationName:"deliveryDestinationName" min:"1" type:"string" required:"true"` + + // The contents of the policy. + // + // DeliveryDestinationPolicy is a required field + DeliveryDestinationPolicy *string `locationName:"deliveryDestinationPolicy" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliveryDestinationPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliveryDestinationPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutDeliveryDestinationPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutDeliveryDestinationPolicyInput"} + if s.DeliveryDestinationName == nil { + invalidParams.Add(request.NewErrParamRequired("DeliveryDestinationName")) + } + if s.DeliveryDestinationName != nil && len(*s.DeliveryDestinationName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DeliveryDestinationName", 1)) + } + if s.DeliveryDestinationPolicy == nil { + invalidParams.Add(request.NewErrParamRequired("DeliveryDestinationPolicy")) + } + if s.DeliveryDestinationPolicy != nil && len(*s.DeliveryDestinationPolicy) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DeliveryDestinationPolicy", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDeliveryDestinationName sets the DeliveryDestinationName field's value. +func (s *PutDeliveryDestinationPolicyInput) SetDeliveryDestinationName(v string) *PutDeliveryDestinationPolicyInput { + s.DeliveryDestinationName = &v + return s +} + +// SetDeliveryDestinationPolicy sets the DeliveryDestinationPolicy field's value. +func (s *PutDeliveryDestinationPolicyInput) SetDeliveryDestinationPolicy(v string) *PutDeliveryDestinationPolicyInput { + s.DeliveryDestinationPolicy = &v + return s +} + +type PutDeliveryDestinationPolicyOutput struct { + _ struct{} `type:"structure"` + + // The contents of the policy that you just created. + Policy *Policy `locationName:"policy" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliveryDestinationPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliveryDestinationPolicyOutput) GoString() string { + return s.String() +} + +// SetPolicy sets the Policy field's value. +func (s *PutDeliveryDestinationPolicyOutput) SetPolicy(v *Policy) *PutDeliveryDestinationPolicyOutput { + s.Policy = v + return s +} + +type PutDeliverySourceInput struct { + _ struct{} `type:"structure"` + + // Defines the type of log that the source is sending. + // + // * For Amazon Bedrock, the valid value is APPLICATION_LOGS. + // + // * For Amazon CodeWhisperer, the valid value is EVENT_LOGS. + // + // * For IAM Identity Center, the valid value is ERROR_LOGS. + // + // * For Amazon WorkMail, the valid values are ACCESS_CONTROL_LOGS, AUTHENTICATION_LOGS, + // WORKMAIL_AVAILABILITY_PROVIDER_LOGS, and WORKMAIL_MAILBOX_ACCESS_LOGS. + // + // LogType is a required field + LogType *string `locationName:"logType" min:"1" type:"string" required:"true"` + + // A name for this delivery source. This name must be unique for all delivery + // sources in your account. + // + // Name is a required field + Name *string `locationName:"name" min:"1" type:"string" required:"true"` + + // The ARN of the Amazon Web Services resource that is generating and sending + // logs. For example, arn:aws:workmail:us-east-1:123456789012:organization/m-1234EXAMPLEabcd1234abcd1234abcd1234 + // + // ResourceArn is a required field + ResourceArn *string `locationName:"resourceArn" type:"string" required:"true"` + + // An optional list of key-value pairs to associate with the resource. + // + // For more information about tagging, see Tagging Amazon Web Services resources + // (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) + Tags map[string]*string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliverySourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliverySourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutDeliverySourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutDeliverySourceInput"} + if s.LogType == nil { + invalidParams.Add(request.NewErrParamRequired("LogType")) + } + if s.LogType != nil && len(*s.LogType) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogType", 1)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + if s.ResourceArn == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceArn")) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogType sets the LogType field's value. +func (s *PutDeliverySourceInput) SetLogType(v string) *PutDeliverySourceInput { + s.LogType = &v + return s +} + +// SetName sets the Name field's value. +func (s *PutDeliverySourceInput) SetName(v string) *PutDeliverySourceInput { + s.Name = &v + return s +} + +// SetResourceArn sets the ResourceArn field's value. +func (s *PutDeliverySourceInput) SetResourceArn(v string) *PutDeliverySourceInput { + s.ResourceArn = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *PutDeliverySourceInput) SetTags(v map[string]*string) *PutDeliverySourceInput { + s.Tags = v + return s +} + +type PutDeliverySourceOutput struct { + _ struct{} `type:"structure"` + + // A structure containing information about the delivery source that was just + // created or updated. + DeliverySource *DeliverySource `locationName:"deliverySource" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliverySourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDeliverySourceOutput) GoString() string { + return s.String() +} + +// SetDeliverySource sets the DeliverySource field's value. +func (s *PutDeliverySourceOutput) SetDeliverySource(v *DeliverySource) *PutDeliverySourceOutput { + s.DeliverySource = v + return s +} + +type PutDestinationInput struct { + _ struct{} `type:"structure"` + + // A name for the destination. + // + // DestinationName is a required field + DestinationName *string `locationName:"destinationName" min:"1" type:"string" required:"true"` + + // The ARN of an IAM role that grants CloudWatch Logs permissions to call the + // Amazon Kinesis PutRecord operation on the destination stream. + // + // RoleArn is a required field + RoleArn *string `locationName:"roleArn" min:"1" type:"string" required:"true"` + + // An optional list of key-value pairs to associate with the resource. + // + // For more information about tagging, see Tagging Amazon Web Services resources + // (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html) + Tags map[string]*string `locationName:"tags" min:"1" type:"map"` + + // The ARN of an Amazon Kinesis stream to which to deliver matching log events. + // + // TargetArn is a required field + TargetArn *string `locationName:"targetArn" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDestinationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDestinationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutDestinationInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutDestinationInput"} + if s.DestinationName == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationName")) + } + if s.DestinationName != nil && len(*s.DestinationName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DestinationName", 1)) + } + if s.RoleArn == nil { + invalidParams.Add(request.NewErrParamRequired("RoleArn")) + } + if s.RoleArn != nil && len(*s.RoleArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RoleArn", 1)) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + if s.TargetArn == nil { + invalidParams.Add(request.NewErrParamRequired("TargetArn")) + } + if s.TargetArn != nil && len(*s.TargetArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TargetArn", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDestinationName sets the DestinationName field's value. +func (s *PutDestinationInput) SetDestinationName(v string) *PutDestinationInput { + s.DestinationName = &v + return s +} + +// SetRoleArn sets the RoleArn field's value. +func (s *PutDestinationInput) SetRoleArn(v string) *PutDestinationInput { + s.RoleArn = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *PutDestinationInput) SetTags(v map[string]*string) *PutDestinationInput { + s.Tags = v + return s +} + +// SetTargetArn sets the TargetArn field's value. +func (s *PutDestinationInput) SetTargetArn(v string) *PutDestinationInput { + s.TargetArn = &v + return s +} + +type PutDestinationOutput struct { + _ struct{} `type:"structure"` + + // The destination. + Destination *Destination `locationName:"destination" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDestinationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDestinationOutput) GoString() string { + return s.String() +} + +// SetDestination sets the Destination field's value. +func (s *PutDestinationOutput) SetDestination(v *Destination) *PutDestinationOutput { + s.Destination = v + return s +} + +type PutDestinationPolicyInput struct { + _ struct{} `type:"structure"` + + // An IAM policy document that authorizes cross-account users to deliver their + // log events to the associated destination. This can be up to 5120 bytes. + // + // AccessPolicy is a required field + AccessPolicy *string `locationName:"accessPolicy" min:"1" type:"string" required:"true"` + + // A name for an existing destination. + // + // DestinationName is a required field + DestinationName *string `locationName:"destinationName" min:"1" type:"string" required:"true"` + + // Specify true if you are updating an existing destination policy to grant + // permission to an organization ID instead of granting permission to individual + // Amazon Web Services accounts. Before you update a destination policy this + // way, you must first update the subscription filters in the accounts that + // send logs to this destination. If you do not, the subscription filters might + // stop working. By specifying true for forceUpdate, you are affirming that + // you have already updated the subscription filters. For more information, + // see Updating an existing cross-account subscription (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Cross-Account-Log_Subscription-Update.html) + // + // If you omit this parameter, the default of false is used. + ForceUpdate *bool `locationName:"forceUpdate" type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDestinationPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDestinationPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutDestinationPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutDestinationPolicyInput"} + if s.AccessPolicy == nil { + invalidParams.Add(request.NewErrParamRequired("AccessPolicy")) + } + if s.AccessPolicy != nil && len(*s.AccessPolicy) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AccessPolicy", 1)) + } + if s.DestinationName == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationName")) + } + if s.DestinationName != nil && len(*s.DestinationName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DestinationName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAccessPolicy sets the AccessPolicy field's value. +func (s *PutDestinationPolicyInput) SetAccessPolicy(v string) *PutDestinationPolicyInput { + s.AccessPolicy = &v + return s +} + +// SetDestinationName sets the DestinationName field's value. +func (s *PutDestinationPolicyInput) SetDestinationName(v string) *PutDestinationPolicyInput { + s.DestinationName = &v + return s +} + +// SetForceUpdate sets the ForceUpdate field's value. +func (s *PutDestinationPolicyInput) SetForceUpdate(v bool) *PutDestinationPolicyInput { + s.ForceUpdate = &v + return s +} + +type PutDestinationPolicyOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDestinationPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutDestinationPolicyOutput) GoString() string { + return s.String() +} + +type PutLogEventsInput struct { + _ struct{} `type:"structure"` + + Entity *Entity `locationName:"entity" type:"structure"` + + // The log events. + // + // LogEvents is a required field + LogEvents []*InputLogEvent `locationName:"logEvents" min:"1" type:"list" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The name of the log stream. + // + // LogStreamName is a required field + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string" required:"true"` + + // The sequence token obtained from the response of the previous PutLogEvents + // call. + // + // The sequenceToken parameter is now ignored in PutLogEvents actions. PutLogEvents + // actions are now accepted and never return InvalidSequenceTokenException or + // DataAlreadyAcceptedException even if the sequence token is not valid. + SequenceToken *string `locationName:"sequenceToken" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutLogEventsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutLogEventsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutLogEventsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutLogEventsInput"} + if s.LogEvents == nil { + invalidParams.Add(request.NewErrParamRequired("LogEvents")) + } + if s.LogEvents != nil && len(s.LogEvents) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogEvents", 1)) + } + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.LogStreamName == nil { + invalidParams.Add(request.NewErrParamRequired("LogStreamName")) + } + if s.LogStreamName != nil && len(*s.LogStreamName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogStreamName", 1)) + } + if s.SequenceToken != nil && len(*s.SequenceToken) < 1 { + invalidParams.Add(request.NewErrParamMinLen("SequenceToken", 1)) + } + if s.Entity != nil { + if err := s.Entity.Validate(); err != nil { + invalidParams.AddNested("Entity", err.(request.ErrInvalidParams)) + } + } + if s.LogEvents != nil { + for i, v := range s.LogEvents { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "LogEvents", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEntity sets the Entity field's value. +func (s *PutLogEventsInput) SetEntity(v *Entity) *PutLogEventsInput { + s.Entity = v + return s +} + +// SetLogEvents sets the LogEvents field's value. +func (s *PutLogEventsInput) SetLogEvents(v []*InputLogEvent) *PutLogEventsInput { + s.LogEvents = v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *PutLogEventsInput) SetLogGroupName(v string) *PutLogEventsInput { + s.LogGroupName = &v + return s +} + +// SetLogStreamName sets the LogStreamName field's value. +func (s *PutLogEventsInput) SetLogStreamName(v string) *PutLogEventsInput { + s.LogStreamName = &v + return s +} + +// SetSequenceToken sets the SequenceToken field's value. +func (s *PutLogEventsInput) SetSequenceToken(v string) *PutLogEventsInput { + s.SequenceToken = &v + return s +} + +type PutLogEventsOutput struct { + _ struct{} `type:"structure"` + + // The next sequence token. + // + // This field has been deprecated. + // + // The sequence token is now ignored in PutLogEvents actions. PutLogEvents actions + // are always accepted even if the sequence token is not valid. You can use + // parallel PutLogEvents actions on the same log stream and you do not need + // to wait for the response of a previous PutLogEvents action to obtain the + // nextSequenceToken value. + NextSequenceToken *string `locationName:"nextSequenceToken" min:"1" type:"string"` + + RejectedEntityInfo *RejectedEntityInfo `locationName:"rejectedEntityInfo" type:"structure"` + + // The rejected events. + RejectedLogEventsInfo *RejectedLogEventsInfo `locationName:"rejectedLogEventsInfo" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutLogEventsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutLogEventsOutput) GoString() string { + return s.String() +} + +// SetNextSequenceToken sets the NextSequenceToken field's value. +func (s *PutLogEventsOutput) SetNextSequenceToken(v string) *PutLogEventsOutput { + s.NextSequenceToken = &v + return s +} + +// SetRejectedEntityInfo sets the RejectedEntityInfo field's value. +func (s *PutLogEventsOutput) SetRejectedEntityInfo(v *RejectedEntityInfo) *PutLogEventsOutput { + s.RejectedEntityInfo = v + return s +} + +// SetRejectedLogEventsInfo sets the RejectedLogEventsInfo field's value. +func (s *PutLogEventsOutput) SetRejectedLogEventsInfo(v *RejectedLogEventsInfo) *PutLogEventsOutput { + s.RejectedLogEventsInfo = v + return s +} + +type PutMetricFilterInput struct { + _ struct{} `type:"structure"` + + // A name for the metric filter. + // + // FilterName is a required field + FilterName *string `locationName:"filterName" min:"1" type:"string" required:"true"` + + // A filter pattern for extracting metric data out of ingested log events. + // + // FilterPattern is a required field + FilterPattern *string `locationName:"filterPattern" type:"string" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // A collection of information that defines how metric data gets emitted. + // + // MetricTransformations is a required field + MetricTransformations []*MetricTransformation `locationName:"metricTransformations" min:"1" type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricFilterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutMetricFilterInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutMetricFilterInput"} + if s.FilterName == nil { + invalidParams.Add(request.NewErrParamRequired("FilterName")) + } + if s.FilterName != nil && len(*s.FilterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("FilterName", 1)) + } + if s.FilterPattern == nil { + invalidParams.Add(request.NewErrParamRequired("FilterPattern")) + } + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.MetricTransformations == nil { + invalidParams.Add(request.NewErrParamRequired("MetricTransformations")) + } + if s.MetricTransformations != nil && len(s.MetricTransformations) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MetricTransformations", 1)) + } + if s.MetricTransformations != nil { + for i, v := range s.MetricTransformations { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricTransformations", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetFilterName sets the FilterName field's value. +func (s *PutMetricFilterInput) SetFilterName(v string) *PutMetricFilterInput { + s.FilterName = &v + return s +} + +// SetFilterPattern sets the FilterPattern field's value. +func (s *PutMetricFilterInput) SetFilterPattern(v string) *PutMetricFilterInput { + s.FilterPattern = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *PutMetricFilterInput) SetLogGroupName(v string) *PutMetricFilterInput { + s.LogGroupName = &v + return s +} + +// SetMetricTransformations sets the MetricTransformations field's value. +func (s *PutMetricFilterInput) SetMetricTransformations(v []*MetricTransformation) *PutMetricFilterInput { + s.MetricTransformations = v + return s +} + +type PutMetricFilterOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutMetricFilterOutput) GoString() string { + return s.String() +} + +type PutQueryDefinitionInput struct { + _ struct{} `type:"structure"` + + // Used as an idempotency token, to avoid returning an exception if the service + // receives the same request twice because of a network error. + ClientToken *string `locationName:"clientToken" min:"36" type:"string" idempotencyToken:"true"` + + // Use this parameter to include specific log groups as part of your query definition. + // + // If you are updating a query definition and you omit this parameter, then + // the updated definition will contain no log groups. + LogGroupNames []*string `locationName:"logGroupNames" type:"list"` + + // A name for the query definition. If you are saving numerous query definitions, + // we recommend that you name them. This way, you can find the ones you want + // by using the first part of the name as a filter in the queryDefinitionNamePrefix + // parameter of DescribeQueryDefinitions (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html). + // + // Name is a required field + Name *string `locationName:"name" min:"1" type:"string" required:"true"` + + // If you are updating a query definition, use this parameter to specify the + // ID of the query definition that you want to update. You can use DescribeQueryDefinitions + // (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeQueryDefinitions.html) + // to retrieve the IDs of your saved query definitions. + // + // If you are creating a query definition, do not specify this parameter. CloudWatch + // generates a unique ID for the new query definition and include it in the + // response to this operation. + QueryDefinitionId *string `locationName:"queryDefinitionId" type:"string"` + + // The query string to use for this definition. For more information, see CloudWatch + // Logs Insights Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html). + // + // QueryString is a required field + QueryString *string `locationName:"queryString" min:"1" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutQueryDefinitionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutQueryDefinitionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutQueryDefinitionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutQueryDefinitionInput"} + if s.ClientToken != nil && len(*s.ClientToken) < 36 { + invalidParams.Add(request.NewErrParamMinLen("ClientToken", 36)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + if s.QueryString == nil { + invalidParams.Add(request.NewErrParamRequired("QueryString")) + } + if s.QueryString != nil && len(*s.QueryString) < 1 { + invalidParams.Add(request.NewErrParamMinLen("QueryString", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *PutQueryDefinitionInput) SetClientToken(v string) *PutQueryDefinitionInput { + s.ClientToken = &v + return s +} + +// SetLogGroupNames sets the LogGroupNames field's value. +func (s *PutQueryDefinitionInput) SetLogGroupNames(v []*string) *PutQueryDefinitionInput { + s.LogGroupNames = v + return s +} + +// SetName sets the Name field's value. +func (s *PutQueryDefinitionInput) SetName(v string) *PutQueryDefinitionInput { + s.Name = &v + return s +} + +// SetQueryDefinitionId sets the QueryDefinitionId field's value. +func (s *PutQueryDefinitionInput) SetQueryDefinitionId(v string) *PutQueryDefinitionInput { + s.QueryDefinitionId = &v + return s +} + +// SetQueryString sets the QueryString field's value. +func (s *PutQueryDefinitionInput) SetQueryString(v string) *PutQueryDefinitionInput { + s.QueryString = &v + return s +} + +type PutQueryDefinitionOutput struct { + _ struct{} `type:"structure"` + + // The ID of the query definition. + QueryDefinitionId *string `locationName:"queryDefinitionId" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutQueryDefinitionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutQueryDefinitionOutput) GoString() string { + return s.String() +} + +// SetQueryDefinitionId sets the QueryDefinitionId field's value. +func (s *PutQueryDefinitionOutput) SetQueryDefinitionId(v string) *PutQueryDefinitionOutput { + s.QueryDefinitionId = &v + return s +} + +type PutResourcePolicyInput struct { + _ struct{} `type:"structure"` + + // Details of the new policy, including the identity of the principal that is + // enabled to put logs to this account. This is formatted as a JSON string. + // This parameter is required. + // + // The following example creates a resource policy enabling the Route 53 service + // to put DNS query logs in to the specified log group. Replace "logArn" with + // the ARN of your CloudWatch Logs resource, such as a log group or log stream. + // + // CloudWatch Logs also supports aws:SourceArn (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourcearn) + // and aws:SourceAccount (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourceaccount) + // condition context keys. + // + // In the example resource policy, you would replace the value of SourceArn + // with the resource making the call from Route 53 to CloudWatch Logs. You would + // also replace the value of SourceAccount with the Amazon Web Services account + // ID making that call. + // + // { "Version": "2012-10-17", "Statement": [ { "Sid": "Route53LogsToCloudWatchLogs", + // "Effect": "Allow", "Principal": { "Service": [ "route53.amazonaws.com" ] + // }, "Action": "logs:PutLogEvents", "Resource": "logArn", "Condition": { "ArnLike": + // { "aws:SourceArn": "myRoute53ResourceArn" }, "StringEquals": { "aws:SourceAccount": + // "myAwsAccountId" } } } ] } + PolicyDocument *string `locationName:"policyDocument" min:"1" type:"string"` + + // Name of the new policy. This parameter is required. + PolicyName *string `locationName:"policyName" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutResourcePolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutResourcePolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutResourcePolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutResourcePolicyInput"} + if s.PolicyDocument != nil && len(*s.PolicyDocument) < 1 { + invalidParams.Add(request.NewErrParamMinLen("PolicyDocument", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetPolicyDocument sets the PolicyDocument field's value. +func (s *PutResourcePolicyInput) SetPolicyDocument(v string) *PutResourcePolicyInput { + s.PolicyDocument = &v + return s +} + +// SetPolicyName sets the PolicyName field's value. +func (s *PutResourcePolicyInput) SetPolicyName(v string) *PutResourcePolicyInput { + s.PolicyName = &v + return s +} + +type PutResourcePolicyOutput struct { + _ struct{} `type:"structure"` + + // The new policy. + ResourcePolicy *ResourcePolicy `locationName:"resourcePolicy" type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutResourcePolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutResourcePolicyOutput) GoString() string { + return s.String() +} + +// SetResourcePolicy sets the ResourcePolicy field's value. +func (s *PutResourcePolicyOutput) SetResourcePolicy(v *ResourcePolicy) *PutResourcePolicyOutput { + s.ResourcePolicy = v + return s +} + +type PutRetentionPolicyInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The number of days to retain the log events in the specified log group. Possible + // values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, + // 1096, 1827, 2192, 2557, 2922, 3288, and 3653. + // + // To set a log group so that its log events do not expire, use DeleteRetentionPolicy + // (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DeleteRetentionPolicy.html). + // + // RetentionInDays is a required field + RetentionInDays *int64 `locationName:"retentionInDays" type:"integer" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutRetentionPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutRetentionPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutRetentionPolicyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutRetentionPolicyInput"} + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.RetentionInDays == nil { + invalidParams.Add(request.NewErrParamRequired("RetentionInDays")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *PutRetentionPolicyInput) SetLogGroupName(v string) *PutRetentionPolicyInput { + s.LogGroupName = &v + return s +} + +// SetRetentionInDays sets the RetentionInDays field's value. +func (s *PutRetentionPolicyInput) SetRetentionInDays(v int64) *PutRetentionPolicyInput { + s.RetentionInDays = &v + return s +} + +type PutRetentionPolicyOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutRetentionPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutRetentionPolicyOutput) GoString() string { + return s.String() +} + +type PutSubscriptionFilterInput struct { + _ struct{} `type:"structure"` + + // The ARN of the destination to deliver matching log events to. Currently, + // the supported destinations are: + // + // * An Amazon Kinesis stream belonging to the same account as the subscription + // filter, for same-account delivery. + // + // * A logical destination (specified using an ARN) belonging to a different + // account, for cross-account delivery. If you're setting up a cross-account + // subscription, the destination must have an IAM policy associated with + // it. The IAM policy must allow the sender to send logs to the destination. + // For more information, see PutDestinationPolicy (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutDestinationPolicy.html). + // + // * A Kinesis Data Firehose delivery stream belonging to the same account + // as the subscription filter, for same-account delivery. + // + // * A Lambda function belonging to the same account as the subscription + // filter, for same-account delivery. + // + // DestinationArn is a required field + DestinationArn *string `locationName:"destinationArn" min:"1" type:"string" required:"true"` + + // The method used to distribute log data to the destination. By default, log + // data is grouped by log stream, but the grouping can be set to random for + // a more even distribution. This property is only applicable when the destination + // is an Amazon Kinesis data stream. + Distribution *string `locationName:"distribution" type:"string" enum:"Distribution"` + + // A name for the subscription filter. If you are updating an existing filter, + // you must specify the correct name in filterName. To find the name of the + // filter currently associated with a log group, use DescribeSubscriptionFilters + // (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeSubscriptionFilters.html). + // + // FilterName is a required field + FilterName *string `locationName:"filterName" min:"1" type:"string" required:"true"` + + // A filter pattern for subscribing to a filtered stream of log events. + // + // FilterPattern is a required field + FilterPattern *string `locationName:"filterPattern" type:"string" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The ARN of an IAM role that grants CloudWatch Logs permissions to deliver + // ingested log events to the destination stream. You don't need to provide + // the ARN when you are working with a logical destination for cross-account + // delivery. + RoleArn *string `locationName:"roleArn" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutSubscriptionFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutSubscriptionFilterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutSubscriptionFilterInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutSubscriptionFilterInput"} + if s.DestinationArn == nil { + invalidParams.Add(request.NewErrParamRequired("DestinationArn")) + } + if s.DestinationArn != nil && len(*s.DestinationArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DestinationArn", 1)) + } + if s.FilterName == nil { + invalidParams.Add(request.NewErrParamRequired("FilterName")) + } + if s.FilterName != nil && len(*s.FilterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("FilterName", 1)) + } + if s.FilterPattern == nil { + invalidParams.Add(request.NewErrParamRequired("FilterPattern")) + } + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.RoleArn != nil && len(*s.RoleArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RoleArn", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDestinationArn sets the DestinationArn field's value. +func (s *PutSubscriptionFilterInput) SetDestinationArn(v string) *PutSubscriptionFilterInput { + s.DestinationArn = &v + return s +} + +// SetDistribution sets the Distribution field's value. +func (s *PutSubscriptionFilterInput) SetDistribution(v string) *PutSubscriptionFilterInput { + s.Distribution = &v + return s +} + +// SetFilterName sets the FilterName field's value. +func (s *PutSubscriptionFilterInput) SetFilterName(v string) *PutSubscriptionFilterInput { + s.FilterName = &v + return s +} + +// SetFilterPattern sets the FilterPattern field's value. +func (s *PutSubscriptionFilterInput) SetFilterPattern(v string) *PutSubscriptionFilterInput { + s.FilterPattern = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *PutSubscriptionFilterInput) SetLogGroupName(v string) *PutSubscriptionFilterInput { + s.LogGroupName = &v + return s +} + +// SetRoleArn sets the RoleArn field's value. +func (s *PutSubscriptionFilterInput) SetRoleArn(v string) *PutSubscriptionFilterInput { + s.RoleArn = &v + return s +} + +type PutSubscriptionFilterOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutSubscriptionFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s PutSubscriptionFilterOutput) GoString() string { + return s.String() +} + +// Reserved. +type QueryCompileError struct { + _ struct{} `type:"structure"` + + // Reserved. + Location *QueryCompileErrorLocation `locationName:"location" type:"structure"` + + // Reserved. + Message *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s QueryCompileError) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s QueryCompileError) GoString() string { + return s.String() +} + +// SetLocation sets the Location field's value. +func (s *QueryCompileError) SetLocation(v *QueryCompileErrorLocation) *QueryCompileError { + s.Location = v + return s +} + +// SetMessage sets the Message field's value. +func (s *QueryCompileError) SetMessage(v string) *QueryCompileError { + s.Message = &v + return s +} + +// Reserved. +type QueryCompileErrorLocation struct { + _ struct{} `type:"structure"` + + // Reserved. + EndCharOffset *int64 `locationName:"endCharOffset" type:"integer"` + + // Reserved. + StartCharOffset *int64 `locationName:"startCharOffset" type:"integer"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s QueryCompileErrorLocation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s QueryCompileErrorLocation) GoString() string { + return s.String() +} + +// SetEndCharOffset sets the EndCharOffset field's value. +func (s *QueryCompileErrorLocation) SetEndCharOffset(v int64) *QueryCompileErrorLocation { + s.EndCharOffset = &v + return s +} + +// SetStartCharOffset sets the StartCharOffset field's value. +func (s *QueryCompileErrorLocation) SetStartCharOffset(v int64) *QueryCompileErrorLocation { + s.StartCharOffset = &v + return s +} + +// This structure contains details about a saved CloudWatch Logs Insights query +// definition. +type QueryDefinition struct { + _ struct{} `type:"structure"` + + // The date that the query definition was most recently modified. + LastModified *int64 `locationName:"lastModified" type:"long"` + + // If this query definition contains a list of log groups that it is limited + // to, that list appears here. + LogGroupNames []*string `locationName:"logGroupNames" type:"list"` + + // The name of the query definition. + Name *string `locationName:"name" min:"1" type:"string"` + + // The unique ID of the query definition. + QueryDefinitionId *string `locationName:"queryDefinitionId" type:"string"` + + // The query string to use for this definition. For more information, see CloudWatch + // Logs Insights Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html). + QueryString *string `locationName:"queryString" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s QueryDefinition) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s QueryDefinition) GoString() string { + return s.String() +} + +// SetLastModified sets the LastModified field's value. +func (s *QueryDefinition) SetLastModified(v int64) *QueryDefinition { + s.LastModified = &v + return s +} + +// SetLogGroupNames sets the LogGroupNames field's value. +func (s *QueryDefinition) SetLogGroupNames(v []*string) *QueryDefinition { + s.LogGroupNames = v + return s +} + +// SetName sets the Name field's value. +func (s *QueryDefinition) SetName(v string) *QueryDefinition { + s.Name = &v + return s +} + +// SetQueryDefinitionId sets the QueryDefinitionId field's value. +func (s *QueryDefinition) SetQueryDefinitionId(v string) *QueryDefinition { + s.QueryDefinitionId = &v + return s +} + +// SetQueryString sets the QueryString field's value. +func (s *QueryDefinition) SetQueryString(v string) *QueryDefinition { + s.QueryString = &v + return s +} + +// Information about one CloudWatch Logs Insights query that matches the request +// in a DescribeQueries operation. +type QueryInfo struct { + _ struct{} `type:"structure"` + + // The date and time that this query was created. + CreateTime *int64 `locationName:"createTime" type:"long"` + + // The name of the log group scanned by this query. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // The unique ID number of this query. + QueryId *string `locationName:"queryId" type:"string"` + + // The query string used in this query. + QueryString *string `locationName:"queryString" type:"string"` + + // The status of this query. Possible values are Cancelled, Complete, Failed, + // Running, Scheduled, and Unknown. + Status *string `locationName:"status" type:"string" enum:"QueryStatus"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s QueryInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s QueryInfo) GoString() string { + return s.String() +} + +// SetCreateTime sets the CreateTime field's value. +func (s *QueryInfo) SetCreateTime(v int64) *QueryInfo { + s.CreateTime = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *QueryInfo) SetLogGroupName(v string) *QueryInfo { + s.LogGroupName = &v + return s +} + +// SetQueryId sets the QueryId field's value. +func (s *QueryInfo) SetQueryId(v string) *QueryInfo { + s.QueryId = &v + return s +} + +// SetQueryString sets the QueryString field's value. +func (s *QueryInfo) SetQueryString(v string) *QueryInfo { + s.QueryString = &v + return s +} + +// SetStatus sets the Status field's value. +func (s *QueryInfo) SetStatus(v string) *QueryInfo { + s.Status = &v + return s +} + +// Contains the number of log events scanned by the query, the number of log +// events that matched the query criteria, and the total number of bytes in +// the log events that were scanned. +type QueryStatistics struct { + _ struct{} `type:"structure"` + + // The total number of bytes in the log events scanned during the query. + BytesScanned *float64 `locationName:"bytesScanned" type:"double"` + + // The number of log events that matched the query string. + RecordsMatched *float64 `locationName:"recordsMatched" type:"double"` + + // The total number of log events scanned during the query. + RecordsScanned *float64 `locationName:"recordsScanned" type:"double"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s QueryStatistics) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s QueryStatistics) GoString() string { + return s.String() +} + +// SetBytesScanned sets the BytesScanned field's value. +func (s *QueryStatistics) SetBytesScanned(v float64) *QueryStatistics { + s.BytesScanned = &v + return s +} + +// SetRecordsMatched sets the RecordsMatched field's value. +func (s *QueryStatistics) SetRecordsMatched(v float64) *QueryStatistics { + s.RecordsMatched = &v + return s +} + +// SetRecordsScanned sets the RecordsScanned field's value. +func (s *QueryStatistics) SetRecordsScanned(v float64) *QueryStatistics { + s.RecordsScanned = &v + return s +} + +type RejectedEntityInfo struct { + _ struct{} `type:"structure"` + + ErrorType *string `locationName:"errorType" type:"string" enum:"EntityRejectionErrorType"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s RejectedEntityInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s RejectedEntityInfo) GoString() string { + return s.String() +} + +// SetErrorType sets the ErrorType field's value. +func (s *RejectedEntityInfo) SetErrorType(v string) *RejectedEntityInfo { + s.ErrorType = &v + return s +} + +// Represents the rejected events. +type RejectedLogEventsInfo struct { + _ struct{} `type:"structure"` + + // The expired log events. + ExpiredLogEventEndIndex *int64 `locationName:"expiredLogEventEndIndex" type:"integer"` + + // The index of the first log event that is too new. This field is inclusive. + TooNewLogEventStartIndex *int64 `locationName:"tooNewLogEventStartIndex" type:"integer"` + + // The index of the last log event that is too old. This field is exclusive. + TooOldLogEventEndIndex *int64 `locationName:"tooOldLogEventEndIndex" type:"integer"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s RejectedLogEventsInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s RejectedLogEventsInfo) GoString() string { + return s.String() +} + +// SetExpiredLogEventEndIndex sets the ExpiredLogEventEndIndex field's value. +func (s *RejectedLogEventsInfo) SetExpiredLogEventEndIndex(v int64) *RejectedLogEventsInfo { + s.ExpiredLogEventEndIndex = &v + return s +} + +// SetTooNewLogEventStartIndex sets the TooNewLogEventStartIndex field's value. +func (s *RejectedLogEventsInfo) SetTooNewLogEventStartIndex(v int64) *RejectedLogEventsInfo { + s.TooNewLogEventStartIndex = &v + return s +} + +// SetTooOldLogEventEndIndex sets the TooOldLogEventEndIndex field's value. +func (s *RejectedLogEventsInfo) SetTooOldLogEventEndIndex(v int64) *RejectedLogEventsInfo { + s.TooOldLogEventEndIndex = &v + return s +} + +// The specified resource already exists. +type ResourceAlreadyExistsException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ResourceAlreadyExistsException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ResourceAlreadyExistsException) GoString() string { + return s.String() +} + +func newErrorResourceAlreadyExistsException(v protocol.ResponseMetadata) error { + return &ResourceAlreadyExistsException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *ResourceAlreadyExistsException) Code() string { + return "ResourceAlreadyExistsException" +} + +// Message returns the exception's message. +func (s *ResourceAlreadyExistsException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *ResourceAlreadyExistsException) OrigErr() error { + return nil +} + +func (s *ResourceAlreadyExistsException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *ResourceAlreadyExistsException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *ResourceAlreadyExistsException) RequestID() string { + return s.RespMetadata.RequestID +} + +// The specified resource does not exist. +type ResourceNotFoundException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ResourceNotFoundException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ResourceNotFoundException) GoString() string { + return s.String() +} + +func newErrorResourceNotFoundException(v protocol.ResponseMetadata) error { + return &ResourceNotFoundException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *ResourceNotFoundException) Code() string { + return "ResourceNotFoundException" +} + +// Message returns the exception's message. +func (s *ResourceNotFoundException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *ResourceNotFoundException) OrigErr() error { + return nil +} + +func (s *ResourceNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *ResourceNotFoundException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *ResourceNotFoundException) RequestID() string { + return s.RespMetadata.RequestID +} + +// A policy enabling one or more entities to put logs to a log group in this +// account. +type ResourcePolicy struct { + _ struct{} `type:"structure"` + + // Timestamp showing when this policy was last updated, expressed as the number + // of milliseconds after Jan 1, 1970 00:00:00 UTC. + LastUpdatedTime *int64 `locationName:"lastUpdatedTime" type:"long"` + + // The details of the policy. + PolicyDocument *string `locationName:"policyDocument" min:"1" type:"string"` + + // The name of the resource policy. + PolicyName *string `locationName:"policyName" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ResourcePolicy) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ResourcePolicy) GoString() string { + return s.String() +} + +// SetLastUpdatedTime sets the LastUpdatedTime field's value. +func (s *ResourcePolicy) SetLastUpdatedTime(v int64) *ResourcePolicy { + s.LastUpdatedTime = &v + return s +} + +// SetPolicyDocument sets the PolicyDocument field's value. +func (s *ResourcePolicy) SetPolicyDocument(v string) *ResourcePolicy { + s.PolicyDocument = &v + return s +} + +// SetPolicyName sets the PolicyName field's value. +func (s *ResourcePolicy) SetPolicyName(v string) *ResourcePolicy { + s.PolicyName = &v + return s +} + +// Contains one field from one log event returned by a CloudWatch Logs Insights +// query, along with the value of that field. +// +// For more information about the fields that are generated by CloudWatch logs, +// see Supported Logs and Discovered Fields (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData-discoverable-fields.html). +type ResultField struct { + _ struct{} `type:"structure"` + + // The log event field. + Field *string `locationName:"field" type:"string"` + + // The value of this field. + Value *string `locationName:"value" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ResultField) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ResultField) GoString() string { + return s.String() +} + +// SetField sets the Field field's value. +func (s *ResultField) SetField(v string) *ResultField { + s.Field = &v + return s +} + +// SetValue sets the Value field's value. +func (s *ResultField) SetValue(v string) *ResultField { + s.Value = &v + return s +} + +// Represents the search status of a log stream. +type SearchedLogStream struct { + _ struct{} `type:"structure"` + + // The name of the log stream. + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string"` + + // Indicates whether all the events in this log stream were searched. + SearchedCompletely *bool `locationName:"searchedCompletely" type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SearchedLogStream) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SearchedLogStream) GoString() string { + return s.String() +} + +// SetLogStreamName sets the LogStreamName field's value. +func (s *SearchedLogStream) SetLogStreamName(v string) *SearchedLogStream { + s.LogStreamName = &v + return s +} + +// SetSearchedCompletely sets the SearchedCompletely field's value. +func (s *SearchedLogStream) SetSearchedCompletely(v bool) *SearchedLogStream { + s.SearchedCompletely = &v + return s +} + +// This request exceeds a service quota. +type ServiceQuotaExceededException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ServiceQuotaExceededException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ServiceQuotaExceededException) GoString() string { + return s.String() +} + +func newErrorServiceQuotaExceededException(v protocol.ResponseMetadata) error { + return &ServiceQuotaExceededException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *ServiceQuotaExceededException) Code() string { + return "ServiceQuotaExceededException" +} + +// Message returns the exception's message. +func (s *ServiceQuotaExceededException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *ServiceQuotaExceededException) OrigErr() error { + return nil +} + +func (s *ServiceQuotaExceededException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *ServiceQuotaExceededException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *ServiceQuotaExceededException) RequestID() string { + return s.RespMetadata.RequestID +} + +// The service cannot complete the request. +type ServiceUnavailableException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ServiceUnavailableException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ServiceUnavailableException) GoString() string { + return s.String() +} + +func newErrorServiceUnavailableException(v protocol.ResponseMetadata) error { + return &ServiceUnavailableException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *ServiceUnavailableException) Code() string { + return "ServiceUnavailableException" +} + +// Message returns the exception's message. +func (s *ServiceUnavailableException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *ServiceUnavailableException) OrigErr() error { + return nil +} + +func (s *ServiceUnavailableException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *ServiceUnavailableException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *ServiceUnavailableException) RequestID() string { + return s.RespMetadata.RequestID +} + +// his exception is returned if an unknown error occurs during a Live Tail session. +type SessionStreamingException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SessionStreamingException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SessionStreamingException) GoString() string { + return s.String() +} + +// The SessionStreamingException is and event in the StartLiveTailResponseStream group of events. +func (s *SessionStreamingException) eventStartLiveTailResponseStream() {} + +// UnmarshalEvent unmarshals the EventStream Message into the SessionStreamingException value. +// This method is only used internally within the SDK's EventStream handling. +func (s *SessionStreamingException) UnmarshalEvent( + payloadUnmarshaler protocol.PayloadUnmarshaler, + msg eventstream.Message, +) error { + if err := payloadUnmarshaler.UnmarshalPayload( + bytes.NewReader(msg.Payload), s, + ); err != nil { + return err + } + return nil +} + +// MarshalEvent marshals the type into an stream event value. This method +// should only used internally within the SDK's EventStream handling. +func (s *SessionStreamingException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { + msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType)) + var buf bytes.Buffer + if err = pm.MarshalPayload(&buf, s); err != nil { + return eventstream.Message{}, err + } + msg.Payload = buf.Bytes() + return msg, err +} + +func newErrorSessionStreamingException(v protocol.ResponseMetadata) error { + return &SessionStreamingException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *SessionStreamingException) Code() string { + return "SessionStreamingException" +} + +// Message returns the exception's message. +func (s *SessionStreamingException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *SessionStreamingException) OrigErr() error { + return nil +} + +func (s *SessionStreamingException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *SessionStreamingException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *SessionStreamingException) RequestID() string { + return s.RespMetadata.RequestID +} + +// This exception is returned in a Live Tail stream when the Live Tail session +// times out. Live Tail sessions time out after three hours. +type SessionTimeoutException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SessionTimeoutException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SessionTimeoutException) GoString() string { + return s.String() +} + +// The SessionTimeoutException is and event in the StartLiveTailResponseStream group of events. +func (s *SessionTimeoutException) eventStartLiveTailResponseStream() {} + +// UnmarshalEvent unmarshals the EventStream Message into the SessionTimeoutException value. +// This method is only used internally within the SDK's EventStream handling. +func (s *SessionTimeoutException) UnmarshalEvent( + payloadUnmarshaler protocol.PayloadUnmarshaler, + msg eventstream.Message, +) error { + if err := payloadUnmarshaler.UnmarshalPayload( + bytes.NewReader(msg.Payload), s, + ); err != nil { + return err + } + return nil +} + +// MarshalEvent marshals the type into an stream event value. This method +// should only used internally within the SDK's EventStream handling. +func (s *SessionTimeoutException) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { + msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType)) + var buf bytes.Buffer + if err = pm.MarshalPayload(&buf, s); err != nil { + return eventstream.Message{}, err + } + msg.Payload = buf.Bytes() + return msg, err +} + +func newErrorSessionTimeoutException(v protocol.ResponseMetadata) error { + return &SessionTimeoutException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *SessionTimeoutException) Code() string { + return "SessionTimeoutException" +} + +// Message returns the exception's message. +func (s *SessionTimeoutException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *SessionTimeoutException) OrigErr() error { + return nil +} + +func (s *SessionTimeoutException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *SessionTimeoutException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *SessionTimeoutException) RequestID() string { + return s.RespMetadata.RequestID +} + +type StartLiveTailInput struct { + _ struct{} `type:"structure"` + + // An optional pattern to use to filter the results to include only log events + // that match the pattern. For example, a filter pattern of error 404 causes + // only log events that include both error and 404 to be included in the Live + // Tail stream. + // + // Regular expression filter patterns are supported. + // + // For more information about filter pattern syntax, see Filter and Pattern + // Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html). + LogEventFilterPattern *string `locationName:"logEventFilterPattern" type:"string"` + + // An array where each item in the array is a log group to include in the Live + // Tail session. + // + // Specify each log group by its ARN. + // + // If you specify an ARN, the ARN can't end with an asterisk (*). + // + // You can include up to 10 log groups. + // + // LogGroupIdentifiers is a required field + LogGroupIdentifiers []*string `locationName:"logGroupIdentifiers" min:"1" type:"list" required:"true"` + + // If you specify this parameter, then only log events in the log streams that + // have names that start with the prefixes that you specify here are included + // in the Live Tail session. + // + // If you specify this field, you can't also specify the logStreamNames field. + // + // You can specify this parameter only if you specify only one log group in + // logGroupIdentifiers. + LogStreamNamePrefixes []*string `locationName:"logStreamNamePrefixes" min:"1" type:"list"` + + // If you specify this parameter, then only log events in the log streams that + // you specify here are included in the Live Tail session. + // + // If you specify this field, you can't also specify the logStreamNamePrefixes + // field. + // + // You can specify this parameter only if you specify only one log group in + // logGroupIdentifiers. + LogStreamNames []*string `locationName:"logStreamNames" min:"1" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartLiveTailInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartLiveTailInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StartLiveTailInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StartLiveTailInput"} + if s.LogGroupIdentifiers == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupIdentifiers")) + } + if s.LogGroupIdentifiers != nil && len(s.LogGroupIdentifiers) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupIdentifiers", 1)) + } + if s.LogStreamNamePrefixes != nil && len(s.LogStreamNamePrefixes) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogStreamNamePrefixes", 1)) + } + if s.LogStreamNames != nil && len(s.LogStreamNames) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogStreamNames", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogEventFilterPattern sets the LogEventFilterPattern field's value. +func (s *StartLiveTailInput) SetLogEventFilterPattern(v string) *StartLiveTailInput { + s.LogEventFilterPattern = &v + return s +} + +// SetLogGroupIdentifiers sets the LogGroupIdentifiers field's value. +func (s *StartLiveTailInput) SetLogGroupIdentifiers(v []*string) *StartLiveTailInput { + s.LogGroupIdentifiers = v + return s +} + +// SetLogStreamNamePrefixes sets the LogStreamNamePrefixes field's value. +func (s *StartLiveTailInput) SetLogStreamNamePrefixes(v []*string) *StartLiveTailInput { + s.LogStreamNamePrefixes = v + return s +} + +// SetLogStreamNames sets the LogStreamNames field's value. +func (s *StartLiveTailInput) SetLogStreamNames(v []*string) *StartLiveTailInput { + s.LogStreamNames = v + return s +} + +type StartLiveTailOutput struct { + _ struct{} `type:"structure"` + + eventStream *StartLiveTailEventStream +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartLiveTailOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartLiveTailOutput) GoString() string { + return s.String() +} + +// GetStream returns the type to interact with the event stream. +func (s *StartLiveTailOutput) GetStream() *StartLiveTailEventStream { + return s.eventStream +} + +// The StartLiveTailOutput is and event in the StartLiveTailResponseStream group of events. +func (s *StartLiveTailOutput) eventStartLiveTailResponseStream() {} + +// UnmarshalEvent unmarshals the EventStream Message into the StartLiveTailOutput value. +// This method is only used internally within the SDK's EventStream handling. +func (s *StartLiveTailOutput) UnmarshalEvent( + payloadUnmarshaler protocol.PayloadUnmarshaler, + msg eventstream.Message, +) error { + if err := payloadUnmarshaler.UnmarshalPayload( + bytes.NewReader(msg.Payload), s, + ); err != nil { + return err + } + return nil +} + +// MarshalEvent marshals the type into an stream event value. This method +// should only used internally within the SDK's EventStream handling. +func (s *StartLiveTailOutput) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) { + msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType)) + var buf bytes.Buffer + if err = pm.MarshalPayload(&buf, s); err != nil { + return eventstream.Message{}, err + } + msg.Payload = buf.Bytes() + return msg, err +} + +// StartLiveTailResponseStreamEvent groups together all EventStream +// events writes for StartLiveTailResponseStream. +// +// These events are: +// +// - LiveTailSessionStart +// - LiveTailSessionUpdate +type StartLiveTailResponseStreamEvent interface { + eventStartLiveTailResponseStream() + eventstreamapi.Marshaler + eventstreamapi.Unmarshaler +} + +// StartLiveTailResponseStreamReader provides the interface for reading to the stream. The +// default implementation for this interface will be StartLiveTailResponseStream. +// +// The reader's Close method must allow multiple concurrent calls. +// +// These events are: +// +// - LiveTailSessionStart +// - LiveTailSessionUpdate +// - StartLiveTailResponseStreamUnknownEvent +type StartLiveTailResponseStreamReader interface { + // Returns a channel of events as they are read from the event stream. + Events() <-chan StartLiveTailResponseStreamEvent + + // Close will stop the reader reading events from the stream. + Close() error + + // Returns any error that has occurred while reading from the event stream. + Err() error +} + +type readStartLiveTailResponseStream struct { + eventReader *eventstreamapi.EventReader + stream chan StartLiveTailResponseStreamEvent + err *eventstreamapi.OnceError + + done chan struct{} + closeOnce sync.Once +} + +func newReadStartLiveTailResponseStream(eventReader *eventstreamapi.EventReader) *readStartLiveTailResponseStream { + r := &readStartLiveTailResponseStream{ + eventReader: eventReader, + stream: make(chan StartLiveTailResponseStreamEvent), + done: make(chan struct{}), + err: eventstreamapi.NewOnceError(), + } + go r.readEventStream() + + return r +} + +// Close will close the underlying event stream reader. +func (r *readStartLiveTailResponseStream) Close() error { + r.closeOnce.Do(r.safeClose) + return r.Err() +} + +func (r *readStartLiveTailResponseStream) ErrorSet() <-chan struct{} { + return r.err.ErrorSet() +} + +func (r *readStartLiveTailResponseStream) Closed() <-chan struct{} { + return r.done +} + +func (r *readStartLiveTailResponseStream) safeClose() { + close(r.done) +} + +func (r *readStartLiveTailResponseStream) Err() error { + return r.err.Err() +} + +func (r *readStartLiveTailResponseStream) Events() <-chan StartLiveTailResponseStreamEvent { + return r.stream +} + +func (r *readStartLiveTailResponseStream) readEventStream() { + defer r.Close() + defer close(r.stream) + + for { + event, err := r.eventReader.ReadEvent() + if err != nil { + if err == io.EOF { + return + } + select { + case <-r.done: + // If closed already ignore the error + return + default: + } + if _, ok := err.(*eventstreamapi.UnknownMessageTypeError); ok { + continue + } + r.err.SetError(err) + return + } + + select { + case r.stream <- event.(StartLiveTailResponseStreamEvent): + case <-r.done: + return + } + } +} + +type unmarshalerForStartLiveTailResponseStreamEvent struct { + metadata protocol.ResponseMetadata +} + +func (u unmarshalerForStartLiveTailResponseStreamEvent) UnmarshalerForEventName(eventType string) (eventstreamapi.Unmarshaler, error) { + switch eventType { + case "sessionStart": + return &LiveTailSessionStart{}, nil + case "sessionUpdate": + return &LiveTailSessionUpdate{}, nil + case "SessionStreamingException": + return newErrorSessionStreamingException(u.metadata).(eventstreamapi.Unmarshaler), nil + case "SessionTimeoutException": + return newErrorSessionTimeoutException(u.metadata).(eventstreamapi.Unmarshaler), nil + default: + return &StartLiveTailResponseStreamUnknownEvent{Type: eventType}, nil + } +} + +// StartLiveTailResponseStreamUnknownEvent provides a failsafe event for the +// StartLiveTailResponseStream group of events when an unknown event is received. +type StartLiveTailResponseStreamUnknownEvent struct { + Type string + Message eventstream.Message +} + +// The StartLiveTailResponseStreamUnknownEvent is and event in the StartLiveTailResponseStream +// group of events. +func (s *StartLiveTailResponseStreamUnknownEvent) eventStartLiveTailResponseStream() {} + +// MarshalEvent marshals the type into an stream event value. This method +// should only used internally within the SDK's EventStream handling. +func (e *StartLiveTailResponseStreamUnknownEvent) MarshalEvent(pm protocol.PayloadMarshaler) ( + msg eventstream.Message, err error, +) { + return e.Message.Clone(), nil +} + +// UnmarshalEvent unmarshals the EventStream Message into the StartLiveTailResponseStream value. +// This method is only used internally within the SDK's EventStream handling. +func (e *StartLiveTailResponseStreamUnknownEvent) UnmarshalEvent( + payloadUnmarshaler protocol.PayloadUnmarshaler, + msg eventstream.Message, +) error { + e.Message = msg.Clone() + return nil +} + +type StartQueryInput struct { + _ struct{} `type:"structure"` + + // The end of the time range to query. The range is inclusive, so the specified + // end time is included in the query. Specified as epoch time, the number of + // seconds since January 1, 1970, 00:00:00 UTC. + // + // EndTime is a required field + EndTime *int64 `locationName:"endTime" type:"long" required:"true"` + + // The maximum number of log events to return in the query. If the query string + // uses the fields command, only the specified fields and their values are returned. + // The default is 1000. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The list of log groups to query. You can include up to 50 log groups. + // + // You can specify them by the log group name or ARN. If a log group that you're + // querying is in a source account and you're using a monitoring account, you + // must specify the ARN of the log group here. The query definition must also + // be defined in the monitoring account. + // + // If you specify an ARN, the ARN can't end with an asterisk (*). + // + // A StartQuery operation must include exactly one of the following parameters: + // logGroupName, logGroupNames, or logGroupIdentifiers. + LogGroupIdentifiers []*string `locationName:"logGroupIdentifiers" type:"list"` + + // The log group on which to perform the query. + // + // A StartQuery operation must include exactly one of the following parameters: + // logGroupName, logGroupNames, or logGroupIdentifiers. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // The list of log groups to be queried. You can include up to 50 log groups. + // + // A StartQuery operation must include exactly one of the following parameters: + // logGroupName, logGroupNames, or logGroupIdentifiers. + LogGroupNames []*string `locationName:"logGroupNames" type:"list"` + + // The query string to use. For more information, see CloudWatch Logs Insights + // Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html). + // + // QueryString is a required field + QueryString *string `locationName:"queryString" type:"string" required:"true"` + + // The beginning of the time range to query. The range is inclusive, so the + // specified start time is included in the query. Specified as epoch time, the + // number of seconds since January 1, 1970, 00:00:00 UTC. + // + // StartTime is a required field + StartTime *int64 `locationName:"startTime" type:"long" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartQueryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartQueryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StartQueryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StartQueryInput"} + if s.EndTime == nil { + invalidParams.Add(request.NewErrParamRequired("EndTime")) + } + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.QueryString == nil { + invalidParams.Add(request.NewErrParamRequired("QueryString")) + } + if s.StartTime == nil { + invalidParams.Add(request.NewErrParamRequired("StartTime")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEndTime sets the EndTime field's value. +func (s *StartQueryInput) SetEndTime(v int64) *StartQueryInput { + s.EndTime = &v + return s +} + +// SetLimit sets the Limit field's value. +func (s *StartQueryInput) SetLimit(v int64) *StartQueryInput { + s.Limit = &v + return s +} + +// SetLogGroupIdentifiers sets the LogGroupIdentifiers field's value. +func (s *StartQueryInput) SetLogGroupIdentifiers(v []*string) *StartQueryInput { + s.LogGroupIdentifiers = v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *StartQueryInput) SetLogGroupName(v string) *StartQueryInput { + s.LogGroupName = &v + return s +} + +// SetLogGroupNames sets the LogGroupNames field's value. +func (s *StartQueryInput) SetLogGroupNames(v []*string) *StartQueryInput { + s.LogGroupNames = v + return s +} + +// SetQueryString sets the QueryString field's value. +func (s *StartQueryInput) SetQueryString(v string) *StartQueryInput { + s.QueryString = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *StartQueryInput) SetStartTime(v int64) *StartQueryInput { + s.StartTime = &v + return s +} + +type StartQueryOutput struct { + _ struct{} `type:"structure"` + + // The unique ID of the query. + QueryId *string `locationName:"queryId" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartQueryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StartQueryOutput) GoString() string { + return s.String() +} + +// SetQueryId sets the QueryId field's value. +func (s *StartQueryOutput) SetQueryId(v string) *StartQueryOutput { + s.QueryId = &v + return s +} + +type StopQueryInput struct { + _ struct{} `type:"structure"` + + // The ID number of the query to stop. To find this ID number, use DescribeQueries. + // + // QueryId is a required field + QueryId *string `locationName:"queryId" type:"string" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StopQueryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StopQueryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StopQueryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StopQueryInput"} + if s.QueryId == nil { + invalidParams.Add(request.NewErrParamRequired("QueryId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetQueryId sets the QueryId field's value. +func (s *StopQueryInput) SetQueryId(v string) *StopQueryInput { + s.QueryId = &v + return s +} + +type StopQueryOutput struct { + _ struct{} `type:"structure"` + + // This is true if the query was stopped by the StopQuery operation. + Success *bool `locationName:"success" type:"boolean"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StopQueryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s StopQueryOutput) GoString() string { + return s.String() +} + +// SetSuccess sets the Success field's value. +func (s *StopQueryOutput) SetSuccess(v bool) *StopQueryOutput { + s.Success = &v + return s +} + +// Represents a subscription filter. +type SubscriptionFilter struct { + _ struct{} `type:"structure"` + + // The creation time of the subscription filter, expressed as the number of + // milliseconds after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` + + // The Amazon Resource Name (ARN) of the destination. + DestinationArn *string `locationName:"destinationArn" min:"1" type:"string"` + + // The method used to distribute log data to the destination, which can be either + // random or grouped by log stream. + Distribution *string `locationName:"distribution" type:"string" enum:"Distribution"` + + // The name of the subscription filter. + FilterName *string `locationName:"filterName" min:"1" type:"string"` + + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event can contain timestamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. + FilterPattern *string `locationName:"filterPattern" type:"string"` + + // The name of the log group. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + RoleArn *string `locationName:"roleArn" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SubscriptionFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SubscriptionFilter) GoString() string { + return s.String() +} + +// SetCreationTime sets the CreationTime field's value. +func (s *SubscriptionFilter) SetCreationTime(v int64) *SubscriptionFilter { + s.CreationTime = &v + return s +} + +// SetDestinationArn sets the DestinationArn field's value. +func (s *SubscriptionFilter) SetDestinationArn(v string) *SubscriptionFilter { + s.DestinationArn = &v + return s +} + +// SetDistribution sets the Distribution field's value. +func (s *SubscriptionFilter) SetDistribution(v string) *SubscriptionFilter { + s.Distribution = &v + return s +} + +// SetFilterName sets the FilterName field's value. +func (s *SubscriptionFilter) SetFilterName(v string) *SubscriptionFilter { + s.FilterName = &v + return s +} + +// SetFilterPattern sets the FilterPattern field's value. +func (s *SubscriptionFilter) SetFilterPattern(v string) *SubscriptionFilter { + s.FilterPattern = &v + return s +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *SubscriptionFilter) SetLogGroupName(v string) *SubscriptionFilter { + s.LogGroupName = &v + return s +} + +// SetRoleArn sets the RoleArn field's value. +func (s *SubscriptionFilter) SetRoleArn(v string) *SubscriptionFilter { + s.RoleArn = &v + return s +} + +// If you are suppressing an anomaly temporariliy, this structure defines how +// long the suppression period is to be. +type SuppressionPeriod struct { + _ struct{} `type:"structure"` + + // Specifies whether the value of value is in seconds, minutes, or hours. + SuppressionUnit *string `locationName:"suppressionUnit" type:"string" enum:"SuppressionUnit"` + + // Specifies the number of seconds, minutes or hours to suppress this anomaly. + // There is no maximum. + Value *int64 `locationName:"value" type:"integer"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SuppressionPeriod) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s SuppressionPeriod) GoString() string { + return s.String() +} + +// SetSuppressionUnit sets the SuppressionUnit field's value. +func (s *SuppressionPeriod) SetSuppressionUnit(v string) *SuppressionPeriod { + s.SuppressionUnit = &v + return s +} + +// SetValue sets the Value field's value. +func (s *SuppressionPeriod) SetValue(v int64) *SuppressionPeriod { + s.Value = &v + return s +} + +// Deprecated: Please use the generic tagging API model TagResourceRequest +type TagLogGroupInput struct { + _ struct{} `deprecated:"true" type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The key-value pairs to use for the tags. + // + // Tags is a required field + Tags map[string]*string `locationName:"tags" min:"1" type:"map" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagLogGroupInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagLogGroupInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TagLogGroupInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TagLogGroupInput"} + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.Tags == nil { + invalidParams.Add(request.NewErrParamRequired("Tags")) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *TagLogGroupInput) SetLogGroupName(v string) *TagLogGroupInput { + s.LogGroupName = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *TagLogGroupInput) SetTags(v map[string]*string) *TagLogGroupInput { + s.Tags = v + return s +} + +type TagLogGroupOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagLogGroupOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagLogGroupOutput) GoString() string { + return s.String() +} + +type TagResourceInput struct { + _ struct{} `type:"structure"` + + // The ARN of the resource that you're adding tags to. + // + // The ARN format of a log group is arn:aws:logs:Region:account-id:log-group:log-group-name + // + // The ARN format of a destination is arn:aws:logs:Region:account-id:destination:destination-name + // + // For more information about ARN format, see CloudWatch Logs resources and + // operations (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html). + // + // ResourceArn is a required field + ResourceArn *string `locationName:"resourceArn" min:"1" type:"string" required:"true"` + + // The list of key-value pairs to associate with the resource. + // + // Tags is a required field + Tags map[string]*string `locationName:"tags" min:"1" type:"map" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TagResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TagResourceInput"} + if s.ResourceArn == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceArn")) + } + if s.ResourceArn != nil && len(*s.ResourceArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceArn", 1)) + } + if s.Tags == nil { + invalidParams.Add(request.NewErrParamRequired("Tags")) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceArn sets the ResourceArn field's value. +func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput { + s.ResourceArn = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *TagResourceInput) SetTags(v map[string]*string) *TagResourceInput { + s.Tags = v + return s +} + +type TagResourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TagResourceOutput) GoString() string { + return s.String() +} + +type TestMetricFilterInput struct { + _ struct{} `type:"structure"` + + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event can contain timestamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. + // + // FilterPattern is a required field + FilterPattern *string `locationName:"filterPattern" type:"string" required:"true"` + + // The log event messages to test. + // + // LogEventMessages is a required field + LogEventMessages []*string `locationName:"logEventMessages" min:"1" type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TestMetricFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TestMetricFilterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TestMetricFilterInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TestMetricFilterInput"} + if s.FilterPattern == nil { + invalidParams.Add(request.NewErrParamRequired("FilterPattern")) + } + if s.LogEventMessages == nil { + invalidParams.Add(request.NewErrParamRequired("LogEventMessages")) + } + if s.LogEventMessages != nil && len(s.LogEventMessages) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogEventMessages", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetFilterPattern sets the FilterPattern field's value. +func (s *TestMetricFilterInput) SetFilterPattern(v string) *TestMetricFilterInput { + s.FilterPattern = &v + return s +} + +// SetLogEventMessages sets the LogEventMessages field's value. +func (s *TestMetricFilterInput) SetLogEventMessages(v []*string) *TestMetricFilterInput { + s.LogEventMessages = v + return s +} + +type TestMetricFilterOutput struct { + _ struct{} `type:"structure"` + + // The matched events. + Matches []*MetricFilterMatchRecord `locationName:"matches" type:"list"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TestMetricFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TestMetricFilterOutput) GoString() string { + return s.String() +} + +// SetMatches sets the Matches field's value. +func (s *TestMetricFilterOutput) SetMatches(v []*MetricFilterMatchRecord) *TestMetricFilterOutput { + s.Matches = v + return s +} + +// The request was throttled because of quota limits. +type ThrottlingException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ThrottlingException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ThrottlingException) GoString() string { + return s.String() +} + +func newErrorThrottlingException(v protocol.ResponseMetadata) error { + return &ThrottlingException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *ThrottlingException) Code() string { + return "ThrottlingException" +} + +// Message returns the exception's message. +func (s *ThrottlingException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *ThrottlingException) OrigErr() error { + return nil +} + +func (s *ThrottlingException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *ThrottlingException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *ThrottlingException) RequestID() string { + return s.RespMetadata.RequestID +} + +// A resource can have no more than 50 tags. +type TooManyTagsException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` + + // The name of the resource. + ResourceName *string `locationName:"resourceName" min:"1" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TooManyTagsException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s TooManyTagsException) GoString() string { + return s.String() +} + +func newErrorTooManyTagsException(v protocol.ResponseMetadata) error { + return &TooManyTagsException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *TooManyTagsException) Code() string { + return "TooManyTagsException" +} + +// Message returns the exception's message. +func (s *TooManyTagsException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *TooManyTagsException) OrigErr() error { + return nil +} + +func (s *TooManyTagsException) Error() string { + return fmt.Sprintf("%s: %s\n%s", s.Code(), s.Message(), s.String()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *TooManyTagsException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *TooManyTagsException) RequestID() string { + return s.RespMetadata.RequestID +} + +// The most likely cause is an Amazon Web Services access key ID or secret key +// that's not valid. +type UnrecognizedClientException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UnrecognizedClientException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UnrecognizedClientException) GoString() string { + return s.String() +} + +func newErrorUnrecognizedClientException(v protocol.ResponseMetadata) error { + return &UnrecognizedClientException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *UnrecognizedClientException) Code() string { + return "UnrecognizedClientException" +} + +// Message returns the exception's message. +func (s *UnrecognizedClientException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *UnrecognizedClientException) OrigErr() error { + return nil +} + +func (s *UnrecognizedClientException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *UnrecognizedClientException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *UnrecognizedClientException) RequestID() string { + return s.RespMetadata.RequestID +} + +// Deprecated: Please use the generic tagging API model UntagResourceRequest +type UntagLogGroupInput struct { + _ struct{} `deprecated:"true" type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The tag keys. The corresponding tags are removed from the log group. + // + // Tags is a required field + Tags []*string `locationName:"tags" min:"1" type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagLogGroupInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagLogGroupInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UntagLogGroupInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UntagLogGroupInput"} + if s.LogGroupName == nil { + invalidParams.Add(request.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("LogGroupName", 1)) + } + if s.Tags == nil { + invalidParams.Add(request.NewErrParamRequired("Tags")) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Tags", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLogGroupName sets the LogGroupName field's value. +func (s *UntagLogGroupInput) SetLogGroupName(v string) *UntagLogGroupInput { + s.LogGroupName = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *UntagLogGroupInput) SetTags(v []*string) *UntagLogGroupInput { + s.Tags = v + return s +} + +type UntagLogGroupOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagLogGroupOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagLogGroupOutput) GoString() string { + return s.String() +} + +type UntagResourceInput struct { + _ struct{} `type:"structure"` + + // The ARN of the CloudWatch Logs resource that you're removing tags from. + // + // The ARN format of a log group is arn:aws:logs:Region:account-id:log-group:log-group-name + // + // The ARN format of a destination is arn:aws:logs:Region:account-id:destination:destination-name + // + // For more information about ARN format, see CloudWatch Logs resources and + // operations (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html). + // + // ResourceArn is a required field + ResourceArn *string `locationName:"resourceArn" min:"1" type:"string" required:"true"` + + // The list of tag keys to remove from the resource. + // + // TagKeys is a required field + TagKeys []*string `locationName:"tagKeys" type:"list" required:"true"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UntagResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UntagResourceInput"} + if s.ResourceArn == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceArn")) + } + if s.ResourceArn != nil && len(*s.ResourceArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceArn", 1)) + } + if s.TagKeys == nil { + invalidParams.Add(request.NewErrParamRequired("TagKeys")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceArn sets the ResourceArn field's value. +func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput { + s.ResourceArn = &v + return s +} + +// SetTagKeys sets the TagKeys field's value. +func (s *UntagResourceInput) SetTagKeys(v []*string) *UntagResourceInput { + s.TagKeys = v + return s +} + +type UntagResourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UntagResourceOutput) GoString() string { + return s.String() +} + +type UpdateAnomalyInput struct { + _ struct{} `type:"structure"` + + // The ARN of the anomaly detector that this operation is to act on. + // + // AnomalyDetectorArn is a required field + AnomalyDetectorArn *string `locationName:"anomalyDetectorArn" min:"1" type:"string" required:"true"` + + // If you are suppressing or unsuppressing an anomaly, specify its unique ID + // here. You can find anomaly IDs by using the ListAnomalies (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html) + // operation. + AnomalyId *string `locationName:"anomalyId" min:"36" type:"string"` + + // If you are suppressing or unsuppressing an pattern, specify its unique ID + // here. You can find pattern IDs by using the ListAnomalies (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html) + // operation. + PatternId *string `locationName:"patternId" min:"32" type:"string"` + + // If you are temporarily suppressing an anomaly or pattern, use this structure + // to specify how long the suppression is to last. + SuppressionPeriod *SuppressionPeriod `locationName:"suppressionPeriod" type:"structure"` + + // Use this to specify whether the suppression to be temporary or infinite. + // If you specify LIMITED, you must also specify a suppressionPeriod. If you + // specify INFINITE, any value for suppressionPeriod is ignored. + SuppressionType *string `locationName:"suppressionType" type:"string" enum:"SuppressionType"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UpdateAnomalyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UpdateAnomalyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateAnomalyInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateAnomalyInput"} + if s.AnomalyDetectorArn == nil { + invalidParams.Add(request.NewErrParamRequired("AnomalyDetectorArn")) + } + if s.AnomalyDetectorArn != nil && len(*s.AnomalyDetectorArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AnomalyDetectorArn", 1)) + } + if s.AnomalyId != nil && len(*s.AnomalyId) < 36 { + invalidParams.Add(request.NewErrParamMinLen("AnomalyId", 36)) + } + if s.PatternId != nil && len(*s.PatternId) < 32 { + invalidParams.Add(request.NewErrParamMinLen("PatternId", 32)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAnomalyDetectorArn sets the AnomalyDetectorArn field's value. +func (s *UpdateAnomalyInput) SetAnomalyDetectorArn(v string) *UpdateAnomalyInput { + s.AnomalyDetectorArn = &v + return s +} + +// SetAnomalyId sets the AnomalyId field's value. +func (s *UpdateAnomalyInput) SetAnomalyId(v string) *UpdateAnomalyInput { + s.AnomalyId = &v + return s +} + +// SetPatternId sets the PatternId field's value. +func (s *UpdateAnomalyInput) SetPatternId(v string) *UpdateAnomalyInput { + s.PatternId = &v + return s +} + +// SetSuppressionPeriod sets the SuppressionPeriod field's value. +func (s *UpdateAnomalyInput) SetSuppressionPeriod(v *SuppressionPeriod) *UpdateAnomalyInput { + s.SuppressionPeriod = v + return s +} + +// SetSuppressionType sets the SuppressionType field's value. +func (s *UpdateAnomalyInput) SetSuppressionType(v string) *UpdateAnomalyInput { + s.SuppressionType = &v + return s +} + +type UpdateAnomalyOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UpdateAnomalyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UpdateAnomalyOutput) GoString() string { + return s.String() +} + +type UpdateLogAnomalyDetectorInput struct { + _ struct{} `type:"structure"` + + // The ARN of the anomaly detector that you want to update. + // + // AnomalyDetectorArn is a required field + AnomalyDetectorArn *string `locationName:"anomalyDetectorArn" min:"1" type:"string" required:"true"` + + // The number of days to use as the life cycle of anomalies. After this time, + // anomalies are automatically baselined and the anomaly detector model will + // treat new occurrences of similar event as normal. Therefore, if you do not + // correct the cause of an anomaly during this time, it will be considered normal + // going forward and will not be detected. + AnomalyVisibilityTime *int64 `locationName:"anomalyVisibilityTime" min:"7" type:"long"` + + // Use this parameter to pause or restart the anomaly detector. + // + // Enabled is a required field + Enabled *bool `locationName:"enabled" type:"boolean" required:"true"` + + // Specifies how often the anomaly detector runs and look for anomalies. Set + // this value according to the frequency that the log group receives new logs. + // For example, if the log group receives new log events every 10 minutes, then + // setting evaluationFrequency to FIFTEEN_MIN might be appropriate. + EvaluationFrequency *string `locationName:"evaluationFrequency" type:"string" enum:"EvaluationFrequency"` + + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event can contain timestamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. + FilterPattern *string `locationName:"filterPattern" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UpdateLogAnomalyDetectorInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UpdateLogAnomalyDetectorInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateLogAnomalyDetectorInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateLogAnomalyDetectorInput"} + if s.AnomalyDetectorArn == nil { + invalidParams.Add(request.NewErrParamRequired("AnomalyDetectorArn")) + } + if s.AnomalyDetectorArn != nil && len(*s.AnomalyDetectorArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AnomalyDetectorArn", 1)) + } + if s.AnomalyVisibilityTime != nil && *s.AnomalyVisibilityTime < 7 { + invalidParams.Add(request.NewErrParamMinValue("AnomalyVisibilityTime", 7)) + } + if s.Enabled == nil { + invalidParams.Add(request.NewErrParamRequired("Enabled")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAnomalyDetectorArn sets the AnomalyDetectorArn field's value. +func (s *UpdateLogAnomalyDetectorInput) SetAnomalyDetectorArn(v string) *UpdateLogAnomalyDetectorInput { + s.AnomalyDetectorArn = &v + return s +} + +// SetAnomalyVisibilityTime sets the AnomalyVisibilityTime field's value. +func (s *UpdateLogAnomalyDetectorInput) SetAnomalyVisibilityTime(v int64) *UpdateLogAnomalyDetectorInput { + s.AnomalyVisibilityTime = &v + return s +} + +// SetEnabled sets the Enabled field's value. +func (s *UpdateLogAnomalyDetectorInput) SetEnabled(v bool) *UpdateLogAnomalyDetectorInput { + s.Enabled = &v + return s +} + +// SetEvaluationFrequency sets the EvaluationFrequency field's value. +func (s *UpdateLogAnomalyDetectorInput) SetEvaluationFrequency(v string) *UpdateLogAnomalyDetectorInput { + s.EvaluationFrequency = &v + return s +} + +// SetFilterPattern sets the FilterPattern field's value. +func (s *UpdateLogAnomalyDetectorInput) SetFilterPattern(v string) *UpdateLogAnomalyDetectorInput { + s.FilterPattern = &v + return s +} + +type UpdateLogAnomalyDetectorOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UpdateLogAnomalyDetectorOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s UpdateLogAnomalyDetectorOutput) GoString() string { + return s.String() +} + +// One of the parameters for the request is not valid. +type ValidationException struct { + _ struct{} `type:"structure"` + RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"` + + Message_ *string `locationName:"message" type:"string"` +} + +// String returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ValidationException) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation. +// +// API parameter values that are decorated as "sensitive" in the API will not +// be included in the string output. The member name will be present, but the +// value will be replaced with "sensitive". +func (s ValidationException) GoString() string { + return s.String() +} + +func newErrorValidationException(v protocol.ResponseMetadata) error { + return &ValidationException{ + RespMetadata: v, + } +} + +// Code returns the exception type name. +func (s *ValidationException) Code() string { + return "ValidationException" +} + +// Message returns the exception's message. +func (s *ValidationException) Message() string { + if s.Message_ != nil { + return *s.Message_ + } + return "" +} + +// OrigErr always returns nil, satisfies awserr.Error interface. +func (s *ValidationException) OrigErr() error { + return nil +} + +func (s *ValidationException) Error() string { + return fmt.Sprintf("%s: %s", s.Code(), s.Message()) +} + +// Status code returns the HTTP status code for the request's response error. +func (s *ValidationException) StatusCode() int { + return s.RespMetadata.StatusCode +} + +// RequestID returns the service's response RequestID for request. +func (s *ValidationException) RequestID() string { + return s.RespMetadata.RequestID +} + +const ( + // AnomalyDetectorStatusInitializing is a AnomalyDetectorStatus enum value + AnomalyDetectorStatusInitializing = "INITIALIZING" + + // AnomalyDetectorStatusTraining is a AnomalyDetectorStatus enum value + AnomalyDetectorStatusTraining = "TRAINING" + + // AnomalyDetectorStatusAnalyzing is a AnomalyDetectorStatus enum value + AnomalyDetectorStatusAnalyzing = "ANALYZING" + + // AnomalyDetectorStatusFailed is a AnomalyDetectorStatus enum value + AnomalyDetectorStatusFailed = "FAILED" + + // AnomalyDetectorStatusDeleted is a AnomalyDetectorStatus enum value + AnomalyDetectorStatusDeleted = "DELETED" + + // AnomalyDetectorStatusPaused is a AnomalyDetectorStatus enum value + AnomalyDetectorStatusPaused = "PAUSED" +) + +// AnomalyDetectorStatus_Values returns all elements of the AnomalyDetectorStatus enum +func AnomalyDetectorStatus_Values() []string { + return []string{ + AnomalyDetectorStatusInitializing, + AnomalyDetectorStatusTraining, + AnomalyDetectorStatusAnalyzing, + AnomalyDetectorStatusFailed, + AnomalyDetectorStatusDeleted, + AnomalyDetectorStatusPaused, + } +} + +const ( + // DataProtectionStatusActivated is a DataProtectionStatus enum value + DataProtectionStatusActivated = "ACTIVATED" + + // DataProtectionStatusDeleted is a DataProtectionStatus enum value + DataProtectionStatusDeleted = "DELETED" + + // DataProtectionStatusArchived is a DataProtectionStatus enum value + DataProtectionStatusArchived = "ARCHIVED" + + // DataProtectionStatusDisabled is a DataProtectionStatus enum value + DataProtectionStatusDisabled = "DISABLED" +) + +// DataProtectionStatus_Values returns all elements of the DataProtectionStatus enum +func DataProtectionStatus_Values() []string { + return []string{ + DataProtectionStatusActivated, + DataProtectionStatusDeleted, + DataProtectionStatusArchived, + DataProtectionStatusDisabled, + } +} + +const ( + // DeliveryDestinationTypeS3 is a DeliveryDestinationType enum value + DeliveryDestinationTypeS3 = "S3" + + // DeliveryDestinationTypeCwl is a DeliveryDestinationType enum value + DeliveryDestinationTypeCwl = "CWL" + + // DeliveryDestinationTypeFh is a DeliveryDestinationType enum value + DeliveryDestinationTypeFh = "FH" +) + +// DeliveryDestinationType_Values returns all elements of the DeliveryDestinationType enum +func DeliveryDestinationType_Values() []string { + return []string{ + DeliveryDestinationTypeS3, + DeliveryDestinationTypeCwl, + DeliveryDestinationTypeFh, + } +} + +// The method used to distribute log data to the destination, which can be either +// random or grouped by log stream. +const ( + // DistributionRandom is a Distribution enum value + DistributionRandom = "Random" + + // DistributionByLogStream is a Distribution enum value + DistributionByLogStream = "ByLogStream" +) + +// Distribution_Values returns all elements of the Distribution enum +func Distribution_Values() []string { + return []string{ + DistributionRandom, + DistributionByLogStream, + } +} + +const ( + // EntityRejectionErrorTypeInvalidEntity is a EntityRejectionErrorType enum value + EntityRejectionErrorTypeInvalidEntity = "InvalidEntity" + + // EntityRejectionErrorTypeInvalidTypeValue is a EntityRejectionErrorType enum value + EntityRejectionErrorTypeInvalidTypeValue = "InvalidTypeValue" + + // EntityRejectionErrorTypeInvalidKeyAttributes is a EntityRejectionErrorType enum value + EntityRejectionErrorTypeInvalidKeyAttributes = "InvalidKeyAttributes" + + // EntityRejectionErrorTypeInvalidAttributes is a EntityRejectionErrorType enum value + EntityRejectionErrorTypeInvalidAttributes = "InvalidAttributes" + + // EntityRejectionErrorTypeEntitySizeTooLarge is a EntityRejectionErrorType enum value + EntityRejectionErrorTypeEntitySizeTooLarge = "EntitySizeTooLarge" + + // EntityRejectionErrorTypeUnsupportedLogGroupType is a EntityRejectionErrorType enum value + EntityRejectionErrorTypeUnsupportedLogGroupType = "UnsupportedLogGroupType" + + // EntityRejectionErrorTypeMissingRequiredFields is a EntityRejectionErrorType enum value + EntityRejectionErrorTypeMissingRequiredFields = "MissingRequiredFields" +) + +// EntityRejectionErrorType_Values returns all elements of the EntityRejectionErrorType enum +func EntityRejectionErrorType_Values() []string { + return []string{ + EntityRejectionErrorTypeInvalidEntity, + EntityRejectionErrorTypeInvalidTypeValue, + EntityRejectionErrorTypeInvalidKeyAttributes, + EntityRejectionErrorTypeInvalidAttributes, + EntityRejectionErrorTypeEntitySizeTooLarge, + EntityRejectionErrorTypeUnsupportedLogGroupType, + EntityRejectionErrorTypeMissingRequiredFields, + } +} + +const ( + // EvaluationFrequencyOneMin is a EvaluationFrequency enum value + EvaluationFrequencyOneMin = "ONE_MIN" + + // EvaluationFrequencyFiveMin is a EvaluationFrequency enum value + EvaluationFrequencyFiveMin = "FIVE_MIN" + + // EvaluationFrequencyTenMin is a EvaluationFrequency enum value + EvaluationFrequencyTenMin = "TEN_MIN" + + // EvaluationFrequencyFifteenMin is a EvaluationFrequency enum value + EvaluationFrequencyFifteenMin = "FIFTEEN_MIN" + + // EvaluationFrequencyThirtyMin is a EvaluationFrequency enum value + EvaluationFrequencyThirtyMin = "THIRTY_MIN" + + // EvaluationFrequencyOneHour is a EvaluationFrequency enum value + EvaluationFrequencyOneHour = "ONE_HOUR" +) + +// EvaluationFrequency_Values returns all elements of the EvaluationFrequency enum +func EvaluationFrequency_Values() []string { + return []string{ + EvaluationFrequencyOneMin, + EvaluationFrequencyFiveMin, + EvaluationFrequencyTenMin, + EvaluationFrequencyFifteenMin, + EvaluationFrequencyThirtyMin, + EvaluationFrequencyOneHour, + } +} + +const ( + // ExportTaskStatusCodeCancelled is a ExportTaskStatusCode enum value + ExportTaskStatusCodeCancelled = "CANCELLED" + + // ExportTaskStatusCodeCompleted is a ExportTaskStatusCode enum value + ExportTaskStatusCodeCompleted = "COMPLETED" + + // ExportTaskStatusCodeFailed is a ExportTaskStatusCode enum value + ExportTaskStatusCodeFailed = "FAILED" + + // ExportTaskStatusCodePending is a ExportTaskStatusCode enum value + ExportTaskStatusCodePending = "PENDING" + + // ExportTaskStatusCodePendingCancel is a ExportTaskStatusCode enum value + ExportTaskStatusCodePendingCancel = "PENDING_CANCEL" + + // ExportTaskStatusCodeRunning is a ExportTaskStatusCode enum value + ExportTaskStatusCodeRunning = "RUNNING" +) + +// ExportTaskStatusCode_Values returns all elements of the ExportTaskStatusCode enum +func ExportTaskStatusCode_Values() []string { + return []string{ + ExportTaskStatusCodeCancelled, + ExportTaskStatusCodeCompleted, + ExportTaskStatusCodeFailed, + ExportTaskStatusCodePending, + ExportTaskStatusCodePendingCancel, + ExportTaskStatusCodeRunning, + } +} + +const ( + // InheritedPropertyAccountDataProtection is a InheritedProperty enum value + InheritedPropertyAccountDataProtection = "ACCOUNT_DATA_PROTECTION" +) + +// InheritedProperty_Values returns all elements of the InheritedProperty enum +func InheritedProperty_Values() []string { + return []string{ + InheritedPropertyAccountDataProtection, + } +} + +const ( + // LogGroupClassStandard is a LogGroupClass enum value + LogGroupClassStandard = "STANDARD" + + // LogGroupClassInfrequentAccess is a LogGroupClass enum value + LogGroupClassInfrequentAccess = "INFREQUENT_ACCESS" +) + +// LogGroupClass_Values returns all elements of the LogGroupClass enum +func LogGroupClass_Values() []string { + return []string{ + LogGroupClassStandard, + LogGroupClassInfrequentAccess, + } +} + +const ( + // OrderByLogStreamName is a OrderBy enum value + OrderByLogStreamName = "LogStreamName" + + // OrderByLastEventTime is a OrderBy enum value + OrderByLastEventTime = "LastEventTime" +) + +// OrderBy_Values returns all elements of the OrderBy enum +func OrderBy_Values() []string { + return []string{ + OrderByLogStreamName, + OrderByLastEventTime, + } +} + +const ( + // OutputFormatJson is a OutputFormat enum value + OutputFormatJson = "json" + + // OutputFormatPlain is a OutputFormat enum value + OutputFormatPlain = "plain" + + // OutputFormatW3c is a OutputFormat enum value + OutputFormatW3c = "w3c" + + // OutputFormatRaw is a OutputFormat enum value + OutputFormatRaw = "raw" + + // OutputFormatParquet is a OutputFormat enum value + OutputFormatParquet = "parquet" +) + +// OutputFormat_Values returns all elements of the OutputFormat enum +func OutputFormat_Values() []string { + return []string{ + OutputFormatJson, + OutputFormatPlain, + OutputFormatW3c, + OutputFormatRaw, + OutputFormatParquet, + } +} + +const ( + // PolicyTypeDataProtectionPolicy is a PolicyType enum value + PolicyTypeDataProtectionPolicy = "DATA_PROTECTION_POLICY" + + // PolicyTypeSubscriptionFilterPolicy is a PolicyType enum value + PolicyTypeSubscriptionFilterPolicy = "SUBSCRIPTION_FILTER_POLICY" +) + +// PolicyType_Values returns all elements of the PolicyType enum +func PolicyType_Values() []string { + return []string{ + PolicyTypeDataProtectionPolicy, + PolicyTypeSubscriptionFilterPolicy, + } +} + +const ( + // QueryStatusScheduled is a QueryStatus enum value + QueryStatusScheduled = "Scheduled" + + // QueryStatusRunning is a QueryStatus enum value + QueryStatusRunning = "Running" + + // QueryStatusComplete is a QueryStatus enum value + QueryStatusComplete = "Complete" + + // QueryStatusFailed is a QueryStatus enum value + QueryStatusFailed = "Failed" + + // QueryStatusCancelled is a QueryStatus enum value + QueryStatusCancelled = "Cancelled" + + // QueryStatusTimeout is a QueryStatus enum value + QueryStatusTimeout = "Timeout" + + // QueryStatusUnknown is a QueryStatus enum value + QueryStatusUnknown = "Unknown" +) + +// QueryStatus_Values returns all elements of the QueryStatus enum +func QueryStatus_Values() []string { + return []string{ + QueryStatusScheduled, + QueryStatusRunning, + QueryStatusComplete, + QueryStatusFailed, + QueryStatusCancelled, + QueryStatusTimeout, + QueryStatusUnknown, + } +} + +const ( + // ScopeAll is a Scope enum value + ScopeAll = "ALL" +) + +// Scope_Values returns all elements of the Scope enum +func Scope_Values() []string { + return []string{ + ScopeAll, + } +} + +const ( + // StandardUnitSeconds is a StandardUnit enum value + StandardUnitSeconds = "Seconds" + + // StandardUnitMicroseconds is a StandardUnit enum value + StandardUnitMicroseconds = "Microseconds" + + // StandardUnitMilliseconds is a StandardUnit enum value + StandardUnitMilliseconds = "Milliseconds" + + // StandardUnitBytes is a StandardUnit enum value + StandardUnitBytes = "Bytes" + + // StandardUnitKilobytes is a StandardUnit enum value + StandardUnitKilobytes = "Kilobytes" + + // StandardUnitMegabytes is a StandardUnit enum value + StandardUnitMegabytes = "Megabytes" + + // StandardUnitGigabytes is a StandardUnit enum value + StandardUnitGigabytes = "Gigabytes" + + // StandardUnitTerabytes is a StandardUnit enum value + StandardUnitTerabytes = "Terabytes" + + // StandardUnitBits is a StandardUnit enum value + StandardUnitBits = "Bits" + + // StandardUnitKilobits is a StandardUnit enum value + StandardUnitKilobits = "Kilobits" + + // StandardUnitMegabits is a StandardUnit enum value + StandardUnitMegabits = "Megabits" + + // StandardUnitGigabits is a StandardUnit enum value + StandardUnitGigabits = "Gigabits" + + // StandardUnitTerabits is a StandardUnit enum value + StandardUnitTerabits = "Terabits" + + // StandardUnitPercent is a StandardUnit enum value + StandardUnitPercent = "Percent" + + // StandardUnitCount is a StandardUnit enum value + StandardUnitCount = "Count" + + // StandardUnitBytesSecond is a StandardUnit enum value + StandardUnitBytesSecond = "Bytes/Second" + + // StandardUnitKilobytesSecond is a StandardUnit enum value + StandardUnitKilobytesSecond = "Kilobytes/Second" + + // StandardUnitMegabytesSecond is a StandardUnit enum value + StandardUnitMegabytesSecond = "Megabytes/Second" + + // StandardUnitGigabytesSecond is a StandardUnit enum value + StandardUnitGigabytesSecond = "Gigabytes/Second" + + // StandardUnitTerabytesSecond is a StandardUnit enum value + StandardUnitTerabytesSecond = "Terabytes/Second" + + // StandardUnitBitsSecond is a StandardUnit enum value + StandardUnitBitsSecond = "Bits/Second" + + // StandardUnitKilobitsSecond is a StandardUnit enum value + StandardUnitKilobitsSecond = "Kilobits/Second" + + // StandardUnitMegabitsSecond is a StandardUnit enum value + StandardUnitMegabitsSecond = "Megabits/Second" + + // StandardUnitGigabitsSecond is a StandardUnit enum value + StandardUnitGigabitsSecond = "Gigabits/Second" + + // StandardUnitTerabitsSecond is a StandardUnit enum value + StandardUnitTerabitsSecond = "Terabits/Second" + + // StandardUnitCountSecond is a StandardUnit enum value + StandardUnitCountSecond = "Count/Second" + + // StandardUnitNone is a StandardUnit enum value + StandardUnitNone = "None" +) + +// StandardUnit_Values returns all elements of the StandardUnit enum +func StandardUnit_Values() []string { + return []string{ + StandardUnitSeconds, + StandardUnitMicroseconds, + StandardUnitMilliseconds, + StandardUnitBytes, + StandardUnitKilobytes, + StandardUnitMegabytes, + StandardUnitGigabytes, + StandardUnitTerabytes, + StandardUnitBits, + StandardUnitKilobits, + StandardUnitMegabits, + StandardUnitGigabits, + StandardUnitTerabits, + StandardUnitPercent, + StandardUnitCount, + StandardUnitBytesSecond, + StandardUnitKilobytesSecond, + StandardUnitMegabytesSecond, + StandardUnitGigabytesSecond, + StandardUnitTerabytesSecond, + StandardUnitBitsSecond, + StandardUnitKilobitsSecond, + StandardUnitMegabitsSecond, + StandardUnitGigabitsSecond, + StandardUnitTerabitsSecond, + StandardUnitCountSecond, + StandardUnitNone, + } +} + +const ( + // StateActive is a State enum value + StateActive = "Active" + + // StateSuppressed is a State enum value + StateSuppressed = "Suppressed" + + // StateBaseline is a State enum value + StateBaseline = "Baseline" +) + +// State_Values returns all elements of the State enum +func State_Values() []string { + return []string{ + StateActive, + StateSuppressed, + StateBaseline, + } +} + +const ( + // SuppressionStateSuppressed is a SuppressionState enum value + SuppressionStateSuppressed = "SUPPRESSED" + + // SuppressionStateUnsuppressed is a SuppressionState enum value + SuppressionStateUnsuppressed = "UNSUPPRESSED" +) + +// SuppressionState_Values returns all elements of the SuppressionState enum +func SuppressionState_Values() []string { + return []string{ + SuppressionStateSuppressed, + SuppressionStateUnsuppressed, + } +} + +const ( + // SuppressionTypeLimited is a SuppressionType enum value + SuppressionTypeLimited = "LIMITED" + + // SuppressionTypeInfinite is a SuppressionType enum value + SuppressionTypeInfinite = "INFINITE" +) + +// SuppressionType_Values returns all elements of the SuppressionType enum +func SuppressionType_Values() []string { + return []string{ + SuppressionTypeLimited, + SuppressionTypeInfinite, + } +} + +const ( + // SuppressionUnitSeconds is a SuppressionUnit enum value + SuppressionUnitSeconds = "SECONDS" + + // SuppressionUnitMinutes is a SuppressionUnit enum value + SuppressionUnitMinutes = "MINUTES" + + // SuppressionUnitHours is a SuppressionUnit enum value + SuppressionUnitHours = "HOURS" +) + +// SuppressionUnit_Values returns all elements of the SuppressionUnit enum +func SuppressionUnit_Values() []string { + return []string{ + SuppressionUnitSeconds, + SuppressionUnitMinutes, + SuppressionUnitHours, + } +} diff --git a/sdk/service/cloudwatchlogs/cloudwatchlogsiface/interface.go b/sdk/service/cloudwatchlogs/cloudwatchlogsiface/interface.go new file mode 100644 index 0000000000..92defc703d --- /dev/null +++ b/sdk/service/cloudwatchlogs/cloudwatchlogsiface/interface.go @@ -0,0 +1,397 @@ +// 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. +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// and waiters. +package cloudwatchlogsiface + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" + + "github.com/aws/amazon-cloudwatch-agent/sdk/service/cloudwatchlogs" +) + +// CloudWatchLogsAPI provides an interface to enable mocking the +// cloudwatchlogs.CloudWatchLogs service client's API operation, +// paginators, and waiters. This make unit testing your code that calls out +// to the SDK's service client's calls easier. +// +// 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 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.AssociateKmsKey request +// } +// +// func main() { +// sess := session.New() +// svc := cloudwatchlogs.New(sess) +// +// myFunc(svc) +// } +// +// In your _test.go file: +// +// // Define a mock struct to be used in your unit tests of myFunc. +// type mockCloudWatchLogsClient struct { +// cloudwatchlogsiface.CloudWatchLogsAPI +// } +// func (m *mockCloudWatchLogsClient) AssociateKmsKey(input *cloudwatchlogs.AssociateKmsKeyInput) (*cloudwatchlogs.AssociateKmsKeyOutput, error) { +// // mock response/functionality +// } +// +// func TestMyFunc(t *testing.T) { +// // Setup Test +// mockSvc := &mockCloudWatchLogsClient{} +// +// myfunc(mockSvc) +// +// // Verify myFunc's functionality +// } +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// 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) + + CreateDelivery(*cloudwatchlogs.CreateDeliveryInput) (*cloudwatchlogs.CreateDeliveryOutput, error) + CreateDeliveryWithContext(aws.Context, *cloudwatchlogs.CreateDeliveryInput, ...request.Option) (*cloudwatchlogs.CreateDeliveryOutput, error) + CreateDeliveryRequest(*cloudwatchlogs.CreateDeliveryInput) (*request.Request, *cloudwatchlogs.CreateDeliveryOutput) + + CreateExportTask(*cloudwatchlogs.CreateExportTaskInput) (*cloudwatchlogs.CreateExportTaskOutput, error) + CreateExportTaskWithContext(aws.Context, *cloudwatchlogs.CreateExportTaskInput, ...request.Option) (*cloudwatchlogs.CreateExportTaskOutput, error) + CreateExportTaskRequest(*cloudwatchlogs.CreateExportTaskInput) (*request.Request, *cloudwatchlogs.CreateExportTaskOutput) + + CreateLogAnomalyDetector(*cloudwatchlogs.CreateLogAnomalyDetectorInput) (*cloudwatchlogs.CreateLogAnomalyDetectorOutput, error) + CreateLogAnomalyDetectorWithContext(aws.Context, *cloudwatchlogs.CreateLogAnomalyDetectorInput, ...request.Option) (*cloudwatchlogs.CreateLogAnomalyDetectorOutput, error) + CreateLogAnomalyDetectorRequest(*cloudwatchlogs.CreateLogAnomalyDetectorInput) (*request.Request, *cloudwatchlogs.CreateLogAnomalyDetectorOutput) + + CreateLogGroup(*cloudwatchlogs.CreateLogGroupInput) (*cloudwatchlogs.CreateLogGroupOutput, error) + CreateLogGroupWithContext(aws.Context, *cloudwatchlogs.CreateLogGroupInput, ...request.Option) (*cloudwatchlogs.CreateLogGroupOutput, error) + CreateLogGroupRequest(*cloudwatchlogs.CreateLogGroupInput) (*request.Request, *cloudwatchlogs.CreateLogGroupOutput) + + CreateLogStream(*cloudwatchlogs.CreateLogStreamInput) (*cloudwatchlogs.CreateLogStreamOutput, error) + CreateLogStreamWithContext(aws.Context, *cloudwatchlogs.CreateLogStreamInput, ...request.Option) (*cloudwatchlogs.CreateLogStreamOutput, error) + CreateLogStreamRequest(*cloudwatchlogs.CreateLogStreamInput) (*request.Request, *cloudwatchlogs.CreateLogStreamOutput) + + DeleteAccountPolicy(*cloudwatchlogs.DeleteAccountPolicyInput) (*cloudwatchlogs.DeleteAccountPolicyOutput, error) + DeleteAccountPolicyWithContext(aws.Context, *cloudwatchlogs.DeleteAccountPolicyInput, ...request.Option) (*cloudwatchlogs.DeleteAccountPolicyOutput, error) + DeleteAccountPolicyRequest(*cloudwatchlogs.DeleteAccountPolicyInput) (*request.Request, *cloudwatchlogs.DeleteAccountPolicyOutput) + + DeleteDataProtectionPolicy(*cloudwatchlogs.DeleteDataProtectionPolicyInput) (*cloudwatchlogs.DeleteDataProtectionPolicyOutput, error) + DeleteDataProtectionPolicyWithContext(aws.Context, *cloudwatchlogs.DeleteDataProtectionPolicyInput, ...request.Option) (*cloudwatchlogs.DeleteDataProtectionPolicyOutput, error) + DeleteDataProtectionPolicyRequest(*cloudwatchlogs.DeleteDataProtectionPolicyInput) (*request.Request, *cloudwatchlogs.DeleteDataProtectionPolicyOutput) + + DeleteDelivery(*cloudwatchlogs.DeleteDeliveryInput) (*cloudwatchlogs.DeleteDeliveryOutput, error) + DeleteDeliveryWithContext(aws.Context, *cloudwatchlogs.DeleteDeliveryInput, ...request.Option) (*cloudwatchlogs.DeleteDeliveryOutput, error) + DeleteDeliveryRequest(*cloudwatchlogs.DeleteDeliveryInput) (*request.Request, *cloudwatchlogs.DeleteDeliveryOutput) + + DeleteDeliveryDestination(*cloudwatchlogs.DeleteDeliveryDestinationInput) (*cloudwatchlogs.DeleteDeliveryDestinationOutput, error) + DeleteDeliveryDestinationWithContext(aws.Context, *cloudwatchlogs.DeleteDeliveryDestinationInput, ...request.Option) (*cloudwatchlogs.DeleteDeliveryDestinationOutput, error) + DeleteDeliveryDestinationRequest(*cloudwatchlogs.DeleteDeliveryDestinationInput) (*request.Request, *cloudwatchlogs.DeleteDeliveryDestinationOutput) + + DeleteDeliveryDestinationPolicy(*cloudwatchlogs.DeleteDeliveryDestinationPolicyInput) (*cloudwatchlogs.DeleteDeliveryDestinationPolicyOutput, error) + DeleteDeliveryDestinationPolicyWithContext(aws.Context, *cloudwatchlogs.DeleteDeliveryDestinationPolicyInput, ...request.Option) (*cloudwatchlogs.DeleteDeliveryDestinationPolicyOutput, error) + DeleteDeliveryDestinationPolicyRequest(*cloudwatchlogs.DeleteDeliveryDestinationPolicyInput) (*request.Request, *cloudwatchlogs.DeleteDeliveryDestinationPolicyOutput) + + DeleteDeliverySource(*cloudwatchlogs.DeleteDeliverySourceInput) (*cloudwatchlogs.DeleteDeliverySourceOutput, error) + DeleteDeliverySourceWithContext(aws.Context, *cloudwatchlogs.DeleteDeliverySourceInput, ...request.Option) (*cloudwatchlogs.DeleteDeliverySourceOutput, error) + DeleteDeliverySourceRequest(*cloudwatchlogs.DeleteDeliverySourceInput) (*request.Request, *cloudwatchlogs.DeleteDeliverySourceOutput) + + DeleteDestination(*cloudwatchlogs.DeleteDestinationInput) (*cloudwatchlogs.DeleteDestinationOutput, error) + DeleteDestinationWithContext(aws.Context, *cloudwatchlogs.DeleteDestinationInput, ...request.Option) (*cloudwatchlogs.DeleteDestinationOutput, error) + DeleteDestinationRequest(*cloudwatchlogs.DeleteDestinationInput) (*request.Request, *cloudwatchlogs.DeleteDestinationOutput) + + DeleteLogAnomalyDetector(*cloudwatchlogs.DeleteLogAnomalyDetectorInput) (*cloudwatchlogs.DeleteLogAnomalyDetectorOutput, error) + DeleteLogAnomalyDetectorWithContext(aws.Context, *cloudwatchlogs.DeleteLogAnomalyDetectorInput, ...request.Option) (*cloudwatchlogs.DeleteLogAnomalyDetectorOutput, error) + DeleteLogAnomalyDetectorRequest(*cloudwatchlogs.DeleteLogAnomalyDetectorInput) (*request.Request, *cloudwatchlogs.DeleteLogAnomalyDetectorOutput) + + DeleteLogGroup(*cloudwatchlogs.DeleteLogGroupInput) (*cloudwatchlogs.DeleteLogGroupOutput, error) + DeleteLogGroupWithContext(aws.Context, *cloudwatchlogs.DeleteLogGroupInput, ...request.Option) (*cloudwatchlogs.DeleteLogGroupOutput, error) + DeleteLogGroupRequest(*cloudwatchlogs.DeleteLogGroupInput) (*request.Request, *cloudwatchlogs.DeleteLogGroupOutput) + + DeleteLogStream(*cloudwatchlogs.DeleteLogStreamInput) (*cloudwatchlogs.DeleteLogStreamOutput, error) + DeleteLogStreamWithContext(aws.Context, *cloudwatchlogs.DeleteLogStreamInput, ...request.Option) (*cloudwatchlogs.DeleteLogStreamOutput, error) + DeleteLogStreamRequest(*cloudwatchlogs.DeleteLogStreamInput) (*request.Request, *cloudwatchlogs.DeleteLogStreamOutput) + + DeleteMetricFilter(*cloudwatchlogs.DeleteMetricFilterInput) (*cloudwatchlogs.DeleteMetricFilterOutput, error) + DeleteMetricFilterWithContext(aws.Context, *cloudwatchlogs.DeleteMetricFilterInput, ...request.Option) (*cloudwatchlogs.DeleteMetricFilterOutput, error) + DeleteMetricFilterRequest(*cloudwatchlogs.DeleteMetricFilterInput) (*request.Request, *cloudwatchlogs.DeleteMetricFilterOutput) + + DeleteQueryDefinition(*cloudwatchlogs.DeleteQueryDefinitionInput) (*cloudwatchlogs.DeleteQueryDefinitionOutput, error) + DeleteQueryDefinitionWithContext(aws.Context, *cloudwatchlogs.DeleteQueryDefinitionInput, ...request.Option) (*cloudwatchlogs.DeleteQueryDefinitionOutput, error) + DeleteQueryDefinitionRequest(*cloudwatchlogs.DeleteQueryDefinitionInput) (*request.Request, *cloudwatchlogs.DeleteQueryDefinitionOutput) + + 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) + + DeleteSubscriptionFilter(*cloudwatchlogs.DeleteSubscriptionFilterInput) (*cloudwatchlogs.DeleteSubscriptionFilterOutput, error) + DeleteSubscriptionFilterWithContext(aws.Context, *cloudwatchlogs.DeleteSubscriptionFilterInput, ...request.Option) (*cloudwatchlogs.DeleteSubscriptionFilterOutput, error) + DeleteSubscriptionFilterRequest(*cloudwatchlogs.DeleteSubscriptionFilterInput) (*request.Request, *cloudwatchlogs.DeleteSubscriptionFilterOutput) + + DescribeAccountPolicies(*cloudwatchlogs.DescribeAccountPoliciesInput) (*cloudwatchlogs.DescribeAccountPoliciesOutput, error) + DescribeAccountPoliciesWithContext(aws.Context, *cloudwatchlogs.DescribeAccountPoliciesInput, ...request.Option) (*cloudwatchlogs.DescribeAccountPoliciesOutput, error) + DescribeAccountPoliciesRequest(*cloudwatchlogs.DescribeAccountPoliciesInput) (*request.Request, *cloudwatchlogs.DescribeAccountPoliciesOutput) + + DescribeDeliveries(*cloudwatchlogs.DescribeDeliveriesInput) (*cloudwatchlogs.DescribeDeliveriesOutput, error) + DescribeDeliveriesWithContext(aws.Context, *cloudwatchlogs.DescribeDeliveriesInput, ...request.Option) (*cloudwatchlogs.DescribeDeliveriesOutput, error) + DescribeDeliveriesRequest(*cloudwatchlogs.DescribeDeliveriesInput) (*request.Request, *cloudwatchlogs.DescribeDeliveriesOutput) + + DescribeDeliveriesPages(*cloudwatchlogs.DescribeDeliveriesInput, func(*cloudwatchlogs.DescribeDeliveriesOutput, bool) bool) error + DescribeDeliveriesPagesWithContext(aws.Context, *cloudwatchlogs.DescribeDeliveriesInput, func(*cloudwatchlogs.DescribeDeliveriesOutput, bool) bool, ...request.Option) error + + DescribeDeliveryDestinations(*cloudwatchlogs.DescribeDeliveryDestinationsInput) (*cloudwatchlogs.DescribeDeliveryDestinationsOutput, error) + DescribeDeliveryDestinationsWithContext(aws.Context, *cloudwatchlogs.DescribeDeliveryDestinationsInput, ...request.Option) (*cloudwatchlogs.DescribeDeliveryDestinationsOutput, error) + DescribeDeliveryDestinationsRequest(*cloudwatchlogs.DescribeDeliveryDestinationsInput) (*request.Request, *cloudwatchlogs.DescribeDeliveryDestinationsOutput) + + DescribeDeliveryDestinationsPages(*cloudwatchlogs.DescribeDeliveryDestinationsInput, func(*cloudwatchlogs.DescribeDeliveryDestinationsOutput, bool) bool) error + DescribeDeliveryDestinationsPagesWithContext(aws.Context, *cloudwatchlogs.DescribeDeliveryDestinationsInput, func(*cloudwatchlogs.DescribeDeliveryDestinationsOutput, bool) bool, ...request.Option) error + + DescribeDeliverySources(*cloudwatchlogs.DescribeDeliverySourcesInput) (*cloudwatchlogs.DescribeDeliverySourcesOutput, error) + DescribeDeliverySourcesWithContext(aws.Context, *cloudwatchlogs.DescribeDeliverySourcesInput, ...request.Option) (*cloudwatchlogs.DescribeDeliverySourcesOutput, error) + DescribeDeliverySourcesRequest(*cloudwatchlogs.DescribeDeliverySourcesInput) (*request.Request, *cloudwatchlogs.DescribeDeliverySourcesOutput) + + DescribeDeliverySourcesPages(*cloudwatchlogs.DescribeDeliverySourcesInput, func(*cloudwatchlogs.DescribeDeliverySourcesOutput, bool) bool) error + DescribeDeliverySourcesPagesWithContext(aws.Context, *cloudwatchlogs.DescribeDeliverySourcesInput, func(*cloudwatchlogs.DescribeDeliverySourcesOutput, bool) bool, ...request.Option) error + + DescribeDestinations(*cloudwatchlogs.DescribeDestinationsInput) (*cloudwatchlogs.DescribeDestinationsOutput, error) + DescribeDestinationsWithContext(aws.Context, *cloudwatchlogs.DescribeDestinationsInput, ...request.Option) (*cloudwatchlogs.DescribeDestinationsOutput, error) + DescribeDestinationsRequest(*cloudwatchlogs.DescribeDestinationsInput) (*request.Request, *cloudwatchlogs.DescribeDestinationsOutput) + + DescribeDestinationsPages(*cloudwatchlogs.DescribeDestinationsInput, func(*cloudwatchlogs.DescribeDestinationsOutput, bool) bool) error + DescribeDestinationsPagesWithContext(aws.Context, *cloudwatchlogs.DescribeDestinationsInput, func(*cloudwatchlogs.DescribeDestinationsOutput, bool) bool, ...request.Option) error + + DescribeExportTasks(*cloudwatchlogs.DescribeExportTasksInput) (*cloudwatchlogs.DescribeExportTasksOutput, error) + DescribeExportTasksWithContext(aws.Context, *cloudwatchlogs.DescribeExportTasksInput, ...request.Option) (*cloudwatchlogs.DescribeExportTasksOutput, error) + DescribeExportTasksRequest(*cloudwatchlogs.DescribeExportTasksInput) (*request.Request, *cloudwatchlogs.DescribeExportTasksOutput) + + DescribeLogGroups(*cloudwatchlogs.DescribeLogGroupsInput) (*cloudwatchlogs.DescribeLogGroupsOutput, error) + DescribeLogGroupsWithContext(aws.Context, *cloudwatchlogs.DescribeLogGroupsInput, ...request.Option) (*cloudwatchlogs.DescribeLogGroupsOutput, error) + DescribeLogGroupsRequest(*cloudwatchlogs.DescribeLogGroupsInput) (*request.Request, *cloudwatchlogs.DescribeLogGroupsOutput) + + DescribeLogGroupsPages(*cloudwatchlogs.DescribeLogGroupsInput, func(*cloudwatchlogs.DescribeLogGroupsOutput, bool) bool) error + DescribeLogGroupsPagesWithContext(aws.Context, *cloudwatchlogs.DescribeLogGroupsInput, func(*cloudwatchlogs.DescribeLogGroupsOutput, bool) bool, ...request.Option) error + + DescribeLogStreams(*cloudwatchlogs.DescribeLogStreamsInput) (*cloudwatchlogs.DescribeLogStreamsOutput, error) + DescribeLogStreamsWithContext(aws.Context, *cloudwatchlogs.DescribeLogStreamsInput, ...request.Option) (*cloudwatchlogs.DescribeLogStreamsOutput, error) + DescribeLogStreamsRequest(*cloudwatchlogs.DescribeLogStreamsInput) (*request.Request, *cloudwatchlogs.DescribeLogStreamsOutput) + + DescribeLogStreamsPages(*cloudwatchlogs.DescribeLogStreamsInput, func(*cloudwatchlogs.DescribeLogStreamsOutput, bool) bool) error + DescribeLogStreamsPagesWithContext(aws.Context, *cloudwatchlogs.DescribeLogStreamsInput, func(*cloudwatchlogs.DescribeLogStreamsOutput, bool) bool, ...request.Option) error + + DescribeMetricFilters(*cloudwatchlogs.DescribeMetricFiltersInput) (*cloudwatchlogs.DescribeMetricFiltersOutput, error) + DescribeMetricFiltersWithContext(aws.Context, *cloudwatchlogs.DescribeMetricFiltersInput, ...request.Option) (*cloudwatchlogs.DescribeMetricFiltersOutput, error) + DescribeMetricFiltersRequest(*cloudwatchlogs.DescribeMetricFiltersInput) (*request.Request, *cloudwatchlogs.DescribeMetricFiltersOutput) + + DescribeMetricFiltersPages(*cloudwatchlogs.DescribeMetricFiltersInput, func(*cloudwatchlogs.DescribeMetricFiltersOutput, bool) bool) error + DescribeMetricFiltersPagesWithContext(aws.Context, *cloudwatchlogs.DescribeMetricFiltersInput, func(*cloudwatchlogs.DescribeMetricFiltersOutput, bool) bool, ...request.Option) error + + DescribeQueries(*cloudwatchlogs.DescribeQueriesInput) (*cloudwatchlogs.DescribeQueriesOutput, error) + DescribeQueriesWithContext(aws.Context, *cloudwatchlogs.DescribeQueriesInput, ...request.Option) (*cloudwatchlogs.DescribeQueriesOutput, error) + DescribeQueriesRequest(*cloudwatchlogs.DescribeQueriesInput) (*request.Request, *cloudwatchlogs.DescribeQueriesOutput) + + DescribeQueryDefinitions(*cloudwatchlogs.DescribeQueryDefinitionsInput) (*cloudwatchlogs.DescribeQueryDefinitionsOutput, error) + DescribeQueryDefinitionsWithContext(aws.Context, *cloudwatchlogs.DescribeQueryDefinitionsInput, ...request.Option) (*cloudwatchlogs.DescribeQueryDefinitionsOutput, error) + DescribeQueryDefinitionsRequest(*cloudwatchlogs.DescribeQueryDefinitionsInput) (*request.Request, *cloudwatchlogs.DescribeQueryDefinitionsOutput) + + 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) + + 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) + + FilterLogEventsPages(*cloudwatchlogs.FilterLogEventsInput, func(*cloudwatchlogs.FilterLogEventsOutput, bool) bool) error + FilterLogEventsPagesWithContext(aws.Context, *cloudwatchlogs.FilterLogEventsInput, func(*cloudwatchlogs.FilterLogEventsOutput, bool) bool, ...request.Option) error + + GetDataProtectionPolicy(*cloudwatchlogs.GetDataProtectionPolicyInput) (*cloudwatchlogs.GetDataProtectionPolicyOutput, error) + GetDataProtectionPolicyWithContext(aws.Context, *cloudwatchlogs.GetDataProtectionPolicyInput, ...request.Option) (*cloudwatchlogs.GetDataProtectionPolicyOutput, error) + GetDataProtectionPolicyRequest(*cloudwatchlogs.GetDataProtectionPolicyInput) (*request.Request, *cloudwatchlogs.GetDataProtectionPolicyOutput) + + GetDelivery(*cloudwatchlogs.GetDeliveryInput) (*cloudwatchlogs.GetDeliveryOutput, error) + GetDeliveryWithContext(aws.Context, *cloudwatchlogs.GetDeliveryInput, ...request.Option) (*cloudwatchlogs.GetDeliveryOutput, error) + GetDeliveryRequest(*cloudwatchlogs.GetDeliveryInput) (*request.Request, *cloudwatchlogs.GetDeliveryOutput) + + GetDeliveryDestination(*cloudwatchlogs.GetDeliveryDestinationInput) (*cloudwatchlogs.GetDeliveryDestinationOutput, error) + GetDeliveryDestinationWithContext(aws.Context, *cloudwatchlogs.GetDeliveryDestinationInput, ...request.Option) (*cloudwatchlogs.GetDeliveryDestinationOutput, error) + GetDeliveryDestinationRequest(*cloudwatchlogs.GetDeliveryDestinationInput) (*request.Request, *cloudwatchlogs.GetDeliveryDestinationOutput) + + GetDeliveryDestinationPolicy(*cloudwatchlogs.GetDeliveryDestinationPolicyInput) (*cloudwatchlogs.GetDeliveryDestinationPolicyOutput, error) + GetDeliveryDestinationPolicyWithContext(aws.Context, *cloudwatchlogs.GetDeliveryDestinationPolicyInput, ...request.Option) (*cloudwatchlogs.GetDeliveryDestinationPolicyOutput, error) + GetDeliveryDestinationPolicyRequest(*cloudwatchlogs.GetDeliveryDestinationPolicyInput) (*request.Request, *cloudwatchlogs.GetDeliveryDestinationPolicyOutput) + + GetDeliverySource(*cloudwatchlogs.GetDeliverySourceInput) (*cloudwatchlogs.GetDeliverySourceOutput, error) + GetDeliverySourceWithContext(aws.Context, *cloudwatchlogs.GetDeliverySourceInput, ...request.Option) (*cloudwatchlogs.GetDeliverySourceOutput, error) + GetDeliverySourceRequest(*cloudwatchlogs.GetDeliverySourceInput) (*request.Request, *cloudwatchlogs.GetDeliverySourceOutput) + + GetLogAnomalyDetector(*cloudwatchlogs.GetLogAnomalyDetectorInput) (*cloudwatchlogs.GetLogAnomalyDetectorOutput, error) + GetLogAnomalyDetectorWithContext(aws.Context, *cloudwatchlogs.GetLogAnomalyDetectorInput, ...request.Option) (*cloudwatchlogs.GetLogAnomalyDetectorOutput, error) + GetLogAnomalyDetectorRequest(*cloudwatchlogs.GetLogAnomalyDetectorInput) (*request.Request, *cloudwatchlogs.GetLogAnomalyDetectorOutput) + + GetLogEvents(*cloudwatchlogs.GetLogEventsInput) (*cloudwatchlogs.GetLogEventsOutput, error) + GetLogEventsWithContext(aws.Context, *cloudwatchlogs.GetLogEventsInput, ...request.Option) (*cloudwatchlogs.GetLogEventsOutput, error) + GetLogEventsRequest(*cloudwatchlogs.GetLogEventsInput) (*request.Request, *cloudwatchlogs.GetLogEventsOutput) + + GetLogEventsPages(*cloudwatchlogs.GetLogEventsInput, func(*cloudwatchlogs.GetLogEventsOutput, bool) bool) error + GetLogEventsPagesWithContext(aws.Context, *cloudwatchlogs.GetLogEventsInput, func(*cloudwatchlogs.GetLogEventsOutput, bool) bool, ...request.Option) error + + GetLogGroupFields(*cloudwatchlogs.GetLogGroupFieldsInput) (*cloudwatchlogs.GetLogGroupFieldsOutput, error) + GetLogGroupFieldsWithContext(aws.Context, *cloudwatchlogs.GetLogGroupFieldsInput, ...request.Option) (*cloudwatchlogs.GetLogGroupFieldsOutput, error) + GetLogGroupFieldsRequest(*cloudwatchlogs.GetLogGroupFieldsInput) (*request.Request, *cloudwatchlogs.GetLogGroupFieldsOutput) + + GetLogRecord(*cloudwatchlogs.GetLogRecordInput) (*cloudwatchlogs.GetLogRecordOutput, error) + GetLogRecordWithContext(aws.Context, *cloudwatchlogs.GetLogRecordInput, ...request.Option) (*cloudwatchlogs.GetLogRecordOutput, error) + GetLogRecordRequest(*cloudwatchlogs.GetLogRecordInput) (*request.Request, *cloudwatchlogs.GetLogRecordOutput) + + GetQueryResults(*cloudwatchlogs.GetQueryResultsInput) (*cloudwatchlogs.GetQueryResultsOutput, error) + GetQueryResultsWithContext(aws.Context, *cloudwatchlogs.GetQueryResultsInput, ...request.Option) (*cloudwatchlogs.GetQueryResultsOutput, error) + GetQueryResultsRequest(*cloudwatchlogs.GetQueryResultsInput) (*request.Request, *cloudwatchlogs.GetQueryResultsOutput) + + ListAnomalies(*cloudwatchlogs.ListAnomaliesInput) (*cloudwatchlogs.ListAnomaliesOutput, error) + ListAnomaliesWithContext(aws.Context, *cloudwatchlogs.ListAnomaliesInput, ...request.Option) (*cloudwatchlogs.ListAnomaliesOutput, error) + ListAnomaliesRequest(*cloudwatchlogs.ListAnomaliesInput) (*request.Request, *cloudwatchlogs.ListAnomaliesOutput) + + ListAnomaliesPages(*cloudwatchlogs.ListAnomaliesInput, func(*cloudwatchlogs.ListAnomaliesOutput, bool) bool) error + ListAnomaliesPagesWithContext(aws.Context, *cloudwatchlogs.ListAnomaliesInput, func(*cloudwatchlogs.ListAnomaliesOutput, bool) bool, ...request.Option) error + + ListLogAnomalyDetectors(*cloudwatchlogs.ListLogAnomalyDetectorsInput) (*cloudwatchlogs.ListLogAnomalyDetectorsOutput, error) + ListLogAnomalyDetectorsWithContext(aws.Context, *cloudwatchlogs.ListLogAnomalyDetectorsInput, ...request.Option) (*cloudwatchlogs.ListLogAnomalyDetectorsOutput, error) + ListLogAnomalyDetectorsRequest(*cloudwatchlogs.ListLogAnomalyDetectorsInput) (*request.Request, *cloudwatchlogs.ListLogAnomalyDetectorsOutput) + + ListLogAnomalyDetectorsPages(*cloudwatchlogs.ListLogAnomalyDetectorsInput, func(*cloudwatchlogs.ListLogAnomalyDetectorsOutput, bool) bool) error + ListLogAnomalyDetectorsPagesWithContext(aws.Context, *cloudwatchlogs.ListLogAnomalyDetectorsInput, func(*cloudwatchlogs.ListLogAnomalyDetectorsOutput, bool) bool, ...request.Option) error + + ListTagsForResource(*cloudwatchlogs.ListTagsForResourceInput) (*cloudwatchlogs.ListTagsForResourceOutput, error) + ListTagsForResourceWithContext(aws.Context, *cloudwatchlogs.ListTagsForResourceInput, ...request.Option) (*cloudwatchlogs.ListTagsForResourceOutput, error) + ListTagsForResourceRequest(*cloudwatchlogs.ListTagsForResourceInput) (*request.Request, *cloudwatchlogs.ListTagsForResourceOutput) + + ListTagsLogGroup(*cloudwatchlogs.ListTagsLogGroupInput) (*cloudwatchlogs.ListTagsLogGroupOutput, error) + ListTagsLogGroupWithContext(aws.Context, *cloudwatchlogs.ListTagsLogGroupInput, ...request.Option) (*cloudwatchlogs.ListTagsLogGroupOutput, error) + ListTagsLogGroupRequest(*cloudwatchlogs.ListTagsLogGroupInput) (*request.Request, *cloudwatchlogs.ListTagsLogGroupOutput) + + PutAccountPolicy(*cloudwatchlogs.PutAccountPolicyInput) (*cloudwatchlogs.PutAccountPolicyOutput, error) + PutAccountPolicyWithContext(aws.Context, *cloudwatchlogs.PutAccountPolicyInput, ...request.Option) (*cloudwatchlogs.PutAccountPolicyOutput, error) + PutAccountPolicyRequest(*cloudwatchlogs.PutAccountPolicyInput) (*request.Request, *cloudwatchlogs.PutAccountPolicyOutput) + + PutDataProtectionPolicy(*cloudwatchlogs.PutDataProtectionPolicyInput) (*cloudwatchlogs.PutDataProtectionPolicyOutput, error) + PutDataProtectionPolicyWithContext(aws.Context, *cloudwatchlogs.PutDataProtectionPolicyInput, ...request.Option) (*cloudwatchlogs.PutDataProtectionPolicyOutput, error) + PutDataProtectionPolicyRequest(*cloudwatchlogs.PutDataProtectionPolicyInput) (*request.Request, *cloudwatchlogs.PutDataProtectionPolicyOutput) + + PutDeliveryDestination(*cloudwatchlogs.PutDeliveryDestinationInput) (*cloudwatchlogs.PutDeliveryDestinationOutput, error) + PutDeliveryDestinationWithContext(aws.Context, *cloudwatchlogs.PutDeliveryDestinationInput, ...request.Option) (*cloudwatchlogs.PutDeliveryDestinationOutput, error) + PutDeliveryDestinationRequest(*cloudwatchlogs.PutDeliveryDestinationInput) (*request.Request, *cloudwatchlogs.PutDeliveryDestinationOutput) + + PutDeliveryDestinationPolicy(*cloudwatchlogs.PutDeliveryDestinationPolicyInput) (*cloudwatchlogs.PutDeliveryDestinationPolicyOutput, error) + PutDeliveryDestinationPolicyWithContext(aws.Context, *cloudwatchlogs.PutDeliveryDestinationPolicyInput, ...request.Option) (*cloudwatchlogs.PutDeliveryDestinationPolicyOutput, error) + PutDeliveryDestinationPolicyRequest(*cloudwatchlogs.PutDeliveryDestinationPolicyInput) (*request.Request, *cloudwatchlogs.PutDeliveryDestinationPolicyOutput) + + PutDeliverySource(*cloudwatchlogs.PutDeliverySourceInput) (*cloudwatchlogs.PutDeliverySourceOutput, error) + PutDeliverySourceWithContext(aws.Context, *cloudwatchlogs.PutDeliverySourceInput, ...request.Option) (*cloudwatchlogs.PutDeliverySourceOutput, error) + PutDeliverySourceRequest(*cloudwatchlogs.PutDeliverySourceInput) (*request.Request, *cloudwatchlogs.PutDeliverySourceOutput) + + PutDestination(*cloudwatchlogs.PutDestinationInput) (*cloudwatchlogs.PutDestinationOutput, error) + PutDestinationWithContext(aws.Context, *cloudwatchlogs.PutDestinationInput, ...request.Option) (*cloudwatchlogs.PutDestinationOutput, error) + PutDestinationRequest(*cloudwatchlogs.PutDestinationInput) (*request.Request, *cloudwatchlogs.PutDestinationOutput) + + PutDestinationPolicy(*cloudwatchlogs.PutDestinationPolicyInput) (*cloudwatchlogs.PutDestinationPolicyOutput, error) + PutDestinationPolicyWithContext(aws.Context, *cloudwatchlogs.PutDestinationPolicyInput, ...request.Option) (*cloudwatchlogs.PutDestinationPolicyOutput, error) + PutDestinationPolicyRequest(*cloudwatchlogs.PutDestinationPolicyInput) (*request.Request, *cloudwatchlogs.PutDestinationPolicyOutput) + + PutLogEvents(*cloudwatchlogs.PutLogEventsInput) (*cloudwatchlogs.PutLogEventsOutput, error) + PutLogEventsWithContext(aws.Context, *cloudwatchlogs.PutLogEventsInput, ...request.Option) (*cloudwatchlogs.PutLogEventsOutput, error) + PutLogEventsRequest(*cloudwatchlogs.PutLogEventsInput) (*request.Request, *cloudwatchlogs.PutLogEventsOutput) + + PutMetricFilter(*cloudwatchlogs.PutMetricFilterInput) (*cloudwatchlogs.PutMetricFilterOutput, error) + PutMetricFilterWithContext(aws.Context, *cloudwatchlogs.PutMetricFilterInput, ...request.Option) (*cloudwatchlogs.PutMetricFilterOutput, error) + PutMetricFilterRequest(*cloudwatchlogs.PutMetricFilterInput) (*request.Request, *cloudwatchlogs.PutMetricFilterOutput) + + PutQueryDefinition(*cloudwatchlogs.PutQueryDefinitionInput) (*cloudwatchlogs.PutQueryDefinitionOutput, error) + PutQueryDefinitionWithContext(aws.Context, *cloudwatchlogs.PutQueryDefinitionInput, ...request.Option) (*cloudwatchlogs.PutQueryDefinitionOutput, error) + PutQueryDefinitionRequest(*cloudwatchlogs.PutQueryDefinitionInput) (*request.Request, *cloudwatchlogs.PutQueryDefinitionOutput) + + 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) + + PutSubscriptionFilter(*cloudwatchlogs.PutSubscriptionFilterInput) (*cloudwatchlogs.PutSubscriptionFilterOutput, error) + PutSubscriptionFilterWithContext(aws.Context, *cloudwatchlogs.PutSubscriptionFilterInput, ...request.Option) (*cloudwatchlogs.PutSubscriptionFilterOutput, error) + PutSubscriptionFilterRequest(*cloudwatchlogs.PutSubscriptionFilterInput) (*request.Request, *cloudwatchlogs.PutSubscriptionFilterOutput) + + StartLiveTail(*cloudwatchlogs.StartLiveTailInput) (*cloudwatchlogs.StartLiveTailOutput, error) + StartLiveTailWithContext(aws.Context, *cloudwatchlogs.StartLiveTailInput, ...request.Option) (*cloudwatchlogs.StartLiveTailOutput, error) + StartLiveTailRequest(*cloudwatchlogs.StartLiveTailInput) (*request.Request, *cloudwatchlogs.StartLiveTailOutput) + + StartQuery(*cloudwatchlogs.StartQueryInput) (*cloudwatchlogs.StartQueryOutput, error) + StartQueryWithContext(aws.Context, *cloudwatchlogs.StartQueryInput, ...request.Option) (*cloudwatchlogs.StartQueryOutput, error) + StartQueryRequest(*cloudwatchlogs.StartQueryInput) (*request.Request, *cloudwatchlogs.StartQueryOutput) + + StopQuery(*cloudwatchlogs.StopQueryInput) (*cloudwatchlogs.StopQueryOutput, error) + StopQueryWithContext(aws.Context, *cloudwatchlogs.StopQueryInput, ...request.Option) (*cloudwatchlogs.StopQueryOutput, error) + StopQueryRequest(*cloudwatchlogs.StopQueryInput) (*request.Request, *cloudwatchlogs.StopQueryOutput) + + TagLogGroup(*cloudwatchlogs.TagLogGroupInput) (*cloudwatchlogs.TagLogGroupOutput, error) + TagLogGroupWithContext(aws.Context, *cloudwatchlogs.TagLogGroupInput, ...request.Option) (*cloudwatchlogs.TagLogGroupOutput, error) + TagLogGroupRequest(*cloudwatchlogs.TagLogGroupInput) (*request.Request, *cloudwatchlogs.TagLogGroupOutput) + + TagResource(*cloudwatchlogs.TagResourceInput) (*cloudwatchlogs.TagResourceOutput, error) + TagResourceWithContext(aws.Context, *cloudwatchlogs.TagResourceInput, ...request.Option) (*cloudwatchlogs.TagResourceOutput, error) + TagResourceRequest(*cloudwatchlogs.TagResourceInput) (*request.Request, *cloudwatchlogs.TagResourceOutput) + + TestMetricFilter(*cloudwatchlogs.TestMetricFilterInput) (*cloudwatchlogs.TestMetricFilterOutput, error) + TestMetricFilterWithContext(aws.Context, *cloudwatchlogs.TestMetricFilterInput, ...request.Option) (*cloudwatchlogs.TestMetricFilterOutput, error) + TestMetricFilterRequest(*cloudwatchlogs.TestMetricFilterInput) (*request.Request, *cloudwatchlogs.TestMetricFilterOutput) + + UntagLogGroup(*cloudwatchlogs.UntagLogGroupInput) (*cloudwatchlogs.UntagLogGroupOutput, error) + UntagLogGroupWithContext(aws.Context, *cloudwatchlogs.UntagLogGroupInput, ...request.Option) (*cloudwatchlogs.UntagLogGroupOutput, error) + UntagLogGroupRequest(*cloudwatchlogs.UntagLogGroupInput) (*request.Request, *cloudwatchlogs.UntagLogGroupOutput) + + UntagResource(*cloudwatchlogs.UntagResourceInput) (*cloudwatchlogs.UntagResourceOutput, error) + UntagResourceWithContext(aws.Context, *cloudwatchlogs.UntagResourceInput, ...request.Option) (*cloudwatchlogs.UntagResourceOutput, error) + UntagResourceRequest(*cloudwatchlogs.UntagResourceInput) (*request.Request, *cloudwatchlogs.UntagResourceOutput) + + UpdateAnomaly(*cloudwatchlogs.UpdateAnomalyInput) (*cloudwatchlogs.UpdateAnomalyOutput, error) + UpdateAnomalyWithContext(aws.Context, *cloudwatchlogs.UpdateAnomalyInput, ...request.Option) (*cloudwatchlogs.UpdateAnomalyOutput, error) + UpdateAnomalyRequest(*cloudwatchlogs.UpdateAnomalyInput) (*request.Request, *cloudwatchlogs.UpdateAnomalyOutput) + + UpdateLogAnomalyDetector(*cloudwatchlogs.UpdateLogAnomalyDetectorInput) (*cloudwatchlogs.UpdateLogAnomalyDetectorOutput, error) + UpdateLogAnomalyDetectorWithContext(aws.Context, *cloudwatchlogs.UpdateLogAnomalyDetectorInput, ...request.Option) (*cloudwatchlogs.UpdateLogAnomalyDetectorOutput, error) + UpdateLogAnomalyDetectorRequest(*cloudwatchlogs.UpdateLogAnomalyDetectorInput) (*request.Request, *cloudwatchlogs.UpdateLogAnomalyDetectorOutput) +} + +var _ CloudWatchLogsAPI = (*cloudwatchlogs.CloudWatchLogs)(nil) diff --git a/sdk/service/cloudwatchlogs/doc.go b/sdk/service/cloudwatchlogs/doc.go new file mode 100644 index 0000000000..bd52e9d9f6 --- /dev/null +++ b/sdk/service/cloudwatchlogs/doc.go @@ -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 EC2 instances, CloudTrail, and other sources. You can then retrieve +// the associated log data from CloudWatch Logs using the CloudWatch console. +// Alternatively, you can use CloudWatch Logs commands in the Amazon Web Services +// 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. Then, it can 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"). +// You can also 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 CloudTrail logged events: You can create alarms in CloudWatch +// and receive notifications of particular API activity as captured by CloudTrail. +// You can 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 earlier than this setting are automatically deleted. +// The CloudWatch Logs agent helps 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 contact 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 diff --git a/sdk/service/cloudwatchlogs/errors.go b/sdk/service/cloudwatchlogs/errors.go new file mode 100644 index 0000000000..4c4ff1b551 --- /dev/null +++ b/sdk/service/cloudwatchlogs/errors.go @@ -0,0 +1,159 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudwatchlogs + +import ( + "github.com/aws/aws-sdk-go/private/protocol" +) + +const ( + + // ErrCodeAccessDeniedException for service response error code + // "AccessDeniedException". + // + // You don't have sufficient permissions to perform this action. + ErrCodeAccessDeniedException = "AccessDeniedException" + + // ErrCodeConflictException for service response error code + // "ConflictException". + // + // This operation attempted to create a resource that already exists. + ErrCodeConflictException = "ConflictException" + + // ErrCodeDataAlreadyAcceptedException for service response error code + // "DataAlreadyAcceptedException". + // + // The event was already logged. + // + // PutLogEvents actions are now always accepted and never return DataAlreadyAcceptedException + // regardless of whether a given batch of log events has already been accepted. + ErrCodeDataAlreadyAcceptedException = "DataAlreadyAcceptedException" + + // ErrCodeInvalidOperationException for service response error code + // "InvalidOperationException". + // + // The operation is not valid on the specified resource. + ErrCodeInvalidOperationException = "InvalidOperationException" + + // ErrCodeInvalidParameterException for service response error code + // "InvalidParameterException". + // + // A parameter is specified incorrectly. + ErrCodeInvalidParameterException = "InvalidParameterException" + + // ErrCodeInvalidSequenceTokenException for service response error code + // "InvalidSequenceTokenException". + // + // The sequence token is not valid. You can get the correct sequence token in + // the expectedSequenceToken field in the InvalidSequenceTokenException message. + // + // PutLogEvents actions are now always accepted and never return InvalidSequenceTokenException + // regardless of receiving an invalid sequence token. + ErrCodeInvalidSequenceTokenException = "InvalidSequenceTokenException" + + // ErrCodeLimitExceededException for service response error code + // "LimitExceededException". + // + // You have reached the maximum number of resources that can be created. + ErrCodeLimitExceededException = "LimitExceededException" + + // ErrCodeMalformedQueryException for service response error code + // "MalformedQueryException". + // + // The query string is not valid. Details about this error are displayed in + // a QueryCompileError object. For more information, see QueryCompileError (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_QueryCompileError.html). + // + // For more information about valid query syntax, see CloudWatch Logs Insights + // Query Syntax (https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html). + ErrCodeMalformedQueryException = "MalformedQueryException" + + // ErrCodeOperationAbortedException for service response error code + // "OperationAbortedException". + // + // Multiple concurrent requests to update the same resource were in conflict. + ErrCodeOperationAbortedException = "OperationAbortedException" + + // ErrCodeResourceAlreadyExistsException for service response error code + // "ResourceAlreadyExistsException". + // + // The specified resource already exists. + ErrCodeResourceAlreadyExistsException = "ResourceAlreadyExistsException" + + // ErrCodeResourceNotFoundException for service response error code + // "ResourceNotFoundException". + // + // The specified resource does not exist. + ErrCodeResourceNotFoundException = "ResourceNotFoundException" + + // ErrCodeServiceQuotaExceededException for service response error code + // "ServiceQuotaExceededException". + // + // This request exceeds a service quota. + ErrCodeServiceQuotaExceededException = "ServiceQuotaExceededException" + + // ErrCodeServiceUnavailableException for service response error code + // "ServiceUnavailableException". + // + // The service cannot complete the request. + ErrCodeServiceUnavailableException = "ServiceUnavailableException" + + // ErrCodeSessionStreamingException for service response error code + // "SessionStreamingException". + // + // his exception is returned if an unknown error occurs during a Live Tail session. + ErrCodeSessionStreamingException = "SessionStreamingException" + + // ErrCodeSessionTimeoutException for service response error code + // "SessionTimeoutException". + // + // This exception is returned in a Live Tail stream when the Live Tail session + // times out. Live Tail sessions time out after three hours. + ErrCodeSessionTimeoutException = "SessionTimeoutException" + + // ErrCodeThrottlingException for service response error code + // "ThrottlingException". + // + // The request was throttled because of quota limits. + ErrCodeThrottlingException = "ThrottlingException" + + // ErrCodeTooManyTagsException for service response error code + // "TooManyTagsException". + // + // A resource can have no more than 50 tags. + ErrCodeTooManyTagsException = "TooManyTagsException" + + // ErrCodeUnrecognizedClientException for service response error code + // "UnrecognizedClientException". + // + // The most likely cause is an Amazon Web Services access key ID or secret key + // that's not valid. + ErrCodeUnrecognizedClientException = "UnrecognizedClientException" + + // ErrCodeValidationException for service response error code + // "ValidationException". + // + // One of the parameters for the request is not valid. + ErrCodeValidationException = "ValidationException" +) + +var exceptionFromCode = map[string]func(protocol.ResponseMetadata) error{ + "AccessDeniedException": newErrorAccessDeniedException, + "ConflictException": newErrorConflictException, + "DataAlreadyAcceptedException": newErrorDataAlreadyAcceptedException, + "InvalidOperationException": newErrorInvalidOperationException, + "InvalidParameterException": newErrorInvalidParameterException, + "InvalidSequenceTokenException": newErrorInvalidSequenceTokenException, + "LimitExceededException": newErrorLimitExceededException, + "MalformedQueryException": newErrorMalformedQueryException, + "OperationAbortedException": newErrorOperationAbortedException, + "ResourceAlreadyExistsException": newErrorResourceAlreadyExistsException, + "ResourceNotFoundException": newErrorResourceNotFoundException, + "ServiceQuotaExceededException": newErrorServiceQuotaExceededException, + "ServiceUnavailableException": newErrorServiceUnavailableException, + "SessionStreamingException": newErrorSessionStreamingException, + "SessionTimeoutException": newErrorSessionTimeoutException, + "ThrottlingException": newErrorThrottlingException, + "TooManyTagsException": newErrorTooManyTagsException, + "UnrecognizedClientException": newErrorUnrecognizedClientException, + "ValidationException": newErrorValidationException, +} diff --git a/sdk/service/cloudwatchlogs/integ_test.go b/sdk/service/cloudwatchlogs/integ_test.go new file mode 100644 index 0000000000..4fe858c27e --- /dev/null +++ b/sdk/service/cloudwatchlogs/integ_test.go @@ -0,0 +1,67 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +//go:build go1.16 && integration +// +build go1.16,integration + +package cloudwatchlogs_test + +import ( + "context" + "testing" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/awstesting/integration" + "github.com/aws/aws-sdk-go/service/cloudwatchlogs" +) + +var _ aws.Config +var _ awserr.Error +var _ request.Request + +func TestInteg_00_DescribeLogGroups(t *testing.T) { + ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second) + defer cancelFn() + + sess := integration.SessionWithDefaultRegion("us-west-2") + svc := cloudwatchlogs.New(sess) + params := &cloudwatchlogs.DescribeLogGroupsInput{} + _, err := svc.DescribeLogGroupsWithContext(ctx, params, func(r *request.Request) { + r.Handlers.Validate.RemoveByName("core.ValidateParametersHandler") + }) + if err != nil { + t.Errorf("expect no error, got %v", err) + } +} +func TestInteg_01_GetLogEvents(t *testing.T) { + ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second) + defer cancelFn() + + sess := integration.SessionWithDefaultRegion("us-west-2") + svc := cloudwatchlogs.New(sess) + params := &cloudwatchlogs.GetLogEventsInput{ + LogGroupName: aws.String("fakegroup"), + LogStreamName: aws.String("fakestream"), + } + _, err := svc.GetLogEventsWithContext(ctx, params, func(r *request.Request) { + r.Handlers.Validate.RemoveByName("core.ValidateParametersHandler") + }) + if err == nil { + t.Fatalf("expect request to fail") + } + aerr, ok := err.(awserr.RequestFailure) + if !ok { + t.Fatalf("expect awserr, was %T", err) + } + if len(aerr.Code()) == 0 { + t.Errorf("expect non-empty error code") + } + if len(aerr.Message()) == 0 { + t.Errorf("expect non-empty error message") + } + if v := aerr.Code(); v == request.ErrCodeSerialization { + t.Errorf("expect API error code got serialization failure") + } +} diff --git a/sdk/service/cloudwatchlogs/service.go b/sdk/service/cloudwatchlogs/service.go new file mode 100644 index 0000000000..180b8da3b9 --- /dev/null +++ b/sdk/service/cloudwatchlogs/service.go @@ -0,0 +1,112 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudwatchlogs + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" + v4 "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" +) + +// 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. +// +// 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 +} + +// Used for custom client initialization logic +var initClient func(*client.Client) + +// Used for custom request initialization logic +var initRequest func(*request.Request) + +// Service information constants +const ( + ServiceName = "logs" // Name of service. + EndpointsID = ServiceName // ID to lookup a service endpoint with. + ServiceID = "CloudWatch Logs" // ServiceID is a unique identifier of a specific service. +) + +// New creates a new instance of the CloudWatchLogs client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// +// mySession := session.Must(session.NewSession()) +// +// // Create a CloudWatchLogs client from just a session. +// svc := cloudwatchlogs.New(mySession) +// +// // Create a CloudWatchLogs client with additional configuration +// svc := cloudwatchlogs.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudWatchLogs { + c := p.ClientConfig(EndpointsID, cfgs...) + if c.SigningNameDerived || len(c.SigningName) == 0 { + c.SigningName = EndpointsID + // No Fallback + } + return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *CloudWatchLogs { + svc := &CloudWatchLogs{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + ServiceID: ServiceID, + SigningName: signingName, + SigningRegion: signingRegion, + PartitionID: partitionID, + Endpoint: endpoint, + APIVersion: "2014-03-28", + ResolvedRegion: resolvedRegion, + JSONVersion: "1.1", + TargetPrefix: "Logs_20140328", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed( + protocol.NewUnmarshalErrorHandler(jsonrpc.NewUnmarshalTypedError(exceptionFromCode)).NamedHandler(), + ) + + svc.Handlers.BuildStream.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.UnmarshalStream.PushBackNamed(jsonrpc.UnmarshalHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) + } + + return svc +} + +// newRequest creates a new request for a CloudWatchLogs operation and runs any +// custom request initialization. +func (c *CloudWatchLogs) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(req) + } + + return req +} diff --git a/service/defaultcomponents/components.go b/service/defaultcomponents/components.go index 0645b40bc6..9fc9661522 100644 --- a/service/defaultcomponents/components.go +++ b/service/defaultcomponents/components.go @@ -42,6 +42,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/debugexporter" + "go.opentelemetry.io/collector/exporter/nopexporter" "go.opentelemetry.io/collector/extension" "go.opentelemetry.io/collector/extension/ballastextension" "go.opentelemetry.io/collector/extension/zpagesextension" @@ -50,11 +51,15 @@ import ( "go.opentelemetry.io/collector/processor/batchprocessor" "go.opentelemetry.io/collector/processor/memorylimiterprocessor" "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/nopreceiver" "go.opentelemetry.io/collector/receiver/otlpreceiver" "github.com/aws/amazon-cloudwatch-agent/extension/agenthealth" + "github.com/aws/amazon-cloudwatch-agent/extension/entitystore" + "github.com/aws/amazon-cloudwatch-agent/extension/server" "github.com/aws/amazon-cloudwatch-agent/plugins/outputs/cloudwatch" "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsapplicationsignals" + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity" "github.com/aws/amazon-cloudwatch-agent/plugins/processors/ec2tagger" "github.com/aws/amazon-cloudwatch-agent/plugins/processors/gpuattributes" "github.com/aws/amazon-cloudwatch-agent/processor/rollupprocessor" @@ -72,6 +77,7 @@ func Factories() (otelcol.Factories, error) { jaegerreceiver.NewFactory(), jmxreceiver.NewFactory(), kafkareceiver.NewFactory(), + nopreceiver.NewFactory(), otlpreceiver.NewFactory(), prometheusreceiver.NewFactory(), statsdreceiver.NewFactory(), @@ -85,6 +91,7 @@ func Factories() (otelcol.Factories, error) { if factories.Processors, err = processor.MakeFactoryMap( attributesprocessor.NewFactory(), awsapplicationsignals.NewFactory(), + awsentity.NewFactory(), batchprocessor.NewFactory(), cumulativetodeltaprocessor.NewFactory(), deltatorateprocessor.NewFactory(), @@ -113,6 +120,7 @@ func Factories() (otelcol.Factories, error) { awsxrayexporter.NewFactory(), cloudwatch.NewFactory(), debugexporter.NewFactory(), + nopexporter.NewFactory(), prometheusremotewriteexporter.NewFactory(), ); err != nil { return otelcol.Factories{}, err @@ -121,6 +129,8 @@ func Factories() (otelcol.Factories, error) { if factories.Extensions, err = extension.MakeFactoryMap( agenthealth.NewFactory(), awsproxy.NewFactory(), + entitystore.NewFactory(), + server.NewFactory(), ballastextension.NewFactory(), ecsobserver.NewFactory(), filestorage.NewFactory(), diff --git a/service/defaultcomponents/components_test.go b/service/defaultcomponents/components_test.go index 68fd233249..e912749dfa 100644 --- a/service/defaultcomponents/components_test.go +++ b/service/defaultcomponents/components_test.go @@ -24,6 +24,7 @@ func TestComponents(t *testing.T) { "jaeger", "jmx", "kafka", + "nop", "otlp", "prometheus", "statsd", @@ -39,6 +40,7 @@ func TestComponents(t *testing.T) { wantProcessors := []string{ "awsapplicationsignals", + "awsentity", "attributes", "batch", "cumulativetodelta", @@ -71,6 +73,7 @@ func TestComponents(t *testing.T) { "awscloudwatch", "awsxray", "debug", + "nop", "prometheusremotewrite", } gotExporters := collections.MapSlice(maps.Keys(factories.Exporters), component.Type.String) @@ -83,10 +86,12 @@ func TestComponents(t *testing.T) { "agenthealth", "awsproxy", "ecs_observer", + "entitystore", "file_storage", "health_check", "memory_ballast", "pprof", + "server", "sigv4auth", "zpages", } diff --git a/translator/config/schema.json b/translator/config/schema.json index 0d091cb8a7..17488bf591 100644 --- a/translator/config/schema.json +++ b/translator/config/schema.json @@ -52,6 +52,18 @@ "omit_hostname": { "description": "Hostname will be tagged by default unless you specifying append_dimensions, this flag allow you to omit hostname from tags without specifying append_dimensions", "type": "boolean" + }, + "service.name": { + "description": "The name of the service to associate with the telemetry produced by the agent.", + "type": "string", + "minLength": 1, + "maxLength": 255 + }, + "deployment.environment": { + "description": "The name of the environment to associate with the telemetry produced by the agent.", + "type": "string", + "minLength": 1, + "maxLength": 259 } }, "additionalProperties": true @@ -170,6 +182,16 @@ "endpoint_override": { "description": "The override endpoint to use to access cloudwatch", "$ref": "#/definitions/endpointOverrideDefinition" + }, + "service.name": { + "type": "string", + "minLength": 1, + "maxLength": 4096 + }, + "deployment.environment": { + "type": "string", + "minLength": 1, + "maxLength": 4096 } }, "additionalProperties": false, @@ -251,6 +273,16 @@ "items": { "type": "string" }, "minItems": 1, "uniqueItems": true + }, + "service.name": { + "type": "string", + "minLength": 1, + "maxLength": 4096 + }, + "deployment.environment": { + "type": "string", + "minLength": 1, + "maxLength": 4096 } }, "additionalProperties": false @@ -364,6 +396,16 @@ "items": { "type": "string" }, "minItems": 1, "uniqueItems": true + }, + "service.name": { + "type": "string", + "minLength": 1, + "maxLength": 4096 + }, + "deployment.environment": { + "type": "string", + "minLength": 1, + "maxLength": 4096 } }, "additionalProperties": false @@ -827,6 +869,18 @@ "endpoint_override": { "description": "The override endpoint to use to access cloudwatch logs", "$ref": "#/definitions/endpointOverrideDefinition" + }, + "service.name": { + "description": "The name of the service to associate with the telemetry produced by the agent.", + "type": "string", + "minLength": 1, + "maxLength": 255 + }, + "deployment.environment": { + "description": "The name of the environment to associate with the telemetry produced by the agent.", + "type": "string", + "minLength": 1, + "maxLength": 259 } }, "additionalProperties": false, @@ -907,6 +961,18 @@ "items": { "$ref": "#/definitions/logsDefinition/definitions/filterDefinition" } + }, + "service.name": { + "description": "The name of the service to associate with the telemetry produced by the agent.", + "type": "string", + "minLength": 1, + "maxLength": 255 + }, + "deployment.environment": { + "description": "The name of the environment to associate with the telemetry produced by the agent.", + "type": "string", + "minLength": 1, + "maxLength": 259 } }, "required": [ diff --git a/translator/processRuleToApplyAndMerge.go b/translator/processRuleToApplyAndMerge.go new file mode 100644 index 0000000000..267f8de1dd --- /dev/null +++ b/translator/processRuleToApplyAndMerge.go @@ -0,0 +1,20 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package translator + +import ( + "golang.org/x/exp/maps" +) + +func ProcessRuleToMergeAndApply(input interface{}, childRule map[string]Rule, result map[string]interface{}) map[string]interface{} { + for _, rule := range childRule { + key, val := rule.ApplyRule(input) + if _, ok := result[key]; ok { + maps.Copy(result[key].(map[string]interface{}), val.(map[string]interface{})) + } else if key != "" { + result[key] = val + } + } + return result +} diff --git a/translator/tocwconfig/sampleConfig/advanced_config_darwin.yaml b/translator/tocwconfig/sampleConfig/advanced_config_darwin.yaml index c4879f7d62..64d81aaa17 100644 --- a/translator/tocwconfig/sampleConfig/advanced_config_darwin.yaml +++ b/translator/tocwconfig/sampleConfig/advanced_config_darwin.yaml @@ -17,7 +17,13 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 cumulativetodelta/hostDeltaMetrics: exclude: match_type: strict @@ -65,22 +71,25 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger receivers: + - telegraf_disk - telegraf_netstat - telegraf_swap - telegraf_cpu - - telegraf_disk - telegraf_mem metrics/hostDeltaMetrics: exporters: - awscloudwatch processors: + - awsentity/resource - cumulativetodelta/hostDeltaMetrics - ec2tagger receivers: diff --git a/translator/tocwconfig/sampleConfig/advanced_config_linux.yaml b/translator/tocwconfig/sampleConfig/advanced_config_linux.yaml index 152b8a77e5..b202e49fd9 100644 --- a/translator/tocwconfig/sampleConfig/advanced_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/advanced_config_linux.yaml @@ -17,7 +17,13 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 cumulativetodelta/hostDeltaMetrics: exclude: match_type: strict @@ -32,9 +38,9 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - InstanceType - ImageId - InstanceId - - InstanceType imds_retries: 1 refresh_interval_seconds: 0s receivers: @@ -73,11 +79,13 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger receivers: - telegraf_cpu @@ -91,6 +99,7 @@ service: exporters: - awscloudwatch processors: + - awsentity/resource - cumulativetodelta/hostDeltaMetrics - ec2tagger receivers: diff --git a/translator/tocwconfig/sampleConfig/advanced_config_windows.yaml b/translator/tocwconfig/sampleConfig/advanced_config_windows.yaml index 593e47e806..0b7068462e 100644 --- a/translator/tocwconfig/sampleConfig/advanced_config_windows.yaml +++ b/translator/tocwconfig/sampleConfig/advanced_config_windows.yaml @@ -17,14 +17,20 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 ec2tagger: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - ImageId - InstanceId - InstanceType - - ImageId imds_retries: 1 refresh_interval_seconds: 0s receivers: @@ -66,20 +72,22 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger receivers: - - telegraf_win_perf_counters/3446270237 - - telegraf_win_perf_counters/3762679655 - - telegraf_win_perf_counters/2073218482 - telegraf_win_perf_counters/2039663244 - telegraf_win_perf_counters/4283769065 - telegraf_win_perf_counters/1492679118 - telegraf_win_perf_counters/3610923661 + - telegraf_win_perf_counters/3446270237 + - telegraf_win_perf_counters/3762679655 + - telegraf_win_perf_counters/2073218482 telemetry: logs: development: false diff --git a/translator/tocwconfig/sampleConfig/amp_config_linux.yaml b/translator/tocwconfig/sampleConfig/amp_config_linux.yaml index edb8ef8a22..d32905f7ca 100644 --- a/translator/tocwconfig/sampleConfig/amp_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/amp_config_linux.yaml @@ -71,11 +71,17 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 sigv4auth: assume_role: sts_region: us-west-2 region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 batch/host/amp: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -121,11 +127,13 @@ service: extensions: - agenthealth/metrics - sigv4auth + - entitystore pipelines: metrics/host/cloudwatch: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger - transform receivers: diff --git a/translator/tocwconfig/sampleConfig/appsignals_and_eks_config.yaml b/translator/tocwconfig/sampleConfig/appsignals_and_eks_config.yaml index 0993f8e186..06d6e36b8d 100644 --- a/translator/tocwconfig/sampleConfig/appsignals_and_eks_config.yaml +++ b/translator/tocwconfig/sampleConfig/appsignals_and_eks_config.yaml @@ -285,6 +285,15 @@ extensions: region: us-east-1 role_arn: "" service_name: "" + entitystore: + mode: ec2 + region: us-east-1 + kubernetes_mode: EKS + server: + listen_addr: :4311 + tls_ca_path: "/etc/amazon-cloudwatch-observability-agent-client-cert/tls-ca.crt" + tls_cert_path: "/etc/amazon-cloudwatch-observability-agent-server-cert/server.crt" + tls_key_path: "/etc/amazon-cloudwatch-observability-agent-server-cert/server.key" processors: awsapplicationsignals: limiter: @@ -296,6 +305,11 @@ processors: resolvers: - name: TestCluster platform: eks + awsentity/service/application_signals: + cluster_name: TestCluster + entity_type: Service + kubernetes_mode: EKS + platform: ec2 batch/containerinsights: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -661,11 +675,14 @@ service: - awsproxy/application_signals - agenthealth/traces - agenthealth/logs + - entitystore + - server pipelines: metrics/application_signals: exporters: - awsemf/application_signals processors: + - awsentity/service/application_signals - resourcedetection - awsapplicationsignals receivers: diff --git a/translator/tocwconfig/sampleConfig/appsignals_and_k8s_config.yaml b/translator/tocwconfig/sampleConfig/appsignals_and_k8s_config.yaml index d66ab2f1ba..6bf6b6a7d9 100644 --- a/translator/tocwconfig/sampleConfig/appsignals_and_k8s_config.yaml +++ b/translator/tocwconfig/sampleConfig/appsignals_and_k8s_config.yaml @@ -286,6 +286,15 @@ extensions: region: us-east-1 role_arn: "" service_name: "" + entitystore: + mode: ec2 + region: us-east-1 + kubernetes_mode: K8sEC2 + server: + listen_addr: :4311 + tls_ca_path: "/etc/amazon-cloudwatch-observability-agent-client-cert/tls-ca.crt" + tls_cert_path: "/etc/amazon-cloudwatch-observability-agent-server-cert/server.crt" + tls_key_path: "/etc/amazon-cloudwatch-observability-agent-server-cert/server.key" processors: awsapplicationsignals: limiter: @@ -295,8 +304,13 @@ processors: log_dropped_metrics: true rotation_interval: 10m0s resolvers: - - name: TestCluster - platform: k8s + - name: TestCluster + platform: k8s + awsentity/service/application_signals: + cluster_name: TestCluster + entity_type: Service + kubernetes_mode: K8sEC2 + platform: ec2 batch/containerinsights: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -642,11 +656,14 @@ service: - awsproxy/application_signals - agenthealth/traces - agenthealth/logs + - entitystore + - server pipelines: metrics/application_signals: exporters: - awsemf/application_signals processors: + - awsentity/service/application_signals - resourcedetection - awsapplicationsignals receivers: diff --git a/translator/tocwconfig/sampleConfig/appsignals_fallback_and_eks_config.yaml b/translator/tocwconfig/sampleConfig/appsignals_fallback_and_eks_config.yaml index 0993f8e186..ed0f4d5b50 100644 --- a/translator/tocwconfig/sampleConfig/appsignals_fallback_and_eks_config.yaml +++ b/translator/tocwconfig/sampleConfig/appsignals_fallback_and_eks_config.yaml @@ -1,703 +1,720 @@ exporters: - awsemf/application_signals: - certificate_file_path: "" - detailed_metrics: false - dimension_rollup_option: NoDimensionRollup - disable_metric_extraction: false - eks_fargate_container_insights_enabled: false - endpoint: https://fake_endpoint - enhanced_container_insights: false - imds_retries: 1 - local_mode: false - log_group_name: /aws/application-signals/data - log_retention: 0 - log_stream_name: "" - max_retries: 2 - metric_declarations: - - dimensions: - - - Environment - - Operation - - Service - - - Environment - - Service - label_matchers: - - label_names: - - Telemetry.Source - regex: ^(ServerSpan|LocalRootSpan)$ - separator: ; - metric_name_selectors: - - Latency - - Fault - - Error - - dimensions: - - - Environment - - Operation - - RemoteEnvironment - - RemoteOperation - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - Environment - - Operation - - RemoteEnvironment - - RemoteOperation - - RemoteService - - Service - - - Environment - - Operation - - RemoteOperation - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - Environment - - Operation - - RemoteOperation - - RemoteService - - Service - - - Environment - - RemoteEnvironment - - RemoteService - - Service - - - Environment - - RemoteService - - Service - - - Environment - - RemoteEnvironment - - RemoteOperation - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - Environment - - RemoteEnvironment - - RemoteOperation - - RemoteService - - Service - - - Environment - - RemoteOperation - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - Environment - - RemoteOperation - - RemoteService - - Service - - - Environment - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - - RemoteService - label_matchers: - - label_names: - - Telemetry.Source - regex: ^(ClientSpan|ProducerSpan|ConsumerSpan)$ - separator: ; - metric_name_selectors: - - Latency - - Fault - - Error - middleware: agenthealth/logs - namespace: ApplicationSignals - no_verify_ssl: false - num_workers: 8 - output_destination: cloudwatch - profile: "" - proxy_address: "" - region: us-east-1 - request_timeout_seconds: 30 - resource_arn: "" - resource_to_telemetry_conversion: - enabled: false - retain_initial_value_of_delta_metric: false - role_arn: "" - version: "1" - awsemf/containerinsights: - certificate_file_path: "" - detailed_metrics: false - dimension_rollup_option: NoDimensionRollup - disable_metric_extraction: true - eks_fargate_container_insights_enabled: false - endpoint: https://fake_endpoint - enhanced_container_insights: false - imds_retries: 1 - local_mode: false - log_group_name: /aws/containerinsights/{ClusterName}/performance - log_retention: 0 - log_stream_name: '{NodeName}' - max_retries: 2 - metric_declarations: - - dimensions: - - - ClusterName - - Namespace - - PodName - - - ClusterName - - - ClusterName - - Namespace - - Service - - - ClusterName - - Namespace - metric_name_selectors: - - pod_cpu_utilization - - pod_memory_utilization - - pod_network_rx_bytes - - pod_network_tx_bytes - - pod_cpu_utilization_over_pod_limit - - pod_memory_utilization_over_pod_limit - - dimensions: - - - ClusterName - - Namespace - - PodName - metric_name_selectors: - - pod_number_of_container_restarts - - dimensions: - - - ClusterName - - Namespace - - PodName - - - ClusterName - metric_name_selectors: - - pod_cpu_reserved_capacity - - pod_memory_reserved_capacity - - dimensions: - - - ClusterName - - InstanceId - - NodeName - - - ClusterName - metric_name_selectors: - - node_cpu_utilization - - node_memory_utilization - - node_network_total_bytes - - node_cpu_reserved_capacity - - node_memory_reserved_capacity - - node_number_of_running_pods - - node_number_of_running_containers - - dimensions: - - - ClusterName - metric_name_selectors: - - node_cpu_usage_total - - node_cpu_limit - - node_memory_working_set - - node_memory_limit - - dimensions: - - - ClusterName - - InstanceId - - NodeName - - - ClusterName - metric_name_selectors: - - node_filesystem_utilization - - dimensions: - - - ClusterName - - Namespace - - Service - - - ClusterName - metric_name_selectors: - - service_number_of_running_pods - - dimensions: - - - ClusterName - - Namespace - - - ClusterName - metric_name_selectors: - - namespace_number_of_running_pods - - dimensions: - - - ClusterName - metric_name_selectors: - - cluster_node_count - - cluster_failed_node_count - middleware: agenthealth/logs - namespace: ContainerInsights - no_verify_ssl: false - num_workers: 8 - output_destination: cloudwatch - parse_json_encoded_attr_values: - - Sources - - kubernetes - profile: "" - proxy_address: "" - region: us-east-1 - request_timeout_seconds: 30 - resource_arn: "" - resource_to_telemetry_conversion: - enabled: true - retain_initial_value_of_delta_metric: false - role_arn: "" - version: "0" - awsxray/application_signals: - certificate_file_path: "" - endpoint: "" - imds_retries: 1 - index_all_attributes: false - indexed_attributes: - - aws.local.service - - aws.local.operation - - aws.local.environment - - aws.remote.service - - aws.remote.operation - - aws.remote.environment - - aws.remote.resource.identifier - - aws.remote.resource.type - local_mode: false - max_retries: 2 - middleware: agenthealth/traces - no_verify_ssl: false - num_workers: 8 - profile: "" - proxy_address: "" - region: us-east-1 - request_timeout_seconds: 30 - resource_arn: "" - role_arn: "" - telemetry: - enabled: true - include_metadata: true + awsemf/application_signals: + certificate_file_path: "" + detailed_metrics: false + dimension_rollup_option: NoDimensionRollup + disable_metric_extraction: false + eks_fargate_container_insights_enabled: false + endpoint: https://fake_endpoint + enhanced_container_insights: false + imds_retries: 1 + local_mode: false + log_group_name: /aws/application-signals/data + log_retention: 0 + log_stream_name: "" + max_retries: 2 + metric_declarations: + - dimensions: + - - Environment + - Operation + - Service + - - Environment + - Service + label_matchers: + - label_names: + - Telemetry.Source + regex: ^(ServerSpan|LocalRootSpan)$ + separator: ; + metric_name_selectors: + - Latency + - Fault + - Error + - dimensions: + - - Environment + - Operation + - RemoteEnvironment + - RemoteOperation + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - Environment + - Operation + - RemoteEnvironment + - RemoteOperation + - RemoteService + - Service + - - Environment + - Operation + - RemoteOperation + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - Environment + - Operation + - RemoteOperation + - RemoteService + - Service + - - Environment + - RemoteEnvironment + - RemoteService + - Service + - - Environment + - RemoteService + - Service + - - Environment + - RemoteEnvironment + - RemoteOperation + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - Environment + - RemoteEnvironment + - RemoteOperation + - RemoteService + - Service + - - Environment + - RemoteOperation + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - Environment + - RemoteOperation + - RemoteService + - Service + - - Environment + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - - RemoteService + label_matchers: + - label_names: + - Telemetry.Source + regex: ^(ClientSpan|ProducerSpan|ConsumerSpan)$ + separator: ; + metric_name_selectors: + - Latency + - Fault + - Error + middleware: agenthealth/logs + namespace: ApplicationSignals + no_verify_ssl: false + num_workers: 8 + output_destination: cloudwatch + profile: "" + proxy_address: "" + region: us-east-1 + request_timeout_seconds: 30 + resource_arn: "" + resource_to_telemetry_conversion: + enabled: false + retain_initial_value_of_delta_metric: false + role_arn: "" + version: "1" + awsemf/containerinsights: + certificate_file_path: "" + detailed_metrics: false + dimension_rollup_option: NoDimensionRollup + disable_metric_extraction: true + eks_fargate_container_insights_enabled: false + endpoint: https://fake_endpoint + enhanced_container_insights: false + imds_retries: 1 + local_mode: false + log_group_name: /aws/containerinsights/{ClusterName}/performance + log_retention: 0 + log_stream_name: '{NodeName}' + max_retries: 2 + metric_declarations: + - dimensions: + - - ClusterName + - Namespace + - PodName + - - ClusterName + - - ClusterName + - Namespace + - Service + - - ClusterName + - Namespace + metric_name_selectors: + - pod_cpu_utilization + - pod_memory_utilization + - pod_network_rx_bytes + - pod_network_tx_bytes + - pod_cpu_utilization_over_pod_limit + - pod_memory_utilization_over_pod_limit + - dimensions: + - - ClusterName + - Namespace + - PodName + metric_name_selectors: + - pod_number_of_container_restarts + - dimensions: + - - ClusterName + - Namespace + - PodName + - - ClusterName + metric_name_selectors: + - pod_cpu_reserved_capacity + - pod_memory_reserved_capacity + - dimensions: + - - ClusterName + - InstanceId + - NodeName + - - ClusterName + metric_name_selectors: + - node_cpu_utilization + - node_memory_utilization + - node_network_total_bytes + - node_cpu_reserved_capacity + - node_memory_reserved_capacity + - node_number_of_running_pods + - node_number_of_running_containers + - dimensions: + - - ClusterName + metric_name_selectors: + - node_cpu_usage_total + - node_cpu_limit + - node_memory_working_set + - node_memory_limit + - dimensions: + - - ClusterName + - InstanceId + - NodeName + - - ClusterName + metric_name_selectors: + - node_filesystem_utilization + - dimensions: + - - ClusterName + - Namespace + - Service + - - ClusterName + metric_name_selectors: + - service_number_of_running_pods + - dimensions: + - - ClusterName + - Namespace + - - ClusterName + metric_name_selectors: + - namespace_number_of_running_pods + - dimensions: + - - ClusterName + metric_name_selectors: + - cluster_node_count + - cluster_failed_node_count + middleware: agenthealth/logs + namespace: ContainerInsights + no_verify_ssl: false + num_workers: 8 + output_destination: cloudwatch + parse_json_encoded_attr_values: + - Sources + - kubernetes + profile: "" + proxy_address: "" + region: us-east-1 + request_timeout_seconds: 30 + resource_arn: "" + resource_to_telemetry_conversion: + enabled: true + retain_initial_value_of_delta_metric: false + role_arn: "" + version: "0" + awsxray/application_signals: + certificate_file_path: "" + endpoint: "" + imds_retries: 1 + index_all_attributes: false + indexed_attributes: + - aws.local.service + - aws.local.operation + - aws.local.environment + - aws.remote.service + - aws.remote.operation + - aws.remote.environment + - aws.remote.resource.identifier + - aws.remote.resource.type + local_mode: false + max_retries: 2 + middleware: agenthealth/traces + no_verify_ssl: false + num_workers: 8 + profile: "" + proxy_address: "" + region: us-east-1 + request_timeout_seconds: 30 + resource_arn: "" + role_arn: "" + telemetry: + enabled: true + include_metadata: true extensions: - agenthealth/logs: - is_usage_data_enabled: true - stats: - operations: - - PutLogEvents - usage_flags: - mode: EKS - region_type: ACJ - agenthealth/traces: - is_usage_data_enabled: true - stats: - operations: - - PutTraceSegments - usage_flags: - mode: EKS - region_type: ACJ - awsproxy/application_signals: - aws_endpoint: "" - certificate_file_path: "" - dialer: - timeout: 0s - endpoint: 0.0.0.0:2000 - imds_retries: 1 - local_mode: false - profile: "" - proxy_address: "" - region: us-east-1 - role_arn: "" - service_name: "" + agenthealth/logs: + is_usage_data_enabled: true + stats: + operations: + - PutLogEvents + usage_flags: + mode: EKS + region_type: ACJ + agenthealth/traces: + is_usage_data_enabled: true + stats: + operations: + - PutTraceSegments + usage_flags: + mode: EKS + region_type: ACJ + awsproxy/application_signals: + aws_endpoint: "" + certificate_file_path: "" + dialer: + timeout: "0s" + endpoint: 0.0.0.0:2000 + imds_retries: 1 + local_mode: false + profile: "" + proxy_address: "" + region: us-east-1 + service_name: "" + role_arn: "" + entitystore: + mode: ec2 + region: us-east-1 + kubernetes_mode: EKS + server: + listen_addr: :4311 + tls_ca_path: "/etc/amazon-cloudwatch-observability-agent-client-cert/tls-ca.crt" + tls_cert_path: "/etc/amazon-cloudwatch-observability-agent-server-cert/server.crt" + tls_key_path: "/etc/amazon-cloudwatch-observability-agent-server-cert/server.key" processors: - awsapplicationsignals: - limiter: - disabled: false - drop_threshold: 500 - garbage_collection_interval: 10m0s - log_dropped_metrics: true - rotation_interval: 10m0s - resolvers: - - name: TestCluster - platform: eks - batch/containerinsights: - metadata_cardinality_limit: 1000 - send_batch_max_size: 0 - send_batch_size: 8192 - timeout: 5s - resourcedetection: - aks: - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - k8s.cluster.name: - enabled: false - azure: - resource_attributes: - azure.resourcegroup.name: - enabled: true - azure.vm.name: - enabled: true - azure.vm.scaleset.name: - enabled: true - azure.vm.size: - enabled: true - cloud.account.id: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - host.id: - enabled: true - host.name: - enabled: true - tags: [] - compression: "" - consul: - address: "" - datacenter: "" - namespace: "" - resource_attributes: - cloud.region: - enabled: true - host.id: - enabled: true - host.name: - enabled: true - token_file: "" - detectors: - - eks - - env - - ec2 - disable_keep_alives: false - docker: - resource_attributes: - host.name: - enabled: true - os.type: - enabled: true - ec2: - resource_attributes: - cloud.account.id: - enabled: true - cloud.availability_zone: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - host.id: - enabled: true - host.image.id: - enabled: true - host.name: - enabled: true - host.type: - enabled: true - tags: - - ^kubernetes.io/cluster/.*$ - - ^aws:autoscaling:groupName - ecs: - resource_attributes: - aws.ecs.cluster.arn: - enabled: true - aws.ecs.launchtype: - enabled: true - aws.ecs.task.arn: - enabled: true - aws.ecs.task.family: - enabled: true - aws.ecs.task.id: - enabled: true - aws.ecs.task.revision: - enabled: true - aws.log.group.arns: - enabled: true - aws.log.group.names: - enabled: true - aws.log.stream.arns: - enabled: true - aws.log.stream.names: - enabled: true - cloud.account.id: - enabled: true - cloud.availability_zone: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - eks: - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - k8s.cluster.name: - enabled: false - elasticbeanstalk: - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - deployment.environment: - enabled: true - service.instance.id: - enabled: true - service.version: - enabled: true - endpoint: "" - gcp: - resource_attributes: - cloud.account.id: - enabled: true - cloud.availability_zone: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - faas.id: - enabled: true - faas.instance: - enabled: true - faas.name: - enabled: true - faas.version: - enabled: true - gcp.cloud_run.job.execution: - enabled: true - gcp.cloud_run.job.task_index: - enabled: true - gcp.gce.instance.hostname: - enabled: false - gcp.gce.instance.name: - enabled: false - host.id: - enabled: true - host.name: - enabled: true - host.type: - enabled: true - k8s.cluster.name: - enabled: true - heroku: - resource_attributes: - cloud.provider: - enabled: true - heroku.app.id: - enabled: true - heroku.dyno.id: - enabled: true - heroku.release.commit: - enabled: true - heroku.release.creation_timestamp: - enabled: true - service.instance.id: - enabled: true - service.name: - enabled: true - service.version: - enabled: true - http2_ping_timeout: 0s - http2_read_idle_timeout: 0s - idle_conn_timeout: 1m30s - k8snode: - auth_type: serviceAccount - context: "" - kube_config_path: "" - node_from_env_var: "" - resource_attributes: - k8s.node.name: - enabled: true - k8s.node.uid: - enabled: true - lambda: - resource_attributes: - aws.log.group.names: - enabled: true - aws.log.stream.names: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - faas.instance: - enabled: true - faas.max_memory: - enabled: true - faas.name: - enabled: true - faas.version: - enabled: true - max_idle_conns: 100 - openshift: - address: "" - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - k8s.cluster.name: - enabled: true - tls: - ca_file: "" - cert_file: "" - include_system_ca_certs_pool: false - insecure: false - insecure_skip_verify: false - key_file: "" - max_version: "" - min_version: "" - reload_interval: 0s - server_name_override: "" - token: "" - override: true - proxy_url: "" - read_buffer_size: 0 - system: - resource_attributes: - host.arch: - enabled: false - host.cpu.cache.l2.size: - enabled: false - host.cpu.family: - enabled: false - host.cpu.model.id: - enabled: false - host.cpu.model.name: - enabled: false - host.cpu.stepping: - enabled: false - host.cpu.vendor.id: - enabled: false - host.id: - enabled: false - host.ip: - enabled: false - host.mac: - enabled: false - host.name: - enabled: true - os.description: - enabled: false - os.type: - enabled: true - timeout: 2s + awsapplicationsignals: + limiter: + disabled: false + drop_threshold: 500 + garbage_collection_interval: 10m0s + log_dropped_metrics: true + rotation_interval: 10m0s + resolvers: + - name: TestCluster + platform: eks + awsentity/service/application_signals: + cluster_name: TestCluster + entity_type: Service + kubernetes_mode: EKS + platform: ec2 + batch/containerinsights: + metadata_cardinality_limit: 1000 + send_batch_max_size: 0 + send_batch_size: 8192 + timeout: 5s + resourcedetection: + aks: + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + k8s.cluster.name: + enabled: false + azure: + resource_attributes: + azure.resourcegroup.name: + enabled: true + azure.vm.name: + enabled: true + azure.vm.scaleset.name: + enabled: true + azure.vm.size: + enabled: true + cloud.account.id: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + host.id: + enabled: true + host.name: + enabled: true + tags: [] + compression: "" + consul: + address: "" + datacenter: "" + namespace: "" + resource_attributes: + cloud.region: + enabled: true + host.id: + enabled: true + host.name: + enabled: true + token_file: "" + detectors: + - eks + - env + - ec2 + disable_keep_alives: false + docker: + resource_attributes: + host.name: + enabled: true + os.type: + enabled: true + ec2: + resource_attributes: + cloud.account.id: + enabled: true + cloud.availability_zone: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + host.id: + enabled: true + host.image.id: + enabled: true + host.name: + enabled: true + host.type: + enabled: true + tags: + - ^kubernetes.io/cluster/.*$ + - ^aws:autoscaling:groupName + ecs: + resource_attributes: + aws.ecs.cluster.arn: + enabled: true + aws.ecs.launchtype: + enabled: true + aws.ecs.task.arn: + enabled: true + aws.ecs.task.family: + enabled: true + aws.ecs.task.id: + enabled: true + aws.ecs.task.revision: + enabled: true + aws.log.group.arns: + enabled: true + aws.log.group.names: + enabled: true + aws.log.stream.arns: + enabled: true + aws.log.stream.names: + enabled: true + cloud.account.id: + enabled: true + cloud.availability_zone: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + eks: + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + k8s.cluster.name: + enabled: false + elasticbeanstalk: + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + deployment.environment: + enabled: true + service.instance.id: + enabled: true + service.version: + enabled: true + endpoint: "" + gcp: + resource_attributes: + cloud.account.id: + enabled: true + cloud.availability_zone: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + faas.id: + enabled: true + faas.instance: + enabled: true + faas.name: + enabled: true + faas.version: + enabled: true + gcp.cloud_run.job.execution: + enabled: true + gcp.cloud_run.job.task_index: + enabled: true + gcp.gce.instance.hostname: + enabled: false + gcp.gce.instance.name: + enabled: false + host.id: + enabled: true + host.name: + enabled: true + host.type: + enabled: true + k8s.cluster.name: + enabled: true + heroku: + resource_attributes: + cloud.provider: + enabled: true + heroku.app.id: + enabled: true + heroku.dyno.id: + enabled: true + heroku.release.commit: + enabled: true + heroku.release.creation_timestamp: + enabled: true + service.instance.id: + enabled: true + service.name: + enabled: true + service.version: + enabled: true + http2_ping_timeout: "0s" + http2_read_idle_timeout: "0s" + idle_conn_timeout: 1m30s + k8snode: + auth_type: serviceAccount + context: "" + kube_config_path: "" + node_from_env_var: "" + resource_attributes: + k8s.node.name: + enabled: true + k8s.node.uid: + enabled: true + lambda: + resource_attributes: + aws.log.group.names: + enabled: true + aws.log.stream.names: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + faas.instance: + enabled: true + faas.max_memory: + enabled: true + faas.name: + enabled: true + faas.version: + enabled: true + max_idle_conns: 100 + openshift: + address: "" + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + k8s.cluster.name: + enabled: true + tls: + ca_file: "" + cert_file: "" + include_system_ca_certs_pool: false + insecure: false + insecure_skip_verify: false + key_file: "" + max_version: "" + min_version: "" + reload_interval: "0s" + server_name_override: "" + token: "" + override: true + proxy_url: "" + read_buffer_size: 0 + system: + resource_attributes: + host.arch: + enabled: false + host.cpu.cache.l2.size: + enabled: false + host.cpu.family: + enabled: false + host.cpu.model.id: + enabled: false + host.cpu.model.name: + enabled: false + host.cpu.stepping: + enabled: false + host.cpu.vendor.id: + enabled: false + host.id: + enabled: false + host.ip: + enabled: false + host.mac: + enabled: false + host.name: + enabled: true + os.description: + enabled: false + os.type: + enabled: true + timeout: 2s + tls: + ca_file: "" + cert_file: "" + include_system_ca_certs_pool: false + insecure: false + insecure_skip_verify: false + key_file: "" + max_version: "" + min_version: "" + reload_interval: "0s" + server_name_override: "" + write_buffer_size: 0 +receivers: + awscontainerinsightreceiver: + accelerated_compute_metrics: false + add_container_name_metric_label: false + add_full_pod_name_metric_label: false + add_service_as_attribute: true + certificate_file_path: "" + cluster_name: TestCluster + collection_interval: 30s + container_orchestrator: eks + enable_control_plane_metrics: false + endpoint: "" + host_ip: "" + host_name: "" + imds_retries: 1 + kube_config_path: "" + leader_lock_name: cwagent-clusterleader + leader_lock_using_config_map_only: true + local_mode: false + max_retries: 0 + no_verify_ssl: false + num_workers: 0 + prefer_full_pod_name: false + profile: "" + proxy_address: "" + region: us-east-1 + request_timeout_seconds: 0 + resource_arn: "" + role_arn: "" + otlp/application_signals: + protocols: + grpc: + endpoint: 0.0.0.0:4315 + dialer: + timeout: "0s" + include_metadata: false + max_concurrent_streams: 0 + max_recv_msg_size_mib: 0 + read_buffer_size: 524288 tls: - ca_file: "" - cert_file: "" - include_system_ca_certs_pool: false - insecure: false - insecure_skip_verify: false - key_file: "" - max_version: "" - min_version: "" - reload_interval: 0s - server_name_override: "" + ca_file: "" + cert_file: path/to/cert.crt + client_ca_file: "" + client_ca_file_reload: false + include_system_ca_certs_pool: false + key_file: path/to/key.key + max_version: "" + min_version: "" + reload_interval: 0s + transport: tcp write_buffer_size: 0 -receivers: - awscontainerinsightreceiver: - accelerated_compute_metrics: false - add_container_name_metric_label: false - add_full_pod_name_metric_label: false - add_service_as_attribute: true - certificate_file_path: "" - cluster_name: TestCluster - collection_interval: 30s - container_orchestrator: eks - enable_control_plane_metrics: false - endpoint: "" - host_ip: "" - host_name: "" - imds_retries: 1 - kube_config_path: "" - leader_lock_name: cwagent-clusterleader - leader_lock_using_config_map_only: true - local_mode: false - max_retries: 0 - no_verify_ssl: false - num_workers: 0 - prefer_full_pod_name: false - profile: "" - proxy_address: "" - region: us-east-1 - request_timeout_seconds: 0 - resource_arn: "" - role_arn: "" - otlp/application_signals: - protocols: - grpc: - dialer: - timeout: 0s - endpoint: 0.0.0.0:4315 - include_metadata: false - max_concurrent_streams: 0 - max_recv_msg_size_mib: 0 - read_buffer_size: 524288 - tls: - ca_file: "" - cert_file: path/to/cert.crt - client_ca_file: "" - client_ca_file_reload: false - include_system_ca_certs_pool: false - key_file: path/to/key.key - max_version: "" - min_version: "" - reload_interval: 0s - transport: tcp - write_buffer_size: 0 - http: - endpoint: 0.0.0.0:4316 - include_metadata: false - logs_url_path: /v1/logs - max_request_body_size: 0 - metrics_url_path: /v1/metrics - tls: - ca_file: "" - cert_file: path/to/cert.crt - client_ca_file: "" - client_ca_file_reload: false - include_system_ca_certs_pool: false - key_file: path/to/key.key - max_version: "" - min_version: "" - reload_interval: 0s - traces_url_path: /v1/traces + http: + endpoint: 0.0.0.0:4316 + include_metadata: false + logs_url_path: /v1/logs + max_request_body_size: 0 + metrics_url_path: /v1/metrics + tls: + ca_file: "" + cert_file: path/to/cert.crt + client_ca_file: "" + client_ca_file_reload: false + key_file: path/to/key.key + max_version: "" + min_version: "" + reload_interval: 0s + include_system_ca_certs_pool: false + traces_url_path: /v1/traces service: - extensions: - - awsproxy/application_signals - - agenthealth/traces - - agenthealth/logs - pipelines: - metrics/application_signals: - exporters: - - awsemf/application_signals - processors: - - resourcedetection - - awsapplicationsignals - receivers: - - otlp/application_signals - metrics/containerinsights: - exporters: - - awsemf/containerinsights - processors: - - batch/containerinsights - receivers: - - awscontainerinsightreceiver - traces/application_signals: - exporters: - - awsxray/application_signals - processors: - - resourcedetection - - awsapplicationsignals - receivers: - - otlp/application_signals - telemetry: - logs: - development: false - disable_caller: false - disable_stacktrace: false - encoding: console - level: info - sampling: - enabled: true - initial: 2 - thereafter: 500 - tick: 10s - metrics: - address: "" - level: None - traces: {} + extensions: + - awsproxy/application_signals + - agenthealth/traces + - agenthealth/logs + - entitystore + - server + pipelines: + metrics/application_signals: + exporters: + - awsemf/application_signals + processors: + - awsentity/service/application_signals + - resourcedetection + - awsapplicationsignals + receivers: + - otlp/application_signals + metrics/containerinsights: + exporters: + - awsemf/containerinsights + processors: + - batch/containerinsights + receivers: + - awscontainerinsightreceiver + traces/application_signals: + exporters: + - awsxray/application_signals + processors: + - resourcedetection + - awsapplicationsignals + receivers: + - otlp/application_signals + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: {} diff --git a/translator/tocwconfig/sampleConfig/appsignals_over_fallback_config.yaml b/translator/tocwconfig/sampleConfig/appsignals_over_fallback_config.yaml index 0993f8e186..f2e00bc52b 100644 --- a/translator/tocwconfig/sampleConfig/appsignals_over_fallback_config.yaml +++ b/translator/tocwconfig/sampleConfig/appsignals_over_fallback_config.yaml @@ -1,703 +1,720 @@ exporters: - awsemf/application_signals: - certificate_file_path: "" - detailed_metrics: false - dimension_rollup_option: NoDimensionRollup - disable_metric_extraction: false - eks_fargate_container_insights_enabled: false - endpoint: https://fake_endpoint - enhanced_container_insights: false - imds_retries: 1 - local_mode: false - log_group_name: /aws/application-signals/data - log_retention: 0 - log_stream_name: "" - max_retries: 2 - metric_declarations: - - dimensions: - - - Environment - - Operation - - Service - - - Environment - - Service - label_matchers: - - label_names: - - Telemetry.Source - regex: ^(ServerSpan|LocalRootSpan)$ - separator: ; - metric_name_selectors: - - Latency - - Fault - - Error - - dimensions: - - - Environment - - Operation - - RemoteEnvironment - - RemoteOperation - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - Environment - - Operation - - RemoteEnvironment - - RemoteOperation - - RemoteService - - Service - - - Environment - - Operation - - RemoteOperation - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - Environment - - Operation - - RemoteOperation - - RemoteService - - Service - - - Environment - - RemoteEnvironment - - RemoteService - - Service - - - Environment - - RemoteService - - Service - - - Environment - - RemoteEnvironment - - RemoteOperation - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - Environment - - RemoteEnvironment - - RemoteOperation - - RemoteService - - Service - - - Environment - - RemoteOperation - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - Environment - - RemoteOperation - - RemoteService - - Service - - - Environment - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - - RemoteService - label_matchers: - - label_names: - - Telemetry.Source - regex: ^(ClientSpan|ProducerSpan|ConsumerSpan)$ - separator: ; - metric_name_selectors: - - Latency - - Fault - - Error - middleware: agenthealth/logs - namespace: ApplicationSignals - no_verify_ssl: false - num_workers: 8 - output_destination: cloudwatch - profile: "" - proxy_address: "" - region: us-east-1 - request_timeout_seconds: 30 - resource_arn: "" - resource_to_telemetry_conversion: - enabled: false - retain_initial_value_of_delta_metric: false - role_arn: "" - version: "1" - awsemf/containerinsights: - certificate_file_path: "" - detailed_metrics: false - dimension_rollup_option: NoDimensionRollup - disable_metric_extraction: true - eks_fargate_container_insights_enabled: false - endpoint: https://fake_endpoint - enhanced_container_insights: false - imds_retries: 1 - local_mode: false - log_group_name: /aws/containerinsights/{ClusterName}/performance - log_retention: 0 - log_stream_name: '{NodeName}' - max_retries: 2 - metric_declarations: - - dimensions: - - - ClusterName - - Namespace - - PodName - - - ClusterName - - - ClusterName - - Namespace - - Service - - - ClusterName - - Namespace - metric_name_selectors: - - pod_cpu_utilization - - pod_memory_utilization - - pod_network_rx_bytes - - pod_network_tx_bytes - - pod_cpu_utilization_over_pod_limit - - pod_memory_utilization_over_pod_limit - - dimensions: - - - ClusterName - - Namespace - - PodName - metric_name_selectors: - - pod_number_of_container_restarts - - dimensions: - - - ClusterName - - Namespace - - PodName - - - ClusterName - metric_name_selectors: - - pod_cpu_reserved_capacity - - pod_memory_reserved_capacity - - dimensions: - - - ClusterName - - InstanceId - - NodeName - - - ClusterName - metric_name_selectors: - - node_cpu_utilization - - node_memory_utilization - - node_network_total_bytes - - node_cpu_reserved_capacity - - node_memory_reserved_capacity - - node_number_of_running_pods - - node_number_of_running_containers - - dimensions: - - - ClusterName - metric_name_selectors: - - node_cpu_usage_total - - node_cpu_limit - - node_memory_working_set - - node_memory_limit - - dimensions: - - - ClusterName - - InstanceId - - NodeName - - - ClusterName - metric_name_selectors: - - node_filesystem_utilization - - dimensions: - - - ClusterName - - Namespace - - Service - - - ClusterName - metric_name_selectors: - - service_number_of_running_pods - - dimensions: - - - ClusterName - - Namespace - - - ClusterName - metric_name_selectors: - - namespace_number_of_running_pods - - dimensions: - - - ClusterName - metric_name_selectors: - - cluster_node_count - - cluster_failed_node_count - middleware: agenthealth/logs - namespace: ContainerInsights - no_verify_ssl: false - num_workers: 8 - output_destination: cloudwatch - parse_json_encoded_attr_values: - - Sources - - kubernetes - profile: "" - proxy_address: "" - region: us-east-1 - request_timeout_seconds: 30 - resource_arn: "" - resource_to_telemetry_conversion: - enabled: true - retain_initial_value_of_delta_metric: false - role_arn: "" - version: "0" - awsxray/application_signals: - certificate_file_path: "" - endpoint: "" - imds_retries: 1 - index_all_attributes: false - indexed_attributes: - - aws.local.service - - aws.local.operation - - aws.local.environment - - aws.remote.service - - aws.remote.operation - - aws.remote.environment - - aws.remote.resource.identifier - - aws.remote.resource.type - local_mode: false - max_retries: 2 - middleware: agenthealth/traces - no_verify_ssl: false - num_workers: 8 - profile: "" - proxy_address: "" - region: us-east-1 - request_timeout_seconds: 30 - resource_arn: "" - role_arn: "" - telemetry: - enabled: true - include_metadata: true + awsemf/application_signals: + certificate_file_path: "" + detailed_metrics: false + dimension_rollup_option: NoDimensionRollup + disable_metric_extraction: false + eks_fargate_container_insights_enabled: false + endpoint: https://fake_endpoint + enhanced_container_insights: false + imds_retries: 1 + local_mode: false + log_group_name: /aws/application-signals/data + log_retention: 0 + log_stream_name: "" + max_retries: 2 + metric_declarations: + - dimensions: + - - Environment + - Operation + - Service + - - Environment + - Service + label_matchers: + - label_names: + - Telemetry.Source + regex: ^(ServerSpan|LocalRootSpan)$ + separator: ; + metric_name_selectors: + - Latency + - Fault + - Error + - dimensions: + - - Environment + - Operation + - RemoteEnvironment + - RemoteOperation + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - Environment + - Operation + - RemoteEnvironment + - RemoteOperation + - RemoteService + - Service + - - Environment + - Operation + - RemoteOperation + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - Environment + - Operation + - RemoteOperation + - RemoteService + - Service + - - Environment + - RemoteEnvironment + - RemoteService + - Service + - - Environment + - RemoteService + - Service + - - Environment + - RemoteEnvironment + - RemoteOperation + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - Environment + - RemoteEnvironment + - RemoteOperation + - RemoteService + - Service + - - Environment + - RemoteOperation + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - Environment + - RemoteOperation + - RemoteService + - Service + - - Environment + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - - RemoteService + label_matchers: + - label_names: + - Telemetry.Source + regex: ^(ClientSpan|ProducerSpan|ConsumerSpan)$ + separator: ; + metric_name_selectors: + - Latency + - Fault + - Error + middleware: agenthealth/logs + namespace: ApplicationSignals + no_verify_ssl: false + num_workers: 8 + output_destination: cloudwatch + profile: "" + proxy_address: "" + region: us-east-1 + request_timeout_seconds: 30 + resource_arn: "" + resource_to_telemetry_conversion: + enabled: false + retain_initial_value_of_delta_metric: false + role_arn: "" + version: "1" + awsemf/containerinsights: + certificate_file_path: "" + detailed_metrics: false + dimension_rollup_option: NoDimensionRollup + disable_metric_extraction: true + eks_fargate_container_insights_enabled: false + endpoint: https://fake_endpoint + enhanced_container_insights: false + imds_retries: 1 + local_mode: false + log_group_name: /aws/containerinsights/{ClusterName}/performance + log_retention: 0 + log_stream_name: '{NodeName}' + max_retries: 2 + metric_declarations: + - dimensions: + - - ClusterName + - Namespace + - PodName + - - ClusterName + - - ClusterName + - Namespace + - Service + - - ClusterName + - Namespace + metric_name_selectors: + - pod_cpu_utilization + - pod_memory_utilization + - pod_network_rx_bytes + - pod_network_tx_bytes + - pod_cpu_utilization_over_pod_limit + - pod_memory_utilization_over_pod_limit + - dimensions: + - - ClusterName + - Namespace + - PodName + metric_name_selectors: + - pod_number_of_container_restarts + - dimensions: + - - ClusterName + - Namespace + - PodName + - - ClusterName + metric_name_selectors: + - pod_cpu_reserved_capacity + - pod_memory_reserved_capacity + - dimensions: + - - ClusterName + - InstanceId + - NodeName + - - ClusterName + metric_name_selectors: + - node_cpu_utilization + - node_memory_utilization + - node_network_total_bytes + - node_cpu_reserved_capacity + - node_memory_reserved_capacity + - node_number_of_running_pods + - node_number_of_running_containers + - dimensions: + - - ClusterName + metric_name_selectors: + - node_cpu_usage_total + - node_cpu_limit + - node_memory_working_set + - node_memory_limit + - dimensions: + - - ClusterName + - InstanceId + - NodeName + - - ClusterName + metric_name_selectors: + - node_filesystem_utilization + - dimensions: + - - ClusterName + - Namespace + - Service + - - ClusterName + metric_name_selectors: + - service_number_of_running_pods + - dimensions: + - - ClusterName + - Namespace + - - ClusterName + metric_name_selectors: + - namespace_number_of_running_pods + - dimensions: + - - ClusterName + metric_name_selectors: + - cluster_node_count + - cluster_failed_node_count + middleware: agenthealth/logs + namespace: ContainerInsights + no_verify_ssl: false + num_workers: 8 + output_destination: cloudwatch + parse_json_encoded_attr_values: + - Sources + - kubernetes + profile: "" + proxy_address: "" + region: us-east-1 + request_timeout_seconds: 30 + resource_arn: "" + resource_to_telemetry_conversion: + enabled: true + retain_initial_value_of_delta_metric: false + role_arn: "" + version: "0" + awsxray/application_signals: + certificate_file_path: "" + endpoint: "" + imds_retries: 1 + index_all_attributes: false + indexed_attributes: + - aws.local.service + - aws.local.operation + - aws.local.environment + - aws.remote.service + - aws.remote.operation + - aws.remote.environment + - aws.remote.resource.identifier + - aws.remote.resource.type + local_mode: false + max_retries: 2 + middleware: agenthealth/traces + no_verify_ssl: false + num_workers: 8 + profile: "" + proxy_address: "" + region: us-east-1 + request_timeout_seconds: 30 + resource_arn: "" + role_arn: "" + telemetry: + enabled: true + include_metadata: true extensions: - agenthealth/logs: - is_usage_data_enabled: true - stats: - operations: - - PutLogEvents - usage_flags: - mode: EKS - region_type: ACJ - agenthealth/traces: - is_usage_data_enabled: true - stats: - operations: - - PutTraceSegments - usage_flags: - mode: EKS - region_type: ACJ - awsproxy/application_signals: - aws_endpoint: "" - certificate_file_path: "" - dialer: - timeout: 0s - endpoint: 0.0.0.0:2000 - imds_retries: 1 - local_mode: false - profile: "" - proxy_address: "" - region: us-east-1 - role_arn: "" - service_name: "" + agenthealth/logs: + is_usage_data_enabled: true + stats: + operations: + - PutLogEvents + usage_flags: + mode: EKS + region_type: ACJ + agenthealth/traces: + is_usage_data_enabled: true + stats: + operations: + - PutTraceSegments + usage_flags: + mode: EKS + region_type: ACJ + awsproxy/application_signals: + aws_endpoint: "" + dialer: + timeout: "0s" + certificate_file_path: "" + endpoint: 0.0.0.0:2000 + imds_retries: 1 + local_mode: false + profile: "" + proxy_address: "" + region: us-east-1 + service_name: "" + role_arn: "" + entitystore: + mode: ec2 + region: us-east-1 + kubernetes_mode: EKS + server: + listen_addr: :4311 + tls_ca_path: "/etc/amazon-cloudwatch-observability-agent-client-cert/tls-ca.crt" + tls_cert_path: "/etc/amazon-cloudwatch-observability-agent-server-cert/server.crt" + tls_key_path: "/etc/amazon-cloudwatch-observability-agent-server-cert/server.key" processors: - awsapplicationsignals: - limiter: - disabled: false - drop_threshold: 500 - garbage_collection_interval: 10m0s - log_dropped_metrics: true - rotation_interval: 10m0s - resolvers: - - name: TestCluster - platform: eks - batch/containerinsights: - metadata_cardinality_limit: 1000 - send_batch_max_size: 0 - send_batch_size: 8192 - timeout: 5s - resourcedetection: - aks: - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - k8s.cluster.name: - enabled: false - azure: - resource_attributes: - azure.resourcegroup.name: - enabled: true - azure.vm.name: - enabled: true - azure.vm.scaleset.name: - enabled: true - azure.vm.size: - enabled: true - cloud.account.id: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - host.id: - enabled: true - host.name: - enabled: true - tags: [] - compression: "" - consul: - address: "" - datacenter: "" - namespace: "" - resource_attributes: - cloud.region: - enabled: true - host.id: - enabled: true - host.name: - enabled: true - token_file: "" - detectors: - - eks - - env - - ec2 - disable_keep_alives: false - docker: - resource_attributes: - host.name: - enabled: true - os.type: - enabled: true - ec2: - resource_attributes: - cloud.account.id: - enabled: true - cloud.availability_zone: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - host.id: - enabled: true - host.image.id: - enabled: true - host.name: - enabled: true - host.type: - enabled: true - tags: - - ^kubernetes.io/cluster/.*$ - - ^aws:autoscaling:groupName - ecs: - resource_attributes: - aws.ecs.cluster.arn: - enabled: true - aws.ecs.launchtype: - enabled: true - aws.ecs.task.arn: - enabled: true - aws.ecs.task.family: - enabled: true - aws.ecs.task.id: - enabled: true - aws.ecs.task.revision: - enabled: true - aws.log.group.arns: - enabled: true - aws.log.group.names: - enabled: true - aws.log.stream.arns: - enabled: true - aws.log.stream.names: - enabled: true - cloud.account.id: - enabled: true - cloud.availability_zone: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - eks: - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - k8s.cluster.name: - enabled: false - elasticbeanstalk: - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - deployment.environment: - enabled: true - service.instance.id: - enabled: true - service.version: - enabled: true - endpoint: "" - gcp: - resource_attributes: - cloud.account.id: - enabled: true - cloud.availability_zone: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - faas.id: - enabled: true - faas.instance: - enabled: true - faas.name: - enabled: true - faas.version: - enabled: true - gcp.cloud_run.job.execution: - enabled: true - gcp.cloud_run.job.task_index: - enabled: true - gcp.gce.instance.hostname: - enabled: false - gcp.gce.instance.name: - enabled: false - host.id: - enabled: true - host.name: - enabled: true - host.type: - enabled: true - k8s.cluster.name: - enabled: true - heroku: - resource_attributes: - cloud.provider: - enabled: true - heroku.app.id: - enabled: true - heroku.dyno.id: - enabled: true - heroku.release.commit: - enabled: true - heroku.release.creation_timestamp: - enabled: true - service.instance.id: - enabled: true - service.name: - enabled: true - service.version: - enabled: true - http2_ping_timeout: 0s - http2_read_idle_timeout: 0s - idle_conn_timeout: 1m30s - k8snode: - auth_type: serviceAccount - context: "" - kube_config_path: "" - node_from_env_var: "" - resource_attributes: - k8s.node.name: - enabled: true - k8s.node.uid: - enabled: true - lambda: - resource_attributes: - aws.log.group.names: - enabled: true - aws.log.stream.names: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - faas.instance: - enabled: true - faas.max_memory: - enabled: true - faas.name: - enabled: true - faas.version: - enabled: true - max_idle_conns: 100 - openshift: - address: "" - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - k8s.cluster.name: - enabled: true - tls: - ca_file: "" - cert_file: "" - include_system_ca_certs_pool: false - insecure: false - insecure_skip_verify: false - key_file: "" - max_version: "" - min_version: "" - reload_interval: 0s - server_name_override: "" - token: "" - override: true - proxy_url: "" - read_buffer_size: 0 - system: - resource_attributes: - host.arch: - enabled: false - host.cpu.cache.l2.size: - enabled: false - host.cpu.family: - enabled: false - host.cpu.model.id: - enabled: false - host.cpu.model.name: - enabled: false - host.cpu.stepping: - enabled: false - host.cpu.vendor.id: - enabled: false - host.id: - enabled: false - host.ip: - enabled: false - host.mac: - enabled: false - host.name: - enabled: true - os.description: - enabled: false - os.type: - enabled: true - timeout: 2s + awsapplicationsignals: + limiter: + disabled: false + drop_threshold: 500 + garbage_collection_interval: 10m0s + log_dropped_metrics: true + rotation_interval: 10m0s + resolvers: + - name: TestCluster + platform: eks + awsentity/service/application_signals: + cluster_name: TestCluster + entity_type: Service + kubernetes_mode: EKS + platform: ec2 + batch/containerinsights: + metadata_cardinality_limit: 1000 + send_batch_max_size: 0 + send_batch_size: 8192 + timeout: 5s + resourcedetection: + aks: + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + k8s.cluster.name: + enabled: false + azure: + resource_attributes: + azure.resourcegroup.name: + enabled: true + azure.vm.name: + enabled: true + azure.vm.scaleset.name: + enabled: true + azure.vm.size: + enabled: true + cloud.account.id: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + host.id: + enabled: true + host.name: + enabled: true + tags: [] + compression: "" + consul: + address: "" + datacenter: "" + namespace: "" + resource_attributes: + cloud.region: + enabled: true + host.id: + enabled: true + host.name: + enabled: true + token_file: "" + detectors: + - eks + - env + - ec2 + disable_keep_alives: false + docker: + resource_attributes: + host.name: + enabled: true + os.type: + enabled: true + ec2: + resource_attributes: + cloud.account.id: + enabled: true + cloud.availability_zone: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + host.id: + enabled: true + host.image.id: + enabled: true + host.name: + enabled: true + host.type: + enabled: true + tags: + - ^kubernetes.io/cluster/.*$ + - ^aws:autoscaling:groupName + ecs: + resource_attributes: + aws.ecs.cluster.arn: + enabled: true + aws.ecs.launchtype: + enabled: true + aws.ecs.task.arn: + enabled: true + aws.ecs.task.family: + enabled: true + aws.ecs.task.revision: + enabled: true + aws.ecs.task.id: + enabled: true + aws.log.group.arns: + enabled: true + aws.log.group.names: + enabled: true + aws.log.stream.arns: + enabled: true + aws.log.stream.names: + enabled: true + cloud.account.id: + enabled: true + cloud.availability_zone: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + eks: + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + k8s.cluster.name: + enabled: false + elasticbeanstalk: + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + deployment.environment: + enabled: true + service.instance.id: + enabled: true + service.version: + enabled: true + endpoint: "" + gcp: + resource_attributes: + cloud.account.id: + enabled: true + cloud.availability_zone: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + faas.id: + enabled: true + faas.instance: + enabled: true + faas.name: + enabled: true + faas.version: + enabled: true + gcp.cloud_run.job.execution: + enabled: true + gcp.cloud_run.job.task_index: + enabled: true + gcp.gce.instance.hostname: + enabled: false + gcp.gce.instance.name: + enabled: false + host.id: + enabled: true + host.name: + enabled: true + host.type: + enabled: true + k8s.cluster.name: + enabled: true + heroku: + resource_attributes: + cloud.provider: + enabled: true + heroku.app.id: + enabled: true + heroku.dyno.id: + enabled: true + heroku.release.commit: + enabled: true + heroku.release.creation_timestamp: + enabled: true + service.instance.id: + enabled: true + service.name: + enabled: true + service.version: + enabled: true + http2_ping_timeout: "0s" + http2_read_idle_timeout: "0s" + idle_conn_timeout: 1m30s + k8snode: + auth_type: serviceAccount + context: "" + kube_config_path: "" + node_from_env_var: "" + resource_attributes: + k8s.node.name: + enabled: true + k8s.node.uid: + enabled: true + lambda: + resource_attributes: + aws.log.group.names: + enabled: true + aws.log.stream.names: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + faas.instance: + enabled: true + faas.max_memory: + enabled: true + faas.name: + enabled: true + faas.version: + enabled: true + max_idle_conns: 100 + openshift: + address: "" + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + k8s.cluster.name: + enabled: true + tls: + ca_file: "" + cert_file: "" + include_system_ca_certs_pool: false + insecure: false + insecure_skip_verify: false + key_file: "" + max_version: "" + min_version: "" + reload_interval: "0s" + server_name_override: "" + token: "" + override: true + proxy_url: "" + read_buffer_size: 0 + system: + resource_attributes: + host.arch: + enabled: false + host.cpu.cache.l2.size: + enabled: false + host.cpu.family: + enabled: false + host.cpu.model.id: + enabled: false + host.cpu.model.name: + enabled: false + host.cpu.stepping: + enabled: false + host.cpu.vendor.id: + enabled: false + host.id: + enabled: false + host.ip: + enabled: false + host.mac: + enabled: false + host.name: + enabled: true + os.description: + enabled: false + os.type: + enabled: true + timeout: 2s + tls: + ca_file: "" + cert_file: "" + include_system_ca_certs_pool: false + insecure: false + insecure_skip_verify: false + key_file: "" + max_version: "" + min_version: "" + reload_interval: "0s" + server_name_override: "" + write_buffer_size: 0 +receivers: + awscontainerinsightreceiver: + accelerated_compute_metrics: false + add_container_name_metric_label: false + add_full_pod_name_metric_label: false + add_service_as_attribute: true + certificate_file_path: "" + cluster_name: TestCluster + collection_interval: 30s + container_orchestrator: eks + enable_control_plane_metrics: false + endpoint: "" + host_ip: "" + host_name: "" + imds_retries: 1 + kube_config_path: "" + leader_lock_name: cwagent-clusterleader + leader_lock_using_config_map_only: true + local_mode: false + max_retries: 0 + no_verify_ssl: false + num_workers: 0 + prefer_full_pod_name: false + profile: "" + proxy_address: "" + region: us-east-1 + request_timeout_seconds: 0 + resource_arn: "" + role_arn: "" + otlp/application_signals: + protocols: + grpc: + endpoint: 0.0.0.0:4315 + dialer: + timeout: "0s" + include_metadata: false + max_concurrent_streams: 0 + max_recv_msg_size_mib: 0 + read_buffer_size: 524288 tls: - ca_file: "" - cert_file: "" - include_system_ca_certs_pool: false - insecure: false - insecure_skip_verify: false - key_file: "" - max_version: "" - min_version: "" - reload_interval: 0s - server_name_override: "" + ca_file: "" + cert_file: path/to/cert.crt + client_ca_file: "" + client_ca_file_reload: false + include_system_ca_certs_pool: false + key_file: path/to/key.key + max_version: "" + min_version: "" + reload_interval: 0s + transport: tcp write_buffer_size: 0 -receivers: - awscontainerinsightreceiver: - accelerated_compute_metrics: false - add_container_name_metric_label: false - add_full_pod_name_metric_label: false - add_service_as_attribute: true - certificate_file_path: "" - cluster_name: TestCluster - collection_interval: 30s - container_orchestrator: eks - enable_control_plane_metrics: false - endpoint: "" - host_ip: "" - host_name: "" - imds_retries: 1 - kube_config_path: "" - leader_lock_name: cwagent-clusterleader - leader_lock_using_config_map_only: true - local_mode: false - max_retries: 0 - no_verify_ssl: false - num_workers: 0 - prefer_full_pod_name: false - profile: "" - proxy_address: "" - region: us-east-1 - request_timeout_seconds: 0 - resource_arn: "" - role_arn: "" - otlp/application_signals: - protocols: - grpc: - dialer: - timeout: 0s - endpoint: 0.0.0.0:4315 - include_metadata: false - max_concurrent_streams: 0 - max_recv_msg_size_mib: 0 - read_buffer_size: 524288 - tls: - ca_file: "" - cert_file: path/to/cert.crt - client_ca_file: "" - client_ca_file_reload: false - include_system_ca_certs_pool: false - key_file: path/to/key.key - max_version: "" - min_version: "" - reload_interval: 0s - transport: tcp - write_buffer_size: 0 - http: - endpoint: 0.0.0.0:4316 - include_metadata: false - logs_url_path: /v1/logs - max_request_body_size: 0 - metrics_url_path: /v1/metrics - tls: - ca_file: "" - cert_file: path/to/cert.crt - client_ca_file: "" - client_ca_file_reload: false - include_system_ca_certs_pool: false - key_file: path/to/key.key - max_version: "" - min_version: "" - reload_interval: 0s - traces_url_path: /v1/traces + http: + endpoint: 0.0.0.0:4316 + include_metadata: false + logs_url_path: /v1/logs + max_request_body_size: 0 + metrics_url_path: /v1/metrics + tls: + ca_file: "" + cert_file: path/to/cert.crt + client_ca_file: "" + client_ca_file_reload: false + include_system_ca_certs_pool: false + key_file: path/to/key.key + max_version: "" + min_version: "" + reload_interval: 0s + traces_url_path: /v1/traces service: - extensions: - - awsproxy/application_signals - - agenthealth/traces - - agenthealth/logs - pipelines: - metrics/application_signals: - exporters: - - awsemf/application_signals - processors: - - resourcedetection - - awsapplicationsignals - receivers: - - otlp/application_signals - metrics/containerinsights: - exporters: - - awsemf/containerinsights - processors: - - batch/containerinsights - receivers: - - awscontainerinsightreceiver - traces/application_signals: - exporters: - - awsxray/application_signals - processors: - - resourcedetection - - awsapplicationsignals - receivers: - - otlp/application_signals - telemetry: - logs: - development: false - disable_caller: false - disable_stacktrace: false - encoding: console - level: info - sampling: - enabled: true - initial: 2 - thereafter: 500 - tick: 10s - metrics: - address: "" - level: None - traces: {} + extensions: + - awsproxy/application_signals + - agenthealth/traces + - agenthealth/logs + - entitystore + - server + pipelines: + metrics/application_signals: + exporters: + - awsemf/application_signals + processors: + - awsentity/service/application_signals + - resourcedetection + - awsapplicationsignals + receivers: + - otlp/application_signals + metrics/containerinsights: + exporters: + - awsemf/containerinsights + processors: + - batch/containerinsights + receivers: + - awscontainerinsightreceiver + traces/application_signals: + exporters: + - awsxray/application_signals + processors: + - resourcedetection + - awsapplicationsignals + receivers: + - otlp/application_signals + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: {} diff --git a/translator/tocwconfig/sampleConfig/base_appsignals_config.yaml b/translator/tocwconfig/sampleConfig/base_appsignals_config.yaml index 49bde8162f..de5fd41888 100644 --- a/translator/tocwconfig/sampleConfig/base_appsignals_config.yaml +++ b/translator/tocwconfig/sampleConfig/base_appsignals_config.yaml @@ -156,6 +156,11 @@ extensions: service_name: "" shared_credentials_file: - fake-path + entitystore: + mode: onPremise + profile: AmazonCloudWatchAgent + region: us-east-1 + shared_credential_file: fake-path processors: awsapplicationsignals: resolvers: @@ -473,6 +478,7 @@ service: - awsproxy/application_signals - agenthealth/traces - agenthealth/logs + - entitystore pipelines: metrics/application_signals: exporters: diff --git a/translator/tocwconfig/sampleConfig/base_appsignals_fallback_config.yaml b/translator/tocwconfig/sampleConfig/base_appsignals_fallback_config.yaml index af5b0a3f4d..9e4eca0b38 100644 --- a/translator/tocwconfig/sampleConfig/base_appsignals_fallback_config.yaml +++ b/translator/tocwconfig/sampleConfig/base_appsignals_fallback_config.yaml @@ -1,506 +1,512 @@ exporters: - awsemf/application_signals: - certificate_file_path: "" - detailed_metrics: false - dimension_rollup_option: NoDimensionRollup - disable_metric_extraction: false - eks_fargate_container_insights_enabled: false - endpoint: https://fake_endpoint - enhanced_container_insights: false - imds_retries: 1 - local_mode: true - log_group_name: /aws/application-signals/data - log_retention: 0 - log_stream_name: "" - max_retries: 2 - metric_declarations: - - dimensions: - - - Environment - - Operation - - Service - - - Environment - - Service - label_matchers: - - label_names: - - Telemetry.Source - regex: ^(ServerSpan|LocalRootSpan)$ - separator: ; - metric_name_selectors: - - Latency - - Fault - - Error - - dimensions: - - - Environment - - Operation - - RemoteOperation - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - Environment - - Operation - - RemoteOperation - - RemoteService - - Service - - - Environment - - RemoteService - - Service - - - Environment - - RemoteOperation - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - Environment - - RemoteOperation - - RemoteService - - Service - - - Environment - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - Service - - - RemoteResourceIdentifier - - RemoteResourceType - - RemoteService - - - RemoteService - label_matchers: - - label_names: - - Telemetry.Source - regex: ^(ClientSpan|ProducerSpan|ConsumerSpan)$ - separator: ; - metric_name_selectors: - - Latency - - Fault - - Error - middleware: agenthealth/logs - namespace: ApplicationSignals - no_verify_ssl: false - num_workers: 8 - output_destination: cloudwatch - profile: AmazonCloudWatchAgent - proxy_address: "" - region: us-east-1 - request_timeout_seconds: 30 - resource_arn: "" - resource_to_telemetry_conversion: - enabled: false - retain_initial_value_of_delta_metric: false - role_arn: "" - shared_credentials_file: - - fake-path - version: "1" - awsxray/application_signals: - certificate_file_path: "" - endpoint: https://fake_endpoint - imds_retries: 1 - index_all_attributes: false - indexed_attributes: - - aws.local.service - - aws.local.operation - - aws.local.environment - - aws.remote.service - - aws.remote.operation - - aws.remote.environment - - aws.remote.resource.identifier - - aws.remote.resource.type - local_mode: true - max_retries: 2 - middleware: agenthealth/traces - no_verify_ssl: false - num_workers: 8 - profile: AmazonCloudWatchAgent - proxy_address: "" - region: us-east-1 - request_timeout_seconds: 30 - resource_arn: "" - role_arn: "" - shared_credentials_file: - - fake-path - telemetry: - enabled: true - include_metadata: true + awsemf/application_signals: + certificate_file_path: "" + detailed_metrics: false + dimension_rollup_option: NoDimensionRollup + disable_metric_extraction: false + eks_fargate_container_insights_enabled: false + endpoint: https://fake_endpoint + enhanced_container_insights: false + imds_retries: 1 + local_mode: true + log_group_name: /aws/application-signals/data + log_retention: 0 + log_stream_name: "" + max_retries: 2 + metric_declarations: + - dimensions: + - - Environment + - Operation + - Service + - - Environment + - Service + label_matchers: + - label_names: + - Telemetry.Source + regex: ^(ServerSpan|LocalRootSpan)$ + separator: ; + metric_name_selectors: + - Latency + - Fault + - Error + - dimensions: + - - Environment + - Operation + - RemoteOperation + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - Environment + - Operation + - RemoteOperation + - RemoteService + - Service + - - Environment + - RemoteService + - Service + - - Environment + - RemoteOperation + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - Environment + - RemoteOperation + - RemoteService + - Service + - - Environment + - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - Service + - - RemoteResourceIdentifier + - RemoteResourceType + - RemoteService + - - RemoteService + label_matchers: + - label_names: + - Telemetry.Source + regex: ^(ClientSpan|ProducerSpan|ConsumerSpan)$ + separator: ; + metric_name_selectors: + - Latency + - Fault + - Error + middleware: agenthealth/logs + namespace: ApplicationSignals + no_verify_ssl: false + num_workers: 8 + output_destination: cloudwatch + profile: AmazonCloudWatchAgent + proxy_address: "" + region: us-east-1 + request_timeout_seconds: 30 + resource_arn: "" + resource_to_telemetry_conversion: + enabled: false + retain_initial_value_of_delta_metric: false + role_arn: "" + shared_credentials_file: + - fake-path + version: "1" + awsxray/application_signals: + certificate_file_path: "" + endpoint: https://fake_endpoint + imds_retries: 1 + index_all_attributes: false + indexed_attributes: + - aws.local.service + - aws.local.operation + - aws.local.environment + - aws.remote.service + - aws.remote.operation + - aws.remote.environment + - aws.remote.resource.identifier + - aws.remote.resource.type + local_mode: true + max_retries: 2 + middleware: agenthealth/traces + no_verify_ssl: false + num_workers: 8 + profile: AmazonCloudWatchAgent + proxy_address: "" + region: us-east-1 + request_timeout_seconds: 30 + resource_arn: "" + role_arn: "" + shared_credentials_file: + - fake-path + telemetry: + enabled: true + include_metadata: true extensions: - agenthealth/logs: - is_usage_data_enabled: true - stats: - operations: - - PutLogEvents - usage_flags: - mode: OP - region_type: ACJ - agenthealth/traces: - is_usage_data_enabled: true - stats: - operations: - - PutTraceSegments - usage_flags: - mode: OP - region_type: ACJ - awsproxy/application_signals: - aws_endpoint: https://fake_endpoint - certificate_file_path: "" - dialer: - timeout: 0s - endpoint: 0.0.0.0:2000 - imds_retries: 1 - local_mode: true - profile: AmazonCloudWatchAgent - proxy_address: "" - region: us-east-1 - role_arn: "" - service_name: "" - shared_credentials_file: - - fake-path + agenthealth/logs: + is_usage_data_enabled: true + stats: + operations: + - PutLogEvents + usage_flags: + mode: OP + region_type: ACJ + agenthealth/traces: + is_usage_data_enabled: true + stats: + operations: + - PutTraceSegments + usage_flags: + mode: OP + region_type: ACJ + awsproxy/application_signals: + aws_endpoint: https://fake_endpoint + dialer: + timeout: "0s" + certificate_file_path: "" + endpoint: 0.0.0.0:2000 + imds_retries: 1 + local_mode: true + profile: AmazonCloudWatchAgent + proxy_address: "" + region: us-east-1 + role_arn: "" + service_name: "" + shared_credentials_file: + - fake-path + entitystore: + mode: onPremise + profile: AmazonCloudWatchAgent + region: us-east-1 + shared_credential_file: fake-path processors: - awsapplicationsignals: - resolvers: - - name: "" - platform: generic - resourcedetection: - aks: - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - k8s.cluster.name: - enabled: false - azure: - resource_attributes: - azure.resourcegroup.name: - enabled: true - azure.vm.name: - enabled: true - azure.vm.scaleset.name: - enabled: true - azure.vm.size: - enabled: true - cloud.account.id: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - host.id: - enabled: true - host.name: - enabled: true - tags: [] - compression: "" - consul: - address: "" - datacenter: "" - namespace: "" - resource_attributes: - cloud.region: - enabled: true - host.id: - enabled: true - host.name: - enabled: true - token_file: "" - detectors: - - eks - - env - - ec2 - disable_keep_alives: false - docker: - resource_attributes: - host.name: - enabled: true - os.type: - enabled: true - ec2: - resource_attributes: - cloud.account.id: - enabled: true - cloud.availability_zone: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - host.id: - enabled: true - host.image.id: - enabled: true - host.name: - enabled: true - host.type: - enabled: true - tags: - - ^kubernetes.io/cluster/.*$ - - ^aws:autoscaling:groupName - ecs: - resource_attributes: - aws.ecs.cluster.arn: - enabled: true - aws.ecs.launchtype: - enabled: true - aws.ecs.task.arn: - enabled: true - aws.ecs.task.family: - enabled: true - aws.ecs.task.id: - enabled: true - aws.ecs.task.revision: - enabled: true - aws.log.group.arns: - enabled: true - aws.log.group.names: - enabled: true - aws.log.stream.arns: - enabled: true - aws.log.stream.names: - enabled: true - cloud.account.id: - enabled: true - cloud.availability_zone: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - eks: - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - k8s.cluster.name: - enabled: false - elasticbeanstalk: - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - deployment.environment: - enabled: true - service.instance.id: - enabled: true - service.version: - enabled: true - endpoint: "" - gcp: - resource_attributes: - cloud.account.id: - enabled: true - cloud.availability_zone: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - faas.id: - enabled: true - faas.instance: - enabled: true - faas.name: - enabled: true - faas.version: - enabled: true - gcp.cloud_run.job.execution: - enabled: true - gcp.cloud_run.job.task_index: - enabled: true - gcp.gce.instance.hostname: - enabled: false - gcp.gce.instance.name: - enabled: false - host.id: - enabled: true - host.name: - enabled: true - host.type: - enabled: true - k8s.cluster.name: - enabled: true - heroku: - resource_attributes: - cloud.provider: - enabled: true - heroku.app.id: - enabled: true - heroku.dyno.id: - enabled: true - heroku.release.commit: - enabled: true - heroku.release.creation_timestamp: - enabled: true - service.instance.id: - enabled: true - service.name: - enabled: true - service.version: - enabled: true - http2_ping_timeout: 0s - http2_read_idle_timeout: 0s - idle_conn_timeout: 1m30s - k8snode: - auth_type: serviceAccount - context: "" - kube_config_path: "" - node_from_env_var: "" - resource_attributes: - k8s.node.name: - enabled: true - k8s.node.uid: - enabled: true - lambda: - resource_attributes: - aws.log.group.names: - enabled: true - aws.log.stream.names: - enabled: true - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - faas.instance: - enabled: true - faas.max_memory: - enabled: true - faas.name: - enabled: true - faas.version: - enabled: true - max_idle_conns: 100 - openshift: - address: "" - resource_attributes: - cloud.platform: - enabled: true - cloud.provider: - enabled: true - cloud.region: - enabled: true - k8s.cluster.name: - enabled: true - tls: - ca_file: "" - cert_file: "" - include_system_ca_certs_pool: false - insecure: false - insecure_skip_verify: false - key_file: "" - max_version: "" - min_version: "" - reload_interval: 0s - server_name_override: "" - token: "" - override: true - proxy_url: "" - read_buffer_size: 0 - system: - resource_attributes: - host.arch: - enabled: false - host.cpu.cache.l2.size: - enabled: false - host.cpu.family: - enabled: false - host.cpu.model.id: - enabled: false - host.cpu.model.name: - enabled: false - host.cpu.stepping: - enabled: false - host.cpu.vendor.id: - enabled: false - host.id: - enabled: false - host.ip: - enabled: false - host.mac: - enabled: false - host.name: - enabled: true - os.description: - enabled: false - os.type: - enabled: true - timeout: 2s - tls: - ca_file: "" - cert_file: "" - include_system_ca_certs_pool: false - insecure: false - insecure_skip_verify: false - key_file: "" - max_version: "" - min_version: "" - reload_interval: 0s - server_name_override: "" - write_buffer_size: 0 + awsapplicationsignals: + resolvers: + - name: "" + platform: generic + resourcedetection: + aks: + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + k8s.cluster.name: + enabled: false + azure: + resource_attributes: + azure.resourcegroup.name: + enabled: true + azure.vm.name: + enabled: true + azure.vm.scaleset.name: + enabled: true + azure.vm.size: + enabled: true + cloud.account.id: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + host.id: + enabled: true + host.name: + enabled: true + tags: [] + compression: "" + consul: + address: "" + datacenter: "" + namespace: "" + resource_attributes: + cloud.region: + enabled: true + host.id: + enabled: true + host.name: + enabled: true + token_file: "" + detectors: + - eks + - env + - ec2 + disable_keep_alives: false + docker: + resource_attributes: + host.name: + enabled: true + os.type: + enabled: true + ec2: + resource_attributes: + cloud.account.id: + enabled: true + cloud.availability_zone: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + host.id: + enabled: true + host.image.id: + enabled: true + host.name: + enabled: true + host.type: + enabled: true + tags: + - ^kubernetes.io/cluster/.*$ + - ^aws:autoscaling:groupName + ecs: + resource_attributes: + aws.ecs.cluster.arn: + enabled: true + aws.ecs.launchtype: + enabled: true + aws.ecs.task.arn: + enabled: true + aws.ecs.task.family: + enabled: true + aws.ecs.task.id: + enabled: true + aws.ecs.task.revision: + enabled: true + aws.log.group.arns: + enabled: true + aws.log.group.names: + enabled: true + aws.log.stream.arns: + enabled: true + aws.log.stream.names: + enabled: true + cloud.account.id: + enabled: true + cloud.availability_zone: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + eks: + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + k8s.cluster.name: + enabled: false + elasticbeanstalk: + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + deployment.environment: + enabled: true + service.instance.id: + enabled: true + service.version: + enabled: true + endpoint: "" + gcp: + resource_attributes: + cloud.account.id: + enabled: true + cloud.availability_zone: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + faas.id: + enabled: true + faas.instance: + enabled: true + faas.name: + enabled: true + faas.version: + enabled: true + gcp.cloud_run.job.execution: + enabled: true + gcp.cloud_run.job.task_index: + enabled: true + gcp.gce.instance.hostname: + enabled: false + gcp.gce.instance.name: + enabled: false + host.id: + enabled: true + host.name: + enabled: true + host.type: + enabled: true + k8s.cluster.name: + enabled: true + heroku: + resource_attributes: + cloud.provider: + enabled: true + heroku.app.id: + enabled: true + heroku.dyno.id: + enabled: true + heroku.release.commit: + enabled: true + heroku.release.creation_timestamp: + enabled: true + service.instance.id: + enabled: true + service.name: + enabled: true + service.version: + enabled: true + http2_ping_timeout: "0s" + http2_read_idle_timeout: "0s" + idle_conn_timeout: 1m30s + k8snode: + auth_type: serviceAccount + context: "" + kube_config_path: "" + node_from_env_var: "" + resource_attributes: + k8s.node.name: + enabled: true + k8s.node.uid: + enabled: true + lambda: + resource_attributes: + aws.log.group.names: + enabled: true + aws.log.stream.names: + enabled: true + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + faas.instance: + enabled: true + faas.max_memory: + enabled: true + faas.name: + enabled: true + faas.version: + enabled: true + max_idle_conns: 100 + openshift: + address: "" + resource_attributes: + cloud.platform: + enabled: true + cloud.provider: + enabled: true + cloud.region: + enabled: true + k8s.cluster.name: + enabled: true + tls: + ca_file: "" + cert_file: "" + include_system_ca_certs_pool: false + insecure: false + insecure_skip_verify: false + key_file: "" + max_version: "" + min_version: "" + reload_interval: "0s" + server_name_override: "" + token: "" + override: true + proxy_url: "" + read_buffer_size: 0 + system: + resource_attributes: + host.arch: + enabled: false + host.cpu.cache.l2.size: + enabled: false + host.cpu.family: + enabled: false + host.cpu.model.id: + enabled: false + host.cpu.model.name: + enabled: false + host.cpu.stepping: + enabled: false + host.cpu.vendor.id: + enabled: false + host.id: + enabled: false + host.ip: + enabled: false + host.mac: + enabled: false + host.name: + enabled: true + os.description: + enabled: false + os.type: + enabled: true + timeout: 2s + tls: + ca_file: "" + cert_file: "" + include_system_ca_certs_pool: false + insecure: false + insecure_skip_verify: false + key_file: "" + max_version: "" + min_version: "" + reload_interval: "0s" + server_name_override: "" + write_buffer_size: 0 receivers: - otlp/application_signals: - protocols: - grpc: - dialer: - timeout: 0s - endpoint: 0.0.0.0:4315 - include_metadata: false - max_concurrent_streams: 0 - max_recv_msg_size_mib: 0 - read_buffer_size: 524288 - transport: tcp - write_buffer_size: 0 - http: - endpoint: 0.0.0.0:4316 - include_metadata: false - logs_url_path: /v1/logs - max_request_body_size: 0 - metrics_url_path: /v1/metrics - traces_url_path: /v1/traces + otlp/application_signals: + protocols: + grpc: + dialer: + timeout: "0s" + endpoint: 0.0.0.0:4315 + include_metadata: false + max_concurrent_streams: 0 + max_recv_msg_size_mib: 0 + read_buffer_size: 524288 + transport: tcp + write_buffer_size: 0 + http: + endpoint: 0.0.0.0:4316 + include_metadata: false + logs_url_path: /v1/logs + max_request_body_size: 0 + metrics_url_path: /v1/metrics + traces_url_path: /v1/traces service: - extensions: - - awsproxy/application_signals - - agenthealth/traces - - agenthealth/logs - pipelines: - metrics/application_signals: - exporters: - - awsemf/application_signals - processors: - - resourcedetection - - awsapplicationsignals - receivers: - - otlp/application_signals - traces/application_signals: - exporters: - - awsxray/application_signals - processors: - - resourcedetection - - awsapplicationsignals - receivers: - - otlp/application_signals - telemetry: - logs: - development: false - disable_caller: false - disable_stacktrace: false - encoding: console - level: info - output_paths: - - /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log - sampling: - enabled: true - initial: 2 - thereafter: 500 - tick: 10s - metrics: - address: "" - level: None - traces: {} + extensions: + - awsproxy/application_signals + - agenthealth/traces + - agenthealth/logs + - entitystore + pipelines: + metrics/application_signals: + exporters: + - awsemf/application_signals + processors: + - resourcedetection + - awsapplicationsignals + receivers: + - otlp/application_signals + traces/application_signals: + exporters: + - awsxray/application_signals + processors: + - resourcedetection + - awsapplicationsignals + receivers: + - otlp/application_signals + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + output_paths: + - /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: {} diff --git a/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml b/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml index 4db3578ebf..618e81c072 100644 --- a/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml +++ b/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml @@ -148,6 +148,9 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-east-1 processors: batch/containerinsights: metadata_cardinality_limit: 1000 @@ -217,6 +220,7 @@ receivers: service: extensions: - agenthealth/logs + - entitystore pipelines: logs/emf_logs: exporters: diff --git a/translator/tocwconfig/sampleConfig/basic_config_linux.yaml b/translator/tocwconfig/sampleConfig/basic_config_linux.yaml index d1a147e783..9a349c682e 100644 --- a/translator/tocwconfig/sampleConfig/basic_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/basic_config_linux.yaml @@ -17,7 +17,13 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-east-1 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 ec2tagger: ec2_instance_tag_keys: - AutoScalingGroupName @@ -39,15 +45,17 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger receivers: - - telegraf_disk - telegraf_mem + - telegraf_disk telemetry: logs: development: false diff --git a/translator/tocwconfig/sampleConfig/basic_config_windows.yaml b/translator/tocwconfig/sampleConfig/basic_config_windows.yaml index 2dd4256f61..31c7c5229b 100644 --- a/translator/tocwconfig/sampleConfig/basic_config_windows.yaml +++ b/translator/tocwconfig/sampleConfig/basic_config_windows.yaml @@ -17,7 +17,13 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 ec2tagger: ec2_instance_tag_keys: - AutoScalingGroupName @@ -41,11 +47,13 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger receivers: - telegraf_win_perf_counters/1492679118 diff --git a/translator/tocwconfig/sampleConfig/collectd_config_linux.yaml b/translator/tocwconfig/sampleConfig/collectd_config_linux.yaml index 43ee813bf5..a1ecf22c1e 100644 --- a/translator/tocwconfig/sampleConfig/collectd_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/collectd_config_linux.yaml @@ -17,6 +17,14 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 +processors: + awsentity/service/telegraf: + entity_type: Service + scrape_datapoint_attribute: true + platform: ec2 receivers: telegraf_socket_listener: collection_interval: 1m0s @@ -25,11 +33,13 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: - metrics/host: + metrics/hostCustomMetrics: exporters: - awscloudwatch - processors: [] + processors: + - awsentity/service/telegraf receivers: - telegraf_socket_listener telemetry: diff --git a/translator/tocwconfig/sampleConfig/compass_linux_config.conf b/translator/tocwconfig/sampleConfig/compass_linux_config.conf new file mode 100644 index 0000000000..deab98289f --- /dev/null +++ b/translator/tocwconfig/sampleConfig/compass_linux_config.conf @@ -0,0 +1,85 @@ +[agent] + collection_jitter = "0s" + debug = true + flush_interval = "1s" + flush_jitter = "0s" + hostname = "" + interval = "10s" + logfile = "/tmp/fake/log/hotdog.log" + logtarget = "lumberjack" + metric_batch_size = 1000 + metric_buffer_limit = 10000 + omit_hostname = false + precision = "" + quiet = true + round_interval = false + +[inputs] + + [[inputs.logfile]] + destination = "cloudwatchlogs" + file_state_folder = "/opt/aws/amazon-cloudwatch-agent/logs/state" + + [[inputs.logfile.file_config]] + deployment_environment = "file-level-environment" + file_path = "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log" + from_beginning = true + log_group_class = "" + log_group_name = "amazon-cloudwatch-agent.log" + log_stream_name = "amazon-cloudwatch-agent.log" + pipe = false + retention_in_days = 5 + service_name = "file-level-service" + timezone = "UTC" + + [[inputs.logfile.file_config]] + auto_removal = true + deployment_environment = "agent-level-environment" + file_path = "/opt/aws/amazon-cloudwatch-agent/logs/test.log" + from_beginning = true + log_group_class = "" + log_group_name = "test.log" + log_stream_name = "test.log" + pipe = false + retention_in_days = -1 + service_name = "log-level-service" + timezone = "UTC" + + [[inputs.socket_listener]] + collectd_auth_file = "/etc/collectd/auth_file" + collectd_security_level = "encrypt" + collectd_typesdb = ["/usr/share/collectd/types.db"] + data_format = "collectd" + name_prefix = "collectd_" + service_address = "udp://127.0.0.1:25826" + [inputs.socket_listener.tags] + "aws:AggregationInterval" = "60s" + "deployment.environment" = "plugin-level-environment" + "service.name" = "plugin-level-service" + "service.name.source" = "UserConfiguration" + "deployment.environment.source" = "UserConfiguration" + + [[inputs.statsd]] + interval = "10s" + metric_separator = "_" + parse_data_dog_tags = true + service_address = ":8125" + [inputs.statsd.tags] + "aws:AggregationInterval" = "60s" + "deployment.environment" = "agent-level-environment" + "service.name" = "metric-level-service" + "service.name.source" = "UserConfiguration" + "deployment.environment.source" = "UserConfiguration" + +[outputs] + + [[outputs.cloudwatch]] + + [[outputs.cloudwatchlogs]] + endpoint_override = "https://logs-fips.us-west-2.amazonaws.com" + force_flush_interval = "60s" + log_stream_name = "LOG_STREAM_NAME" + mode = "EC2" + region = "us-west-2" + region_type = "ACJ" + role_arn = "log_role_arn_value_test" diff --git a/translator/tocwconfig/sampleConfig/compass_linux_config.json b/translator/tocwconfig/sampleConfig/compass_linux_config.json new file mode 100755 index 0000000000..b61f1884cb --- /dev/null +++ b/translator/tocwconfig/sampleConfig/compass_linux_config.json @@ -0,0 +1,102 @@ +{ + "agent": { + "metrics_collection_interval": 10, + "logfile": "/tmp/fake/log/hotdog.log", + "internal": true, + "debug": true, + "quiet": true, + "aws_sdk_log_level": "LogDebug", + "user_agent": "CUSTOM USER AGENT VALUE", + "credentials": { + "role_arn": "global_role_arn_value" + }, + "region": "us-west-2", + "service.name": "agent-level-service", + "deployment.environment": "agent-level-environment" + }, + "logs": { + "logs_collected": { + "files": { + "collect_list": [ + { + "file_path": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log", + "log_group_name": "amazon-cloudwatch-agent.log", + "log_stream_name": "amazon-cloudwatch-agent.log", + "timezone": "UTC", + "retention_in_days": 5, + "service.name": "file-level-service", + "deployment.environment": "file-level-environment" + }, + { + "file_path": "/opt/aws/amazon-cloudwatch-agent/logs/test.log", + "log_group_name": "test.log", + "log_stream_name": "test.log", + "timezone": "UTC", + "auto_removal": true + } + ] + } + }, + "log_stream_name": "LOG_STREAM_NAME", + "force_flush_interval": 60, + "credentials": { + "role_arn": "log_role_arn_value_test" + }, + "endpoint_override": "https://logs-fips.us-west-2.amazonaws.com", + "service.name": "log-level-service" + }, + "metrics": { + "metrics_collected": { + "collectd": { + "service_address": "udp://127.0.0.1:25826", + "name_prefix": "collectd_", + "collectd_auth_file": "/etc/collectd/auth_file", + "collectd_security_level": "encrypt", + "collectd_typesdb": [ + "/usr/share/collectd/types.db" + ], + "metrics_aggregation_interval": 60, + "drop_original_metrics": [ + "collectd_drop" + ], + "service.name": "plugin-level-service", + "deployment.environment": "plugin-level-environment" + }, + "statsd": { + "service_address": ":8125", + "metrics_collection_interval": 10, + "metrics_aggregation_interval": 60, + "metric_separator": "_", + "drop_original_metrics": [ + "statsd_drop" + ] + } + }, + "append_dimensions": { + "ImageId": "${aws:ImageId}", + "InstanceId": "${aws:InstanceId}", + "InstanceType": "${aws:InstanceType}", + "AutoScalingGroupName": "${aws:AutoScalingGroupName}" + }, + "aggregation_dimensions": [ + [ + "ImageId" + ], + [ + "InstanceId", + "InstanceType" + ], + [ + "d1" + ], + [] + ], + "force_flush_interval": 60, + "credentials": { + "role_arn": "metrics_role_arn_value_test" + }, + "endpoint_override": "https://monitoring-fips.us-west-2.amazonaws.com", + "service.name": "metric-level-service" + } + +} \ No newline at end of file diff --git a/translator/tocwconfig/sampleConfig/compass_linux_config.yaml b/translator/tocwconfig/sampleConfig/compass_linux_config.yaml new file mode 100644 index 0000000000..ab934cba89 --- /dev/null +++ b/translator/tocwconfig/sampleConfig/compass_linux_config.yaml @@ -0,0 +1,88 @@ +exporters: + awscloudwatch: + drop_original_metrics: + collectd_drop: true + statsd_drop: true + endpoint_override: https://monitoring-fips.us-west-2.amazonaws.com + force_flush_interval: 1m0s + max_datums_per_call: 1000 + max_values_per_datum: 5000 + middleware: agenthealth/metrics + namespace: CWAgent + region: us-west-2 + resource_to_telemetry_conversion: + enabled: true + role_arn: metrics_role_arn_value_test + rollup_dimensions: + - - ImageId + - - InstanceId + - InstanceType + - - d1 + - [] +extensions: + agenthealth/metrics: + is_usage_data_enabled: true + stats: + operations: + - PutMetricData + usage_flags: + mode: EC2 + region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 +processors: + awsentity/service/telegraf: + entity_type: Service + scrape_datapoint_attribute: true + platform: ec2 + ec2tagger: + ec2_instance_tag_keys: + - AutoScalingGroupName + ec2_metadata_tags: + - InstanceId + - InstanceType + - ImageId + imds_retries: 1 + refresh_interval_seconds: 0s +receivers: + telegraf_socket_listener: + collection_interval: 10s + initial_delay: 1s + timeout: 0s + telegraf_statsd: + collection_interval: 10s + initial_delay: 1s + timeout: 0s +service: + extensions: + - agenthealth/metrics + - entitystore + pipelines: + metrics/hostCustomMetrics: + exporters: + - awscloudwatch + processors: + - awsentity/service/telegraf + - ec2tagger + receivers: + - telegraf_socket_listener + - telegraf_statsd + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: error + output_paths: + - /tmp/fake/log/hotdog.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: {} diff --git a/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml b/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml index b3ecfde34b..ec2a2d8994 100644 --- a/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml +++ b/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml @@ -91,7 +91,17 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 + awsentity/service/telegraf: + entity_type: Service + scrape_datapoint_attribute: true + platform: ec2 batch/emf_logs: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -116,9 +126,9 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - InstanceType - ImageId - InstanceId - - InstanceType imds_retries: 1 refresh_interval_seconds: 0s transform: @@ -128,11 +138,11 @@ processors: metric_statements: - context: metric statements: - - set(unit, "unit") where name == "disk_free" - - set(name, "DISK_FREE") where name == "disk_free" - - set(unit, "unit") where name == "cpu_usage_idle" - - set(name, "CPU_USAGE_IDLE") where name == "cpu_usage_idle" - - set(unit, "unit") where name == "cpu_usage_nice" + - set(unit, "unit") where name == "disk_free" + - set(name, "DISK_FREE") where name == "disk_free" + - set(unit, "unit") where name == "cpu_usage_idle" + - set(name, "CPU_USAGE_IDLE") where name == "cpu_usage_idle" + - set(unit, "unit") where name == "cpu_usage_nice" trace_statements: [] receivers: awsxray: @@ -248,6 +258,7 @@ service: - agenthealth/metrics - agenthealth/logs - agenthealth/traces + - entitystore pipelines: logs/emf_logs: exporters: @@ -260,22 +271,32 @@ service: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger - transform receivers: - - telegraf_statsd - - telegraf_netstat - - telegraf_disk - - telegraf_socket_listener - - telegraf_swap - telegraf_procstat/1917393364 - telegraf_cpu - telegraf_mem + - telegraf_netstat - telegraf_processes + - telegraf_swap + - telegraf_disk + metrics/hostCustomMetrics: + exporters: + - awscloudwatch + processors: + - awsentity/service/telegraf + - ec2tagger + - transform + receivers: + - telegraf_socket_listener + - telegraf_statsd metrics/hostDeltaMetrics: exporters: - awscloudwatch processors: + - awsentity/resource - cumulativetodelta/hostDeltaMetrics - ec2tagger - transform diff --git a/translator/tocwconfig/sampleConfig/complete_linux_config.yaml b/translator/tocwconfig/sampleConfig/complete_linux_config.yaml index 041c8dd564..e54d859883 100644 --- a/translator/tocwconfig/sampleConfig/complete_linux_config.yaml +++ b/translator/tocwconfig/sampleConfig/complete_linux_config.yaml @@ -96,7 +96,17 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 + awsentity/service/telegraf: + entity_type: Service + scrape_datapoint_attribute: true + platform: ec2 batch/emf_logs: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -128,9 +138,9 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - InstanceType - ImageId - InstanceId - - InstanceType imds_retries: 1 refresh_interval_seconds: 0s filter/jmx/0: @@ -179,11 +189,11 @@ processors: metric_statements: - context: metric statements: - - set(unit, "unit") where name == "disk_free" - - set(name, "DISK_FREE") where name == "disk_free" - - set(unit, "unit") where name == "cpu_usage_idle" - - set(name, "CPU_USAGE_IDLE") where name == "cpu_usage_idle" - - set(unit, "unit") where name == "cpu_usage_nice" + - set(unit, "unit") where name == "cpu_usage_idle" + - set(name, "CPU_USAGE_IDLE") where name == "cpu_usage_idle" + - set(unit, "unit") where name == "cpu_usage_nice" + - set(unit, "unit") where name == "disk_free" + - set(name, "DISK_FREE") where name == "disk_free" trace_statements: [] transform/jmx/0: error_mode: propagate @@ -192,9 +202,9 @@ processors: metric_statements: - context: metric statements: - - set(name, "kafka.fetch-rate") where name == "kafka.consumer.fetch-rate" - - set(unit, "unit") where name == "jvm.memory.heap.used" - - set(name, "JVM_MEM_HEAP_USED") where name == "jvm.memory.heap.used" + - set(name, "kafka.fetch-rate") where name == "kafka.consumer.fetch-rate" + - set(unit, "unit") where name == "jvm.memory.heap.used" + - set(name, "JVM_MEM_HEAP_USED") where name == "jvm.memory.heap.used" trace_statements: [] transform/jmx/1: error_mode: propagate @@ -203,7 +213,7 @@ processors: metric_statements: - context: metric statements: - - set(name, "TC_ERR") where name == "tomcat.errors" + - set(name, "TC_ERR") where name == "tomcat.errors" trace_statements: [] receivers: awsxray: @@ -354,6 +364,7 @@ service: - agenthealth/metrics - agenthealth/logs - agenthealth/traces + - entitystore pipelines: logs/emf_logs: exporters: @@ -366,28 +377,38 @@ service: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger - transform receivers: - - telegraf_statsd - - telegraf_processes - - telegraf_socket_listener - - telegraf_cpu - - telegraf_swap - - telegraf_procstat/1917393364 - telegraf_mem - telegraf_netstat + - telegraf_procstat/1917393364 + - telegraf_swap + - telegraf_cpu - telegraf_disk + - telegraf_processes + metrics/hostCustomMetrics/cloudwatch: + exporters: + - awscloudwatch + processors: + - awsentity/service/telegraf + - ec2tagger + - transform + receivers: + - telegraf_socket_listener + - telegraf_statsd metrics/hostDeltaMetrics/cloudwatch: exporters: - awscloudwatch processors: + - awsentity/resource - cumulativetodelta/hostDeltaMetrics/cloudwatch - ec2tagger - transform receivers: - - telegraf_net - telegraf_diskio + - telegraf_net metrics/jmx/cloudwatch/0: exporters: - awscloudwatch diff --git a/translator/tocwconfig/sampleConfig/complete_windows_config.yaml b/translator/tocwconfig/sampleConfig/complete_windows_config.yaml index f909003965..d41982d0cb 100644 --- a/translator/tocwconfig/sampleConfig/complete_windows_config.yaml +++ b/translator/tocwconfig/sampleConfig/complete_windows_config.yaml @@ -91,7 +91,17 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 + awsentity/service/telegraf: + entity_type: Service + scrape_datapoint_attribute: true + platform: ec2 batch/emf_logs: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -235,6 +245,7 @@ service: - agenthealth/metrics - agenthealth/logs - agenthealth/traces + - entitystore pipelines: logs/emf_logs: exporters: @@ -247,6 +258,7 @@ service: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger - transform receivers: @@ -254,11 +266,19 @@ service: - telegraf_nvidia_smi - telegraf_win_perf_counters/4283769065 - telegraf_win_perf_counters/3081249416 - - telegraf_statsd - telegraf_win_perf_counters/1492679118 - telegraf_win_perf_counters/2402387132 - telegraf_win_perf_counters/3762679655 - telegraf_procstat/1340600742 + metrics/hostCustomMetrics: + exporters: + - awscloudwatch + processors: + - awsentity/service/telegraf + - ec2tagger + - transform + receivers: + - telegraf_statsd traces/xray: exporters: - awsxray diff --git a/translator/tocwconfig/sampleConfig/config_with_env.yaml b/translator/tocwconfig/sampleConfig/config_with_env.yaml index 6ce8ebb230..c776e99d76 100644 --- a/translator/tocwconfig/sampleConfig/config_with_env.yaml +++ b/translator/tocwconfig/sampleConfig/config_with_env.yaml @@ -39,6 +39,9 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: ${ENV_REGION} processors: batch/emf_logs: metadata_cardinality_limit: 1000 @@ -75,6 +78,7 @@ receivers: service: extensions: - agenthealth/logs + - entitystore pipelines: logs/emf_logs: exporters: diff --git a/translator/tocwconfig/sampleConfig/container_insights_jmx.yaml b/translator/tocwconfig/sampleConfig/container_insights_jmx.yaml index 38a624b908..28be63530c 100644 --- a/translator/tocwconfig/sampleConfig/container_insights_jmx.yaml +++ b/translator/tocwconfig/sampleConfig/container_insights_jmx.yaml @@ -182,6 +182,9 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: batch/containerinsights: metadata_cardinality_limit: 1000 @@ -514,6 +517,7 @@ receivers: service: extensions: - agenthealth/logs + - entitystore pipelines: metrics/containerinsights: exporters: diff --git a/translator/tocwconfig/sampleConfig/delta_config_linux.yaml b/translator/tocwconfig/sampleConfig/delta_config_linux.yaml index 0eab49e607..6a27ffc90d 100644 --- a/translator/tocwconfig/sampleConfig/delta_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/delta_config_linux.yaml @@ -17,7 +17,13 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-east-1 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 cumulativetodelta/hostDeltaMetrics: exclude: match_type: strict @@ -44,12 +50,12 @@ processors: metric_statements: - context: metric statements: - - set(unit, "Count") where name == "diskio_iops_in_progress" - - set(name, "DRIVER_DISKIO_IOPS_IN_PROGRESS") where name == "diskio_iops_in_progress" - - set(unit, "Milliseconds") where name == "diskio_read_time" - - set(name, "DRIVER_DISKIO_READ_TIME") where name == "diskio_read_time" - - set(unit, "Milliseconds") where name == "diskio_write_time" - - set(name, "DRIVER_DISKIO_WRITE_TIME") where name == "diskio_write_time" + - set(unit, "Count") where name == "diskio_iops_in_progress" + - set(name, "DRIVER_DISKIO_IOPS_IN_PROGRESS") where name == "diskio_iops_in_progress" + - set(unit, "Milliseconds") where name == "diskio_read_time" + - set(name, "DRIVER_DISKIO_READ_TIME") where name == "diskio_read_time" + - set(unit, "Milliseconds") where name == "diskio_write_time" + - set(name, "DRIVER_DISKIO_WRITE_TIME") where name == "diskio_write_time" trace_statements: [] receivers: telegraf_diskio: @@ -59,11 +65,13 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/hostDeltaMetrics: exporters: - awscloudwatch processors: + - awsentity/resource - cumulativetodelta/hostDeltaMetrics - ec2tagger - transform diff --git a/translator/tocwconfig/sampleConfig/delta_net_config_linux.yaml b/translator/tocwconfig/sampleConfig/delta_net_config_linux.yaml index 23d3fa3554..f6601c168d 100644 --- a/translator/tocwconfig/sampleConfig/delta_net_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/delta_net_config_linux.yaml @@ -17,7 +17,13 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-east-1 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 cumulativetodelta/hostDeltaMetrics: exclude: match_type: "" @@ -29,9 +35,9 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: - - ImageId - InstanceId - InstanceType + - ImageId imds_retries: 1 refresh_interval_seconds: 0s receivers: @@ -42,11 +48,13 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/hostDeltaMetrics: exporters: - awscloudwatch processors: + - awsentity/resource - cumulativetodelta/hostDeltaMetrics - ec2tagger receivers: diff --git a/translator/tocwconfig/sampleConfig/drop_origin_linux.yaml b/translator/tocwconfig/sampleConfig/drop_origin_linux.yaml index 5e93fe2bc7..a458852b8e 100644 --- a/translator/tocwconfig/sampleConfig/drop_origin_linux.yaml +++ b/translator/tocwconfig/sampleConfig/drop_origin_linux.yaml @@ -22,14 +22,20 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 ec2tagger: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - InstanceType - ImageId - InstanceId - - InstanceType imds_retries: 1 refresh_interval_seconds: 0s transform: @@ -39,9 +45,9 @@ processors: metric_statements: - context: metric statements: - - set(unit, "unit") where name == "cpu_usage_idle" - - set(name, "CPU_USAGE_IDLE") where name == "cpu_usage_idle" - - set(unit, "unit") where name == "cpu_usage_nice" + - set(unit, "unit") where name == "cpu_usage_idle" + - set(name, "CPU_USAGE_IDLE") where name == "cpu_usage_idle" + - set(unit, "unit") where name == "cpu_usage_nice" trace_statements: [] receivers: telegraf_cpu: @@ -59,17 +65,19 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger - transform receivers: + - telegraf_nvidia_smi - telegraf_cpu - telegraf_disk - - telegraf_nvidia_smi telemetry: logs: development: false diff --git a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml index 1f4fc27b70..18e4401d58 100644 --- a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml +++ b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml @@ -398,6 +398,11 @@ extensions: usage_flags: mode: OP region_type: ACJ + entitystore: + mode: onPremise + profile: default + region: us-east-1 + shared_credential_file: /root/.aws/credentials processors: batch/containerinsights: metadata_cardinality_limit: 1000 @@ -479,6 +484,7 @@ receivers: service: extensions: - agenthealth/logs + - entitystore pipelines: logs/emf_logs: exporters: diff --git a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml index 7cb2fe15f0..169eb97852 100644 --- a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml +++ b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml @@ -656,6 +656,11 @@ extensions: usage_flags: mode: OP region_type: ACJ + entitystore: + mode: onPremise + profile: default + region: us-east-1 + shared_credential_file: /root/.aws/credentials processors: batch/containerinsights: metadata_cardinality_limit: 1000 @@ -1151,6 +1156,7 @@ receivers: service: extensions: - agenthealth/logs + - entitystore pipelines: logs/emf_logs: exporters: diff --git a/translator/tocwconfig/sampleConfig/ignore_append_dimensions.yaml b/translator/tocwconfig/sampleConfig/ignore_append_dimensions.yaml index c98f0ad6da..d38f02f2cd 100644 --- a/translator/tocwconfig/sampleConfig/ignore_append_dimensions.yaml +++ b/translator/tocwconfig/sampleConfig/ignore_append_dimensions.yaml @@ -17,7 +17,13 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-east-1 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 ec2tagger: imds_retries: 1 refresh_interval_seconds: 0s @@ -33,11 +39,13 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger receivers: - telegraf_disk diff --git a/translator/tocwconfig/sampleConfig/invalid_input_linux.yaml b/translator/tocwconfig/sampleConfig/invalid_input_linux.yaml index c5aa6c51e8..373ba8e154 100644 --- a/translator/tocwconfig/sampleConfig/invalid_input_linux.yaml +++ b/translator/tocwconfig/sampleConfig/invalid_input_linux.yaml @@ -17,14 +17,20 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-east-1 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 ec2tagger: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - ImageId - InstanceId - InstanceType - - ImageId imds_retries: 1 refresh_interval_seconds: 0s receivers: @@ -39,11 +45,13 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger receivers: - telegraf_disk diff --git a/translator/tocwconfig/sampleConfig/jmx_config_linux.yaml b/translator/tocwconfig/sampleConfig/jmx_config_linux.yaml index 1bfb77f779..2bd2541d3e 100644 --- a/translator/tocwconfig/sampleConfig/jmx_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/jmx_config_linux.yaml @@ -65,11 +65,17 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 sigv4auth: assume_role: sts_region: us-west-2 region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 batch/host/amp: metadata_cardinality_limit: 1000 send_batch_max_size: 0 @@ -160,6 +166,7 @@ service: extensions: - agenthealth/metrics - sigv4auth + - entitystore pipelines: metrics/host/amp: exporters: @@ -174,6 +181,7 @@ service: exporters: - awscloudwatch processors: + - awsentity/resource - transform receivers: - telegraf_disk diff --git a/translator/tocwconfig/sampleConfig/jmx_eks_config_linux.yaml b/translator/tocwconfig/sampleConfig/jmx_eks_config_linux.yaml index 05162a8dd1..a4edf266d3 100644 --- a/translator/tocwconfig/sampleConfig/jmx_eks_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/jmx_eks_config_linux.yaml @@ -66,6 +66,9 @@ extensions: assume_role: sts_region: us-west-2 region: us-west-2 + entitystore: + mode: ec2 + region: us-west-2 processors: batch/jmx/amp/0: metadata_cardinality_limit: 1000 @@ -216,6 +219,7 @@ service: extensions: - agenthealth/metrics - sigv4auth + - entitystore pipelines: metrics/jmx/amp/0: exporters: diff --git a/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml b/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml index c5f7ebc112..68118d53b9 100644 --- a/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml +++ b/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml @@ -365,6 +365,11 @@ extensions: usage_flags: mode: OP region_type: ACJ + entitystore: + mode: onPremise + profile: AmazonCloudWatchAgent + region: us-east-1 + shared_credential_file: fake-path processors: batch/containerinsights: metadata_cardinality_limit: 1000 @@ -415,6 +420,7 @@ receivers: service: extensions: - agenthealth/logs + - entitystore pipelines: metrics/containerinsights: exporters: diff --git a/translator/tocwconfig/sampleConfig/log_ecs_metric_only.conf b/translator/tocwconfig/sampleConfig/log_ecs_metric_only.conf index 1a25fe50c5..0738ed9634 100644 --- a/translator/tocwconfig/sampleConfig/log_ecs_metric_only.conf +++ b/translator/tocwconfig/sampleConfig/log_ecs_metric_only.conf @@ -21,6 +21,6 @@ [[outputs.cloudwatchlogs]] endpoint_override = "https://fake_endpoint" force_flush_interval = "5s" - log_stream_name = "fake-host-name" + log_stream_name = "arn_aws_ecs_us-east-1_account_id_task/task_id" region = "us-west-2" diff --git a/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml b/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml index b08d51c861..3943981aa6 100644 --- a/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml +++ b/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml @@ -7,7 +7,7 @@ exporters: local_mode: false log_group_name: emf/logs/default log_retention: 0 - log_stream_name: fake-host-name + log_stream_name: arn_aws_ecs_us-east-1_account_id_task/task_id max_retries: 2 middleware: agenthealth/logs no_verify_ssl: false diff --git a/translator/tocwconfig/sampleConfig/log_filter.yaml b/translator/tocwconfig/sampleConfig/log_filter.yaml new file mode 100644 index 0000000000..0b694fca94 --- /dev/null +++ b/translator/tocwconfig/sampleConfig/log_filter.yaml @@ -0,0 +1,36 @@ +exporters: + nop: {} +extensions: + entitystore: + mode: "ec2" + region: us-east-1 +receivers: + nop: {} +service: + extensions: + - entitystore + pipelines: + metrics/nop: + exporters: + - nop + processors: [] + receivers: + - nop + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + output_paths: + - /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: { } \ No newline at end of file diff --git a/translator/tocwconfig/sampleConfig/log_only_config_windows.yaml b/translator/tocwconfig/sampleConfig/log_only_config_windows.yaml new file mode 100644 index 0000000000..a01b2785ed --- /dev/null +++ b/translator/tocwconfig/sampleConfig/log_only_config_windows.yaml @@ -0,0 +1,36 @@ +exporters: + nop: {} +extensions: + entitystore: + mode: "ec2" + region: us-west-2 +receivers: + nop: {} +service: + extensions: + - entitystore + pipelines: + metrics/nop: + exporters: + - nop + processors: [] + receivers: + - nop + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + output_paths: + - c:\ProgramData\Amazon\AmazonCloudWatchAgent\Logs\amazon-cloudwatch-agent.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: { } \ No newline at end of file diff --git a/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml b/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml index 6000b359a5..28594ce0e7 100644 --- a/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml +++ b/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml @@ -394,6 +394,10 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-east-1 + processors: batch/containerinsights: metadata_cardinality_limit: 1000 @@ -473,6 +477,7 @@ receivers: service: extensions: - agenthealth/logs + - entitystore pipelines: logs/emf_logs: exporters: diff --git a/translator/tocwconfig/sampleConfig/no_skip_log_timestamp.yaml b/translator/tocwconfig/sampleConfig/no_skip_log_timestamp.yaml new file mode 100644 index 0000000000..e3327e1d00 --- /dev/null +++ b/translator/tocwconfig/sampleConfig/no_skip_log_timestamp.yaml @@ -0,0 +1,36 @@ +exporters: + nop: {} +extensions: + entitystore: + mode: "ec2" + region: us-west-2 +receivers: + nop: {} +service: + extensions: + - entitystore + pipelines: + metrics/nop: + exporters: + - nop + processors: [] + receivers: + - nop + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + output_paths: + - /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: { } \ No newline at end of file diff --git a/translator/tocwconfig/sampleConfig/no_skip_log_timestamp_windows.yaml b/translator/tocwconfig/sampleConfig/no_skip_log_timestamp_windows.yaml new file mode 100644 index 0000000000..a01b2785ed --- /dev/null +++ b/translator/tocwconfig/sampleConfig/no_skip_log_timestamp_windows.yaml @@ -0,0 +1,36 @@ +exporters: + nop: {} +extensions: + entitystore: + mode: "ec2" + region: us-west-2 +receivers: + nop: {} +service: + extensions: + - entitystore + pipelines: + metrics/nop: + exporters: + - nop + processors: [] + receivers: + - nop + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + output_paths: + - c:\ProgramData\Amazon\AmazonCloudWatchAgent\Logs\amazon-cloudwatch-agent.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: { } \ No newline at end of file diff --git a/translator/tocwconfig/sampleConfig/otlp_metrics_cloudwatchlogs_config.yaml b/translator/tocwconfig/sampleConfig/otlp_metrics_cloudwatchlogs_config.yaml index 2b4577bc59..f6233cf355 100644 --- a/translator/tocwconfig/sampleConfig/otlp_metrics_cloudwatchlogs_config.yaml +++ b/translator/tocwconfig/sampleConfig/otlp_metrics_cloudwatchlogs_config.yaml @@ -37,13 +37,16 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: - batch/hostDeltaMetrics/cloudwatchlogs: + batch/hostOtlpMetrics/cloudwatchlogs: metadata_cardinality_limit: 1000 send_batch_max_size: 0 send_batch_size: 8192 timeout: 30s - cumulativetodelta/hostDeltaMetrics/cloudwatchlogs: + cumulativetodelta/hostOtlpMetrics/cloudwatchlogs: exclude: match_type: "" include: @@ -93,13 +96,14 @@ receivers: service: extensions: - agenthealth/logs + - entitystore pipelines: - metrics/hostDeltaMetrics/cloudwatchlogs: + metrics/hostOtlpMetrics/cloudwatchlogs: exporters: - awsemf processors: - - batch/hostDeltaMetrics/cloudwatchlogs - - cumulativetodelta/hostDeltaMetrics/cloudwatchlogs + - batch/hostOtlpMetrics/cloudwatchlogs + - cumulativetodelta/hostOtlpMetrics/cloudwatchlogs receivers: - otlp/metrics telemetry: diff --git a/translator/tocwconfig/sampleConfig/otlp_metrics_config.yaml b/translator/tocwconfig/sampleConfig/otlp_metrics_config.yaml index 3457282e76..8f47cce671 100644 --- a/translator/tocwconfig/sampleConfig/otlp_metrics_config.yaml +++ b/translator/tocwconfig/sampleConfig/otlp_metrics_config.yaml @@ -17,8 +17,11 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: - cumulativetodelta/hostDeltaMetrics: + cumulativetodelta/hostOtlpMetrics: exclude: match_type: "" include: @@ -77,12 +80,13 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: - metrics/hostDeltaMetrics: + metrics/hostOtlpMetrics: exporters: - awscloudwatch processors: - - cumulativetodelta/hostDeltaMetrics + - cumulativetodelta/hostOtlpMetrics - ec2tagger receivers: - otlp/metrics diff --git a/translator/tocwconfig/sampleConfig/procstat_memory_swap_config.yaml b/translator/tocwconfig/sampleConfig/procstat_memory_swap_config.yaml index 72352a1576..cfce7bfa44 100644 --- a/translator/tocwconfig/sampleConfig/procstat_memory_swap_config.yaml +++ b/translator/tocwconfig/sampleConfig/procstat_memory_swap_config.yaml @@ -19,6 +19,11 @@ extensions: usage_flags: mode: OP region_type: ACJ + entitystore: + mode: onPremise + profile: AmazonCloudWatchAgent + region: us-west-2 + shared_credential_file: fake-path receivers: telegraf_procstat/793254176: alias_name: amazon-cloudwatch-agent @@ -28,6 +33,7 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: diff --git a/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml b/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml index 83ca491154..ce4ad17041 100644 --- a/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml @@ -77,6 +77,9 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-east-1 processors: batch/prometheus: metadata_cardinality_limit: 1000 @@ -91,6 +94,7 @@ receivers: service: extensions: - agenthealth/logs + - entitystore pipelines: metrics/prometheus: exporters: diff --git a/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml b/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml index bb0866fc55..2a47f34ae3 100644 --- a/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml +++ b/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml @@ -59,6 +59,9 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-east-1 processors: batch/prometheus: metadata_cardinality_limit: 1000 @@ -73,6 +76,7 @@ receivers: service: extensions: - agenthealth/logs + - entitystore pipelines: metrics/prometheus: exporters: diff --git a/translator/tocwconfig/sampleConfig/skip_log_timestamp.yaml b/translator/tocwconfig/sampleConfig/skip_log_timestamp.yaml new file mode 100644 index 0000000000..df1b94808d --- /dev/null +++ b/translator/tocwconfig/sampleConfig/skip_log_timestamp.yaml @@ -0,0 +1,36 @@ +exporters: + nop: {} +extensions: + entitystore: + mode: "ec2" + region: us-west-2 +receivers: + nop: {} +service: + extensions: + - entitystore + pipelines: + metrics/nop: + exporters: + - nop + processors: [] + receivers: + - nop + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + output_paths: + - /opt/tmp/a.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: { } \ No newline at end of file diff --git a/translator/tocwconfig/sampleConfig/skip_log_timestamp_default.yaml b/translator/tocwconfig/sampleConfig/skip_log_timestamp_default.yaml new file mode 100644 index 0000000000..e3327e1d00 --- /dev/null +++ b/translator/tocwconfig/sampleConfig/skip_log_timestamp_default.yaml @@ -0,0 +1,36 @@ +exporters: + nop: {} +extensions: + entitystore: + mode: "ec2" + region: us-west-2 +receivers: + nop: {} +service: + extensions: + - entitystore + pipelines: + metrics/nop: + exporters: + - nop + processors: [] + receivers: + - nop + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + output_paths: + - /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: { } \ No newline at end of file diff --git a/translator/tocwconfig/sampleConfig/skip_log_timestamp_default_windows.yaml b/translator/tocwconfig/sampleConfig/skip_log_timestamp_default_windows.yaml new file mode 100644 index 0000000000..a01b2785ed --- /dev/null +++ b/translator/tocwconfig/sampleConfig/skip_log_timestamp_default_windows.yaml @@ -0,0 +1,36 @@ +exporters: + nop: {} +extensions: + entitystore: + mode: "ec2" + region: us-west-2 +receivers: + nop: {} +service: + extensions: + - entitystore + pipelines: + metrics/nop: + exporters: + - nop + processors: [] + receivers: + - nop + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + output_paths: + - c:\ProgramData\Amazon\AmazonCloudWatchAgent\Logs\amazon-cloudwatch-agent.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: { } \ No newline at end of file diff --git a/translator/tocwconfig/sampleConfig/skip_log_timestamp_windows.yaml b/translator/tocwconfig/sampleConfig/skip_log_timestamp_windows.yaml new file mode 100644 index 0000000000..e3dd15b6ba --- /dev/null +++ b/translator/tocwconfig/sampleConfig/skip_log_timestamp_windows.yaml @@ -0,0 +1,36 @@ +exporters: + nop: {} +extensions: + entitystore: + mode: "ec2" + region: us-west-2 +receivers: + nop: {} +service: + extensions: + - entitystore + pipelines: + metrics/nop: + exporters: + - nop + processors: [] + receivers: + - nop + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + output_paths: + - c:\tmp\am.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: { } \ No newline at end of file diff --git a/translator/tocwconfig/sampleConfig/standard_config_linux.yaml b/translator/tocwconfig/sampleConfig/standard_config_linux.yaml index 621f6cefd4..99724c7d28 100644 --- a/translator/tocwconfig/sampleConfig/standard_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/standard_config_linux.yaml @@ -17,7 +17,13 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 cumulativetodelta/hostDeltaMetrics: exclude: match_type: strict @@ -32,9 +38,9 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - ImageId - InstanceId - InstanceType - - ImageId refresh_interval_seconds: 0s receivers: telegraf_cpu: @@ -60,21 +66,24 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger receivers: + - telegraf_cpu - telegraf_disk - telegraf_mem - telegraf_swap - - telegraf_cpu metrics/hostDeltaMetrics: exporters: - awscloudwatch processors: + - awsentity/resource - cumulativetodelta/hostDeltaMetrics - ec2tagger receivers: diff --git a/translator/tocwconfig/sampleConfig/standard_config_linux_with_common_config.yaml b/translator/tocwconfig/sampleConfig/standard_config_linux_with_common_config.yaml index 9f566c5c12..13bac887c2 100644 --- a/translator/tocwconfig/sampleConfig/standard_config_linux_with_common_config.yaml +++ b/translator/tocwconfig/sampleConfig/standard_config_linux_with_common_config.yaml @@ -19,7 +19,15 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + profile: AmazonCloudWatchAgent + region: us-west-2 + shared_credential_file: fake-path processors: + awsentity/resource: + entity_type: Resource + platform: ec2 cumulativetodelta/hostDeltaMetrics: exclude: match_type: strict @@ -65,21 +73,24 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger receivers: + - telegraf_cpu - telegraf_disk - telegraf_mem - telegraf_swap - - telegraf_cpu metrics/hostDeltaMetrics: exporters: - awscloudwatch processors: + - awsentity/resource - cumulativetodelta/hostDeltaMetrics - ec2tagger receivers: diff --git a/translator/tocwconfig/sampleConfig/standard_config_windows.yaml b/translator/tocwconfig/sampleConfig/standard_config_windows.yaml index fec2223aa6..8df619d970 100644 --- a/translator/tocwconfig/sampleConfig/standard_config_windows.yaml +++ b/translator/tocwconfig/sampleConfig/standard_config_windows.yaml @@ -17,7 +17,13 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 processors: + awsentity/resource: + entity_type: Resource + platform: ec2 ec2tagger: ec2_instance_tag_keys: - AutoScalingGroupName @@ -55,18 +61,20 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger receivers: - - telegraf_win_perf_counters/3446270237 - - telegraf_win_perf_counters/3762679655 - telegraf_win_perf_counters/4283769065 - telegraf_win_perf_counters/1492679118 - telegraf_win_perf_counters/3610923661 + - telegraf_win_perf_counters/3446270237 + - telegraf_win_perf_counters/3762679655 telemetry: logs: development: false diff --git a/translator/tocwconfig/sampleConfig/standard_config_windows_with_common_config.yaml b/translator/tocwconfig/sampleConfig/standard_config_windows_with_common_config.yaml index 6c6c531d15..2914d1bb74 100644 --- a/translator/tocwconfig/sampleConfig/standard_config_windows_with_common_config.yaml +++ b/translator/tocwconfig/sampleConfig/standard_config_windows_with_common_config.yaml @@ -19,14 +19,22 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + profile: AmazonCloudWatchAgent + region: us-west-2 + shared_credential_file: fake-path processors: + awsentity/resource: + entity_type: Resource + platform: ec2 ec2tagger: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - InstanceType - ImageId - InstanceId - - InstanceType imds_retries: 2 profile: AmazonCloudWatchAgent refresh_interval_seconds: 0s @@ -60,18 +68,20 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: metrics/host: exporters: - awscloudwatch processors: + - awsentity/resource - ec2tagger receivers: - - telegraf_win_perf_counters/3610923661 - - telegraf_win_perf_counters/3446270237 - telegraf_win_perf_counters/3762679655 - telegraf_win_perf_counters/4283769065 - telegraf_win_perf_counters/1492679118 + - telegraf_win_perf_counters/3610923661 + - telegraf_win_perf_counters/3446270237 telemetry: logs: development: false diff --git a/translator/tocwconfig/sampleConfig/statsd_config_linux.yaml b/translator/tocwconfig/sampleConfig/statsd_config_linux.yaml index 6e818d628f..0034301d02 100644 --- a/translator/tocwconfig/sampleConfig/statsd_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/statsd_config_linux.yaml @@ -17,6 +17,14 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 +processors: + awsentity/service/telegraf: + entity_type: Service + scrape_datapoint_attribute: true + platform: ec2 receivers: telegraf_statsd: collection_interval: 10s @@ -25,11 +33,13 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: - metrics/host: + metrics/hostCustomMetrics: exporters: - awscloudwatch - processors: [] + processors: + - awsentity/service/telegraf receivers: - telegraf_statsd telemetry: diff --git a/translator/tocwconfig/sampleConfig/statsd_config_windows.yaml b/translator/tocwconfig/sampleConfig/statsd_config_windows.yaml index b0c9488ad8..6aeeae4dd6 100644 --- a/translator/tocwconfig/sampleConfig/statsd_config_windows.yaml +++ b/translator/tocwconfig/sampleConfig/statsd_config_windows.yaml @@ -17,6 +17,14 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + region: us-west-2 +processors: + awsentity/service/telegraf: + entity_type: Service + scrape_datapoint_attribute: true + platform: ec2 receivers: telegraf_statsd: collection_interval: 10s @@ -25,11 +33,13 @@ receivers: service: extensions: - agenthealth/metrics + - entitystore pipelines: - metrics/host: + metrics/hostCustomMetrics: exporters: - awscloudwatch - processors: [] + processors: + - awsentity/service/telegraf receivers: - telegraf_statsd telemetry: diff --git a/translator/tocwconfig/sampleConfig/trace_config_linux.yaml b/translator/tocwconfig/sampleConfig/trace_config_linux.yaml index 6502bfec4d..11aceb51c8 100644 --- a/translator/tocwconfig/sampleConfig/trace_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/trace_config_linux.yaml @@ -30,6 +30,11 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + profile: default + region: us-west-2 + shared_credential_file: /root/.aws/credentials processors: batch/xray: metadata_cardinality_limit: 1000 @@ -79,6 +84,7 @@ receivers: service: extensions: - agenthealth/traces + - entitystore pipelines: traces/xray: exporters: diff --git a/translator/tocwconfig/sampleConfig/trace_config_windows.yaml b/translator/tocwconfig/sampleConfig/trace_config_windows.yaml index c5b4d92093..4ab7efc002 100644 --- a/translator/tocwconfig/sampleConfig/trace_config_windows.yaml +++ b/translator/tocwconfig/sampleConfig/trace_config_windows.yaml @@ -30,6 +30,11 @@ extensions: usage_flags: mode: EC2 region_type: ACJ + entitystore: + mode: ec2 + profile: default + region: us-west-2 + shared_credential_file: /root/.aws/credentials processors: batch/xray: metadata_cardinality_limit: 1000 @@ -79,6 +84,7 @@ receivers: service: extensions: - agenthealth/traces + - entitystore pipelines: traces/xray: exporters: diff --git a/translator/tocwconfig/sampleConfig/windows_eventlog_only_config.yaml b/translator/tocwconfig/sampleConfig/windows_eventlog_only_config.yaml new file mode 100644 index 0000000000..78c680ddcf --- /dev/null +++ b/translator/tocwconfig/sampleConfig/windows_eventlog_only_config.yaml @@ -0,0 +1,36 @@ +exporters: + nop: {} +extensions: + entitystore: + mode: "ec2" + region: us-west-2 +receivers: + nop: {} +service: + extensions: + - entitystore + pipelines: + metrics/nop: + exporters: + - nop + processors: [] + receivers: + - nop + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + output_paths: + - c:\ProgramData\Amazon\AmazonCloudWatchAgent\Logs\amazon-cloudwatch-agent.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: { } \ No newline at end of file diff --git a/translator/tocwconfig/tocwconfig_test.go b/translator/tocwconfig/tocwconfig_test.go index 1be7a0b497..60b0d2ad9c 100644 --- a/translator/tocwconfig/tocwconfig_test.go +++ b/translator/tocwconfig/tocwconfig_test.go @@ -180,6 +180,19 @@ func TestAppSignalsAndNativeKubernetesConfig(t *testing.T) { checkTranslation(t, "appsignals_and_k8s_config", "windows", expectedEnvVars, "") } +func TestCompassConfig(t *testing.T) { + resetContext(t) + + //context.CurrentContext().SetRunInContainer(true) + context.CurrentContext().SetMode(config.ModeEC2) + + t.Setenv(config.HOST_NAME, "host_name_from_env") + t.Setenv(config.HOST_IP, "127.0.0.1") + + checkTranslation(t, "compass_linux_config", "linux", nil, "") + checkTranslation(t, "compass_linux_config", "darwin", nil, "") +} + func TestEmfAndKubernetesConfig(t *testing.T) { resetContext(t) readCommonConfig(t, "./sampleConfig/commonConfig/withCredentials.toml") @@ -595,12 +608,17 @@ func TestECSNodeMetricConfig(t *testing.T) { resetContext(t) context.CurrentContext().SetRunInContainer(true) context.CurrentContext().SetMode(config.ModeEC2) + ecsutil.GetECSUtilSingleton().TaskARN = "arn:aws:ecs:us-east-1:account_id:task/task_id" + ecsSingleton := ecsutil.GetECSUtilSingleton() + ecsSingleton.Region = "us-west-2" t.Setenv("RUN_IN_CONTAINER", "True") t.Setenv("HOST_NAME", "fake-host-name") t.Setenv("HOST_IP", "127.0.0.1") expectedEnvVars := map[string]string{} checkTranslation(t, "log_ecs_metric_only", "linux", expectedEnvVars, "") checkTranslation(t, "log_ecs_metric_only", "darwin", nil, "") + //Reset back to default value to not impact other tests + ecsSingleton.Region = "" } func TestLogFilterConfig(t *testing.T) { @@ -726,8 +744,6 @@ func verifyToYamlTranslation(t *testing.T, input interface{}, expectedYamlFilePa yamlStr := toyamlconfig.ToYamlConfig(yamlConfig) require.NoError(t, yaml.Unmarshal([]byte(yamlStr), &actual)) - // assert.NoError(t, os.WriteFile(expectedYamlFilePath, []byte(yamlStr), 0644)) // useful for regenerating YAML - opt := cmpopts.SortSlices(func(x, y interface{}) bool { return pretty.Sprint(x) < pretty.Sprint(y) }) diff --git a/translator/tocwconfig/totomlconfig/testdata/agentToml.conf b/translator/tocwconfig/totomlconfig/testdata/agentToml.conf index 1bbd040d06..4b9a68b829 100644 --- a/translator/tocwconfig/totomlconfig/testdata/agentToml.conf +++ b/translator/tocwconfig/totomlconfig/testdata/agentToml.conf @@ -104,6 +104,7 @@ [inputs.socket_listener.tags] "aws:AggregationInterval" = "60s" + [[inputs.statsd]] interval = "10s" metric_separator = "_" @@ -112,6 +113,7 @@ [inputs.statsd.tags] "aws:AggregationInterval" = "60s" + [[inputs.swap]] fieldpass = ["used", "free", "used_percent"] [inputs.swap.tags] diff --git a/translator/tocwconfig/totomlconfig/tomlConfigTemplate/tomlConfig.go b/translator/tocwconfig/totomlconfig/tomlConfigTemplate/tomlConfig.go index b48129cea4..2a26ad9bb2 100644 --- a/translator/tocwconfig/totomlconfig/tomlConfigTemplate/tomlConfig.go +++ b/translator/tocwconfig/totomlconfig/tomlConfigTemplate/tomlConfig.go @@ -126,8 +126,12 @@ type ( Pipe bool RetentionInDays int `toml:"retention_in_days"` Timezone string - Tags map[string]string - Filters []fileConfigFilter + //Customer specified service.name + ServiceName string `toml:"service_name"` + //Customer specified deployment.environment + DeploymentEnvironment string `toml:"deployment_environment"` + Tags map[string]string + Filters []fileConfigFilter } k8sApiServerConfig struct { diff --git a/translator/translate/agent/agent.go b/translator/translate/agent/agent.go index dad8a19392..fe196352af 100644 --- a/translator/translate/agent/agent.go +++ b/translator/translate/agent/agent.go @@ -25,20 +25,25 @@ func RegisterRule(fieldname string, r translator.Rule) { } type Agent struct { - Interval string - Credentials map[string]interface{} - Region string - RegionType string - Mode string - Internal bool - Role_arn string + Interval string + Credentials map[string]interface{} + Region string + RegionType string + Mode string + Internal bool + Role_arn string + ServiceName string + DeploymentEnvironment string } -var Global_Config Agent = *new(Agent) +var ( + Global_Config Agent = *new(Agent) +) func (a *Agent) ApplyRule(input interface{}) (returnKey string, returnVal interface{}) { m := input.(map[string]interface{}) result := map[string]interface{}{} + /* In JSON config file, it represent as "agent" : {//specification config information} To check the specification config entry diff --git a/translator/translate/agent/agent_test.go b/translator/translate/agent/agent_test.go index 4b3f221aed..f1158d4e29 100644 --- a/translator/translate/agent/agent_test.go +++ b/translator/translate/agent/agent_test.go @@ -174,3 +174,21 @@ func restoreProxyEnv() { os.Setenv("https_proxy", httpsProxy) os.Setenv("no_proxy", noProxy) } + +func TestAgentServiceAndEnvironmentConfig(t *testing.T) { + agentServiceAndEnvironmentConfig(t, config.OS_TYPE_LINUX) + agentServiceAndEnvironmentConfig(t, config.OS_TYPE_DARWIN) +} + +func agentServiceAndEnvironmentConfig(t *testing.T, osType string) { + a := new(Agent) + translator.SetTargetPlatform(osType) + var input interface{} + err := json.Unmarshal([]byte(`{"agent":{"region": "us-west-2", "service.name": "my-service", "deployment.environment":"test-environment"}}`), &input) + if err != nil { + assert.Fail(t, err.Error()) + } + _, _ = a.ApplyRule(input) + assert.Equal(t, "my-service", Global_Config.ServiceName) + assert.Equal(t, "test-environment", Global_Config.DeploymentEnvironment) +} diff --git a/translator/translate/agent/ruleDeploymentEnvironment.go b/translator/translate/agent/ruleDeploymentEnvironment.go new file mode 100644 index 0000000000..02d7bdfa49 --- /dev/null +++ b/translator/translate/agent/ruleDeploymentEnvironment.go @@ -0,0 +1,23 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package agent + +import ( + "github.com/aws/amazon-cloudwatch-agent/translator" +) + +type DeploymentEnvironment struct{} + +func (f *DeploymentEnvironment) ApplyRule(input interface{}) (returnKey string, returnVal interface{}) { + _, result := translator.DefaultCase("deployment.environment", "", input) + + // Set global agent deployment environment + Global_Config.DeploymentEnvironment = result.(string) + return +} + +func init() { + f := new(DeploymentEnvironment) + RegisterRule("deployment.environment", f) +} diff --git a/translator/translate/agent/ruleServiceName.go b/translator/translate/agent/ruleServiceName.go new file mode 100644 index 0000000000..15434bd185 --- /dev/null +++ b/translator/translate/agent/ruleServiceName.go @@ -0,0 +1,24 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package agent + +import ( + "github.com/aws/amazon-cloudwatch-agent/translator" +) + +type ServiceName struct { +} + +func (f *ServiceName) ApplyRule(input interface{}) (returnKey string, returnVal interface{}) { + _, result := translator.DefaultCase("service.name", "", input) + + // Set global agent service name + Global_Config.ServiceName = result.(string) + return +} + +func init() { + f := new(ServiceName) + RegisterRule("service.name", f) +} diff --git a/translator/translate/logs/logs.go b/translator/translate/logs/logs.go index b39a022f40..e0887b40c5 100644 --- a/translator/translate/logs/logs.go +++ b/translator/translate/logs/logs.go @@ -30,11 +30,17 @@ func RegisterRule(fieldname string, r Rule) { } type Logs struct { - FileStateFolder string - MetadataInfo map[string]string + FileStateFolder string + MetadataInfo map[string]string + ServiceName string + DeploymentEnvironment string } -var GlobalLogConfig = Logs{} +var ( + GlobalLogConfig = Logs{} + serviceName ServiceName + deploymentEnvironment DeploymentEnvironment +) func (l *Logs) ApplyRule(input interface{}) (returnKey string, returnVal interface{}) { im := input.(map[string]interface{}) @@ -44,6 +50,10 @@ func (l *Logs) ApplyRule(input interface{}) (returnKey string, returnVal interfa cloudwatchConfig := map[string]interface{}{} GlobalLogConfig.MetadataInfo = util.GetMetadataInfo(util.Ec2MetadataInfoProvider) + //Apply Environment and ServiceName rules + serviceName.ApplyRule(im[SectionKey]) + deploymentEnvironment.ApplyRule(im[SectionKey]) + //Check if this plugin exist in the input instance //If not, not process if _, ok := im[SectionKey]; !ok { diff --git a/translator/translate/logs/logs_collected/files/collect_list/collect_list_test.go b/translator/translate/logs/logs_collected/files/collect_list/collect_list_test.go index 5d023296e5..5f5e93b115 100644 --- a/translator/translate/logs/logs_collected/files/collect_list/collect_list_test.go +++ b/translator/translate/logs/logs_collected/files/collect_list/collect_list_test.go @@ -17,6 +17,7 @@ import ( "github.com/aws/amazon-cloudwatch-agent/translator" "github.com/aws/amazon-cloudwatch-agent/translator/context" "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/logs" ) func TestFileConfig(t *testing.T) { @@ -30,13 +31,15 @@ func TestFileConfig(t *testing.T) { _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "log_group_name": "group1", - "log_stream_name": "LOG_STREAM_NAME", - "log_group_class": util.StandardLogGroupClass, - "pipe": false, - "retention_in_days": -1, + "file_path": "path1", + "from_beginning": true, + "log_group_name": "group1", + "log_stream_name": "LOG_STREAM_NAME", + "log_group_class": util.StandardLogGroupClass, + "pipe": false, + "retention_in_days": -1, + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) } @@ -51,12 +54,14 @@ func TestFileConfigOverride(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": false, - "log_group_name": "group1", - "pipe": false, - "retention_in_days": -1, - "log_group_class": "", + "file_path": "path1", + "from_beginning": false, + "log_group_name": "group1", + "pipe": false, + "retention_in_days": -1, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) } @@ -78,14 +83,16 @@ func TestTimestampFormat(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "timestamp_layout": []string{"15:04:05 06 Jan _2"}, - "timestamp_regex": "(\\d{2}:\\d{2}:\\d{2} \\d{2} \\w{3} \\s{0,1}\\d{1,2})", - "timezone": "UTC", - "retention_in_days": -1, - "log_group_class": "", + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "timestamp_layout": []string{"15:04:05 06 Jan _2"}, + "timestamp_regex": "(\\d{2}:\\d{2}:\\d{2} \\d{2} \\w{3} \\s{0,1}\\d{1,2})", + "timezone": "UTC", + "retention_in_days": -1, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) } @@ -105,13 +112,15 @@ func TestTimestampFormatAll(t *testing.T) { ] }`, expected: []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "timestamp_layout": []string{"15:04:05 06 Jan _2"}, - "timestamp_regex": "(\\d{2}:\\d{2}:\\d{2} \\d{2} \\w{3} \\s{0,1}\\d{1,2})", - "log_group_class": "", + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": []string{"15:04:05 06 Jan _2"}, + "timestamp_regex": "(\\d{2}:\\d{2}:\\d{2} \\d{2} \\w{3} \\s{0,1}\\d{1,2})", + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }}, }, { @@ -124,13 +133,15 @@ func TestTimestampFormatAll(t *testing.T) { ] }`, expected: []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "timestamp_layout": []string{"1 _2 15:04:05", "01 _2 15:04:05"}, - "timestamp_regex": "(\\d{1,2} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", - "log_group_class": "", + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": []string{"1 _2 15:04:05", "01 _2 15:04:05"}, + "timestamp_regex": "(\\d{1,2} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }}, }, { @@ -143,13 +154,15 @@ func TestTimestampFormatAll(t *testing.T) { ] }`, expected: []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "timestamp_layout": []string{"_2 1 15:04:05", "_2 01 15:04:05"}, - "timestamp_regex": "(\\d{1,2} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", - "log_group_class": "", + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": []string{"_2 1 15:04:05", "_2 01 15:04:05"}, + "timestamp_regex": "(\\d{1,2} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }}, }, { @@ -162,13 +175,15 @@ func TestTimestampFormatAll(t *testing.T) { ] }`, expected: []interface{}{map[string]interface{}{ - "file_path": "path4", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "timestamp_layout": []string{"Jan _2 15:04:05"}, - "timestamp_regex": "(\\w{3} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", - "log_group_class": "", + "file_path": "path4", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": []string{"Jan _2 15:04:05"}, + "timestamp_regex": "(\\w{3} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }}, }, { @@ -181,13 +196,57 @@ func TestTimestampFormatAll(t *testing.T) { ] }`, expected: []interface{}{map[string]interface{}{ - "file_path": "path5", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "timestamp_layout": []string{"Jan _2 15:04:05"}, - "timestamp_regex": "(\\w{3} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", - "log_group_class": "", + "file_path": "path5", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": []string{"Jan _2 15:04:05"}, + "timestamp_regex": "(\\w{3} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", + "log_group_class": "", + "service_name": "", + "deployment_environment": "", + }}, + }, + { + input: `{ + "collect_list":[ + { + "file_path":"path4", + "timestamp_format": "%b %d %H:%M:%S" + } + ] + }`, + expected: []interface{}{map[string]interface{}{ + "file_path": "path4", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": []string{"Jan _2 15:04:05"}, + "timestamp_regex": "(\\w{3} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", + "log_group_class": "", + "service_name": "", + "deployment_environment": "", + }}, + }, + { + input: `{ + "collect_list":[ + { + "file_path":"path5", + "timestamp_format": "%b %-d %H:%M:%S" + } + ] + }`, + expected: []interface{}{map[string]interface{}{ + "file_path": "path5", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": []string{"Jan _2 15:04:05"}, + "timestamp_regex": "(\\w{3} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }}, }, { @@ -200,13 +259,15 @@ func TestTimestampFormatAll(t *testing.T) { ] }`, expected: []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "timestamp_layout": []string{"5 _2 1 15:04:05", "5 _2 01 15:04:05"}, - "timestamp_regex": "(\\d{1,2} \\s{0,1}\\d{1,2} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", - "log_group_class": "", + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": []string{"5 _2 1 15:04:05", "5 _2 01 15:04:05"}, + "timestamp_regex": "(\\d{1,2} \\s{0,1}\\d{1,2} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }}, }, { @@ -219,13 +280,15 @@ func TestTimestampFormatAll(t *testing.T) { ] }`, expected: []interface{}{map[string]interface{}{ - "file_path": "path7", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "timestamp_layout": []string{"5 _2 01 15:04:05", "5 _2 1 15:04:05"}, - "timestamp_regex": "(\\d{1,2} \\s{0,1}\\d{1,2} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", - "log_group_class": "", + "file_path": "path7", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": []string{"5 _2 01 15:04:05", "5 _2 1 15:04:05"}, + "timestamp_regex": "(\\d{1,2} \\s{0,1}\\d{1,2} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})", + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }}, }, } @@ -267,14 +330,16 @@ func TestTimestampFormat_NonZeroPadding(t *testing.T) { expectedLayout := []string{"3:4:5 06 1 _2", "3:4:5 06 01 _2"} expectedRegex := "(\\d{1,2}:\\d{1,2}:\\d{1,2} \\d{2} \\s{0,1}\\d{1,2} \\s{0,1}\\d{1,2})" expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "log_group_class": "", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "timestamp_layout": expectedLayout, - "timestamp_regex": expectedRegex, - "timezone": "UTC", + "file_path": "path1", + "log_group_class": "", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": expectedLayout, + "timestamp_regex": expectedRegex, + "timezone": "UTC", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) @@ -313,14 +378,16 @@ func TestTimestampFormat_SpecialCharacters(t *testing.T) { expectedLayout := []string{"^.*?|[({15:04:05 06 Jan _2})]$"} expectedRegex := "(\\^\\.\\*\\?\\|\\[\\(\\{\\d{2}:\\d{2}:\\d{2} \\d{2} \\w{3} \\s{0,1}\\d{1,2}\\}\\)\\]\\$)" expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "log_group_class": "", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "timestamp_layout": expectedLayout, - "timestamp_regex": expectedRegex, - "timezone": "UTC", + "file_path": "path1", + "log_group_class": "", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": expectedLayout, + "timestamp_regex": expectedRegex, + "timezone": "UTC", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) @@ -353,13 +420,15 @@ func TestTimestampFormat_Template(t *testing.T) { expectedLayout := []string{"Jan _2 15:04:05"} expectedRegex := "(\\w{3} \\s{0,1}\\d{1,2} \\d{2}:\\d{2}:\\d{2})" expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "log_group_class": "", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "timestamp_layout": expectedLayout, - "timestamp_regex": expectedRegex, + "file_path": "path1", + "log_group_class": "", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "timestamp_layout": expectedLayout, + "timestamp_regex": expectedRegex, + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) @@ -417,6 +486,8 @@ func TestMultiLineStartPattern(t *testing.T) { "timestamp_regex": "(\\d{2}:\\d{2}:\\d{2} \\d{2} \\w{3} \\s{0,1}\\d{1,2})", "timezone": "UTC", "multi_line_start_pattern": "{timestamp_regex}", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) } @@ -439,15 +510,17 @@ func TestEncoding(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "log_group_class": "", - "timestamp_layout": []string{"15:04:05 06 Jan _2"}, - "timestamp_regex": "(\\d{2}:\\d{2}:\\d{2} \\d{2} \\w{3} \\s{0,1}\\d{1,2})", - "timezone": "UTC", - "encoding": "gbk", + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "log_group_class": "", + "timestamp_layout": []string{"15:04:05 06 Jan _2"}, + "timestamp_regex": "(\\d{2}:\\d{2}:\\d{2} \\d{2} \\w{3} \\s{0,1}\\d{1,2})", + "timezone": "UTC", + "encoding": "gbk", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) } @@ -469,11 +542,13 @@ func TestEncoding_Invalid(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "log_group_class": "", - "retention_in_days": -1, + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "log_group_class": "", + "retention_in_days": -1, + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) assert.False(t, translator.IsTranslateSuccess()) @@ -497,12 +572,14 @@ func TestAutoRemoval(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "log_group_class": "", - "auto_removal": true, + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "log_group_class": "", + "auto_removal": true, + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) @@ -519,12 +596,14 @@ func TestAutoRemoval(t *testing.T) { } _, val = f.ApplyRule(input) expectVal = []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "auto_removal": false, - "log_group_class": "", + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "auto_removal": false, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) @@ -540,11 +619,13 @@ func TestAutoRemoval(t *testing.T) { } _, val = f.ApplyRule(input) expectVal = []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "log_group_class": "", + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) } @@ -613,14 +694,16 @@ func TestPublishMultiLogs_WithBlackList(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "log_group_class": "", - "blacklist": "^agent.log", - "publish_multi_logs": true, - "timezone": "UTC", + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "log_group_class": "", + "blacklist": "^agent.log", + "publish_multi_logs": true, + "timezone": "UTC", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) @@ -638,13 +721,15 @@ func TestPublishMultiLogs_WithBlackList(t *testing.T) { } _, val = f.ApplyRule(input) expectVal = []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "publish_multi_logs": false, - "timezone": "UTC", - "log_group_class": "", + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "publish_multi_logs": false, + "timezone": "UTC", + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) @@ -660,11 +745,13 @@ func TestPublishMultiLogs_WithBlackList(t *testing.T) { } _, val = f.ApplyRule(input) expectVal = []interface{}{map[string]interface{}{ - "file_path": "path1", - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "log_group_class": "", + "file_path": "path1", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) } @@ -685,10 +772,12 @@ func TestLogFilters(t *testing.T) { assert.Nil(t, e) _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "from_beginning": true, - "pipe": false, - "retention_in_days": -1, - "log_group_class": "", + "from_beginning": true, + "pipe": false, + "retention_in_days": -1, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", "filters": []interface{}{ map[string]interface{}{ "type": "include", @@ -725,19 +814,23 @@ func TestRetentionDifferentLogGroups(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test2", - "pipe": false, - "retention_in_days": 3, - "from_beginning": true, - "log_group_class": "", + "file_path": "path1", + "log_group_name": "test2", + "pipe": false, + "retention_in_days": 3, + "from_beginning": true, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }, map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test1", - "pipe": false, - "retention_in_days": 3, - "from_beginning": true, - "log_group_class": "", + "file_path": "path1", + "log_group_name": "test1", + "pipe": false, + "retention_in_days": 3, + "from_beginning": true, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) } @@ -764,19 +857,23 @@ func TestDuplicateRetention(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test1", - "pipe": false, - "retention_in_days": 3, - "from_beginning": true, - "log_group_class": "", + "file_path": "path1", + "log_group_name": "test1", + "pipe": false, + "retention_in_days": 3, + "from_beginning": true, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }, map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test1", - "pipe": false, - "retention_in_days": 3, - "from_beginning": true, - "log_group_class": "", + "file_path": "path1", + "log_group_name": "test1", + "pipe": false, + "retention_in_days": 3, + "from_beginning": true, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) } @@ -804,19 +901,23 @@ func TestConflictingRetention(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test1", - "pipe": false, - "retention_in_days": 3, - "from_beginning": true, - "log_group_class": "", + "file_path": "path1", + "log_group_name": "test1", + "pipe": false, + "retention_in_days": 3, + "from_beginning": true, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }, map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test1", - "pipe": false, - "retention_in_days": 5, - "from_beginning": true, - "log_group_class": "", + "file_path": "path1", + "log_group_name": "test1", + "pipe": false, + "retention_in_days": 5, + "from_beginning": true, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, "Under path : /logs/logs_collected/files/collect_list/ | Error : Different retention_in_days values can't be set for the same log group: test1", translator.ErrorMessages[len(translator.ErrorMessages)-1]) assert.Equal(t, expectVal, val) @@ -844,19 +945,23 @@ func TestDifferentLogGroupClasses(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test2", - "pipe": false, - "retention_in_days": 3, - "from_beginning": true, - "log_group_class": "", + "file_path": "path1", + "log_group_name": "test2", + "pipe": false, + "retention_in_days": 3, + "from_beginning": true, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }, map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test1", - "pipe": false, - "retention_in_days": 3, - "from_beginning": true, - "log_group_class": "", + "file_path": "path1", + "log_group_name": "test1", + "pipe": false, + "retention_in_days": 3, + "from_beginning": true, + "log_group_class": "", + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) } @@ -885,19 +990,23 @@ func TestDuplicateLogGroupClass(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test1", - "pipe": false, - "retention_in_days": 3, - "from_beginning": true, - "log_group_class": util.StandardLogGroupClass, + "file_path": "path1", + "log_group_name": "test1", + "pipe": false, + "retention_in_days": 3, + "from_beginning": true, + "log_group_class": util.StandardLogGroupClass, + "service_name": "", + "deployment_environment": "", }, map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test1", - "pipe": false, - "retention_in_days": 3, - "from_beginning": true, - "log_group_class": util.StandardLogGroupClass, + "file_path": "path1", + "log_group_name": "test1", + "pipe": false, + "retention_in_days": 3, + "from_beginning": true, + "log_group_class": util.StandardLogGroupClass, + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, expectVal, val) } @@ -929,20 +1038,97 @@ func TestConflictingLogGroupClass(t *testing.T) { } _, val := f.ApplyRule(input) expectVal := []interface{}{map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test1", - "pipe": false, - "retention_in_days": 3, - "from_beginning": true, - "log_group_class": util.StandardLogGroupClass, + "file_path": "path1", + "log_group_name": "test1", + "pipe": false, + "retention_in_days": 3, + "from_beginning": true, + "log_group_class": util.StandardLogGroupClass, + "service_name": "", + "deployment_environment": "", }, map[string]interface{}{ - "file_path": "path1", - "log_group_name": "test1", - "pipe": false, - "retention_in_days": 3, - "from_beginning": true, - "log_group_class": util.InfrequentAccessLogGroupClass, + "file_path": "path1", + "log_group_name": "test1", + "pipe": false, + "retention_in_days": 3, + "from_beginning": true, + "log_group_class": util.InfrequentAccessLogGroupClass, + "service_name": "", + "deployment_environment": "", }} assert.Equal(t, "Under path : /logs/logs_collected/files/collect_list/ | Error : Different log_group_class values can't be set for the same log group: test1", translator.ErrorMessages[len(translator.ErrorMessages)-1]) assert.Equal(t, expectVal, val) } + +func TestServiceAndEnvironment(t *testing.T) { + logs.GlobalLogConfig.DeploymentEnvironment = "ec2:default" + + f := new(FileConfig) + var input interface{} + e := json.Unmarshal([]byte(`{ + "collect_list": [ + { + "service.name": "my-service1", + "deployment.environment": "ec2:test-deployment-environment", + "file_path": "path1", + "log_group_name": "group1", + "log_stream_name": "stream", + "log_group_class": "standard" + }, + { + "service.name": "my-service2", + "file_path": "path2", + "log_group_name": "group2", + "log_stream_name": "stream", + "log_group_class": "standard" + }, + { + "file_path": "path3", + "log_group_name": "group3", + "log_stream_name": "stream", + "log_group_class": "standard" + } + ] + }`), &input) + if e != nil { + assert.Fail(t, e.Error()) + } + _, val := f.ApplyRule(input) + + expectVal := []interface{}{ + map[string]interface{}{ + "file_path": "path1", + "log_group_name": "group1", + "log_stream_name": "stream", + "service_name": "my-service1", + "deployment_environment": "ec2:test-deployment-environment", + "from_beginning": true, + "log_group_class": util.StandardLogGroupClass, + "pipe": false, + "retention_in_days": -1, + }, + map[string]interface{}{ + "file_path": "path2", + "log_group_name": "group2", + "log_stream_name": "stream", + "service_name": "my-service2", + "deployment_environment": "ec2:default", + "from_beginning": true, + "log_group_class": util.StandardLogGroupClass, + "pipe": false, + "retention_in_days": -1, + }, + map[string]interface{}{ + "file_path": "path3", + "log_group_name": "group3", + "log_stream_name": "stream", + "from_beginning": true, + "log_group_class": util.StandardLogGroupClass, + "pipe": false, + "retention_in_days": -1, + "service_name": "", + "deployment_environment": "ec2:default", + }, + } + assert.Equal(t, expectVal, val) +} diff --git a/translator/translate/logs/logs_collected/files/collect_list/ruleDeploymentEnvironment.go b/translator/translate/logs/logs_collected/files/collect_list/ruleDeploymentEnvironment.go new file mode 100644 index 0000000000..6608add89b --- /dev/null +++ b/translator/translate/logs/logs_collected/files/collect_list/ruleDeploymentEnvironment.go @@ -0,0 +1,29 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package collect_list + +import ( + "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/logs" +) + +type DeploymentEnvironment struct { +} + +func (f *DeploymentEnvironment) ApplyRule(input interface{}) (returnKey string, returnVal interface{}) { + _, returnVal = translator.DefaultCase("deployment.environment", "", input) + returnKey = "deployment_environment" + + if returnVal == "" { + returnVal = logs.GlobalLogConfig.DeploymentEnvironment + } + + return +} + +func init() { + f := new(DeploymentEnvironment) + r := []Rule{f} + RegisterRule("deployment.environment", r) +} diff --git a/translator/translate/logs/logs_collected/files/collect_list/ruleServiceName.go b/translator/translate/logs/logs_collected/files/collect_list/ruleServiceName.go new file mode 100644 index 0000000000..cf9a3b735c --- /dev/null +++ b/translator/translate/logs/logs_collected/files/collect_list/ruleServiceName.go @@ -0,0 +1,29 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package collect_list + +import ( + "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/logs" +) + +type ServiceName struct { +} + +func (f *ServiceName) ApplyRule(input interface{}) (returnKey string, returnVal interface{}) { + _, returnVal = translator.DefaultCase("service.name", "", input) + returnKey = "service_name" + + if returnVal == "" { + returnVal = logs.GlobalLogConfig.ServiceName + } + + return +} + +func init() { + f := new(ServiceName) + r := []Rule{f} + RegisterRule("service.name", r) +} diff --git a/translator/translate/logs/logs_test.go b/translator/translate/logs/logs_test.go index 923386164f..fe1dc0583d 100644 --- a/translator/translate/logs/logs_test.go +++ b/translator/translate/logs/logs_test.go @@ -200,3 +200,42 @@ func TestLogs_EndpointOverride(t *testing.T) { ctx.SetMode(config.ModeEC2) //reset back to default mode } + +func TestLogs_ServiceAndEnvironment(t *testing.T) { + l := new(Logs) + agent.Global_Config.Region = "us-east-1" + agent.Global_Config.RegionType = "any" + + context.ResetContext() + + var input interface{} + err := json.Unmarshal([]byte(`{"logs":{"service.name": "my-service", + "deployment.environment": "ec2:group","log_stream_name":"LOG_STREAM_NAME"}}`), &input) + if err != nil { + assert.Fail(t, err.Error()) + } + + _, _ = l.ApplyRule(input) + assert.Equal(t, "my-service", GlobalLogConfig.ServiceName) + assert.Equal(t, "ec2:group", GlobalLogConfig.DeploymentEnvironment) +} + +func TestLogs_ServiceAndEnvironmentMissing(t *testing.T) { + l := new(Logs) + agent.Global_Config.Region = "us-east-1" + agent.Global_Config.RegionType = "any" + agent.Global_Config.DeploymentEnvironment = "ec2:group" + agent.Global_Config.ServiceName = "my-service" + + context.ResetContext() + + var input interface{} + err := json.Unmarshal([]byte(`{"logs":{"log_stream_name":"LOG_STREAM_NAME"}}`), &input) + if err != nil { + assert.Fail(t, err.Error()) + } + + _, _ = l.ApplyRule(input) + assert.Equal(t, "my-service", GlobalLogConfig.ServiceName) + assert.Equal(t, "ec2:group", GlobalLogConfig.DeploymentEnvironment) +} diff --git a/translator/translate/logs/ruleDeploymentEnvironment.go b/translator/translate/logs/ruleDeploymentEnvironment.go new file mode 100644 index 0000000000..498bf889d1 --- /dev/null +++ b/translator/translate/logs/ruleDeploymentEnvironment.go @@ -0,0 +1,24 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package logs + +import ( + "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" +) + +type DeploymentEnvironment struct { +} + +func (f *DeploymentEnvironment) ApplyRule(input interface{}) (returnKey string, returnVal interface{}) { + _, result := translator.DefaultCase("deployment.environment", "", input) + + if result == "" { + result = agent.Global_Config.DeploymentEnvironment + } + // Set global log deployment environment + GlobalLogConfig.DeploymentEnvironment = result.(string) + + return +} diff --git a/translator/translate/logs/ruleServiceName.go b/translator/translate/logs/ruleServiceName.go new file mode 100644 index 0000000000..f209f23f17 --- /dev/null +++ b/translator/translate/logs/ruleServiceName.go @@ -0,0 +1,24 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package logs + +import ( + "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" +) + +type ServiceName struct { +} + +func (f *ServiceName) ApplyRule(input interface{}) (returnKey string, returnVal interface{}) { + _, result := translator.DefaultCase("service.name", "", input) + + if result == "" { + result = agent.Global_Config.ServiceName + } + // Set global log service name + GlobalLogConfig.ServiceName = result.(string) + + return +} diff --git a/translator/translate/metrics/metrics.go b/translator/translate/metrics/metrics.go index b6848248bd..7ef97a151a 100755 --- a/translator/translate/metrics/metrics.go +++ b/translator/translate/metrics/metrics.go @@ -16,7 +16,13 @@ import ( type Rule translator.Rule -var ChildRule = map[string]Rule{} +var ( + ChildRule = map[string]Rule{} + GlobalMetricConfig = Metrics{} + + serviceName ServiceName + deploymentEnvironment DeploymentEnvironment +) const ( SectionKey = "metrics" @@ -33,6 +39,8 @@ func RegisterRule(fieldName string, r Rule) { } type Metrics struct { + ServiceName string + DeploymentEnvironment string } func (m *Metrics) ApplyRule(input interface{}) (returnKey string, returnVal interface{}) { @@ -40,6 +48,10 @@ func (m *Metrics) ApplyRule(input interface{}) (returnKey string, returnVal inte result := map[string]interface{}{} outputPlugInfo := map[string]interface{}{} + //Apply Environment and ServiceName rules + serviceName.ApplyRule(im[SectionKey]) + deploymentEnvironment.ApplyRule(im[SectionKey]) + //Check if this plugin exist in the input instance //If not, not process if _, ok := im[SectionKey]; !ok { diff --git a/translator/translate/metrics/metrics_collect/collectd/collectd.go b/translator/translate/metrics/metrics_collect/collectd/collectd.go index 3ebb6496c7..d59ae70756 100644 --- a/translator/translate/metrics/metrics_collect/collectd/collectd.go +++ b/translator/translate/metrics/metrics_collect/collectd/collectd.go @@ -51,7 +51,7 @@ func (obj *CollectD) ApplyRule(input interface{}) (returnKey string, returnVal i } else { //If exists, process it //Check if there are some config entry with rules applied - result = translator.ProcessRuleToApply(m[SectionKey], ChildRule, result) + result = translator.ProcessRuleToMergeAndApply(m[SectionKey], ChildRule, result) resArray = append(resArray, result) returnKey = SectionMappedKey returnVal = resArray diff --git a/translator/translate/metrics/metrics_collect/collectd/ruleDeploymentEnvironment.go b/translator/translate/metrics/metrics_collect/collectd/ruleDeploymentEnvironment.go new file mode 100644 index 0000000000..04d9201996 --- /dev/null +++ b/translator/translate/metrics/metrics_collect/collectd/ruleDeploymentEnvironment.go @@ -0,0 +1,33 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package collected + +import ( + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity/entityattributes" + "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/metrics" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" +) + +type DeploymentEnvironment struct { +} + +const SectionkeyDeploymentEnvironment = "deployment.environment" + +func (obj *DeploymentEnvironment) ApplyRule(input interface{}) (string, interface{}) { + returnKey, returnVal := translator.DefaultCase(SectionkeyDeploymentEnvironment, "", input) + + parentKeyVal := metrics.GlobalMetricConfig.DeploymentEnvironment + if returnVal != "" { + return common.Tags, map[string]interface{}{returnKey: returnVal, entityattributes.AttributeDeploymentEnvironmentSource: entityattributes.AttributeServiceNameSourceUserConfig} + } else if parentKeyVal != "" { + return common.Tags, map[string]interface{}{returnKey: parentKeyVal, entityattributes.AttributeDeploymentEnvironmentSource: entityattributes.AttributeServiceNameSourceUserConfig} + } + return "", nil +} + +func init() { + obj := new(DeploymentEnvironment) + RegisterRule(SectionkeyDeploymentEnvironment, obj) +} diff --git a/translator/translate/metrics/metrics_collect/collectd/ruleServiceName.go b/translator/translate/metrics/metrics_collect/collectd/ruleServiceName.go new file mode 100644 index 0000000000..dc7113580a --- /dev/null +++ b/translator/translate/metrics/metrics_collect/collectd/ruleServiceName.go @@ -0,0 +1,33 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package collected + +import ( + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity/entityattributes" + "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/metrics" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" +) + +type ServiceName struct { +} + +const SectionkeyServicename = "service.name" + +func (obj *ServiceName) ApplyRule(input interface{}) (string, interface{}) { + returnKey, returnVal := translator.DefaultCase(SectionkeyServicename, "", input) + + parentKeyVal := metrics.GlobalMetricConfig.ServiceName + if returnVal != "" { + return common.Tags, map[string]interface{}{returnKey: returnVal, entityattributes.AttributeServiceNameSource: entityattributes.AttributeServiceNameSourceUserConfig} + } else if parentKeyVal != "" { + return common.Tags, map[string]interface{}{returnKey: parentKeyVal, entityattributes.AttributeServiceNameSource: entityattributes.AttributeServiceNameSourceUserConfig} + } + return "", nil +} + +func init() { + obj := new(ServiceName) + RegisterRule(SectionkeyServicename, obj) +} diff --git a/translator/translate/metrics/metrics_collect/statsd/ruleDeploymentEnvironment.go b/translator/translate/metrics/metrics_collect/statsd/ruleDeploymentEnvironment.go new file mode 100644 index 0000000000..bb037a81f4 --- /dev/null +++ b/translator/translate/metrics/metrics_collect/statsd/ruleDeploymentEnvironment.go @@ -0,0 +1,33 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package statsd + +import ( + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity/entityattributes" + "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/metrics" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" +) + +type DeploymentEnvironment struct { +} + +const SectionkeyDeploymentEnvironment = "deployment.environment" + +func (obj *DeploymentEnvironment) ApplyRule(input interface{}) (string, interface{}) { + returnKey, returnVal := translator.DefaultCase(SectionkeyDeploymentEnvironment, "", input) + + parentKeyVal := metrics.GlobalMetricConfig.DeploymentEnvironment + if returnVal != "" { + return common.Tags, map[string]interface{}{returnKey: returnVal, entityattributes.AttributeDeploymentEnvironmentSource: entityattributes.AttributeServiceNameSourceUserConfig} + } else if parentKeyVal != "" { + return common.Tags, map[string]interface{}{returnKey: parentKeyVal, entityattributes.AttributeDeploymentEnvironmentSource: entityattributes.AttributeServiceNameSourceUserConfig} + } + return "", nil +} + +func init() { + obj := new(DeploymentEnvironment) + RegisterRule(SectionkeyDeploymentEnvironment, obj) +} diff --git a/translator/translate/metrics/metrics_collect/statsd/ruleServiceName.go b/translator/translate/metrics/metrics_collect/statsd/ruleServiceName.go new file mode 100644 index 0000000000..10832c9e60 --- /dev/null +++ b/translator/translate/metrics/metrics_collect/statsd/ruleServiceName.go @@ -0,0 +1,33 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package statsd + +import ( + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity/entityattributes" + "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/metrics" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" +) + +type ServiceName struct { +} + +const SectionkeyServicename = "service.name" + +func (obj *ServiceName) ApplyRule(input interface{}) (string, interface{}) { + returnKey, returnVal := translator.DefaultCase(SectionkeyServicename, "", input) + + parentKeyVal := metrics.GlobalMetricConfig.ServiceName + if returnVal != "" { + return common.Tags, map[string]interface{}{returnKey: returnVal, entityattributes.AttributeServiceNameSource: entityattributes.AttributeServiceNameSourceUserConfig} + } else if parentKeyVal != "" { + return common.Tags, map[string]interface{}{returnKey: parentKeyVal, entityattributes.AttributeServiceNameSource: entityattributes.AttributeServiceNameSourceUserConfig} + } + return "", nil +} + +func init() { + obj := new(ServiceName) + RegisterRule(SectionkeyServicename, obj) +} diff --git a/translator/translate/metrics/metrics_collect/statsd/statsd.go b/translator/translate/metrics/metrics_collect/statsd/statsd.go index d979692832..6f3e3cdde6 100644 --- a/translator/translate/metrics/metrics_collect/statsd/statsd.go +++ b/translator/translate/metrics/metrics_collect/statsd/statsd.go @@ -47,7 +47,7 @@ func (obj *StatsD) ApplyRule(input interface{}) (returnKey string, returnVal int } else { //If exists, process it //Check if there are some config entry with rules applied - result = translator.ProcessRuleToApply(m[SectionKey], ChildRule, result) + result = translator.ProcessRuleToMergeAndApply(m[SectionKey], ChildRule, result) resArray = append(resArray, result) returnKey = SectionKey returnVal = resArray diff --git a/translator/translate/metrics/ruleDeploymentEnvironmentl.go b/translator/translate/metrics/ruleDeploymentEnvironmentl.go new file mode 100644 index 0000000000..5d1d6de55b --- /dev/null +++ b/translator/translate/metrics/ruleDeploymentEnvironmentl.go @@ -0,0 +1,29 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package metrics + +import ( + "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" +) + +type DeploymentEnvironment struct { +} + +func (f *DeploymentEnvironment) ApplyRule(input interface{}) (returnKey string, returnVal interface{}) { + _, returnVal = translator.DefaultCase("deployment.environment", "", input) + returnKey = "deployment_environment" + + if returnVal == "" { + returnVal = agent.Global_Config.DeploymentEnvironment + } + + // Set global metric deployment environment + GlobalMetricConfig.DeploymentEnvironment = returnVal.(string) + return +} + +func init() { + RegisterRule("deployment.environment", new(DeploymentEnvironment)) +} diff --git a/translator/translate/metrics/ruleServiceName.go b/translator/translate/metrics/ruleServiceName.go new file mode 100644 index 0000000000..5728008eea --- /dev/null +++ b/translator/translate/metrics/ruleServiceName.go @@ -0,0 +1,28 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package metrics + +import ( + "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" +) + +type ServiceName struct{} + +func (f *ServiceName) ApplyRule(input interface{}) (returnKey string, returnVal interface{}) { + _, returnVal = translator.DefaultCase("service.name", "", input) + returnKey = "service_name" + + if returnVal == "" { + returnVal = agent.Global_Config.ServiceName + } + + // Set global metric service name + GlobalMetricConfig.ServiceName = returnVal.(string) + return +} + +func init() { + RegisterRule("service.name", new(ServiceName)) +} diff --git a/translator/translate/otel/common/common.go b/translator/translate/otel/common/common.go index 8231735c62..f7637150d2 100644 --- a/translator/translate/otel/common/common.go +++ b/translator/translate/otel/common/common.go @@ -67,6 +67,8 @@ const ( ServiceAddress = "service_address" Udp = "udp" Tcp = "tcp" + TlsKey = "tls" + Tags = "tags" Region = "region" LogGroupName = "log_group_name" LogStreamName = "log_stream_name" @@ -75,9 +77,37 @@ const ( UnitKey = "unit" ) +const ( + CollectDMetricKey = "collectd" + CollectDPluginKey = "socket_listener" + CPUMetricKey = "cpu" + DiskMetricKey = "disk" + DiskIoMetricKey = "diskio" + StatsDMetricKey = "statsd" + SwapMetricKey = "swap" + MemMetricKey = "mem" + NetMetricKey = "net" + NetStatMetricKey = "netstat" + ProcessMetricKey = "process" + ProcStatMetricKey = "procstat" + + //Windows Plugins + MemMetricKeyWindows = "Memory" + LogicalDiskMetricKeyWindows = "LogicalDisk" + NetworkMetricKeyWindows = "Network Interface" + PagingMetricKeyWindows = "Paging" + PhysicalDiskMetricKeyWindows = "PhysicalDisk" + ProcessorMetricKeyWindows = "Processor" + SystemMetricKeyWindows = "System" + TCPv4MetricKeyWindows = "TCPv4" + TCPv6MetricKeyWindows = "TCPv6" +) + const ( PipelineNameHost = "host" + PipelineNameHostCustomMetrics = "hostCustomMetrics" PipelineNameHostDeltaMetrics = "hostDeltaMetrics" + PipelineNameHostOtlpMetrics = "hostOtlpMetrics" PipelineNameContainerInsights = "containerinsights" PipelineNameJmx = "jmx" PipelineNameContainerInsightsJmx = "containerinsightsjmx" diff --git a/translator/translate/otel/exporter/translator.go b/translator/translate/otel/exporter/translator.go new file mode 100644 index 0000000000..d8c2acbc37 --- /dev/null +++ b/translator/translate/otel/exporter/translator.go @@ -0,0 +1,33 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package exporter + +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/exporter" + + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" +) + +type translator struct { + name string + factory exporter.Factory +} + +func NewDefaultTranslator(factory exporter.Factory) common.Translator[component.Config] { + return NewDefaultTranslatorWithName("", factory) +} + +func NewDefaultTranslatorWithName(name string, factory exporter.Factory) common.Translator[component.Config] { + return &translator{name, factory} +} + +func (t *translator) Translate(*confmap.Conf) (component.Config, error) { + return t.factory.CreateDefaultConfig(), nil +} + +func (t *translator) ID() component.ID { + return component.NewIDWithName(t.factory.Type(), t.name) +} diff --git a/translator/translate/otel/exporter/translator_test.go b/translator/translate/otel/exporter/translator_test.go new file mode 100644 index 0000000000..d8946a3850 --- /dev/null +++ b/translator/translate/otel/exporter/translator_test.go @@ -0,0 +1,20 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package exporter + +import ( + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/exporter/exportertest" +) + +func TestTranslator(t *testing.T) { + factory := exportertest.NewNopFactory() + got := NewDefaultTranslator(factory) + require.Equal(t, "nop", got.ID().String()) + cfg, err := got.Translate(nil) + require.NoError(t, err) + require.Equal(t, factory.CreateDefaultConfig(), cfg) +} diff --git a/translator/translate/otel/extension/entitystore/translator.go b/translator/translate/otel/extension/entitystore/translator.go new file mode 100644 index 0000000000..e98d4ee549 --- /dev/null +++ b/translator/translate/otel/extension/entitystore/translator.go @@ -0,0 +1,44 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/extension" + + "github.com/aws/amazon-cloudwatch-agent/extension/entitystore" + "github.com/aws/amazon-cloudwatch-agent/translator/context" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" +) + +type translator struct { + name string + factory extension.Factory +} + +var _ common.Translator[component.Config] = (*translator)(nil) + +func NewTranslator() common.Translator[component.Config] { + return &translator{ + factory: entitystore.NewFactory(), + } +} + +func (t *translator) ID() component.ID { + return component.NewIDWithName(t.factory.Type(), t.name) +} + +// Translate creates an extension configuration. +func (t *translator) Translate(conf *confmap.Conf) (component.Config, error) { + cfg := t.factory.CreateDefaultConfig().(*entitystore.Config) + cfg.Mode = context.CurrentContext().Mode() + cfg.KubernetesMode = context.CurrentContext().KubernetesMode() + cfg.Region = agent.Global_Config.Region + credentials := confmap.NewFromStringMap(agent.Global_Config.Credentials) + _ = credentials.Unmarshal(cfg) + + return cfg, nil +} diff --git a/translator/translate/otel/extension/entitystore/translator_test.go b/translator/translate/otel/extension/entitystore/translator_test.go new file mode 100644 index 0000000000..4180b02970 --- /dev/null +++ b/translator/translate/otel/extension/entitystore/translator_test.go @@ -0,0 +1,87 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package entitystore + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/confmap" + + "github.com/aws/amazon-cloudwatch-agent/extension/entitystore" + "github.com/aws/amazon-cloudwatch-agent/translator/config" + "github.com/aws/amazon-cloudwatch-agent/translator/context" + translateagent "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" +) + +func TestTranslate(t *testing.T) { + translateagent.Global_Config.Credentials = make(map[string]interface{}) + translateagent.Global_Config.Region = "us-east-1" + testCases := map[string]struct { + input map[string]interface{} + inputMode string + inputK8sMode string + file_exists bool + profile_exists bool + want *entitystore.Config + }{ + "OnlyProfile": { + input: map[string]interface{}{}, + inputMode: config.ModeEC2, + inputK8sMode: config.ModeEKS, + profile_exists: true, + want: &entitystore.Config{ + Mode: config.ModeEC2, + KubernetesMode: config.ModeEKS, + Region: "us-east-1", + Profile: "test_profile", + }, + }, + "OnlyProfileWithK8sOnPrem": { + input: map[string]interface{}{}, + inputMode: config.ModeEC2, + inputK8sMode: config.ModeK8sOnPrem, + profile_exists: true, + want: &entitystore.Config{ + Mode: config.ModeEC2, + KubernetesMode: config.ModeK8sOnPrem, + Region: "us-east-1", + Profile: "test_profile", + }, + }, + "OnlyFile": { + input: map[string]interface{}{}, + inputMode: config.ModeEC2, + inputK8sMode: config.ModeK8sEC2, + file_exists: true, + want: &entitystore.Config{ + Mode: config.ModeEC2, + KubernetesMode: config.ModeK8sEC2, + Region: "us-east-1", + Filename: "test_file", + }, + }, + } + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + translateagent.Global_Config.Credentials[translateagent.CredentialsSectionKey] = "" + if testCase.file_exists { + translateagent.Global_Config.Credentials[translateagent.CredentialsFile_Key] = "test_file" + translateagent.Global_Config.Credentials[translateagent.Profile_Key] = "" + } + if testCase.profile_exists { + translateagent.Global_Config.Credentials[translateagent.Profile_Key] = "test_profile" + translateagent.Global_Config.Credentials[translateagent.CredentialsFile_Key] = "" + } + tt := NewTranslator().(*translator) + assert.Equal(t, "entitystore", tt.ID().String()) + conf := confmap.NewFromStringMap(testCase.input) + context.CurrentContext().SetMode(testCase.inputMode) + context.CurrentContext().SetKubernetesMode(testCase.inputK8sMode) + got, err := tt.Translate(conf) + assert.NoError(t, err) + assert.Equal(t, testCase.want, got) + }) + } +} diff --git a/translator/translate/otel/extension/server/translator.go b/translator/translate/otel/extension/server/translator.go new file mode 100644 index 0000000000..1be1d814ee --- /dev/null +++ b/translator/translate/otel/extension/server/translator.go @@ -0,0 +1,47 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package server + +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/extension" + + "github.com/aws/amazon-cloudwatch-agent/extension/server" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" +) + +const ( + defaultListenAddr = ":4311" + tlsServerCertFilePath = "/etc/amazon-cloudwatch-observability-agent-server-cert/server.crt" + tlsServerKeyFilePath = "/etc/amazon-cloudwatch-observability-agent-server-cert/server.key" + caFilePath = "/etc/amazon-cloudwatch-observability-agent-client-cert/tls-ca.crt" +) + +type translator struct { + name string + factory extension.Factory +} + +var _ common.Translator[component.Config] = (*translator)(nil) + +func NewTranslator() common.Translator[component.Config] { + return &translator{ + factory: server.NewFactory(), + } +} + +func (t *translator) ID() component.ID { + return component.NewIDWithName(t.factory.Type(), t.name) +} + +// Translate creates an extension configuration. +func (t *translator) Translate(conf *confmap.Conf) (component.Config, error) { + cfg := t.factory.CreateDefaultConfig().(*server.Config) + cfg.ListenAddress = defaultListenAddr + cfg.TLSCAPath = caFilePath + cfg.TLSCertPath = tlsServerCertFilePath + cfg.TLSKeyPath = tlsServerKeyFilePath + return cfg, nil +} diff --git a/translator/translate/otel/extension/server/translator_test.go b/translator/translate/otel/extension/server/translator_test.go new file mode 100644 index 0000000000..010f275164 --- /dev/null +++ b/translator/translate/otel/extension/server/translator_test.go @@ -0,0 +1,35 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package server + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/confmap" + + "github.com/aws/amazon-cloudwatch-agent/extension/server" +) + +func TestTranslate(t *testing.T) { + testCases := map[string]struct { + input map[string]interface{} + want *server.Config + }{ + "DefaultConfig": { + input: map[string]interface{}{}, + want: &server.Config{ListenAddress: defaultListenAddr, TLSCAPath: caFilePath, TLSCertPath: tlsServerCertFilePath, TLSKeyPath: tlsServerKeyFilePath}, + }, + } + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + tt := NewTranslator().(*translator) + assert.Equal(t, "server", tt.ID().String()) + conf := confmap.NewFromStringMap(testCase.input) + got, err := tt.Translate(conf) + assert.NoError(t, err) + assert.Equal(t, testCase.want, got) + }) + } +} diff --git a/translator/translate/otel/pipeline/applicationsignals/translator.go b/translator/translate/otel/pipeline/applicationsignals/translator.go index 45d247d3ab..bc20a570c8 100644 --- a/translator/translate/otel/pipeline/applicationsignals/translator.go +++ b/translator/translate/otel/pipeline/applicationsignals/translator.go @@ -9,6 +9,7 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/confmap" + "github.com/aws/amazon-cloudwatch-agent/translator/context" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/exporter/awsemf" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/exporter/awsxray" @@ -16,6 +17,7 @@ import ( "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/agenthealth" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/awsproxy" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/awsapplicationsignals" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/awsentity" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/resourcedetection" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver/otlp" ) @@ -52,6 +54,10 @@ func (t *translator) Translate(conf *confmap.Conf) (*common.ComponentTranslators Extensions: common.NewTranslatorMap[component.Config](), } + mode := context.CurrentContext().KubernetesMode() + if t.dataType == component.DataTypeMetrics && mode != "" { + translators.Processors.Set(awsentity.NewTranslatorWithEntityType(awsentity.Service, common.AppSignals, false)) + } translators.Processors.Set(resourcedetection.NewTranslator(resourcedetection.WithDataType(t.dataType))) translators.Processors.Set(awsapplicationsignals.NewTranslator(awsapplicationsignals.WithDataType(t.dataType))) diff --git a/translator/translate/otel/pipeline/applicationsignals/translator_test.go b/translator/translate/otel/pipeline/applicationsignals/translator_test.go index 3373da7ec3..9572dfd1d2 100644 --- a/translator/translate/otel/pipeline/applicationsignals/translator_test.go +++ b/translator/translate/otel/pipeline/applicationsignals/translator_test.go @@ -105,11 +105,12 @@ func TestTranslatorMetricsForKubernetes(t *testing.T) { tt := NewTranslator(component.DataTypeMetrics) assert.EqualValues(t, "metrics/application_signals", tt.ID().String()) testCases := map[string]struct { - input map[string]interface{} - want *want - wantErr error - detector func() (eksdetector.Detector, error) - isEKSCache func() eksdetector.IsEKSCache + input map[string]interface{} + want *want + wantErr error + detector func() (eksdetector.Detector, error) + isEKSCache func() eksdetector.IsEKSCache + kubernetesMode string }{ "WithoutMetricsCollectedKey": { input: map[string]interface{}{}, @@ -125,12 +126,13 @@ func TestTranslatorMetricsForKubernetes(t *testing.T) { }, want: &want{ receivers: []string{"otlp/application_signals"}, - processors: []string{"resourcedetection", "awsapplicationsignals"}, + processors: []string{"awsentity/service/application_signals", "resourcedetection", "awsapplicationsignals"}, exporters: []string{"awsemf/application_signals"}, extensions: []string{"agenthealth/logs"}, }, - detector: eksdetector.TestEKSDetector, - isEKSCache: eksdetector.TestIsEKSCacheEKS, + detector: eksdetector.TestEKSDetector, + isEKSCache: eksdetector.TestIsEKSCacheEKS, + kubernetesMode: config.ModeEKS, }, "WithAppSignalsAndLoggingEnabled": { input: map[string]interface{}{ @@ -145,12 +147,13 @@ func TestTranslatorMetricsForKubernetes(t *testing.T) { }, want: &want{ receivers: []string{"otlp/application_signals"}, - processors: []string{"resourcedetection", "awsapplicationsignals"}, + processors: []string{"awsentity/service/application_signals", "resourcedetection", "awsapplicationsignals"}, exporters: []string{"debug/application_signals", "awsemf/application_signals"}, extensions: []string{"agenthealth/logs"}, }, - detector: eksdetector.TestEKSDetector, - isEKSCache: eksdetector.TestIsEKSCacheEKS, + detector: eksdetector.TestEKSDetector, + isEKSCache: eksdetector.TestIsEKSCacheEKS, + kubernetesMode: config.ModeEKS, }, "WithAppSignalsEnabledK8s": { input: map[string]interface{}{ @@ -162,12 +165,13 @@ func TestTranslatorMetricsForKubernetes(t *testing.T) { }, want: &want{ receivers: []string{"otlp/application_signals"}, - processors: []string{"resourcedetection", "awsapplicationsignals"}, + processors: []string{"awsentity/service/application_signals", "resourcedetection", "awsapplicationsignals"}, exporters: []string{"awsemf/application_signals"}, extensions: []string{"agenthealth/logs"}, }, - detector: eksdetector.TestK8sDetector, - isEKSCache: eksdetector.TestIsEKSCacheK8s, + detector: eksdetector.TestK8sDetector, + isEKSCache: eksdetector.TestIsEKSCacheK8s, + kubernetesMode: config.ModeEKS, }, } for name, testCase := range testCases { @@ -175,6 +179,7 @@ func TestTranslatorMetricsForKubernetes(t *testing.T) { t.Setenv(common.KubernetesEnvVar, "TEST") eksdetector.NewDetector = testCase.detector eksdetector.IsEKS = testCase.isEKSCache + context.CurrentContext().SetKubernetesMode(testCase.kubernetesMode) conf := confmap.NewFromStringMap(testCase.input) got, err := tt.Translate(conf) assert.Equal(t, testCase.wantErr, err) @@ -251,6 +256,7 @@ func TestTranslatorMetricsForEC2(t *testing.T) { for name, testCase := range testCases { t.Run(name, func(t *testing.T) { ctx := context.CurrentContext() + context.CurrentContext().SetKubernetesMode("") ctx.SetMode(config.ModeEC2) conf := confmap.NewFromStringMap(testCase.input) got, err := tt.Translate(conf) diff --git a/translator/translate/otel/pipeline/host/translator.go b/translator/translate/otel/pipeline/host/translator.go index 17b6aca350..641ed43e93 100644 --- a/translator/translate/otel/pipeline/host/translator.go +++ b/translator/translate/otel/pipeline/host/translator.go @@ -11,12 +11,15 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/confmap" + "github.com/aws/amazon-cloudwatch-agent/translator/config" + "github.com/aws/amazon-cloudwatch-agent/translator/context" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/exporter/awscloudwatch" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/exporter/awsemf" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/exporter/prometheusremotewrite" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/agenthealth" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/sigv4auth" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/awsentity" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/batchprocessor" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/cumulativetodeltaprocessor" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/ec2taggerprocessor" @@ -59,6 +62,14 @@ func (t translator) Translate(conf *confmap.Conf) (*common.ComponentTranslators, if conf == nil || t.receivers.Len() == 0 { return nil, fmt.Errorf("no receivers configured in pipeline %s", t.name) } + var entityProcessor common.Translator[component.Config] + if strings.HasPrefix(t.name, common.PipelineNameHostOtlpMetrics) { + entityProcessor = nil + } else if strings.HasPrefix(t.name, common.PipelineNameHostCustomMetrics) { + entityProcessor = awsentity.NewTranslatorWithEntityType(awsentity.Service, "telegraf", true) + } else if strings.HasPrefix(t.name, common.PipelineNameHost) || strings.HasPrefix(t.name, common.PipelineNameHostDeltaMetrics) { + entityProcessor = awsentity.NewTranslatorWithEntityType(awsentity.Resource, "", false) + } translators := common.ComponentTranslators{ Receivers: t.receivers, @@ -66,8 +77,12 @@ func (t translator) Translate(conf *confmap.Conf) (*common.ComponentTranslators, Exporters: common.NewTranslatorMap[component.Config](), Extensions: common.NewTranslatorMap[component.Config](), } + currentContext := context.CurrentContext() + if entityProcessor != nil && currentContext.Mode() == config.ModeEC2 && !currentContext.RunInContainer() && (t.Destination() == common.CloudWatchKey || t.Destination() == common.DefaultDestination) { + translators.Processors.Set(entityProcessor) + } - if strings.HasPrefix(t.name, common.PipelineNameHostDeltaMetrics) { + if strings.HasPrefix(t.name, common.PipelineNameHostDeltaMetrics) || strings.HasPrefix(t.name, common.PipelineNameHostOtlpMetrics) { log.Printf("D! delta processor required because metrics with diskio or net are set") translators.Processors.Set(cumulativetodeltaprocessor.NewTranslator(common.WithName(t.name), cumulativetodeltaprocessor.WithDefaultKeys())) } diff --git a/translator/translate/otel/pipeline/host/translator_test.go b/translator/translate/otel/pipeline/host/translator_test.go index 4a6eb733ee..85f7f762c2 100644 --- a/translator/translate/otel/pipeline/host/translator_test.go +++ b/translator/translate/otel/pipeline/host/translator_test.go @@ -4,7 +4,6 @@ package host import ( - "fmt" "testing" "github.com/stretchr/testify/assert" @@ -13,6 +12,8 @@ import ( "go.opentelemetry.io/collector/confmap" "github.com/aws/amazon-cloudwatch-agent/internal/util/collections" + "github.com/aws/amazon-cloudwatch-agent/translator/config" + "github.com/aws/amazon-cloudwatch-agent/translator/context" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" ) @@ -39,21 +40,24 @@ func TestTranslator(t *testing.T) { extensions []string } testCases := map[string]struct { - input map[string]interface{} - pipelineName string - destination string - want *want - wantErr error + input map[string]interface{} + pipelineName string + destination string + mode string + runInContainer bool + want *want + wantErr error }{ "WithMetricsSection": { input: map[string]interface{}{ "metrics": map[string]interface{}{}, }, pipelineName: common.PipelineNameHost, + mode: config.ModeEC2, want: &want{ pipelineID: "metrics/host", receivers: []string{"nop", "other"}, - processors: []string{}, + processors: []string{"awsentity/resource"}, exporters: []string{"awscloudwatch"}, extensions: []string{"agenthealth/metrics"}, }, @@ -66,11 +70,49 @@ func TestTranslator(t *testing.T) { }, }, }, - pipelineName: fmt.Sprintf("%s_test", common.PipelineNameHostDeltaMetrics), + pipelineName: common.PipelineNameHostDeltaMetrics, + mode: config.ModeEC2, + want: &want{ + pipelineID: "metrics/hostDeltaMetrics", + receivers: []string{"nop", "other"}, + processors: []string{"awsentity/resource", "cumulativetodelta/hostDeltaMetrics"}, + exporters: []string{"awscloudwatch"}, + extensions: []string{"agenthealth/metrics"}, + }, + }, + "WithMetricsKeyStatsD": { + input: map[string]interface{}{ + "metrics": map[string]interface{}{ + "metrics_collected": map[string]interface{}{ + "statsd": map[string]interface{}{}, + }, + }, + }, + pipelineName: common.PipelineNameHostCustomMetrics, + mode: config.ModeEC2, want: &want{ - pipelineID: "metrics/hostDeltaMetrics_test", + pipelineID: "metrics/hostCustomMetrics", receivers: []string{"nop", "other"}, - processors: []string{"cumulativetodelta/hostDeltaMetrics_test"}, + processors: []string{"awsentity/service/telegraf"}, + exporters: []string{"awscloudwatch"}, + extensions: []string{"agenthealth/metrics"}, + }, + }, + "WithMetricsKeyStatsDContainer": { + input: map[string]interface{}{ + "metrics": map[string]interface{}{ + "metrics_collected": map[string]interface{}{ + "statsd": map[string]interface{}{}, + }, + }, + }, + pipelineName: common.PipelineNameHostCustomMetrics, + mode: config.ModeEC2, + runInContainer: true, + want: &want{ + pipelineID: "metrics/hostCustomMetrics", + receivers: []string{"nop", "other"}, + processors: []string{}, exporters: []string{"awscloudwatch"}, extensions: []string{"agenthealth/metrics"}, }, @@ -91,10 +133,11 @@ func TestTranslator(t *testing.T) { }, }, pipelineName: common.PipelineNameHost, + mode: config.ModeEC2, want: &want{ pipelineID: "metrics/host", receivers: []string{"nop", "other"}, - processors: []string{"transform"}, + processors: []string{"awsentity/resource", "transform"}, exporters: []string{"awscloudwatch"}, extensions: []string{"agenthealth/metrics"}, }, @@ -112,10 +155,11 @@ func TestTranslator(t *testing.T) { }, }, pipelineName: common.PipelineNameHost, + mode: config.ModeEC2, want: &want{ pipelineID: "metrics/host", receivers: []string{"nop", "other"}, - processors: []string{}, + processors: []string{"awsentity/resource"}, exporters: []string{"awscloudwatch"}, extensions: []string{"agenthealth/metrics"}, }, @@ -127,10 +171,11 @@ func TestTranslator(t *testing.T) { }, }, pipelineName: common.PipelineNameHost, + mode: config.ModeEC2, want: &want{ pipelineID: "metrics/host", receivers: []string{"nop", "other"}, - processors: []string{"ec2tagger"}, + processors: []string{"awsentity/resource", "ec2tagger"}, exporters: []string{"awscloudwatch"}, extensions: []string{"agenthealth/metrics"}, }, @@ -143,6 +188,7 @@ func TestTranslator(t *testing.T) { }, pipelineName: common.PipelineNameHost, destination: common.AMPKey, + mode: config.ModeEC2, want: &want{ pipelineID: "metrics/host/amp", receivers: []string{"nop", "other"}, @@ -157,6 +203,7 @@ func TestTranslator(t *testing.T) { }, pipelineName: common.PipelineNameHost, destination: common.AMPKey, + mode: config.ModeEC2, want: &want{ pipelineID: "metrics/host/amp", receivers: []string{"nop", "other"}, @@ -168,6 +215,8 @@ func TestTranslator(t *testing.T) { } for name, testCase := range testCases { t.Run(name, func(t *testing.T) { + context.CurrentContext().SetMode(testCase.mode) + context.CurrentContext().SetRunInContainer(testCase.runInContainer) ht := NewTranslator( testCase.pipelineName, common.NewTranslatorMap[component.Config]( diff --git a/translator/translate/otel/pipeline/host/translators.go b/translator/translate/otel/pipeline/host/translators.go index 3cfd7c93e6..f44fee05a7 100644 --- a/translator/translate/otel/pipeline/host/translators.go +++ b/translator/translate/otel/pipeline/host/translators.go @@ -24,7 +24,9 @@ var ( func NewTranslators(conf *confmap.Conf, configSection, os string) (pipeline.TranslatorMap, error) { translators := common.NewTranslatorMap[*common.ComponentTranslators]() hostReceivers := common.NewTranslatorMap[component.Config]() + hostCustomReceivers := common.NewTranslatorMap[component.Config]() deltaReceivers := common.NewTranslatorMap[component.Config]() + otlpReceivers := common.NewTranslatorMap[component.Config]() // Gather adapter receivers if configSection == MetricsKey { @@ -35,6 +37,8 @@ func NewTranslators(conf *confmap.Conf, configSection, os string) (pipeline.Tran adapterReceivers.Range(func(translator common.Translator[component.Config]) { if translator.ID().Type() == adapter.Type(common.DiskIOKey) || translator.ID().Type() == adapter.Type(common.NetKey) { deltaReceivers.Set(translator) + } else if translator.ID().Type() == adapter.Type(common.StatsDMetricKey) || translator.ID().Type() == adapter.Type(common.CollectDPluginKey) { + hostCustomReceivers.Set(translator) } else { hostReceivers.Set(translator) } @@ -45,21 +49,23 @@ func NewTranslators(conf *confmap.Conf, configSection, os string) (pipeline.Tran switch v := conf.Get(common.ConfigKey(configSection, common.OtlpKey)).(type) { case []any: for index := range v { - deltaReceivers.Set(otlpreceiver.NewTranslator( + otlpReceivers.Set(otlpreceiver.NewTranslator( otlpreceiver.WithDataType(component.DataTypeMetrics), otlpreceiver.WithConfigKey(common.ConfigKey(configSection, common.OtlpKey)), common.WithIndex(index), )) } case map[string]any: - deltaReceivers.Set(otlpreceiver.NewTranslator( + otlpReceivers.Set(otlpreceiver.NewTranslator( otlpreceiver.WithDataType(component.DataTypeMetrics), otlpreceiver.WithConfigKey(common.ConfigKey(configSection, common.OtlpKey)), )) } hasHostPipeline := hostReceivers.Len() != 0 + hasHostCustomPipeline := hostCustomReceivers.Len() != 0 hasDeltaPipeline := deltaReceivers.Len() != 0 + hasOtlpPipeline := otlpReceivers.Len() != 0 var destinations []string switch configSection { @@ -76,6 +82,7 @@ func NewTranslators(conf *confmap.Conf, configSection, os string) (pipeline.Tran receivers := common.NewTranslatorMap[component.Config]() receivers.Merge(hostReceivers) receivers.Merge(deltaReceivers) + receivers.Merge(otlpReceivers) translators.Set(NewTranslator( common.PipelineNameHost, receivers, @@ -89,6 +96,12 @@ func NewTranslators(conf *confmap.Conf, configSection, os string) (pipeline.Tran common.WithDestination(destination), )) } + if hasHostCustomPipeline { + translators.Set(NewTranslator( + common.PipelineNameHostCustomMetrics, + hostCustomReceivers, + common.WithDestination(destination))) + } if hasDeltaPipeline { translators.Set(NewTranslator( common.PipelineNameHostDeltaMetrics, @@ -96,6 +109,13 @@ func NewTranslators(conf *confmap.Conf, configSection, os string) (pipeline.Tran common.WithDestination(destination), )) } + if hasOtlpPipeline { + translators.Set(NewTranslator( + common.PipelineNameHostOtlpMetrics, + otlpReceivers, + common.WithDestination(destination), + )) + } } } diff --git a/translator/translate/otel/pipeline/host/translators_test.go b/translator/translate/otel/pipeline/host/translators_test.go index 267e5ca363..8977b99fd2 100644 --- a/translator/translate/otel/pipeline/host/translators_test.go +++ b/translator/translate/otel/pipeline/host/translators_test.go @@ -131,7 +131,7 @@ func TestTranslators(t *testing.T) { }, configSection: MetricsKey, want: map[string]want{ - "metrics/hostDeltaMetrics": { + "metrics/hostOtlpMetrics": { receivers: []string{"otlp/metrics"}, exporters: []string{"awscloudwatch"}, }, @@ -147,12 +147,28 @@ func TestTranslators(t *testing.T) { }, configSection: LogsKey, want: map[string]want{ - "metrics/hostDeltaMetrics/cloudwatchlogs": { + "metrics/hostOtlpMetrics/cloudwatchlogs": { receivers: []string{"otlp/metrics"}, exporters: []string{"awsemf"}, }, }, }, + "WithCustomMetrics": { + input: map[string]interface{}{ + "metrics": map[string]interface{}{ + "metrics_collected": map[string]interface{}{ + "statsd": map[string]interface{}{}, + }, + }, + }, + configSection: MetricsKey, + want: map[string]want{ + "metrics/hostCustomMetrics": { + receivers: []string{"telegraf_statsd"}, + exporters: []string{"awscloudwatch"}, + }, + }, + }, } for name, testCase := range testCases { t.Run(name, func(t *testing.T) { diff --git a/translator/translate/otel/pipeline/nop/translator.go b/translator/translate/otel/pipeline/nop/translator.go new file mode 100644 index 0000000000..0efd23b470 --- /dev/null +++ b/translator/translate/otel/pipeline/nop/translator.go @@ -0,0 +1,55 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package nop + +import ( + "fmt" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/exporter/nopexporter" + "go.opentelemetry.io/collector/receiver/nopreceiver" + + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/exporter" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver" +) + +const ( + pipelineName = "nop" +) + +var ( + traceKey = common.ConfigKey(common.TracesKey) + metricKey = common.ConfigKey(common.MetricsKey) + emfKey = common.ConfigKey(common.LogsKey, common.MetricsCollectedKey) + logAgentKey = common.ConfigKey(common.LogsKey, common.LogsCollectedKey) +) + +type translator struct { +} + +var _ common.Translator[*common.ComponentTranslators] = (*translator)(nil) + +func NewTranslator() common.Translator[*common.ComponentTranslators] { + return &translator{} +} + +func (t *translator) ID() component.ID { + return component.NewIDWithName(component.DataTypeMetrics, pipelineName) +} + +func (t *translator) Translate(conf *confmap.Conf) (*common.ComponentTranslators, error) { + if conf == nil || !conf.IsSet(logAgentKey) { + return nil, &common.MissingKeyError{ID: t.ID(), JsonKey: fmt.Sprint(logAgentKey)} + } + + translators := &common.ComponentTranslators{ + Receivers: common.NewTranslatorMap(receiver.NewDefaultTranslator(nopreceiver.NewFactory())), + Processors: common.NewTranslatorMap[component.Config](), + Exporters: common.NewTranslatorMap(exporter.NewDefaultTranslator(nopexporter.NewFactory())), + Extensions: common.NewTranslatorMap[component.Config](), + } + return translators, nil +} diff --git a/translator/translate/otel/pipeline/nop/translator_test.go b/translator/translate/otel/pipeline/nop/translator_test.go new file mode 100644 index 0000000000..22c30371dd --- /dev/null +++ b/translator/translate/otel/pipeline/nop/translator_test.go @@ -0,0 +1,89 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package nop + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + + "github.com/aws/amazon-cloudwatch-agent/internal/util/collections" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" +) + +func TestTranslator(t *testing.T) { + type want struct { + receivers []string + processors []string + exporters []string + extensions []string + } + tt := NewTranslator() + assert.EqualValues(t, "metrics/nop", tt.ID().String()) + testCases := map[string]struct { + input map[string]interface{} + want *want + wantErr error + }{ + "WithoutKey": { + input: map[string]interface{}{}, + wantErr: &common.MissingKeyError{ID: tt.ID(), JsonKey: fmt.Sprint(logAgentKey)}, + }, + "WithMetricsKey": { + input: map[string]interface{}{ + "metrics": map[string]interface{}{}, + }, + wantErr: &common.MissingKeyError{ID: tt.ID(), JsonKey: fmt.Sprint(logAgentKey)}, + }, + "WithTracesKey": { + input: map[string]interface{}{ + "traces": map[string]interface{}{}, + }, + wantErr: &common.MissingKeyError{ID: tt.ID(), JsonKey: fmt.Sprint(logAgentKey)}, + }, + "WithEMFKey": { + input: map[string]interface{}{ + "logs": map[string]interface{}{ + "metrics_collected": map[string]interface{}{}, + }, + }, + wantErr: &common.MissingKeyError{ID: tt.ID(), JsonKey: fmt.Sprint(logAgentKey)}, + }, + "WithLogsKey": { + input: map[string]interface{}{ + "logs": map[string]interface{}{ + "logs_collected": map[string]interface{}{ + "files": nil, + }, + }, + }, + want: &want{ + receivers: []string{"nop"}, + processors: []string{}, + exporters: []string{"nop"}, + extensions: []string{}, + }, + }, + } + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + conf := confmap.NewFromStringMap(testCase.input) + got, err := tt.Translate(conf) + assert.Equal(t, testCase.wantErr, err) + if testCase.want == nil { + assert.Nil(t, got) + } else { + require.NotNil(t, got) + assert.Equal(t, testCase.want.receivers, collections.MapSlice(got.Receivers.Keys(), component.ID.String)) + assert.Equal(t, testCase.want.processors, collections.MapSlice(got.Processors.Keys(), component.ID.String)) + assert.Equal(t, testCase.want.exporters, collections.MapSlice(got.Exporters.Keys(), component.ID.String)) + assert.Equal(t, testCase.want.extensions, collections.MapSlice(got.Extensions.Keys(), component.ID.String)) + } + }) + } +} diff --git a/translator/translate/otel/processor/awsentity/translator.go b/translator/translate/otel/processor/awsentity/translator.go new file mode 100644 index 0000000000..ed81c702d0 --- /dev/null +++ b/translator/translate/otel/processor/awsentity/translator.go @@ -0,0 +1,101 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package awsentity + +import ( + "strings" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/processor" + + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity" + "github.com/aws/amazon-cloudwatch-agent/translator/context" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/logs/util" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" + "github.com/aws/amazon-cloudwatch-agent/translator/util/ecsutil" +) + +const ( + name = "awsentity" + Service = "Service" + Resource = "Resource" +) + +type translator struct { + factory processor.Factory + entityType string + name string + scrapeDatapointAttribute bool +} + +func NewTranslator() common.Translator[component.Config] { + return &translator{ + factory: awsentity.NewFactory(), + } +} + +func NewTranslatorWithEntityType(entityType string, name string, scrapeDatapointAttribute bool) common.Translator[component.Config] { + pipelineName := strings.ToLower(entityType) + if name != "" { + pipelineName = pipelineName + "/" + name + } + + return &translator{ + factory: awsentity.NewFactory(), + entityType: entityType, + name: pipelineName, + scrapeDatapointAttribute: scrapeDatapointAttribute, + } +} + +func (t *translator) ID() component.ID { + return component.NewIDWithName(t.factory.Type(), t.name) +} + +func (t *translator) Translate(conf *confmap.Conf) (component.Config, error) { + // Do not send entity for ECS + if context.CurrentContext().RunInContainer() && ecsutil.GetECSUtilSingleton().IsECS() { + return nil, nil + } + + cfg := t.factory.CreateDefaultConfig().(*awsentity.Config) + + if t.entityType != "" { + cfg.EntityType = t.entityType + } + + if t.scrapeDatapointAttribute { + cfg.ScrapeDatapointAttribute = true + } + + hostedInConfigKey := common.ConfigKey(common.LogsKey, common.MetricsCollectedKey, common.AppSignals, "hosted_in") + hostedIn, hostedInConfigured := common.GetString(conf, hostedInConfigKey) + if !hostedInConfigured { + hostedInConfigKey = common.ConfigKey(common.LogsKey, common.MetricsCollectedKey, common.AppSignalsFallback, "hosted_in") + hostedIn, hostedInConfigured = common.GetString(conf, hostedInConfigKey) + } + if common.IsAppSignalsKubernetes() { + if !hostedInConfigured { + hostedIn = util.GetClusterNameFromEc2Tagger() + } + } + + //TODO: This logic is more or less identical to what AppSignals does. This should be moved to a common place for reuse + ctx := context.CurrentContext() + mode := ctx.KubernetesMode() + cfg.KubernetesMode = mode + + mode = ctx.Mode() + if cfg.KubernetesMode != "" { + cfg.ClusterName = hostedIn + } + + // We want to keep platform config variable to be + // anything that is non-Kubernetes related so the + // processor can perform different logics for EKS + // in EC2 or Non-EC2 + cfg.Platform = mode + return cfg, nil +} diff --git a/translator/translate/otel/processor/awsentity/translator_test.go b/translator/translate/otel/processor/awsentity/translator_test.go new file mode 100644 index 0000000000..11b44e37f4 --- /dev/null +++ b/translator/translate/otel/processor/awsentity/translator_test.go @@ -0,0 +1,70 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package awsentity + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/confmap" + + "github.com/aws/amazon-cloudwatch-agent/plugins/processors/awsentity" + "github.com/aws/amazon-cloudwatch-agent/translator/config" + "github.com/aws/amazon-cloudwatch-agent/translator/context" + "github.com/aws/amazon-cloudwatch-agent/translator/util/ecsutil" +) + +func TestTranslate(t *testing.T) { + testCases := map[string]struct { + input map[string]interface{} + mode string + kubernetesMode string + want *awsentity.Config + }{ + "OnlyProfile": { + input: map[string]interface{}{ + "logs": map[string]interface{}{ + "metrics_collected": map[string]interface{}{ + "app_signals": map[string]interface{}{ + "hosted_in": "test", + }, + }, + }}, + mode: config.ModeEC2, + kubernetesMode: config.ModeEKS, + want: &awsentity.Config{ + ClusterName: "test", + KubernetesMode: config.ModeEKS, + Platform: config.ModeEC2, + }, + }, + "ECS": { + input: map[string]interface{}{}, + mode: config.ModeECS, + want: nil, + }, + } + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + if testCase.mode == config.ModeECS { + context.CurrentContext().SetRunInContainer(true) + t.Setenv(config.RUN_IN_CONTAINER, config.RUN_IN_CONTAINER_TRUE) + ecsutil.GetECSUtilSingleton().Region = "test" + } else { + context.CurrentContext().SetMode(testCase.mode) + context.CurrentContext().SetKubernetesMode(testCase.kubernetesMode) + } + tt := NewTranslator() + assert.Equal(t, "awsentity", tt.ID().String()) + conf := confmap.NewFromStringMap(testCase.input) + got, err := tt.Translate(conf) + assert.NoError(t, err) + if testCase.want == nil { + assert.Nil(t, got) + } else { + assert.Equal(t, testCase.want, got) + } + }) + } +} diff --git a/translator/translate/otel/receiver/translator.go b/translator/translate/otel/receiver/translator.go new file mode 100644 index 0000000000..c07b95a3c6 --- /dev/null +++ b/translator/translate/otel/receiver/translator.go @@ -0,0 +1,33 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package receiver + +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/receiver" + + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" +) + +type translator struct { + name string + factory receiver.Factory +} + +func NewDefaultTranslator(factory receiver.Factory) common.Translator[component.Config] { + return NewDefaultTranslatorWithName("", factory) +} + +func NewDefaultTranslatorWithName(name string, factory receiver.Factory) common.Translator[component.Config] { + return &translator{name, factory} +} + +func (t *translator) Translate(*confmap.Conf) (component.Config, error) { + return t.factory.CreateDefaultConfig(), nil +} + +func (t *translator) ID() component.ID { + return component.NewIDWithName(t.factory.Type(), t.name) +} diff --git a/translator/translate/otel/receiver/translator_test.go b/translator/translate/otel/receiver/translator_test.go new file mode 100644 index 0000000000..543392b693 --- /dev/null +++ b/translator/translate/otel/receiver/translator_test.go @@ -0,0 +1,20 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package receiver + +import ( + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/receiver/receivertest" +) + +func TestTranslator(t *testing.T) { + factory := receivertest.NewNopFactory() + got := NewDefaultTranslator(factory) + require.Equal(t, "nop", got.ID().String()) + cfg, err := got.Translate(nil) + require.NoError(t, err) + require.Equal(t, factory.CreateDefaultConfig(), cfg) +} diff --git a/translator/translate/otel/translate_otel.go b/translator/translate/otel/translate_otel.go index aa38c00ef7..12c38185fd 100644 --- a/translator/translate/otel/translate_otel.go +++ b/translator/translate/otel/translate_otel.go @@ -20,6 +20,8 @@ import ( "github.com/aws/amazon-cloudwatch-agent/translator/context" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/entitystore" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/server" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/pipeline" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/pipeline/applicationsignals" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/pipeline/containerinsights" @@ -27,8 +29,10 @@ import ( "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/pipeline/emf_logs" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/pipeline/host" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/pipeline/jmx" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/pipeline/nop" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/pipeline/prometheus" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/pipeline/xray" + "github.com/aws/amazon-cloudwatch-agent/translator/util/ecsutil" ) var registry = common.NewTranslatorMap[*common.ComponentTranslators]() @@ -72,8 +76,19 @@ func Translate(jsonConfig interface{}, os string) (*otelcol.Config, error) { translators.Merge(jmx.NewTranslators(conf)) translators.Merge(registry) pipelines, err := pipeline.NewTranslator(translators).Translate(conf) - if err != nil { - return nil, err + if pipelines == nil { + translators.Set(nop.NewTranslator()) + pipelines, err = pipeline.NewTranslator(translators).Translate(conf) + if err != nil { + return nil, err + } + } + // ECS is not in scope for entity association, so we only add the entity store in non ECS platforms + if !ecsutil.GetECSUtilSingleton().IsECS() { + pipelines.Translators.Extensions.Set(entitystore.NewTranslator()) + } + if context.CurrentContext().KubernetesMode() != "" { + pipelines.Translators.Extensions.Set(server.NewTranslator()) } cfg := &otelcol.Config{ Receivers: map[component.ID]component.Config{},