mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-30 04:20:53 +00:00
Update Go AWS SDK to the latest version
This commit is contained in:
committed by
Andrey Smirnov
parent
d08be990ef
commit
94a72b23ff
+4022
-187
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+66
-2
@@ -26,7 +26,7 @@ import (
|
||||
// // myFunc uses an SDK service client to make a request to
|
||||
// // Amazon CloudWatch Events.
|
||||
// func myFunc(svc cloudwatcheventsiface.CloudWatchEventsAPI) bool {
|
||||
// // Make svc.DeleteRule request
|
||||
// // Make svc.ActivateEventSource request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
@@ -42,7 +42,7 @@ import (
|
||||
// type mockCloudWatchEventsClient struct {
|
||||
// cloudwatcheventsiface.CloudWatchEventsAPI
|
||||
// }
|
||||
// func (m *mockCloudWatchEventsClient) DeleteRule(input *cloudwatchevents.DeleteRuleInput) (*cloudwatchevents.DeleteRuleOutput, error) {
|
||||
// func (m *mockCloudWatchEventsClient) ActivateEventSource(input *cloudwatchevents.ActivateEventSourceInput) (*cloudwatchevents.ActivateEventSourceOutput, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
@@ -60,6 +60,30 @@ import (
|
||||
// and waiters. Its suggested to use the pattern above for testing, or using
|
||||
// tooling to generate mocks to satisfy the interfaces.
|
||||
type CloudWatchEventsAPI interface {
|
||||
ActivateEventSource(*cloudwatchevents.ActivateEventSourceInput) (*cloudwatchevents.ActivateEventSourceOutput, error)
|
||||
ActivateEventSourceWithContext(aws.Context, *cloudwatchevents.ActivateEventSourceInput, ...request.Option) (*cloudwatchevents.ActivateEventSourceOutput, error)
|
||||
ActivateEventSourceRequest(*cloudwatchevents.ActivateEventSourceInput) (*request.Request, *cloudwatchevents.ActivateEventSourceOutput)
|
||||
|
||||
CreateEventBus(*cloudwatchevents.CreateEventBusInput) (*cloudwatchevents.CreateEventBusOutput, error)
|
||||
CreateEventBusWithContext(aws.Context, *cloudwatchevents.CreateEventBusInput, ...request.Option) (*cloudwatchevents.CreateEventBusOutput, error)
|
||||
CreateEventBusRequest(*cloudwatchevents.CreateEventBusInput) (*request.Request, *cloudwatchevents.CreateEventBusOutput)
|
||||
|
||||
CreatePartnerEventSource(*cloudwatchevents.CreatePartnerEventSourceInput) (*cloudwatchevents.CreatePartnerEventSourceOutput, error)
|
||||
CreatePartnerEventSourceWithContext(aws.Context, *cloudwatchevents.CreatePartnerEventSourceInput, ...request.Option) (*cloudwatchevents.CreatePartnerEventSourceOutput, error)
|
||||
CreatePartnerEventSourceRequest(*cloudwatchevents.CreatePartnerEventSourceInput) (*request.Request, *cloudwatchevents.CreatePartnerEventSourceOutput)
|
||||
|
||||
DeactivateEventSource(*cloudwatchevents.DeactivateEventSourceInput) (*cloudwatchevents.DeactivateEventSourceOutput, error)
|
||||
DeactivateEventSourceWithContext(aws.Context, *cloudwatchevents.DeactivateEventSourceInput, ...request.Option) (*cloudwatchevents.DeactivateEventSourceOutput, error)
|
||||
DeactivateEventSourceRequest(*cloudwatchevents.DeactivateEventSourceInput) (*request.Request, *cloudwatchevents.DeactivateEventSourceOutput)
|
||||
|
||||
DeleteEventBus(*cloudwatchevents.DeleteEventBusInput) (*cloudwatchevents.DeleteEventBusOutput, error)
|
||||
DeleteEventBusWithContext(aws.Context, *cloudwatchevents.DeleteEventBusInput, ...request.Option) (*cloudwatchevents.DeleteEventBusOutput, error)
|
||||
DeleteEventBusRequest(*cloudwatchevents.DeleteEventBusInput) (*request.Request, *cloudwatchevents.DeleteEventBusOutput)
|
||||
|
||||
DeletePartnerEventSource(*cloudwatchevents.DeletePartnerEventSourceInput) (*cloudwatchevents.DeletePartnerEventSourceOutput, error)
|
||||
DeletePartnerEventSourceWithContext(aws.Context, *cloudwatchevents.DeletePartnerEventSourceInput, ...request.Option) (*cloudwatchevents.DeletePartnerEventSourceOutput, error)
|
||||
DeletePartnerEventSourceRequest(*cloudwatchevents.DeletePartnerEventSourceInput) (*request.Request, *cloudwatchevents.DeletePartnerEventSourceOutput)
|
||||
|
||||
DeleteRule(*cloudwatchevents.DeleteRuleInput) (*cloudwatchevents.DeleteRuleOutput, error)
|
||||
DeleteRuleWithContext(aws.Context, *cloudwatchevents.DeleteRuleInput, ...request.Option) (*cloudwatchevents.DeleteRuleOutput, error)
|
||||
DeleteRuleRequest(*cloudwatchevents.DeleteRuleInput) (*request.Request, *cloudwatchevents.DeleteRuleOutput)
|
||||
@@ -68,6 +92,14 @@ type CloudWatchEventsAPI interface {
|
||||
DescribeEventBusWithContext(aws.Context, *cloudwatchevents.DescribeEventBusInput, ...request.Option) (*cloudwatchevents.DescribeEventBusOutput, error)
|
||||
DescribeEventBusRequest(*cloudwatchevents.DescribeEventBusInput) (*request.Request, *cloudwatchevents.DescribeEventBusOutput)
|
||||
|
||||
DescribeEventSource(*cloudwatchevents.DescribeEventSourceInput) (*cloudwatchevents.DescribeEventSourceOutput, error)
|
||||
DescribeEventSourceWithContext(aws.Context, *cloudwatchevents.DescribeEventSourceInput, ...request.Option) (*cloudwatchevents.DescribeEventSourceOutput, error)
|
||||
DescribeEventSourceRequest(*cloudwatchevents.DescribeEventSourceInput) (*request.Request, *cloudwatchevents.DescribeEventSourceOutput)
|
||||
|
||||
DescribePartnerEventSource(*cloudwatchevents.DescribePartnerEventSourceInput) (*cloudwatchevents.DescribePartnerEventSourceOutput, error)
|
||||
DescribePartnerEventSourceWithContext(aws.Context, *cloudwatchevents.DescribePartnerEventSourceInput, ...request.Option) (*cloudwatchevents.DescribePartnerEventSourceOutput, error)
|
||||
DescribePartnerEventSourceRequest(*cloudwatchevents.DescribePartnerEventSourceInput) (*request.Request, *cloudwatchevents.DescribePartnerEventSourceOutput)
|
||||
|
||||
DescribeRule(*cloudwatchevents.DescribeRuleInput) (*cloudwatchevents.DescribeRuleOutput, error)
|
||||
DescribeRuleWithContext(aws.Context, *cloudwatchevents.DescribeRuleInput, ...request.Option) (*cloudwatchevents.DescribeRuleOutput, error)
|
||||
DescribeRuleRequest(*cloudwatchevents.DescribeRuleInput) (*request.Request, *cloudwatchevents.DescribeRuleOutput)
|
||||
@@ -80,6 +112,22 @@ type CloudWatchEventsAPI interface {
|
||||
EnableRuleWithContext(aws.Context, *cloudwatchevents.EnableRuleInput, ...request.Option) (*cloudwatchevents.EnableRuleOutput, error)
|
||||
EnableRuleRequest(*cloudwatchevents.EnableRuleInput) (*request.Request, *cloudwatchevents.EnableRuleOutput)
|
||||
|
||||
ListEventBuses(*cloudwatchevents.ListEventBusesInput) (*cloudwatchevents.ListEventBusesOutput, error)
|
||||
ListEventBusesWithContext(aws.Context, *cloudwatchevents.ListEventBusesInput, ...request.Option) (*cloudwatchevents.ListEventBusesOutput, error)
|
||||
ListEventBusesRequest(*cloudwatchevents.ListEventBusesInput) (*request.Request, *cloudwatchevents.ListEventBusesOutput)
|
||||
|
||||
ListEventSources(*cloudwatchevents.ListEventSourcesInput) (*cloudwatchevents.ListEventSourcesOutput, error)
|
||||
ListEventSourcesWithContext(aws.Context, *cloudwatchevents.ListEventSourcesInput, ...request.Option) (*cloudwatchevents.ListEventSourcesOutput, error)
|
||||
ListEventSourcesRequest(*cloudwatchevents.ListEventSourcesInput) (*request.Request, *cloudwatchevents.ListEventSourcesOutput)
|
||||
|
||||
ListPartnerEventSourceAccounts(*cloudwatchevents.ListPartnerEventSourceAccountsInput) (*cloudwatchevents.ListPartnerEventSourceAccountsOutput, error)
|
||||
ListPartnerEventSourceAccountsWithContext(aws.Context, *cloudwatchevents.ListPartnerEventSourceAccountsInput, ...request.Option) (*cloudwatchevents.ListPartnerEventSourceAccountsOutput, error)
|
||||
ListPartnerEventSourceAccountsRequest(*cloudwatchevents.ListPartnerEventSourceAccountsInput) (*request.Request, *cloudwatchevents.ListPartnerEventSourceAccountsOutput)
|
||||
|
||||
ListPartnerEventSources(*cloudwatchevents.ListPartnerEventSourcesInput) (*cloudwatchevents.ListPartnerEventSourcesOutput, error)
|
||||
ListPartnerEventSourcesWithContext(aws.Context, *cloudwatchevents.ListPartnerEventSourcesInput, ...request.Option) (*cloudwatchevents.ListPartnerEventSourcesOutput, error)
|
||||
ListPartnerEventSourcesRequest(*cloudwatchevents.ListPartnerEventSourcesInput) (*request.Request, *cloudwatchevents.ListPartnerEventSourcesOutput)
|
||||
|
||||
ListRuleNamesByTarget(*cloudwatchevents.ListRuleNamesByTargetInput) (*cloudwatchevents.ListRuleNamesByTargetOutput, error)
|
||||
ListRuleNamesByTargetWithContext(aws.Context, *cloudwatchevents.ListRuleNamesByTargetInput, ...request.Option) (*cloudwatchevents.ListRuleNamesByTargetOutput, error)
|
||||
ListRuleNamesByTargetRequest(*cloudwatchevents.ListRuleNamesByTargetInput) (*request.Request, *cloudwatchevents.ListRuleNamesByTargetOutput)
|
||||
@@ -88,6 +136,10 @@ type CloudWatchEventsAPI interface {
|
||||
ListRulesWithContext(aws.Context, *cloudwatchevents.ListRulesInput, ...request.Option) (*cloudwatchevents.ListRulesOutput, error)
|
||||
ListRulesRequest(*cloudwatchevents.ListRulesInput) (*request.Request, *cloudwatchevents.ListRulesOutput)
|
||||
|
||||
ListTagsForResource(*cloudwatchevents.ListTagsForResourceInput) (*cloudwatchevents.ListTagsForResourceOutput, error)
|
||||
ListTagsForResourceWithContext(aws.Context, *cloudwatchevents.ListTagsForResourceInput, ...request.Option) (*cloudwatchevents.ListTagsForResourceOutput, error)
|
||||
ListTagsForResourceRequest(*cloudwatchevents.ListTagsForResourceInput) (*request.Request, *cloudwatchevents.ListTagsForResourceOutput)
|
||||
|
||||
ListTargetsByRule(*cloudwatchevents.ListTargetsByRuleInput) (*cloudwatchevents.ListTargetsByRuleOutput, error)
|
||||
ListTargetsByRuleWithContext(aws.Context, *cloudwatchevents.ListTargetsByRuleInput, ...request.Option) (*cloudwatchevents.ListTargetsByRuleOutput, error)
|
||||
ListTargetsByRuleRequest(*cloudwatchevents.ListTargetsByRuleInput) (*request.Request, *cloudwatchevents.ListTargetsByRuleOutput)
|
||||
@@ -96,6 +148,10 @@ type CloudWatchEventsAPI interface {
|
||||
PutEventsWithContext(aws.Context, *cloudwatchevents.PutEventsInput, ...request.Option) (*cloudwatchevents.PutEventsOutput, error)
|
||||
PutEventsRequest(*cloudwatchevents.PutEventsInput) (*request.Request, *cloudwatchevents.PutEventsOutput)
|
||||
|
||||
PutPartnerEvents(*cloudwatchevents.PutPartnerEventsInput) (*cloudwatchevents.PutPartnerEventsOutput, error)
|
||||
PutPartnerEventsWithContext(aws.Context, *cloudwatchevents.PutPartnerEventsInput, ...request.Option) (*cloudwatchevents.PutPartnerEventsOutput, error)
|
||||
PutPartnerEventsRequest(*cloudwatchevents.PutPartnerEventsInput) (*request.Request, *cloudwatchevents.PutPartnerEventsOutput)
|
||||
|
||||
PutPermission(*cloudwatchevents.PutPermissionInput) (*cloudwatchevents.PutPermissionOutput, error)
|
||||
PutPermissionWithContext(aws.Context, *cloudwatchevents.PutPermissionInput, ...request.Option) (*cloudwatchevents.PutPermissionOutput, error)
|
||||
PutPermissionRequest(*cloudwatchevents.PutPermissionInput) (*request.Request, *cloudwatchevents.PutPermissionOutput)
|
||||
@@ -116,9 +172,17 @@ type CloudWatchEventsAPI interface {
|
||||
RemoveTargetsWithContext(aws.Context, *cloudwatchevents.RemoveTargetsInput, ...request.Option) (*cloudwatchevents.RemoveTargetsOutput, error)
|
||||
RemoveTargetsRequest(*cloudwatchevents.RemoveTargetsInput) (*request.Request, *cloudwatchevents.RemoveTargetsOutput)
|
||||
|
||||
TagResource(*cloudwatchevents.TagResourceInput) (*cloudwatchevents.TagResourceOutput, error)
|
||||
TagResourceWithContext(aws.Context, *cloudwatchevents.TagResourceInput, ...request.Option) (*cloudwatchevents.TagResourceOutput, error)
|
||||
TagResourceRequest(*cloudwatchevents.TagResourceInput) (*request.Request, *cloudwatchevents.TagResourceOutput)
|
||||
|
||||
TestEventPattern(*cloudwatchevents.TestEventPatternInput) (*cloudwatchevents.TestEventPatternOutput, error)
|
||||
TestEventPatternWithContext(aws.Context, *cloudwatchevents.TestEventPatternInput, ...request.Option) (*cloudwatchevents.TestEventPatternOutput, error)
|
||||
TestEventPatternRequest(*cloudwatchevents.TestEventPatternInput) (*request.Request, *cloudwatchevents.TestEventPatternOutput)
|
||||
|
||||
UntagResource(*cloudwatchevents.UntagResourceInput) (*cloudwatchevents.UntagResourceOutput, error)
|
||||
UntagResourceWithContext(aws.Context, *cloudwatchevents.UntagResourceInput, ...request.Option) (*cloudwatchevents.UntagResourceOutput, error)
|
||||
UntagResourceRequest(*cloudwatchevents.UntagResourceInput) (*request.Request, *cloudwatchevents.UntagResourceOutput)
|
||||
}
|
||||
|
||||
var _ CloudWatchEventsAPI = (*cloudwatchevents.CloudWatchEvents)(nil)
|
||||
|
||||
+13
-12
@@ -3,24 +3,25 @@
|
||||
// Package cloudwatchevents provides the client and types for making API
|
||||
// requests to Amazon CloudWatch Events.
|
||||
//
|
||||
// Amazon CloudWatch Events helps you to respond to state changes in your AWS
|
||||
// resources. When your resources change state, they automatically send events
|
||||
// into an event stream. You can create rules that match selected events in
|
||||
// the stream and route them to targets to take action. You can also use rules
|
||||
// to take action on a pre-determined schedule. For example, you can configure
|
||||
// rules to:
|
||||
// Amazon EventBridge helps you to respond to state changes in your AWS resources.
|
||||
// When your resources change state, they automatically send events into an
|
||||
// event stream. You can create rules that match selected events in the stream
|
||||
// and route them to targets to take action. You can also use rules to take
|
||||
// action on a predetermined schedule. For example, you can configure rules
|
||||
// to:
|
||||
//
|
||||
// * Automatically invoke an AWS Lambda function to update DNS entries when
|
||||
// an event notifies you that Amazon EC2 instance enters the running state.
|
||||
// an event notifies you that Amazon EC2 instance enters the running state
|
||||
//
|
||||
// * Direct specific API records from CloudTrail to an Amazon Kinesis stream
|
||||
// for detailed analysis of potential security or availability risks.
|
||||
// * Direct specific API records from AWS CloudTrail to an Amazon Kinesis
|
||||
// data stream for detailed analysis of potential security or availability
|
||||
// risks
|
||||
//
|
||||
// * Periodically invoke a built-in target to create a snapshot of an Amazon
|
||||
// EBS volume.
|
||||
// EBS volume
|
||||
//
|
||||
// For more information about the features of Amazon CloudWatch Events, see
|
||||
// the Amazon CloudWatch Events User Guide (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events).
|
||||
// For more information about the features of Amazon EventBridge, see the Amazon
|
||||
// EventBridge User Guide (https://docs.aws.amazon.com/eventbridge/latest/userguide/).
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07 for more information on this service.
|
||||
//
|
||||
|
||||
+26
-4
@@ -7,7 +7,7 @@ const (
|
||||
// ErrCodeConcurrentModificationException for service response error code
|
||||
// "ConcurrentModificationException".
|
||||
//
|
||||
// There is concurrent modification on a rule or target.
|
||||
// There is concurrent modification on a resource.
|
||||
ErrCodeConcurrentModificationException = "ConcurrentModificationException"
|
||||
|
||||
// ErrCodeInternalException for service response error code
|
||||
@@ -19,24 +19,46 @@ const (
|
||||
// ErrCodeInvalidEventPatternException for service response error code
|
||||
// "InvalidEventPatternException".
|
||||
//
|
||||
// The event pattern is not valid.
|
||||
// The event pattern isn't valid.
|
||||
ErrCodeInvalidEventPatternException = "InvalidEventPatternException"
|
||||
|
||||
// ErrCodeInvalidStateException for service response error code
|
||||
// "InvalidStateException".
|
||||
//
|
||||
// The specified state isn't a valid state for an event source.
|
||||
ErrCodeInvalidStateException = "InvalidStateException"
|
||||
|
||||
// ErrCodeLimitExceededException for service response error code
|
||||
// "LimitExceededException".
|
||||
//
|
||||
// You tried to create more rules or add more targets to a rule than is allowed.
|
||||
// You tried to create more resources than is allowed.
|
||||
ErrCodeLimitExceededException = "LimitExceededException"
|
||||
|
||||
// ErrCodeManagedRuleException for service response error code
|
||||
// "ManagedRuleException".
|
||||
//
|
||||
// An AWS service created this rule on behalf of your account. That service
|
||||
// manages it. If you see this error in response to DeleteRule or RemoveTargets,
|
||||
// you can use the Force parameter in those calls to delete the rule or remove
|
||||
// targets from the rule. You can't modify these managed rules by using DisableRule,
|
||||
// EnableRule, PutTargets, PutRule, TagResource, or UntagResource.
|
||||
ErrCodeManagedRuleException = "ManagedRuleException"
|
||||
|
||||
// ErrCodePolicyLengthExceededException for service response error code
|
||||
// "PolicyLengthExceededException".
|
||||
//
|
||||
// The event bus policy is too long. For more information, see the limits.
|
||||
ErrCodePolicyLengthExceededException = "PolicyLengthExceededException"
|
||||
|
||||
// ErrCodeResourceAlreadyExistsException for service response error code
|
||||
// "ResourceAlreadyExistsException".
|
||||
//
|
||||
// The resource that you're trying to create already exists.
|
||||
ErrCodeResourceAlreadyExistsException = "ResourceAlreadyExistsException"
|
||||
|
||||
// ErrCodeResourceNotFoundException for service response error code
|
||||
// "ResourceNotFoundException".
|
||||
//
|
||||
// An entity that you specified does not exist.
|
||||
// An entity that you specified doesn't exist.
|
||||
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
|
||||
)
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// +build go1.10,integration
|
||||
|
||||
package cloudwatchevents_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/cloudwatchevents"
|
||||
)
|
||||
|
||||
var _ aws.Config
|
||||
var _ awserr.Error
|
||||
var _ request.Request
|
||||
|
||||
func TestInteg_00_ListRules(t *testing.T) {
|
||||
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancelFn()
|
||||
|
||||
sess := integration.SessionWithDefaultRegion("us-west-2")
|
||||
svc := cloudwatchevents.New(sess)
|
||||
params := &cloudwatchevents.ListRulesInput{}
|
||||
_, err := svc.ListRulesWithContext(ctx, params)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
}
|
||||
func TestInteg_01_DescribeRule(t *testing.T) {
|
||||
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancelFn()
|
||||
|
||||
sess := integration.SessionWithDefaultRegion("us-west-2")
|
||||
svc := cloudwatchevents.New(sess)
|
||||
params := &cloudwatchevents.DescribeRuleInput{
|
||||
Name: aws.String("fake-rule"),
|
||||
}
|
||||
_, err := svc.DescribeRuleWithContext(ctx, params)
|
||||
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 v := aerr.Code(); v == request.ErrCodeSerialization {
|
||||
t.Errorf("expect API error code got serialization failure")
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -29,8 +29,9 @@ var initRequest func(*request.Request)
|
||||
|
||||
// Service information constants
|
||||
const (
|
||||
ServiceName = "events" // Service endpoint prefix API calls made to.
|
||||
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
|
||||
ServiceName = "events" // Name of service.
|
||||
EndpointsID = ServiceName // ID to lookup a service endpoint with.
|
||||
ServiceID = "CloudWatch Events" // ServiceID is a unique identifer of a specific service.
|
||||
)
|
||||
|
||||
// New creates a new instance of the CloudWatchEvents client with a session.
|
||||
@@ -55,6 +56,7 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
ServiceID: ServiceID,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
|
||||
Reference in New Issue
Block a user