blib/lib/Paws/CloudWatch/PutMetricAlarm.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 33 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1  
2 package Paws::CloudWatch::PutMetricAlarm;
3 use Moose;
4 has ActionsEnabled => (is => 'ro', isa => 'Bool');
5 has AlarmActions => (is => 'ro', isa => 'ArrayRef[Str|Undef]');
6 has AlarmDescription => (is => 'ro', isa => 'Str');
7 has AlarmName => (is => 'ro', isa => 'Str', required => 1);
8 has ComparisonOperator => (is => 'ro', isa => 'Str', required => 1);
9 has DatapointsToAlarm => (is => 'ro', isa => 'Int');
10 has Dimensions => (is => 'ro', isa => 'ArrayRef[Paws::CloudWatch::Dimension]');
11 has EvaluateLowSampleCountPercentile => (is => 'ro', isa => 'Str');
12 has EvaluationPeriods => (is => 'ro', isa => 'Int', required => 1);
13 has ExtendedStatistic => (is => 'ro', isa => 'Str');
14 has InsufficientDataActions => (is => 'ro', isa => 'ArrayRef[Str|Undef]');
15 has MetricName => (is => 'ro', isa => 'Str');
16 has Metrics => (is => 'ro', isa => 'ArrayRef[Paws::CloudWatch::MetricDataQuery]');
17 has Namespace => (is => 'ro', isa => 'Str');
18 has OKActions => (is => 'ro', isa => 'ArrayRef[Str|Undef]');
19 has Period => (is => 'ro', isa => 'Int');
20 has Statistic => (is => 'ro', isa => 'Str');
21 has Tags => (is => 'ro', isa => 'ArrayRef[Paws::CloudWatch::Tag]');
22 has Threshold => (is => 'ro', isa => 'Num');
23 has ThresholdMetricId => (is => 'ro', isa => 'Str');
24 has TreatMissingData => (is => 'ro', isa => 'Str');
25 has Unit => (is => 'ro', isa => 'Str');
26  
27 use MooseX::ClassAttribute;
28  
29 class_has _api_call => (isa => 'Str', is => 'ro', default => 'PutMetricAlarm');
30 class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::API::Response');
31 class_has _result_key => (isa => 'Str', is => 'ro');
32 1;
33  
34 ### main pod documentation begin ###
35  
36 =head1 NAME
37  
38 Paws::CloudWatch::PutMetricAlarm - Arguments for method PutMetricAlarm on L<Paws::CloudWatch>
39  
40 =head1 DESCRIPTION
41  
42 This class represents the parameters used for calling the method PutMetricAlarm on the
43 L<Amazon CloudWatch|Paws::CloudWatch> service. Use the attributes of this class
44 as arguments to method PutMetricAlarm.
45  
46 You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to PutMetricAlarm.
47  
48 =head1 SYNOPSIS
49  
50 my $monitoring = Paws->service('CloudWatch');
51 $monitoring->PutMetricAlarm(
52 AlarmName => 'MyAlarmName',
53 ComparisonOperator => 'GreaterThanOrEqualToThreshold',
54 EvaluationPeriods => 1,
55 ActionsEnabled => 1, # OPTIONAL
56 AlarmActions => [
57 'MyResourceName', ... # min: 1, max: 1024
58 ], # OPTIONAL
59 AlarmDescription => 'MyAlarmDescription', # OPTIONAL
60 DatapointsToAlarm => 1, # OPTIONAL
61 Dimensions => [
62 {
63 Name => 'MyDimensionName', # min: 1, max: 255
64 Value => 'MyDimensionValue', # min: 1, max: 255
65  
66 },
67 ...
68 ], # OPTIONAL
69 EvaluateLowSampleCountPercentile =>
70 'MyEvaluateLowSampleCountPercentile', # OPTIONAL
71 ExtendedStatistic => 'MyExtendedStatistic', # OPTIONAL
72 InsufficientDataActions => [
73 'MyResourceName', ... # min: 1, max: 1024
74 ], # OPTIONAL
75 MetricName => 'MyMetricName', # OPTIONAL
76 Metrics => [
77 {
78 Id => 'MyMetricId', # min: 1, max: 255
79 Expression => 'MyMetricExpression', # min: 1, max: 1024; OPTIONAL
80 Label => 'MyMetricLabel', # OPTIONAL
81 MetricStat => {
82 Metric => {
83 Dimensions => [
84 {
85 Name => 'MyDimensionName', # min: 1, max: 255
86 Value => 'MyDimensionValue', # min: 1, max: 255
87  
88 },
89 ...
90 ], # max: 10
91 MetricName => 'MyMetricName', # min: 1, max: 255
92 Namespace => 'MyNamespace', # min: 1, max: 255; OPTIONAL
93 },
94 Period => 1, # min: 1
95 Stat => 'MyStat',
96 Unit => 'Seconds'
97 , # values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None; OPTIONAL
98 }, # OPTIONAL
99 Period => 1, # min: 1
100 ReturnData => 1, # OPTIONAL
101 },
102 ...
103 ], # OPTIONAL
104 Namespace => 'MyNamespace', # OPTIONAL
105 OKActions => [
106 'MyResourceName', ... # min: 1, max: 1024
107 ], # OPTIONAL
108 Period => 1, # OPTIONAL
109 Statistic => 'SampleCount', # OPTIONAL
110 Tags => [
111 {
112 Key => 'MyTagKey', # min: 1, max: 128
113 Value => 'MyTagValue', # max: 256
114  
115 },
116 ...
117 ], # OPTIONAL
118 Threshold => 1, # OPTIONAL
119 ThresholdMetricId => 'MyMetricId', # OPTIONAL
120 TreatMissingData => 'MyTreatMissingData', # OPTIONAL
121 Unit => 'Seconds', # OPTIONAL
122 );
123  
124 Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object.
125 For the AWS API documentation, see L<https://docs.aws.amazon.com/goto/WebAPI/monitoring/PutMetricAlarm>
126  
127 =head1 ATTRIBUTES
128  
129  
130 =head2 ActionsEnabled => Bool
131  
132 Indicates whether actions should be executed during any changes to the
133 alarm state. The default is C<TRUE>.
134  
135  
136  
137 =head2 AlarmActions => ArrayRef[Str|Undef]
138  
139 The actions to execute when this alarm transitions to the C<ALARM>
140 state from any other state. Each action is specified as an Amazon
141 Resource Name (ARN).
142  
143 Valid Values: C<arn:aws:automate:I<region>:ec2:stop> |
144 C<arn:aws:automate:I<region>:ec2:terminate> |
145 C<arn:aws:automate:I<region>:ec2:recover> |
146 C<arn:aws:automate:I<region>:ec2:reboot> |
147 C<arn:aws:sns:I<region>:I<account-id>:I<sns-topic-name> > |
148 C<arn:aws:autoscaling:I<region>:I<account-id>:scalingPolicy:I<policy-id>:autoScalingGroupName/I<group-friendly-name>:policyName/I<policy-friendly-name>
149 > | C<arn:aws:ssm:I<region>:I<account-id>:opsitem:I<severity>>
150  
151 Valid Values (for use with IAM roles):
152 C<arn:aws:swf:I<region>:I<account-id>:action/actions/AWS_EC2.InstanceId.Stop/1.0>
153 |
154 C<arn:aws:swf:I<region>:I<account-id>:action/actions/AWS_EC2.InstanceId.Terminate/1.0>
155 |
156 C<arn:aws:swf:I<region>:I<account-id>:action/actions/AWS_EC2.InstanceId.Reboot/1.0>
157  
158  
159  
160 =head2 AlarmDescription => Str
161  
162 The description for the alarm.
163  
164  
165  
166 =head2 B<REQUIRED> AlarmName => Str
167  
168 The name for the alarm. This name must be unique within the Region.
169  
170  
171  
172 =head2 B<REQUIRED> ComparisonOperator => Str
173  
174 The arithmetic operation to use when comparing the specified statistic
175 and threshold. The specified statistic value is used as the first
176 operand.
177  
178 The values C<LessThanLowerOrGreaterThanUpperThreshold>,
179 C<LessThanLowerThreshold>, and C<GreaterThanUpperThreshold> are used
180 only for alarms based on anomaly detection models.
181  
182 Valid values are: C<"GreaterThanOrEqualToThreshold">, C<"GreaterThanThreshold">, C<"LessThanThreshold">, C<"LessThanOrEqualToThreshold">, C<"LessThanLowerOrGreaterThanUpperThreshold">, C<"LessThanLowerThreshold">, C<"GreaterThanUpperThreshold">
183  
184 =head2 DatapointsToAlarm => Int
185  
186 The number of data points that must be breaching to trigger the alarm.
187 This is used only if you are setting an "M out of N" alarm. In that
188 case, this value is the M. For more information, see Evaluating an
189 Alarm
190 (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation)
191 in the I<Amazon CloudWatch User Guide>.
192  
193  
194  
195 =head2 Dimensions => ArrayRef[L<Paws::CloudWatch::Dimension>]
196  
197 The dimensions for the metric specified in C<MetricName>.
198  
199  
200  
201 =head2 EvaluateLowSampleCountPercentile => Str
202  
203 Used only for alarms based on percentiles. If you specify C<ignore>,
204 the alarm state does not change during periods with too few data points
205 to be statistically significant. If you specify C<evaluate> or omit
206 this parameter, the alarm is always evaluated and possibly changes
207 state no matter how many data points are available. For more
208 information, see Percentile-Based CloudWatch Alarms and Low Data
209 Samples
210 (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#percentiles-with-low-samples).
211  
212 Valid Values: C<evaluate | ignore>
213  
214  
215  
216 =head2 B<REQUIRED> EvaluationPeriods => Int
217  
218 The number of periods over which data is compared to the specified
219 threshold. If you are setting an alarm that requires that a number of
220 consecutive data points be breaching to trigger the alarm, this value
221 specifies that number. If you are setting an "M out of N" alarm, this
222 value is the N.
223  
224 An alarm's total current evaluation period can be no longer than one
225 day, so this number multiplied by C<Period> cannot be more than 86,400
226 seconds.
227  
228  
229  
230 =head2 ExtendedStatistic => Str
231  
232 The percentile statistic for the metric specified in C<MetricName>.
233 Specify a value between p0.0 and p100. When you call C<PutMetricAlarm>
234 and specify a C<MetricName>, you must specify either C<Statistic> or
235 C<ExtendedStatistic,> but not both.
236  
237  
238  
239 =head2 InsufficientDataActions => ArrayRef[Str|Undef]
240  
241 The actions to execute when this alarm transitions to the
242 C<INSUFFICIENT_DATA> state from any other state. Each action is
243 specified as an Amazon Resource Name (ARN).
244  
245 Valid Values: C<arn:aws:automate:I<region>:ec2:stop> |
246 C<arn:aws:automate:I<region>:ec2:terminate> |
247 C<arn:aws:automate:I<region>:ec2:recover> |
248 C<arn:aws:automate:I<region>:ec2:reboot> |
249 C<arn:aws:sns:I<region>:I<account-id>:I<sns-topic-name> > |
250 C<arn:aws:autoscaling:I<region>:I<account-id>:scalingPolicy:I<policy-id>:autoScalingGroupName/I<group-friendly-name>:policyName/I<policy-friendly-name>>
251  
252 Valid Values (for use with IAM roles):
253 C<E<gt>arn:aws:swf:I<region>:I<account-id>:action/actions/AWS_EC2.InstanceId.Stop/1.0>
254 |
255 C<arn:aws:swf:I<region>:I<account-id>:action/actions/AWS_EC2.InstanceId.Terminate/1.0>
256 |
257 C<arn:aws:swf:I<region>:I<account-id>:action/actions/AWS_EC2.InstanceId.Reboot/1.0>
258  
259  
260  
261 =head2 MetricName => Str
262  
263 The name for the metric associated with the alarm. For each
264 C<PutMetricAlarm> operation, you must specify either C<MetricName> or a
265 C<Metrics> array.
266  
267 If you are creating an alarm based on a math expression, you cannot
268 specify this parameter, or any of the C<Dimensions>, C<Period>,
269 C<Namespace>, C<Statistic>, or C<ExtendedStatistic> parameters.
270 Instead, you specify all this information in the C<Metrics> array.
271  
272  
273  
274 =head2 Metrics => ArrayRef[L<Paws::CloudWatch::MetricDataQuery>]
275  
276 An array of C<MetricDataQuery> structures that enable you to create an
277 alarm based on the result of a metric math expression. For each
278 C<PutMetricAlarm> operation, you must specify either C<MetricName> or a
279 C<Metrics> array.
280  
281 Each item in the C<Metrics> array either retrieves a metric or performs
282 a math expression.
283  
284 One item in the C<Metrics> array is the expression that the alarm
285 watches. You designate this expression by setting C<ReturnData> to true
286 for this object in the array. For more information, see MetricDataQuery
287 (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDataQuery.html).
288  
289 If you use the C<Metrics> parameter, you cannot include the
290 C<MetricName>, C<Dimensions>, C<Period>, C<Namespace>, C<Statistic>, or
291 C<ExtendedStatistic> parameters of C<PutMetricAlarm> in the same
292 operation. Instead, you retrieve the metrics you are using in your math
293 expression as part of the C<Metrics> array.
294  
295  
296  
297 =head2 Namespace => Str
298  
299 The namespace for the metric associated specified in C<MetricName>.
300  
301  
302  
303 =head2 OKActions => ArrayRef[Str|Undef]
304  
305 The actions to execute when this alarm transitions to an C<OK> state
306 from any other state. Each action is specified as an Amazon Resource
307 Name (ARN).
308  
309 Valid Values: C<arn:aws:automate:I<region>:ec2:stop> |
310 C<arn:aws:automate:I<region>:ec2:terminate> |
311 C<arn:aws:automate:I<region>:ec2:recover> |
312 C<arn:aws:automate:I<region>:ec2:reboot> |
313 C<arn:aws:sns:I<region>:I<account-id>:I<sns-topic-name> > |
314 C<arn:aws:autoscaling:I<region>:I<account-id>:scalingPolicy:I<policy-id>:autoScalingGroupName/I<group-friendly-name>:policyName/I<policy-friendly-name>>
315  
316 Valid Values (for use with IAM roles):
317 C<arn:aws:swf:I<region>:I<account-id>:action/actions/AWS_EC2.InstanceId.Stop/1.0>
318 |
319 C<arn:aws:swf:I<region>:I<account-id>:action/actions/AWS_EC2.InstanceId.Terminate/1.0>
320 |
321 C<arn:aws:swf:I<region>:I<account-id>:action/actions/AWS_EC2.InstanceId.Reboot/1.0>
322 |
323 C<arn:aws:swf:I<region>:I<account-id>:action/actions/AWS_EC2.InstanceId.Recover/1.0>
324  
325  
326  
327 =head2 Period => Int
328  
329 The length, in seconds, used each time the metric specified in
330 C<MetricName> is evaluated. Valid values are 10, 30, and any multiple
331 of 60.
332  
333 C<Period> is required for alarms based on static thresholds. If you are
334 creating an alarm based on a metric math expression, you specify the
335 period for each metric within the objects in the C<Metrics> array.
336  
337 Be sure to specify 10 or 30 only for metrics that are stored by a
338 C<PutMetricData> call with a C<StorageResolution> of 1. If you specify
339 a period of 10 or 30 for a metric that does not have sub-minute
340 resolution, the alarm still attempts to gather data at the period rate
341 that you specify. In this case, it does not receive data for the
342 attempts that do not correspond to a one-minute data resolution, and
343 the alarm might often lapse into INSUFFICENT_DATA status. Specifying 10
344 or 30 also sets this alarm as a high-resolution alarm, which has a
345 higher charge than other alarms. For more information about pricing,
346 see Amazon CloudWatch Pricing
347 (https://aws.amazon.com/cloudwatch/pricing/).
348  
349 An alarm's total current evaluation period can be no longer than one
350 day, so C<Period> multiplied by C<EvaluationPeriods> cannot be more
351 than 86,400 seconds.
352  
353  
354  
355 =head2 Statistic => Str
356  
357 The statistic for the metric specified in C<MetricName>, other than
358 percentile. For percentile statistics, use C<ExtendedStatistic>. When
359 you call C<PutMetricAlarm> and specify a C<MetricName>, you must
360 specify either C<Statistic> or C<ExtendedStatistic,> but not both.
361  
362 Valid values are: C<"SampleCount">, C<"Average">, C<"Sum">, C<"Minimum">, C<"Maximum">
363  
364 =head2 Tags => ArrayRef[L<Paws::CloudWatch::Tag>]
365  
366 A list of key-value pairs to associate with the alarm. You can
367 associate as many as 50 tags with an alarm.
368  
369 Tags can help you organize and categorize your resources. You can also
370 use them to scope user permissions by granting a user permission to
371 access or change only resources with certain tag values.
372  
373 If you are using this operation to update an existing alarm, any tags
374 you specify in this parameter are ignored. To change the tags of an
375 existing alarm, use TagResource
376 (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html)
377 or UntagResource
378 (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_UntagResource.html).
379  
380  
381  
382 =head2 Threshold => Num
383  
384 The value against which the specified statistic is compared.
385  
386 This parameter is required for alarms based on static thresholds, but
387 should not be used for alarms based on anomaly detection models.
388  
389  
390  
391 =head2 ThresholdMetricId => Str
392  
393 If this is an alarm based on an anomaly detection model, make this
394 value match the ID of the C<ANOMALY_DETECTION_BAND> function.
395  
396 For an example of how to use this parameter, see the B<Anomaly
397 Detection Model Alarm> example on this page.
398  
399 If your alarm uses this parameter, it cannot have Auto Scaling actions.
400  
401  
402  
403 =head2 TreatMissingData => Str
404  
405 Sets how this alarm is to handle missing data points. If
406 C<TreatMissingData> is omitted, the default behavior of C<missing> is
407 used. For more information, see Configuring How CloudWatch Alarms
408 Treats Missing Data
409 (https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data).
410  
411 Valid Values: C<breaching | notBreaching | ignore | missing>
412  
413  
414  
415 =head2 Unit => Str
416  
417 The unit of measure for the statistic. For example, the units for the
418 Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the
419 number of bytes that an instance receives on all network interfaces.
420 You can also specify a unit when you create a custom metric. Units help
421 provide conceptual meaning to your data. Metric data points that
422 specify a unit of measure, such as Percent, are aggregated separately.
423  
424 If you don't specify C<Unit>, CloudWatch retrieves all unit types that
425 have been published for the metric and attempts to evaluate the alarm.
426 Usually, metrics are published with only one unit, so the alarm works
427 as intended.
428  
429 However, if the metric is published with multiple types of units and
430 you don't specify a unit, the alarm's behavior is not defined and it
431 behaves predictably.
432  
433 We recommend omitting C<Unit> so that you don't inadvertently specify
434 an incorrect unit that is not published for this metric. Doing so
435 causes the alarm to be stuck in the C<INSUFFICIENT DATA> state.
436  
437 Valid values are: C<"Seconds">, C<"Microseconds">, C<"Milliseconds">, C<"Bytes">, C<"Kilobytes">, C<"Megabytes">, C<"Gigabytes">, C<"Terabytes">, C<"Bits">, C<"Kilobits">, C<"Megabits">, C<"Gigabits">, C<"Terabits">, C<"Percent">, C<"Count">, C<"Bytes/Second">, C<"Kilobytes/Second">, C<"Megabytes/Second">, C<"Gigabytes/Second">, C<"Terabytes/Second">, C<"Bits/Second">, C<"Kilobits/Second">, C<"Megabits/Second">, C<"Gigabits/Second">, C<"Terabits/Second">, C<"Count/Second">, C<"None">
438  
439  
440 =head1 SEE ALSO
441  
442 This class forms part of L<Paws>, documenting arguments for method PutMetricAlarm in L<Paws::CloudWatch>
443  
444 =head1 BUGS and CONTRIBUTIONS
445  
446 The source code is located here: L<https://github.com/pplu/aws-sdk-perl>
447  
448 Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues>
449  
450 =cut
451