本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/kinesis.Kinesis.DisableEnhancedMonitoring方法的典型用法代码示例。如果您正苦于以下问题:Golang Kinesis.DisableEnhancedMonitoring方法的具体用法?Golang Kinesis.DisableEnhancedMonitoring怎么用?Golang Kinesis.DisableEnhancedMonitoring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/aws/aws-sdk-go/service/kinesis.Kinesis
的用法示例。
在下文中一共展示了Kinesis.DisableEnhancedMonitoring方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: updateKinesisShardLevelMetrics
func updateKinesisShardLevelMetrics(conn *kinesis.Kinesis, d *schema.ResourceData) error {
sn := d.Get("name").(string)
o, n := d.GetChange("shard_level_metrics")
if o == nil {
o = new(schema.Set)
}
if n == nil {
n = new(schema.Set)
}
os := o.(*schema.Set)
ns := n.(*schema.Set)
disableMetrics := os.Difference(ns)
if disableMetrics.Len() != 0 {
metrics := disableMetrics.List()
log.Printf("[DEBUG] Disabling shard level metrics %v for stream %s", metrics, sn)
props := &kinesis.DisableEnhancedMonitoringInput{
StreamName: aws.String(sn),
ShardLevelMetrics: expandStringList(metrics),
}
_, err := conn.DisableEnhancedMonitoring(props)
if err != nil {
return fmt.Errorf("Failure to disable shard level metrics for stream %s: %s", sn, err)
}
if err := waitForKinesisToBeActive(conn, sn); err != nil {
return err
}
}
enabledMetrics := ns.Difference(os)
if enabledMetrics.Len() != 0 {
metrics := enabledMetrics.List()
log.Printf("[DEBUG] Enabling shard level metrics %v for stream %s", metrics, sn)
props := &kinesis.EnableEnhancedMonitoringInput{
StreamName: aws.String(sn),
ShardLevelMetrics: expandStringList(metrics),
}
_, err := conn.EnableEnhancedMonitoring(props)
if err != nil {
return fmt.Errorf("Failure to enable shard level metrics for stream %s: %s", sn, err)
}
if err := waitForKinesisToBeActive(conn, sn); err != nil {
return err
}
}
return nil
}