本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/cloudwatchevents.PutRuleInput.ScheduleExpression方法的典型用法代码示例。如果您正苦于以下问题:Golang PutRuleInput.ScheduleExpression方法的具体用法?Golang PutRuleInput.ScheduleExpression怎么用?Golang PutRuleInput.ScheduleExpression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/aws/aws-sdk-go/service/cloudwatchevents.PutRuleInput
的用法示例。
在下文中一共展示了PutRuleInput.ScheduleExpression方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: buildPutRuleInputStruct
func buildPutRuleInputStruct(d *schema.ResourceData) (*events.PutRuleInput, error) {
input := events.PutRuleInput{
Name: aws.String(d.Get("name").(string)),
}
if v, ok := d.GetOk("description"); ok {
input.Description = aws.String(v.(string))
}
if v, ok := d.GetOk("event_pattern"); ok {
pattern, err := normalizeJsonString(v)
if err != nil {
return nil, errwrap.Wrapf("event pattern contains an invalid JSON: {{err}}", err)
}
input.EventPattern = aws.String(pattern)
}
if v, ok := d.GetOk("role_arn"); ok {
input.RoleArn = aws.String(v.(string))
}
if v, ok := d.GetOk("schedule_expression"); ok {
input.ScheduleExpression = aws.String(v.(string))
}
input.State = aws.String(getStringStateFromBoolean(d.Get("is_enabled").(bool)))
return &input, nil
}
示例2: buildPutRuleInputStruct
func buildPutRuleInputStruct(d *schema.ResourceData) *events.PutRuleInput {
input := events.PutRuleInput{
Name: aws.String(d.Get("name").(string)),
}
if v, ok := d.GetOk("description"); ok {
input.Description = aws.String(v.(string))
}
if v, ok := d.GetOk("event_pattern"); ok {
input.EventPattern = aws.String(normalizeJson(v.(string)))
}
if v, ok := d.GetOk("role_arn"); ok {
input.RoleArn = aws.String(v.(string))
}
if v, ok := d.GetOk("schedule_expression"); ok {
input.ScheduleExpression = aws.String(v.(string))
}
input.State = aws.String(getStringStateFromBoolean(d.Get("is_enabled").(bool)))
return &input
}