/
cloudwatch.clj
93 lines (74 loc) · 3.45 KB
/
cloudwatch.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
(ns crucible.aws.cloudwatch
"Resources in AWS::CloudWatch::*"
(:require [crucible.resources :refer [spec-or-ref defresource] :as res]
[crucible.values :as v]
[crucible.encoding.keys :refer [->key]]
[clojure.spec.alpha :as s]))
(defmethod ->key ::ok-actions [_] "OKActions")
(s/def ::actions-enabled (spec-or-ref string? #_boolean?))
(s/def ::alarm-description (spec-or-ref string?))
(s/def ::alarm-name (spec-or-ref string?))
(s/def ::comparison-operator (spec-or-ref #{"GreaterThanOrEqualToThreshold"
"GreaterThanThreshold"
"LessThanThreshold"
"LessThanOrEqualToThreshold"}))
(s/def ::value (spec-or-ref string?))
(s/def ::name (spec-or-ref string?))
(s/def ::dimension (s/keys :req [::name ::value]))
(s/def ::dimensions (s/coll-of ::dimension :kind vector?))
(s/def ::evaluation-periods (spec-or-ref string? #_pos-int?))
(s/def ::metric-name (spec-or-ref string?))
(s/def ::namespace (spec-or-ref string?))
(s/def ::ok-actions (s/coll-of (spec-or-ref string?) :kind vector?))
(s/def ::insufficient-data-actions ::ok-actions)
(s/def ::alarm-actions (s/coll-of (spec-or-ref string?) :kind vector?))
(s/def ::period (spec-or-ref string? #_(s/and pos-int?
#(= 0 (mod % 60)))))
(s/def ::statistic (spec-or-ref #{"SampleCount"
"Average"
"Sum"
"Minimum"
"Maximum"}))
(s/def ::threshold (spec-or-ref string? #_number?))
(s/def ::unit (spec-or-ref #{"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"}))
(s/def ::alarm (s/keys :req [::comparison-operator
::evaluation-periods
::metric-name
::namespace
::period
::statistic
::threshold]
:opt [::actions-enabled
::alarm-actions
::alarm-description
::alarm-name
::dimensions
::insufficient-data-actions
::ok-actions
::unit]))
(defresource alarm "AWS::CloudWatch::Alarm" ::alarm)