AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the SetAlarmState operation. Temporarily sets the state of an alarm for testing purposes. When the updated state differs from the previous value, the action configured for the appropriate state is invoked. For example, if your alarm is configured to send an Amazon SNS message when an alarm is triggered, temporarily changing the alarm state to ALARM sends an SNS message. The alarm returns to its actual state (often within seconds). Because the alarm state change happens quickly, it is typically only visible in the alarm's History tab in the Amazon CloudWatch console or through DescribeAlarmHistory.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.CloudWatch.AmazonCloudWatchRequest
      Amazon.CloudWatch.Model.SetAlarmStateRequest

Namespace: Amazon.CloudWatch.Model
Assembly: AWSSDK.CloudWatch.dll
Version: 3.x.y.z

Syntax

C#
public class SetAlarmStateRequest : AmazonCloudWatchRequest
         IAmazonWebServiceRequest

The SetAlarmStateRequest type exposes the following members

Constructors

NameDescription
Public Method SetAlarmStateRequest()

Properties

NameTypeDescription
Public Property AlarmName System.String

Gets and sets the property AlarmName.

The name for the alarm. This name must be unique within the AWS account. The maximum length is 255 characters.

Public Property StateReason System.String

Gets and sets the property StateReason.

The reason that this alarm is set to this specific state, in text format.

Public Property StateReasonData System.String

Gets and sets the property StateReasonData.

The reason that this alarm is set to this specific state, in JSON format.

Public Property StateValue Amazon.CloudWatch.StateValue

Gets and sets the property StateValue.

The value of the state.

Examples

This example shows how to temporarily set an alarm's state.

Set alarm state example

var client = new AmazonCloudWatchClient();

var request = new SetAlarmStateRequest
{
  AlarmName = "Offline Instances",
  StateReason = "Too many instances are offline.",
  StateValue = StateValue.ALARM
};

client.SetAlarmState(request);
      

Version Information

.NET Standard:
Supported in: 1.3

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms