func ExampleCloudWatchEvents_PutTargets() { svc := cloudwatchevents.New(session.New()) params := &cloudwatchevents.PutTargetsInput{ Rule: aws.String("RuleName"), // Required Targets: []*cloudwatchevents.Target{ // Required { // Required Arn: aws.String("TargetArn"), // Required Id: aws.String("TargetId"), // Required Input: aws.String("TargetInput"), InputPath: aws.String("TargetInputPath"), }, // 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_PutEvents() { svc := cloudwatchevents.New(session.New()) 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_EnableRule() { svc := cloudwatchevents.New(session.New()) 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_TestEventPattern() { svc := cloudwatchevents.New(session.New()) 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) }
func ExampleCloudWatchEvents_ListRuleNamesByTarget() { svc := cloudwatchevents.New(session.New()) 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_RemoveTargets() { svc := cloudwatchevents.New(session.New()) 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_PutRule() { svc := cloudwatchevents.New(session.New()) 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) }