in alibabacloudstack/resource_apsarastack_cms_metric_rule_template.go [19:196]
func resourceAlibabacloudCmsMetricRuleTemplate() *schema.Resource {
resource := &schema.Resource{
Schema: map[string]*schema.Schema{
"alert_templates": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"category": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"ecs", "rds", "ads", "slb", "vpc", "apigateway", "cdn", "cs", "dcdn", "ddos", "eip", "elasticsearch", "emr", "ess", "hbase", "iot_edge", "kvstore_sharding", "kvstore_splitrw", "kvstore_standard", "memcache", "mns", "mongodb", "mongodb_cluster", "mongodb_sharding", "mq_topic", "ocs", "opensearch", "oss", "polardb", "petadata", "scdn", "sharebandwidthpackages", "sls", "vpn"}, false),
},
"escalations": {
Type: schema.TypeSet,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"critical": {
Type: schema.TypeSet,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"comparison_operator": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"GreaterThanOrEqualToThreshold", "GreaterThanThreshold", "LessThanOrEqualToThreshold", "LessThanThreshold", "NotEqualToThreshold", "GreaterThanYesterday", "LessThanYesterday", "GreaterThanLastWeek", "LessThanLastWeek", "GreaterThanLastPeriod", "LessThanLastPeriod"}, false),
},
"statistics": {
Type: schema.TypeString,
Optional: true,
},
"threshold": {
Type: schema.TypeString,
Optional: true,
},
"times": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
"info": {
Type: schema.TypeSet,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"comparison_operator": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"GreaterThanOrEqualToThreshold", "GreaterThanThreshold", "LessThanOrEqualToThreshold", "LessThanThreshold", "NotEqualToThreshold", "GreaterThanYesterday", "LessThanYesterday", "GreaterThanLastWeek", "LessThanLastWeek", "GreaterThanLastPeriod", "LessThanLastPeriod"}, false),
},
"statistics": {
Type: schema.TypeString,
Optional: true,
},
"threshold": {
Type: schema.TypeString,
Optional: true,
},
"times": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
"warn": {
Type: schema.TypeSet,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"comparison_operator": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"GreaterThanOrEqualToThreshold", "GreaterThanThreshold", "LessThanOrEqualToThreshold", "LessThanThreshold", "NotEqualToThreshold", "GreaterThanYesterday", "LessThanYesterday", "GreaterThanLastWeek", "LessThanLastWeek", "GreaterThanLastPeriod", "LessThanLastPeriod"}, false),
},
"statistics": {
Type: schema.TypeString,
Optional: true,
},
"threshold": {
Type: schema.TypeString,
Optional: true,
},
"times": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
},
},
},
"metric_name": {
Type: schema.TypeString,
Required: true,
},
"namespace": {
Type: schema.TypeString,
Required: true,
},
"rule_name": {
Type: schema.TypeString,
Required: true,
},
"webhook": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
"apply_mode": {
Type: schema.TypeString,
Optional: true,
},
"description": {
Type: schema.TypeString,
Optional: true,
},
"enable": {
Type: schema.TypeBool,
Optional: true,
},
"enable_end_time": {
Type: schema.TypeString,
Optional: true,
},
"enable_start_time": {
Type: schema.TypeString,
Optional: true,
},
"group_id": {
Type: schema.TypeString,
Optional: true,
},
"metric_rule_template_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"notify_level": {
Type: schema.TypeString,
Optional: true,
},
"rest_version": {
Optional: true,
Type: schema.TypeString,
Computed: true,
},
"silence_time": {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(0, 86400),
},
"webhook": {
Type: schema.TypeString,
Optional: true,
},
"overwrite": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
},
}
setResourceFunc(resource, resourceAlibabacloudCmsMetricRuleTemplateCreate,
resourceAlibabacloudCmsMetricRuleTemplateRead, resourceAlibabacloudCmsMetricRuleTemplateUpdate,
resourceAlibabacloudCmsMetricRuleTemplateDelete)
return resource
}