当前位置: 首页>>代码示例>>Golang>>正文


Golang cloudwatchevents.PutRuleInput类代码示例

本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/cloudwatchevents.PutRuleInput的典型用法代码示例。如果您正苦于以下问题:Golang PutRuleInput类的具体用法?Golang PutRuleInput怎么用?Golang PutRuleInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PutRuleInput类的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
}
开发者ID:paultyng,项目名称:terraform,代码行数:25,代码来源:resource_aws_cloudwatch_event_rule.go

示例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
}
开发者ID:chandy,项目名称:terraform,代码行数:21,代码来源:resource_aws_cloudwatch_event_rule.go


注:本文中的github.com/aws/aws-sdk-go/service/cloudwatchevents.PutRuleInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。