Switch to using the dep tool and update all the dependencies
This commit is contained in:
+2882
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+112
@@ -0,0 +1,112 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package cloudwatcheventsiface provides an interface to enable mocking the Amazon CloudWatch Events 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 cloudwatcheventsiface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
|
||||
)
|
||||
|
||||
// CloudWatchEventsAPI provides an interface to enable mocking the
|
||||
// cloudwatchevents.CloudWatchEvents 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 the SDK's request pipeline.
|
||||
//
|
||||
// // myFunc uses an SDK service client to make a request to
|
||||
// // Amazon CloudWatch Events.
|
||||
// func myFunc(svc cloudwatcheventsiface.CloudWatchEventsAPI) bool {
|
||||
// // Make svc.DeleteRule request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// sess := session.New()
|
||||
// svc := cloudwatchevents.New(sess)
|
||||
//
|
||||
// myFunc(svc)
|
||||
// }
|
||||
//
|
||||
// In your _test.go file:
|
||||
//
|
||||
// // Define a mock struct to be used in your unit tests of myFunc.
|
||||
// type mockCloudWatchEventsClient struct {
|
||||
// cloudwatcheventsiface.CloudWatchEventsAPI
|
||||
// }
|
||||
// func (m *mockCloudWatchEventsClient) DeleteRule(input *cloudwatchevents.DeleteRuleInput) (*cloudwatchevents.DeleteRuleOutput, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
// func TestMyFunc(t *testing.T) {
|
||||
// // Setup Test
|
||||
// mockSvc := &mockCloudWatchEventsClient{}
|
||||
//
|
||||
// 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 CloudWatchEventsAPI interface {
|
||||
DeleteRule(*cloudwatchevents.DeleteRuleInput) (*cloudwatchevents.DeleteRuleOutput, error)
|
||||
DeleteRuleWithContext(aws.Context, *cloudwatchevents.DeleteRuleInput, ...request.Option) (*cloudwatchevents.DeleteRuleOutput, error)
|
||||
DeleteRuleRequest(*cloudwatchevents.DeleteRuleInput) (*request.Request, *cloudwatchevents.DeleteRuleOutput)
|
||||
|
||||
DescribeRule(*cloudwatchevents.DescribeRuleInput) (*cloudwatchevents.DescribeRuleOutput, error)
|
||||
DescribeRuleWithContext(aws.Context, *cloudwatchevents.DescribeRuleInput, ...request.Option) (*cloudwatchevents.DescribeRuleOutput, error)
|
||||
DescribeRuleRequest(*cloudwatchevents.DescribeRuleInput) (*request.Request, *cloudwatchevents.DescribeRuleOutput)
|
||||
|
||||
DisableRule(*cloudwatchevents.DisableRuleInput) (*cloudwatchevents.DisableRuleOutput, error)
|
||||
DisableRuleWithContext(aws.Context, *cloudwatchevents.DisableRuleInput, ...request.Option) (*cloudwatchevents.DisableRuleOutput, error)
|
||||
DisableRuleRequest(*cloudwatchevents.DisableRuleInput) (*request.Request, *cloudwatchevents.DisableRuleOutput)
|
||||
|
||||
EnableRule(*cloudwatchevents.EnableRuleInput) (*cloudwatchevents.EnableRuleOutput, error)
|
||||
EnableRuleWithContext(aws.Context, *cloudwatchevents.EnableRuleInput, ...request.Option) (*cloudwatchevents.EnableRuleOutput, error)
|
||||
EnableRuleRequest(*cloudwatchevents.EnableRuleInput) (*request.Request, *cloudwatchevents.EnableRuleOutput)
|
||||
|
||||
ListRuleNamesByTarget(*cloudwatchevents.ListRuleNamesByTargetInput) (*cloudwatchevents.ListRuleNamesByTargetOutput, error)
|
||||
ListRuleNamesByTargetWithContext(aws.Context, *cloudwatchevents.ListRuleNamesByTargetInput, ...request.Option) (*cloudwatchevents.ListRuleNamesByTargetOutput, error)
|
||||
ListRuleNamesByTargetRequest(*cloudwatchevents.ListRuleNamesByTargetInput) (*request.Request, *cloudwatchevents.ListRuleNamesByTargetOutput)
|
||||
|
||||
ListRules(*cloudwatchevents.ListRulesInput) (*cloudwatchevents.ListRulesOutput, error)
|
||||
ListRulesWithContext(aws.Context, *cloudwatchevents.ListRulesInput, ...request.Option) (*cloudwatchevents.ListRulesOutput, error)
|
||||
ListRulesRequest(*cloudwatchevents.ListRulesInput) (*request.Request, *cloudwatchevents.ListRulesOutput)
|
||||
|
||||
ListTargetsByRule(*cloudwatchevents.ListTargetsByRuleInput) (*cloudwatchevents.ListTargetsByRuleOutput, error)
|
||||
ListTargetsByRuleWithContext(aws.Context, *cloudwatchevents.ListTargetsByRuleInput, ...request.Option) (*cloudwatchevents.ListTargetsByRuleOutput, error)
|
||||
ListTargetsByRuleRequest(*cloudwatchevents.ListTargetsByRuleInput) (*request.Request, *cloudwatchevents.ListTargetsByRuleOutput)
|
||||
|
||||
PutEvents(*cloudwatchevents.PutEventsInput) (*cloudwatchevents.PutEventsOutput, error)
|
||||
PutEventsWithContext(aws.Context, *cloudwatchevents.PutEventsInput, ...request.Option) (*cloudwatchevents.PutEventsOutput, error)
|
||||
PutEventsRequest(*cloudwatchevents.PutEventsInput) (*request.Request, *cloudwatchevents.PutEventsOutput)
|
||||
|
||||
PutRule(*cloudwatchevents.PutRuleInput) (*cloudwatchevents.PutRuleOutput, error)
|
||||
PutRuleWithContext(aws.Context, *cloudwatchevents.PutRuleInput, ...request.Option) (*cloudwatchevents.PutRuleOutput, error)
|
||||
PutRuleRequest(*cloudwatchevents.PutRuleInput) (*request.Request, *cloudwatchevents.PutRuleOutput)
|
||||
|
||||
PutTargets(*cloudwatchevents.PutTargetsInput) (*cloudwatchevents.PutTargetsOutput, error)
|
||||
PutTargetsWithContext(aws.Context, *cloudwatchevents.PutTargetsInput, ...request.Option) (*cloudwatchevents.PutTargetsOutput, error)
|
||||
PutTargetsRequest(*cloudwatchevents.PutTargetsInput) (*request.Request, *cloudwatchevents.PutTargetsOutput)
|
||||
|
||||
RemoveTargets(*cloudwatchevents.RemoveTargetsInput) (*cloudwatchevents.RemoveTargetsOutput, error)
|
||||
RemoveTargetsWithContext(aws.Context, *cloudwatchevents.RemoveTargetsInput, ...request.Option) (*cloudwatchevents.RemoveTargetsOutput, error)
|
||||
RemoveTargetsRequest(*cloudwatchevents.RemoveTargetsInput) (*request.Request, *cloudwatchevents.RemoveTargetsOutput)
|
||||
|
||||
TestEventPattern(*cloudwatchevents.TestEventPatternInput) (*cloudwatchevents.TestEventPatternOutput, error)
|
||||
TestEventPatternWithContext(aws.Context, *cloudwatchevents.TestEventPatternInput, ...request.Option) (*cloudwatchevents.TestEventPatternOutput, error)
|
||||
TestEventPatternRequest(*cloudwatchevents.TestEventPatternInput) (*request.Request, *cloudwatchevents.TestEventPatternOutput)
|
||||
}
|
||||
|
||||
var _ CloudWatchEventsAPI = (*cloudwatchevents.CloudWatchEvents)(nil)
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// 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:
|
||||
//
|
||||
// * Automatically invoke an AWS Lambda function to update DNS entries when
|
||||
// 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.
|
||||
//
|
||||
// * Periodically invoke a built-in target to create a snapshot of an Amazon
|
||||
// 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).
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07 for more information on this service.
|
||||
//
|
||||
// See cloudwatchevents package documentation for more information.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatchevents/
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To use the client for Amazon CloudWatch Events you will first need
|
||||
// to create a new instance of it.
|
||||
//
|
||||
// When creating a client for an AWS service you'll first need to have a Session
|
||||
// already created. The Session provides configuration that can be shared
|
||||
// between multiple service clients. Additional configuration can be applied to
|
||||
// the Session and service's client when they are constructed. The aws package's
|
||||
// Config type contains several fields such as Region for the AWS Region the
|
||||
// client should make API requests too. The optional Config value can be provided
|
||||
// as the variadic argument for Sessions and client creation.
|
||||
//
|
||||
// Once the service's client is created you can use it to make API requests the
|
||||
// AWS service. These clients are safe to use concurrently.
|
||||
//
|
||||
// // Create a session to share configuration, and load external configuration.
|
||||
// sess := session.Must(session.NewSession())
|
||||
//
|
||||
// // Create the service's client with the session.
|
||||
// svc := cloudwatchevents.New(sess)
|
||||
//
|
||||
// See the SDK's documentation for more information on how to use service clients.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/
|
||||
//
|
||||
// See aws package's Config type for more information on configuration options.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
|
||||
//
|
||||
// See the Amazon CloudWatch Events client CloudWatchEvents for more
|
||||
// information on creating the service's client.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatchevents/#New
|
||||
//
|
||||
// Once the client is created you can make an API request to the service.
|
||||
// Each API method takes a input parameter, and returns the service response
|
||||
// and an error.
|
||||
//
|
||||
// The API method will document which error codes the service can be returned
|
||||
// by the operation if the service models the API operation's errors. These
|
||||
// errors will also be available as const strings prefixed with "ErrCode".
|
||||
//
|
||||
// result, err := svc.DeleteRule(params)
|
||||
// if err != nil {
|
||||
// // Cast err to awserr.Error to handle specific error codes.
|
||||
// aerr, ok := err.(awserr.Error)
|
||||
// if ok && aerr.Code() == <error code to check for> {
|
||||
// // Specific error code handling
|
||||
// }
|
||||
// return err
|
||||
// }
|
||||
//
|
||||
// fmt.Println("DeleteRule result:")
|
||||
// fmt.Println(result)
|
||||
//
|
||||
// Using the Client with Context
|
||||
//
|
||||
// The service's client also provides methods to make API requests with a Context
|
||||
// value. This allows you to control the timeout, and cancellation of pending
|
||||
// requests. These methods also take request Option as variadic parameter to apply
|
||||
// additional configuration to the API request.
|
||||
//
|
||||
// ctx := context.Background()
|
||||
//
|
||||
// result, err := svc.DeleteRuleWithContext(ctx, params)
|
||||
//
|
||||
// See the request package documentation for more information on using Context pattern
|
||||
// with the SDK.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/request/
|
||||
package cloudwatchevents
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package cloudwatchevents
|
||||
|
||||
const (
|
||||
|
||||
// ErrCodeConcurrentModificationException for service response error code
|
||||
// "ConcurrentModificationException".
|
||||
//
|
||||
// There is concurrent modification on a rule or target.
|
||||
ErrCodeConcurrentModificationException = "ConcurrentModificationException"
|
||||
|
||||
// ErrCodeInternalException for service response error code
|
||||
// "InternalException".
|
||||
//
|
||||
// This exception occurs due to unexpected causes.
|
||||
ErrCodeInternalException = "InternalException"
|
||||
|
||||
// ErrCodeInvalidEventPatternException for service response error code
|
||||
// "InvalidEventPatternException".
|
||||
//
|
||||
// The event pattern is not valid.
|
||||
ErrCodeInvalidEventPatternException = "InvalidEventPatternException"
|
||||
|
||||
// ErrCodeLimitExceededException for service response error code
|
||||
// "LimitExceededException".
|
||||
//
|
||||
// You tried to create more rules or add more targets to a rule than is allowed.
|
||||
ErrCodeLimitExceededException = "LimitExceededException"
|
||||
|
||||
// ErrCodeResourceNotFoundException for service response error code
|
||||
// "ResourceNotFoundException".
|
||||
//
|
||||
// The rule does not exist.
|
||||
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
|
||||
)
|
||||
+332
@@ -0,0 +1,332 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package cloudwatchevents_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
"github.com/aws/aws-sdk-go/service/cloudwatchevents"
|
||||
)
|
||||
|
||||
var _ time.Duration
|
||||
var _ bytes.Buffer
|
||||
|
||||
func ExampleCloudWatchEvents_DeleteRule() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.DeleteRuleInput{
|
||||
Name: aws.String("RuleName"), // Required
|
||||
}
|
||||
resp, err := svc.DeleteRule(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleCloudWatchEvents_DescribeRule() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.DescribeRuleInput{
|
||||
Name: aws.String("RuleName"), // Required
|
||||
}
|
||||
resp, err := svc.DescribeRule(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleCloudWatchEvents_DisableRule() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.DisableRuleInput{
|
||||
Name: aws.String("RuleName"), // Required
|
||||
}
|
||||
resp, err := svc.DisableRule(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleCloudWatchEvents_EnableRule() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.EnableRuleInput{
|
||||
Name: aws.String("RuleName"), // Required
|
||||
}
|
||||
resp, err := svc.EnableRule(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleCloudWatchEvents_ListRuleNamesByTarget() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.ListRuleNamesByTargetInput{
|
||||
TargetArn: aws.String("TargetArn"), // Required
|
||||
Limit: aws.Int64(1),
|
||||
NextToken: aws.String("NextToken"),
|
||||
}
|
||||
resp, err := svc.ListRuleNamesByTarget(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleCloudWatchEvents_ListRules() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.ListRulesInput{
|
||||
Limit: aws.Int64(1),
|
||||
NamePrefix: aws.String("RuleName"),
|
||||
NextToken: aws.String("NextToken"),
|
||||
}
|
||||
resp, err := svc.ListRules(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleCloudWatchEvents_ListTargetsByRule() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.ListTargetsByRuleInput{
|
||||
Rule: aws.String("RuleName"), // Required
|
||||
Limit: aws.Int64(1),
|
||||
NextToken: aws.String("NextToken"),
|
||||
}
|
||||
resp, err := svc.ListTargetsByRule(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleCloudWatchEvents_PutEvents() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.PutEventsInput{
|
||||
Entries: []*cloudwatchevents.PutEventsRequestEntry{ // Required
|
||||
{ // Required
|
||||
Detail: aws.String("String"),
|
||||
DetailType: aws.String("String"),
|
||||
Resources: []*string{
|
||||
aws.String("EventResource"), // Required
|
||||
// More values...
|
||||
},
|
||||
Source: aws.String("String"),
|
||||
Time: aws.Time(time.Now()),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
resp, err := svc.PutEvents(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleCloudWatchEvents_PutRule() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.PutRuleInput{
|
||||
Name: aws.String("RuleName"), // Required
|
||||
Description: aws.String("RuleDescription"),
|
||||
EventPattern: aws.String("EventPattern"),
|
||||
RoleArn: aws.String("RoleArn"),
|
||||
ScheduleExpression: aws.String("ScheduleExpression"),
|
||||
State: aws.String("RuleState"),
|
||||
}
|
||||
resp, err := svc.PutRule(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleCloudWatchEvents_PutTargets() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.PutTargetsInput{
|
||||
Rule: aws.String("RuleName"), // Required
|
||||
Targets: []*cloudwatchevents.Target{ // Required
|
||||
{ // Required
|
||||
Arn: aws.String("TargetArn"), // Required
|
||||
Id: aws.String("TargetId"), // Required
|
||||
EcsParameters: &cloudwatchevents.EcsParameters{
|
||||
TaskDefinitionArn: aws.String("Arn"), // Required
|
||||
TaskCount: aws.Int64(1),
|
||||
},
|
||||
Input: aws.String("TargetInput"),
|
||||
InputPath: aws.String("TargetInputPath"),
|
||||
InputTransformer: &cloudwatchevents.InputTransformer{
|
||||
InputTemplate: aws.String("TransformerInput"), // Required
|
||||
InputPathsMap: map[string]*string{
|
||||
"Key": aws.String("TargetInputPath"), // Required
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
KinesisParameters: &cloudwatchevents.KinesisParameters{
|
||||
PartitionKeyPath: aws.String("TargetPartitionKeyPath"), // Required
|
||||
},
|
||||
RoleArn: aws.String("RoleArn"),
|
||||
RunCommandParameters: &cloudwatchevents.RunCommandParameters{
|
||||
RunCommandTargets: []*cloudwatchevents.RunCommandTarget{ // Required
|
||||
{ // Required
|
||||
Key: aws.String("RunCommandTargetKey"), // Required
|
||||
Values: []*string{ // Required
|
||||
aws.String("RunCommandTargetValue"), // Required
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
resp, err := svc.PutTargets(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleCloudWatchEvents_RemoveTargets() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.RemoveTargetsInput{
|
||||
Ids: []*string{ // Required
|
||||
aws.String("TargetId"), // Required
|
||||
// More values...
|
||||
},
|
||||
Rule: aws.String("RuleName"), // Required
|
||||
}
|
||||
resp, err := svc.RemoveTargets(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
|
||||
func ExampleCloudWatchEvents_TestEventPattern() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudwatchevents.New(sess)
|
||||
|
||||
params := &cloudwatchevents.TestEventPatternInput{
|
||||
Event: aws.String("String"), // Required
|
||||
EventPattern: aws.String("EventPattern"), // Required
|
||||
}
|
||||
resp, err := svc.TestEventPattern(params)
|
||||
|
||||
if err != nil {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(resp)
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package cloudwatchevents
|
||||
|
||||
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"
|
||||
"github.com/aws/aws-sdk-go/aws/signer/v4"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
|
||||
)
|
||||
|
||||
// CloudWatchEvents provides the API operation methods for making requests to
|
||||
// Amazon CloudWatch Events. See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// CloudWatchEvents methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type CloudWatchEvents 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 = "events" // Service endpoint prefix API calls made to.
|
||||
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
|
||||
)
|
||||
|
||||
// New creates a new instance of the CloudWatchEvents 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:
|
||||
// // Create a CloudWatchEvents client from just a session.
|
||||
// svc := cloudwatchevents.New(mySession)
|
||||
//
|
||||
// // Create a CloudWatchEvents client with additional configuration
|
||||
// svc := cloudwatchevents.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudWatchEvents {
|
||||
c := p.ClientConfig(EndpointsID, cfgs...)
|
||||
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *CloudWatchEvents {
|
||||
svc := &CloudWatchEvents{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "2015-10-07",
|
||||
JSONVersion: "1.1",
|
||||
TargetPrefix: "AWSEvents",
|
||||
},
|
||||
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(jsonrpc.UnmarshalErrorHandler)
|
||||
|
||||
// Run custom client initialization if present
|
||||
if initClient != nil {
|
||||
initClient(svc.Client)
|
||||
}
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a CloudWatchEvents operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *CloudWatchEvents) 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
|
||||
}
|
||||
Reference in New Issue
Block a user