api.go 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. // Package cloudwatch provides a client for Amazon CloudWatch.
  3. package cloudwatch
  4. import (
  5. "fmt"
  6. "time"
  7. "github.com/aws/aws-sdk-go/aws/awsutil"
  8. "github.com/aws/aws-sdk-go/aws/request"
  9. "github.com/aws/aws-sdk-go/private/protocol"
  10. "github.com/aws/aws-sdk-go/private/protocol/query"
  11. )
  12. const opDeleteAlarms = "DeleteAlarms"
  13. // DeleteAlarmsRequest generates a "aws/request.Request" representing the
  14. // client's request for the DeleteAlarms operation. The "output" return
  15. // value can be used to capture response data after the request's "Send" method
  16. // is called.
  17. //
  18. // Creating a request object using this method should be used when you want to inject
  19. // custom logic into the request's lifecycle using a custom handler, or if you want to
  20. // access properties on the request object before or after sending the request. If
  21. // you just want the service response, call the DeleteAlarms method directly
  22. // instead.
  23. //
  24. // Note: You must call the "Send" method on the returned request object in order
  25. // to execute the request.
  26. //
  27. // // Example sending a request using the DeleteAlarmsRequest method.
  28. // req, resp := client.DeleteAlarmsRequest(params)
  29. //
  30. // err := req.Send()
  31. // if err == nil { // resp is now filled
  32. // fmt.Println(resp)
  33. // }
  34. //
  35. func (c *CloudWatch) DeleteAlarmsRequest(input *DeleteAlarmsInput) (req *request.Request, output *DeleteAlarmsOutput) {
  36. op := &request.Operation{
  37. Name: opDeleteAlarms,
  38. HTTPMethod: "POST",
  39. HTTPPath: "/",
  40. }
  41. if input == nil {
  42. input = &DeleteAlarmsInput{}
  43. }
  44. req = c.newRequest(op, input, output)
  45. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  46. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  47. output = &DeleteAlarmsOutput{}
  48. req.Data = output
  49. return
  50. }
  51. // Deletes all specified alarms. In the event of an error, no alarms are deleted.
  52. func (c *CloudWatch) DeleteAlarms(input *DeleteAlarmsInput) (*DeleteAlarmsOutput, error) {
  53. req, out := c.DeleteAlarmsRequest(input)
  54. err := req.Send()
  55. return out, err
  56. }
  57. const opDescribeAlarmHistory = "DescribeAlarmHistory"
  58. // DescribeAlarmHistoryRequest generates a "aws/request.Request" representing the
  59. // client's request for the DescribeAlarmHistory operation. The "output" return
  60. // value can be used to capture response data after the request's "Send" method
  61. // is called.
  62. //
  63. // Creating a request object using this method should be used when you want to inject
  64. // custom logic into the request's lifecycle using a custom handler, or if you want to
  65. // access properties on the request object before or after sending the request. If
  66. // you just want the service response, call the DescribeAlarmHistory method directly
  67. // instead.
  68. //
  69. // Note: You must call the "Send" method on the returned request object in order
  70. // to execute the request.
  71. //
  72. // // Example sending a request using the DescribeAlarmHistoryRequest method.
  73. // req, resp := client.DescribeAlarmHistoryRequest(params)
  74. //
  75. // err := req.Send()
  76. // if err == nil { // resp is now filled
  77. // fmt.Println(resp)
  78. // }
  79. //
  80. func (c *CloudWatch) DescribeAlarmHistoryRequest(input *DescribeAlarmHistoryInput) (req *request.Request, output *DescribeAlarmHistoryOutput) {
  81. op := &request.Operation{
  82. Name: opDescribeAlarmHistory,
  83. HTTPMethod: "POST",
  84. HTTPPath: "/",
  85. Paginator: &request.Paginator{
  86. InputTokens: []string{"NextToken"},
  87. OutputTokens: []string{"NextToken"},
  88. LimitToken: "MaxRecords",
  89. TruncationToken: "",
  90. },
  91. }
  92. if input == nil {
  93. input = &DescribeAlarmHistoryInput{}
  94. }
  95. req = c.newRequest(op, input, output)
  96. output = &DescribeAlarmHistoryOutput{}
  97. req.Data = output
  98. return
  99. }
  100. // Retrieves history for the specified alarm. Filter alarms by date range or
  101. // item type. If an alarm name is not specified, Amazon CloudWatch returns histories
  102. // for all of the owner's alarms.
  103. //
  104. // Amazon CloudWatch retains the history of an alarm for two weeks, whether
  105. // or not you delete the alarm.
  106. func (c *CloudWatch) DescribeAlarmHistory(input *DescribeAlarmHistoryInput) (*DescribeAlarmHistoryOutput, error) {
  107. req, out := c.DescribeAlarmHistoryRequest(input)
  108. err := req.Send()
  109. return out, err
  110. }
  111. // DescribeAlarmHistoryPages iterates over the pages of a DescribeAlarmHistory operation,
  112. // calling the "fn" function with the response data for each page. To stop
  113. // iterating, return false from the fn function.
  114. //
  115. // See DescribeAlarmHistory method for more information on how to use this operation.
  116. //
  117. // Note: This operation can generate multiple requests to a service.
  118. //
  119. // // Example iterating over at most 3 pages of a DescribeAlarmHistory operation.
  120. // pageNum := 0
  121. // err := client.DescribeAlarmHistoryPages(params,
  122. // func(page *DescribeAlarmHistoryOutput, lastPage bool) bool {
  123. // pageNum++
  124. // fmt.Println(page)
  125. // return pageNum <= 3
  126. // })
  127. //
  128. func (c *CloudWatch) DescribeAlarmHistoryPages(input *DescribeAlarmHistoryInput, fn func(p *DescribeAlarmHistoryOutput, lastPage bool) (shouldContinue bool)) error {
  129. page, _ := c.DescribeAlarmHistoryRequest(input)
  130. page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator"))
  131. return page.EachPage(func(p interface{}, lastPage bool) bool {
  132. return fn(p.(*DescribeAlarmHistoryOutput), lastPage)
  133. })
  134. }
  135. const opDescribeAlarms = "DescribeAlarms"
  136. // DescribeAlarmsRequest generates a "aws/request.Request" representing the
  137. // client's request for the DescribeAlarms operation. The "output" return
  138. // value can be used to capture response data after the request's "Send" method
  139. // is called.
  140. //
  141. // Creating a request object using this method should be used when you want to inject
  142. // custom logic into the request's lifecycle using a custom handler, or if you want to
  143. // access properties on the request object before or after sending the request. If
  144. // you just want the service response, call the DescribeAlarms method directly
  145. // instead.
  146. //
  147. // Note: You must call the "Send" method on the returned request object in order
  148. // to execute the request.
  149. //
  150. // // Example sending a request using the DescribeAlarmsRequest method.
  151. // req, resp := client.DescribeAlarmsRequest(params)
  152. //
  153. // err := req.Send()
  154. // if err == nil { // resp is now filled
  155. // fmt.Println(resp)
  156. // }
  157. //
  158. func (c *CloudWatch) DescribeAlarmsRequest(input *DescribeAlarmsInput) (req *request.Request, output *DescribeAlarmsOutput) {
  159. op := &request.Operation{
  160. Name: opDescribeAlarms,
  161. HTTPMethod: "POST",
  162. HTTPPath: "/",
  163. Paginator: &request.Paginator{
  164. InputTokens: []string{"NextToken"},
  165. OutputTokens: []string{"NextToken"},
  166. LimitToken: "MaxRecords",
  167. TruncationToken: "",
  168. },
  169. }
  170. if input == nil {
  171. input = &DescribeAlarmsInput{}
  172. }
  173. req = c.newRequest(op, input, output)
  174. output = &DescribeAlarmsOutput{}
  175. req.Data = output
  176. return
  177. }
  178. // Retrieves alarms with the specified names. If no name is specified, all alarms
  179. // for the user are returned. Alarms can be retrieved by using only a prefix
  180. // for the alarm name, the alarm state, or a prefix for any action.
  181. func (c *CloudWatch) DescribeAlarms(input *DescribeAlarmsInput) (*DescribeAlarmsOutput, error) {
  182. req, out := c.DescribeAlarmsRequest(input)
  183. err := req.Send()
  184. return out, err
  185. }
  186. // DescribeAlarmsPages iterates over the pages of a DescribeAlarms operation,
  187. // calling the "fn" function with the response data for each page. To stop
  188. // iterating, return false from the fn function.
  189. //
  190. // See DescribeAlarms method for more information on how to use this operation.
  191. //
  192. // Note: This operation can generate multiple requests to a service.
  193. //
  194. // // Example iterating over at most 3 pages of a DescribeAlarms operation.
  195. // pageNum := 0
  196. // err := client.DescribeAlarmsPages(params,
  197. // func(page *DescribeAlarmsOutput, lastPage bool) bool {
  198. // pageNum++
  199. // fmt.Println(page)
  200. // return pageNum <= 3
  201. // })
  202. //
  203. func (c *CloudWatch) DescribeAlarmsPages(input *DescribeAlarmsInput, fn func(p *DescribeAlarmsOutput, lastPage bool) (shouldContinue bool)) error {
  204. page, _ := c.DescribeAlarmsRequest(input)
  205. page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator"))
  206. return page.EachPage(func(p interface{}, lastPage bool) bool {
  207. return fn(p.(*DescribeAlarmsOutput), lastPage)
  208. })
  209. }
  210. const opDescribeAlarmsForMetric = "DescribeAlarmsForMetric"
  211. // DescribeAlarmsForMetricRequest generates a "aws/request.Request" representing the
  212. // client's request for the DescribeAlarmsForMetric operation. The "output" return
  213. // value can be used to capture response data after the request's "Send" method
  214. // is called.
  215. //
  216. // Creating a request object using this method should be used when you want to inject
  217. // custom logic into the request's lifecycle using a custom handler, or if you want to
  218. // access properties on the request object before or after sending the request. If
  219. // you just want the service response, call the DescribeAlarmsForMetric method directly
  220. // instead.
  221. //
  222. // Note: You must call the "Send" method on the returned request object in order
  223. // to execute the request.
  224. //
  225. // // Example sending a request using the DescribeAlarmsForMetricRequest method.
  226. // req, resp := client.DescribeAlarmsForMetricRequest(params)
  227. //
  228. // err := req.Send()
  229. // if err == nil { // resp is now filled
  230. // fmt.Println(resp)
  231. // }
  232. //
  233. func (c *CloudWatch) DescribeAlarmsForMetricRequest(input *DescribeAlarmsForMetricInput) (req *request.Request, output *DescribeAlarmsForMetricOutput) {
  234. op := &request.Operation{
  235. Name: opDescribeAlarmsForMetric,
  236. HTTPMethod: "POST",
  237. HTTPPath: "/",
  238. }
  239. if input == nil {
  240. input = &DescribeAlarmsForMetricInput{}
  241. }
  242. req = c.newRequest(op, input, output)
  243. output = &DescribeAlarmsForMetricOutput{}
  244. req.Data = output
  245. return
  246. }
  247. // Retrieves all alarms for a single metric. Specify a statistic, period, or
  248. // unit to filter the set of alarms further.
  249. func (c *CloudWatch) DescribeAlarmsForMetric(input *DescribeAlarmsForMetricInput) (*DescribeAlarmsForMetricOutput, error) {
  250. req, out := c.DescribeAlarmsForMetricRequest(input)
  251. err := req.Send()
  252. return out, err
  253. }
  254. const opDisableAlarmActions = "DisableAlarmActions"
  255. // DisableAlarmActionsRequest generates a "aws/request.Request" representing the
  256. // client's request for the DisableAlarmActions operation. The "output" return
  257. // value can be used to capture response data after the request's "Send" method
  258. // is called.
  259. //
  260. // Creating a request object using this method should be used when you want to inject
  261. // custom logic into the request's lifecycle using a custom handler, or if you want to
  262. // access properties on the request object before or after sending the request. If
  263. // you just want the service response, call the DisableAlarmActions method directly
  264. // instead.
  265. //
  266. // Note: You must call the "Send" method on the returned request object in order
  267. // to execute the request.
  268. //
  269. // // Example sending a request using the DisableAlarmActionsRequest method.
  270. // req, resp := client.DisableAlarmActionsRequest(params)
  271. //
  272. // err := req.Send()
  273. // if err == nil { // resp is now filled
  274. // fmt.Println(resp)
  275. // }
  276. //
  277. func (c *CloudWatch) DisableAlarmActionsRequest(input *DisableAlarmActionsInput) (req *request.Request, output *DisableAlarmActionsOutput) {
  278. op := &request.Operation{
  279. Name: opDisableAlarmActions,
  280. HTTPMethod: "POST",
  281. HTTPPath: "/",
  282. }
  283. if input == nil {
  284. input = &DisableAlarmActionsInput{}
  285. }
  286. req = c.newRequest(op, input, output)
  287. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  288. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  289. output = &DisableAlarmActionsOutput{}
  290. req.Data = output
  291. return
  292. }
  293. // Disables actions for the specified alarms. When an alarm's actions are disabled
  294. // the alarm's state may change, but none of the alarm's actions will execute.
  295. func (c *CloudWatch) DisableAlarmActions(input *DisableAlarmActionsInput) (*DisableAlarmActionsOutput, error) {
  296. req, out := c.DisableAlarmActionsRequest(input)
  297. err := req.Send()
  298. return out, err
  299. }
  300. const opEnableAlarmActions = "EnableAlarmActions"
  301. // EnableAlarmActionsRequest generates a "aws/request.Request" representing the
  302. // client's request for the EnableAlarmActions operation. The "output" return
  303. // value can be used to capture response data after the request's "Send" method
  304. // is called.
  305. //
  306. // Creating a request object using this method should be used when you want to inject
  307. // custom logic into the request's lifecycle using a custom handler, or if you want to
  308. // access properties on the request object before or after sending the request. If
  309. // you just want the service response, call the EnableAlarmActions method directly
  310. // instead.
  311. //
  312. // Note: You must call the "Send" method on the returned request object in order
  313. // to execute the request.
  314. //
  315. // // Example sending a request using the EnableAlarmActionsRequest method.
  316. // req, resp := client.EnableAlarmActionsRequest(params)
  317. //
  318. // err := req.Send()
  319. // if err == nil { // resp is now filled
  320. // fmt.Println(resp)
  321. // }
  322. //
  323. func (c *CloudWatch) EnableAlarmActionsRequest(input *EnableAlarmActionsInput) (req *request.Request, output *EnableAlarmActionsOutput) {
  324. op := &request.Operation{
  325. Name: opEnableAlarmActions,
  326. HTTPMethod: "POST",
  327. HTTPPath: "/",
  328. }
  329. if input == nil {
  330. input = &EnableAlarmActionsInput{}
  331. }
  332. req = c.newRequest(op, input, output)
  333. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  334. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  335. output = &EnableAlarmActionsOutput{}
  336. req.Data = output
  337. return
  338. }
  339. // Enables actions for the specified alarms.
  340. func (c *CloudWatch) EnableAlarmActions(input *EnableAlarmActionsInput) (*EnableAlarmActionsOutput, error) {
  341. req, out := c.EnableAlarmActionsRequest(input)
  342. err := req.Send()
  343. return out, err
  344. }
  345. const opGetMetricStatistics = "GetMetricStatistics"
  346. // GetMetricStatisticsRequest generates a "aws/request.Request" representing the
  347. // client's request for the GetMetricStatistics operation. The "output" return
  348. // value can be used to capture response data after the request's "Send" method
  349. // is called.
  350. //
  351. // Creating a request object using this method should be used when you want to inject
  352. // custom logic into the request's lifecycle using a custom handler, or if you want to
  353. // access properties on the request object before or after sending the request. If
  354. // you just want the service response, call the GetMetricStatistics method directly
  355. // instead.
  356. //
  357. // Note: You must call the "Send" method on the returned request object in order
  358. // to execute the request.
  359. //
  360. // // Example sending a request using the GetMetricStatisticsRequest method.
  361. // req, resp := client.GetMetricStatisticsRequest(params)
  362. //
  363. // err := req.Send()
  364. // if err == nil { // resp is now filled
  365. // fmt.Println(resp)
  366. // }
  367. //
  368. func (c *CloudWatch) GetMetricStatisticsRequest(input *GetMetricStatisticsInput) (req *request.Request, output *GetMetricStatisticsOutput) {
  369. op := &request.Operation{
  370. Name: opGetMetricStatistics,
  371. HTTPMethod: "POST",
  372. HTTPPath: "/",
  373. }
  374. if input == nil {
  375. input = &GetMetricStatisticsInput{}
  376. }
  377. req = c.newRequest(op, input, output)
  378. output = &GetMetricStatisticsOutput{}
  379. req.Data = output
  380. return
  381. }
  382. // Gets statistics for the specified metric.
  383. //
  384. // The maximum number of data points that can be queried is 50,850, whereas
  385. // the maximum number of data points returned from a single GetMetricStatistics
  386. // request is 1,440. If you make a request that generates more than 1,440 data
  387. // points, Amazon CloudWatch returns an error. In such a case, you can alter
  388. // the request by narrowing the specified time range or increasing the specified
  389. // period. A period can be as short as one minute (60 seconds) or as long as
  390. // one day (86,400 seconds). Alternatively, you can make multiple requests across
  391. // adjacent time ranges. GetMetricStatistics does not return the data in chronological
  392. // order.
  393. //
  394. // Amazon CloudWatch aggregates data points based on the length of the period
  395. // that you specify. For example, if you request statistics with a one-minute
  396. // granularity, Amazon CloudWatch aggregates data points with time stamps that
  397. // fall within the same one-minute period. In such a case, the data points queried
  398. // can greatly outnumber the data points returned.
  399. //
  400. // The following examples show various statistics allowed by the data point
  401. // query maximum of 50,850 when you call GetMetricStatistics on Amazon EC2 instances
  402. // with detailed (one-minute) monitoring enabled:
  403. //
  404. // Statistics for up to 400 instances for a span of one hour
  405. //
  406. // Statistics for up to 35 instances over a span of 24 hours
  407. //
  408. // Statistics for up to 2 instances over a span of 2 weeks
  409. //
  410. // For information about the namespace, metric names, and dimensions that
  411. // other Amazon Web Services products use to send metrics to CloudWatch, go
  412. // to Amazon CloudWatch Metrics, Namespaces, and Dimensions Reference (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html)
  413. // in the Amazon CloudWatch Developer Guide.
  414. func (c *CloudWatch) GetMetricStatistics(input *GetMetricStatisticsInput) (*GetMetricStatisticsOutput, error) {
  415. req, out := c.GetMetricStatisticsRequest(input)
  416. err := req.Send()
  417. return out, err
  418. }
  419. const opListMetrics = "ListMetrics"
  420. // ListMetricsRequest generates a "aws/request.Request" representing the
  421. // client's request for the ListMetrics operation. The "output" return
  422. // value can be used to capture response data after the request's "Send" method
  423. // is called.
  424. //
  425. // Creating a request object using this method should be used when you want to inject
  426. // custom logic into the request's lifecycle using a custom handler, or if you want to
  427. // access properties on the request object before or after sending the request. If
  428. // you just want the service response, call the ListMetrics method directly
  429. // instead.
  430. //
  431. // Note: You must call the "Send" method on the returned request object in order
  432. // to execute the request.
  433. //
  434. // // Example sending a request using the ListMetricsRequest method.
  435. // req, resp := client.ListMetricsRequest(params)
  436. //
  437. // err := req.Send()
  438. // if err == nil { // resp is now filled
  439. // fmt.Println(resp)
  440. // }
  441. //
  442. func (c *CloudWatch) ListMetricsRequest(input *ListMetricsInput) (req *request.Request, output *ListMetricsOutput) {
  443. op := &request.Operation{
  444. Name: opListMetrics,
  445. HTTPMethod: "POST",
  446. HTTPPath: "/",
  447. Paginator: &request.Paginator{
  448. InputTokens: []string{"NextToken"},
  449. OutputTokens: []string{"NextToken"},
  450. LimitToken: "",
  451. TruncationToken: "",
  452. },
  453. }
  454. if input == nil {
  455. input = &ListMetricsInput{}
  456. }
  457. req = c.newRequest(op, input, output)
  458. output = &ListMetricsOutput{}
  459. req.Data = output
  460. return
  461. }
  462. // Returns a list of valid metrics stored for the AWS account owner. Returned
  463. // metrics can be used with GetMetricStatistics to obtain statistical data for
  464. // a given metric.
  465. //
  466. // Up to 500 results are returned for any one call. To retrieve further results,
  467. // use returned NextToken values with subsequent ListMetrics operations.
  468. //
  469. // If you create a metric with PutMetricData, allow up to fifteen minutes
  470. // for the metric to appear in calls to ListMetrics. Statistics about the metric,
  471. // however, are available sooner using GetMetricStatistics.
  472. func (c *CloudWatch) ListMetrics(input *ListMetricsInput) (*ListMetricsOutput, error) {
  473. req, out := c.ListMetricsRequest(input)
  474. err := req.Send()
  475. return out, err
  476. }
  477. // ListMetricsPages iterates over the pages of a ListMetrics operation,
  478. // calling the "fn" function with the response data for each page. To stop
  479. // iterating, return false from the fn function.
  480. //
  481. // See ListMetrics method for more information on how to use this operation.
  482. //
  483. // Note: This operation can generate multiple requests to a service.
  484. //
  485. // // Example iterating over at most 3 pages of a ListMetrics operation.
  486. // pageNum := 0
  487. // err := client.ListMetricsPages(params,
  488. // func(page *ListMetricsOutput, lastPage bool) bool {
  489. // pageNum++
  490. // fmt.Println(page)
  491. // return pageNum <= 3
  492. // })
  493. //
  494. func (c *CloudWatch) ListMetricsPages(input *ListMetricsInput, fn func(p *ListMetricsOutput, lastPage bool) (shouldContinue bool)) error {
  495. page, _ := c.ListMetricsRequest(input)
  496. page.Handlers.Build.PushBack(request.MakeAddToUserAgentFreeFormHandler("Paginator"))
  497. return page.EachPage(func(p interface{}, lastPage bool) bool {
  498. return fn(p.(*ListMetricsOutput), lastPage)
  499. })
  500. }
  501. const opPutMetricAlarm = "PutMetricAlarm"
  502. // PutMetricAlarmRequest generates a "aws/request.Request" representing the
  503. // client's request for the PutMetricAlarm operation. The "output" return
  504. // value can be used to capture response data after the request's "Send" method
  505. // is called.
  506. //
  507. // Creating a request object using this method should be used when you want to inject
  508. // custom logic into the request's lifecycle using a custom handler, or if you want to
  509. // access properties on the request object before or after sending the request. If
  510. // you just want the service response, call the PutMetricAlarm method directly
  511. // instead.
  512. //
  513. // Note: You must call the "Send" method on the returned request object in order
  514. // to execute the request.
  515. //
  516. // // Example sending a request using the PutMetricAlarmRequest method.
  517. // req, resp := client.PutMetricAlarmRequest(params)
  518. //
  519. // err := req.Send()
  520. // if err == nil { // resp is now filled
  521. // fmt.Println(resp)
  522. // }
  523. //
  524. func (c *CloudWatch) PutMetricAlarmRequest(input *PutMetricAlarmInput) (req *request.Request, output *PutMetricAlarmOutput) {
  525. op := &request.Operation{
  526. Name: opPutMetricAlarm,
  527. HTTPMethod: "POST",
  528. HTTPPath: "/",
  529. }
  530. if input == nil {
  531. input = &PutMetricAlarmInput{}
  532. }
  533. req = c.newRequest(op, input, output)
  534. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  535. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  536. output = &PutMetricAlarmOutput{}
  537. req.Data = output
  538. return
  539. }
  540. // Creates or updates an alarm and associates it with the specified Amazon CloudWatch
  541. // metric. Optionally, this operation can associate one or more Amazon SNS resources
  542. // with the alarm.
  543. //
  544. // When this operation creates an alarm, the alarm state is immediately set
  545. // to INSUFFICIENT_DATA. The alarm is evaluated and its StateValue is set appropriately.
  546. // Any actions associated with the StateValue are then executed.
  547. //
  548. // When updating an existing alarm, its StateValue is left unchanged, but
  549. // it completely overwrites the alarm's previous configuration.
  550. //
  551. // If you are using an AWS Identity and Access Management (IAM) account to
  552. // create or modify an alarm, you must have the following Amazon EC2 permissions:
  553. //
  554. // ec2:DescribeInstanceStatus and ec2:DescribeInstances for all alarms on
  555. // Amazon EC2 instance status metrics.
  556. //
  557. // ec2:StopInstances for alarms with stop actions.
  558. //
  559. // ec2:TerminateInstances for alarms with terminate actions.
  560. //
  561. // ec2:DescribeInstanceRecoveryAttribute, and ec2:RecoverInstances for alarms
  562. // with recover actions.
  563. //
  564. // If you have read/write permissions for Amazon CloudWatch but not for Amazon
  565. // EC2, you can still create an alarm but the stop or terminate actions won't
  566. // be performed on the Amazon EC2 instance. However, if you are later granted
  567. // permission to use the associated Amazon EC2 APIs, the alarm actions you created
  568. // earlier will be performed. For more information about IAM permissions, see
  569. // Permissions and Policies (http://docs.aws.amazon.com/IAM/latest/UserGuide/PermissionsAndPolicies.html)
  570. // in Using IAM.
  571. //
  572. // If you are using an IAM role (e.g., an Amazon EC2 instance profile), you
  573. // cannot stop or terminate the instance using alarm actions. However, you can
  574. // still see the alarm state and perform any other actions such as Amazon SNS
  575. // notifications or Auto Scaling policies.
  576. //
  577. // If you are using temporary security credentials granted using the AWS Security
  578. // Token Service (AWS STS), you cannot stop or terminate an Amazon EC2 instance
  579. // using alarm actions.
  580. func (c *CloudWatch) PutMetricAlarm(input *PutMetricAlarmInput) (*PutMetricAlarmOutput, error) {
  581. req, out := c.PutMetricAlarmRequest(input)
  582. err := req.Send()
  583. return out, err
  584. }
  585. const opPutMetricData = "PutMetricData"
  586. // PutMetricDataRequest generates a "aws/request.Request" representing the
  587. // client's request for the PutMetricData operation. The "output" return
  588. // value can be used to capture response data after the request's "Send" method
  589. // is called.
  590. //
  591. // Creating a request object using this method should be used when you want to inject
  592. // custom logic into the request's lifecycle using a custom handler, or if you want to
  593. // access properties on the request object before or after sending the request. If
  594. // you just want the service response, call the PutMetricData method directly
  595. // instead.
  596. //
  597. // Note: You must call the "Send" method on the returned request object in order
  598. // to execute the request.
  599. //
  600. // // Example sending a request using the PutMetricDataRequest method.
  601. // req, resp := client.PutMetricDataRequest(params)
  602. //
  603. // err := req.Send()
  604. // if err == nil { // resp is now filled
  605. // fmt.Println(resp)
  606. // }
  607. //
  608. func (c *CloudWatch) PutMetricDataRequest(input *PutMetricDataInput) (req *request.Request, output *PutMetricDataOutput) {
  609. op := &request.Operation{
  610. Name: opPutMetricData,
  611. HTTPMethod: "POST",
  612. HTTPPath: "/",
  613. }
  614. if input == nil {
  615. input = &PutMetricDataInput{}
  616. }
  617. req = c.newRequest(op, input, output)
  618. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  619. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  620. output = &PutMetricDataOutput{}
  621. req.Data = output
  622. return
  623. }
  624. // Publishes metric data points to Amazon CloudWatch. Amazon CloudWatch associates
  625. // the data points with the specified metric. If the specified metric does not
  626. // exist, Amazon CloudWatch creates the metric. When Amazon CloudWatch creates
  627. // a metric, it can take up to fifteen minutes for the metric to appear in calls
  628. // to ListMetrics.
  629. //
  630. // Each PutMetricData request is limited to 8 KB in size for HTTP GET requests
  631. // and is limited to 40 KB in size for HTTP POST requests.
  632. //
  633. // Although the Value parameter accepts numbers of type Double, Amazon CloudWatch
  634. // rejects values that are either too small or too large. Values must be in
  635. // the range of 8.515920e-109 to 1.174271e+108 (Base 10) or 2e-360 to 2e360
  636. // (Base 2). In addition, special values (e.g., NaN, +Infinity, -Infinity) are
  637. // not supported.
  638. //
  639. // Data that is timestamped 24 hours or more in the past may take in excess
  640. // of 48 hours to become available from submission time using GetMetricStatistics.
  641. func (c *CloudWatch) PutMetricData(input *PutMetricDataInput) (*PutMetricDataOutput, error) {
  642. req, out := c.PutMetricDataRequest(input)
  643. err := req.Send()
  644. return out, err
  645. }
  646. const opSetAlarmState = "SetAlarmState"
  647. // SetAlarmStateRequest generates a "aws/request.Request" representing the
  648. // client's request for the SetAlarmState operation. The "output" return
  649. // value can be used to capture response data after the request's "Send" method
  650. // is called.
  651. //
  652. // Creating a request object using this method should be used when you want to inject
  653. // custom logic into the request's lifecycle using a custom handler, or if you want to
  654. // access properties on the request object before or after sending the request. If
  655. // you just want the service response, call the SetAlarmState method directly
  656. // instead.
  657. //
  658. // Note: You must call the "Send" method on the returned request object in order
  659. // to execute the request.
  660. //
  661. // // Example sending a request using the SetAlarmStateRequest method.
  662. // req, resp := client.SetAlarmStateRequest(params)
  663. //
  664. // err := req.Send()
  665. // if err == nil { // resp is now filled
  666. // fmt.Println(resp)
  667. // }
  668. //
  669. func (c *CloudWatch) SetAlarmStateRequest(input *SetAlarmStateInput) (req *request.Request, output *SetAlarmStateOutput) {
  670. op := &request.Operation{
  671. Name: opSetAlarmState,
  672. HTTPMethod: "POST",
  673. HTTPPath: "/",
  674. }
  675. if input == nil {
  676. input = &SetAlarmStateInput{}
  677. }
  678. req = c.newRequest(op, input, output)
  679. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  680. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  681. output = &SetAlarmStateOutput{}
  682. req.Data = output
  683. return
  684. }
  685. // Temporarily sets the state of an alarm for testing purposes. When the updated
  686. // StateValue differs from the previous value, the action configured for the
  687. // appropriate state is invoked. For example, if your alarm is configured to
  688. // send an Amazon SNS message when an alarm is triggered, temporarily changing
  689. // the alarm's state to ALARM sends an Amazon SNS message. The alarm returns
  690. // to its actual state (often within seconds). Because the alarm state change
  691. // happens very quickly, it is typically only visible in the alarm's History
  692. // tab in the Amazon CloudWatch console or through DescribeAlarmHistory.
  693. func (c *CloudWatch) SetAlarmState(input *SetAlarmStateInput) (*SetAlarmStateOutput, error) {
  694. req, out := c.SetAlarmStateRequest(input)
  695. err := req.Send()
  696. return out, err
  697. }
  698. // The AlarmHistoryItem data type contains descriptive information about the
  699. // history of a specific alarm. If you call DescribeAlarmHistory, Amazon CloudWatch
  700. // returns this data type as part of the DescribeAlarmHistoryResult data type.
  701. type AlarmHistoryItem struct {
  702. _ struct{} `type:"structure"`
  703. // The descriptive name for the alarm.
  704. AlarmName *string `min:"1" type:"string"`
  705. // Machine-readable data about the alarm in JSON format.
  706. HistoryData *string `min:"1" type:"string"`
  707. // The type of alarm history item.
  708. HistoryItemType *string `type:"string" enum:"HistoryItemType"`
  709. // A human-readable summary of the alarm history.
  710. HistorySummary *string `min:"1" type:"string"`
  711. // The time stamp for the alarm history item.
  712. Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  713. }
  714. // String returns the string representation
  715. func (s AlarmHistoryItem) String() string {
  716. return awsutil.Prettify(s)
  717. }
  718. // GoString returns the string representation
  719. func (s AlarmHistoryItem) GoString() string {
  720. return s.String()
  721. }
  722. // The Datapoint data type encapsulates the statistical data that Amazon CloudWatch
  723. // computes from metric data.
  724. type Datapoint struct {
  725. _ struct{} `type:"structure"`
  726. // The average of metric values that correspond to the datapoint.
  727. Average *float64 `type:"double"`
  728. // The maximum of the metric value used for the datapoint.
  729. Maximum *float64 `type:"double"`
  730. // The minimum metric value used for the datapoint.
  731. Minimum *float64 `type:"double"`
  732. // The number of metric values that contributed to the aggregate value of this
  733. // datapoint.
  734. SampleCount *float64 `type:"double"`
  735. // The sum of metric values used for the datapoint.
  736. Sum *float64 `type:"double"`
  737. // The time stamp used for the datapoint.
  738. Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  739. // The standard unit used for the datapoint.
  740. Unit *string `type:"string" enum:"StandardUnit"`
  741. }
  742. // String returns the string representation
  743. func (s Datapoint) String() string {
  744. return awsutil.Prettify(s)
  745. }
  746. // GoString returns the string representation
  747. func (s Datapoint) GoString() string {
  748. return s.String()
  749. }
  750. // Describes the inputs for DeleteAlarms.
  751. type DeleteAlarmsInput struct {
  752. _ struct{} `type:"structure"`
  753. // A list of alarms to be deleted.
  754. AlarmNames []*string `type:"list" required:"true"`
  755. }
  756. // String returns the string representation
  757. func (s DeleteAlarmsInput) String() string {
  758. return awsutil.Prettify(s)
  759. }
  760. // GoString returns the string representation
  761. func (s DeleteAlarmsInput) GoString() string {
  762. return s.String()
  763. }
  764. // Validate inspects the fields of the type to determine if they are valid.
  765. func (s *DeleteAlarmsInput) Validate() error {
  766. invalidParams := request.ErrInvalidParams{Context: "DeleteAlarmsInput"}
  767. if s.AlarmNames == nil {
  768. invalidParams.Add(request.NewErrParamRequired("AlarmNames"))
  769. }
  770. if invalidParams.Len() > 0 {
  771. return invalidParams
  772. }
  773. return nil
  774. }
  775. type DeleteAlarmsOutput struct {
  776. _ struct{} `type:"structure"`
  777. }
  778. // String returns the string representation
  779. func (s DeleteAlarmsOutput) String() string {
  780. return awsutil.Prettify(s)
  781. }
  782. // GoString returns the string representation
  783. func (s DeleteAlarmsOutput) GoString() string {
  784. return s.String()
  785. }
  786. // Describes the inputs for DescribeAlarmHistory.
  787. type DescribeAlarmHistoryInput struct {
  788. _ struct{} `type:"structure"`
  789. // The name of the alarm.
  790. AlarmName *string `min:"1" type:"string"`
  791. // The ending date to retrieve alarm history.
  792. EndDate *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  793. // The type of alarm histories to retrieve.
  794. HistoryItemType *string `type:"string" enum:"HistoryItemType"`
  795. // The maximum number of alarm history records to retrieve.
  796. MaxRecords *int64 `min:"1" type:"integer"`
  797. // The token returned by a previous call to indicate that there is more data
  798. // available.
  799. NextToken *string `type:"string"`
  800. // The starting date to retrieve alarm history.
  801. StartDate *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  802. }
  803. // String returns the string representation
  804. func (s DescribeAlarmHistoryInput) String() string {
  805. return awsutil.Prettify(s)
  806. }
  807. // GoString returns the string representation
  808. func (s DescribeAlarmHistoryInput) GoString() string {
  809. return s.String()
  810. }
  811. // Validate inspects the fields of the type to determine if they are valid.
  812. func (s *DescribeAlarmHistoryInput) Validate() error {
  813. invalidParams := request.ErrInvalidParams{Context: "DescribeAlarmHistoryInput"}
  814. if s.AlarmName != nil && len(*s.AlarmName) < 1 {
  815. invalidParams.Add(request.NewErrParamMinLen("AlarmName", 1))
  816. }
  817. if s.MaxRecords != nil && *s.MaxRecords < 1 {
  818. invalidParams.Add(request.NewErrParamMinValue("MaxRecords", 1))
  819. }
  820. if invalidParams.Len() > 0 {
  821. return invalidParams
  822. }
  823. return nil
  824. }
  825. // The output for DescribeAlarmHistory.
  826. type DescribeAlarmHistoryOutput struct {
  827. _ struct{} `type:"structure"`
  828. // A list of alarm histories in JSON format.
  829. AlarmHistoryItems []*AlarmHistoryItem `type:"list"`
  830. // A string that marks the start of the next batch of returned results.
  831. NextToken *string `type:"string"`
  832. }
  833. // String returns the string representation
  834. func (s DescribeAlarmHistoryOutput) String() string {
  835. return awsutil.Prettify(s)
  836. }
  837. // GoString returns the string representation
  838. func (s DescribeAlarmHistoryOutput) GoString() string {
  839. return s.String()
  840. }
  841. // Describes the inputs for DescribeAlarmsForMetric.
  842. type DescribeAlarmsForMetricInput struct {
  843. _ struct{} `type:"structure"`
  844. // The list of dimensions associated with the metric. If the metric has any
  845. // associated dimensions, you must specify them in order for the DescribeAlarmsForMetric
  846. // to succeed.
  847. Dimensions []*Dimension `type:"list"`
  848. // The name of the metric.
  849. MetricName *string `min:"1" type:"string" required:"true"`
  850. // The namespace of the metric.
  851. Namespace *string `min:"1" type:"string" required:"true"`
  852. // The period in seconds over which the statistic is applied.
  853. Period *int64 `min:"60" type:"integer"`
  854. // The statistic for the metric.
  855. Statistic *string `type:"string" enum:"Statistic"`
  856. // The unit for the metric.
  857. Unit *string `type:"string" enum:"StandardUnit"`
  858. }
  859. // String returns the string representation
  860. func (s DescribeAlarmsForMetricInput) String() string {
  861. return awsutil.Prettify(s)
  862. }
  863. // GoString returns the string representation
  864. func (s DescribeAlarmsForMetricInput) GoString() string {
  865. return s.String()
  866. }
  867. // Validate inspects the fields of the type to determine if they are valid.
  868. func (s *DescribeAlarmsForMetricInput) Validate() error {
  869. invalidParams := request.ErrInvalidParams{Context: "DescribeAlarmsForMetricInput"}
  870. if s.MetricName == nil {
  871. invalidParams.Add(request.NewErrParamRequired("MetricName"))
  872. }
  873. if s.MetricName != nil && len(*s.MetricName) < 1 {
  874. invalidParams.Add(request.NewErrParamMinLen("MetricName", 1))
  875. }
  876. if s.Namespace == nil {
  877. invalidParams.Add(request.NewErrParamRequired("Namespace"))
  878. }
  879. if s.Namespace != nil && len(*s.Namespace) < 1 {
  880. invalidParams.Add(request.NewErrParamMinLen("Namespace", 1))
  881. }
  882. if s.Period != nil && *s.Period < 60 {
  883. invalidParams.Add(request.NewErrParamMinValue("Period", 60))
  884. }
  885. if s.Dimensions != nil {
  886. for i, v := range s.Dimensions {
  887. if v == nil {
  888. continue
  889. }
  890. if err := v.Validate(); err != nil {
  891. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
  892. }
  893. }
  894. }
  895. if invalidParams.Len() > 0 {
  896. return invalidParams
  897. }
  898. return nil
  899. }
  900. // The output for DescribeAlarmsForMetric.
  901. type DescribeAlarmsForMetricOutput struct {
  902. _ struct{} `type:"structure"`
  903. // A list of information for each alarm with the specified metric.
  904. MetricAlarms []*MetricAlarm `type:"list"`
  905. }
  906. // String returns the string representation
  907. func (s DescribeAlarmsForMetricOutput) String() string {
  908. return awsutil.Prettify(s)
  909. }
  910. // GoString returns the string representation
  911. func (s DescribeAlarmsForMetricOutput) GoString() string {
  912. return s.String()
  913. }
  914. // Describes the inputs for DescribeAlarms.
  915. type DescribeAlarmsInput struct {
  916. _ struct{} `type:"structure"`
  917. // The action name prefix.
  918. ActionPrefix *string `min:"1" type:"string"`
  919. // The alarm name prefix. AlarmNames cannot be specified if this parameter is
  920. // specified.
  921. AlarmNamePrefix *string `min:"1" type:"string"`
  922. // A list of alarm names to retrieve information for.
  923. AlarmNames []*string `type:"list"`
  924. // The maximum number of alarm descriptions to retrieve.
  925. MaxRecords *int64 `min:"1" type:"integer"`
  926. // The token returned by a previous call to indicate that there is more data
  927. // available.
  928. NextToken *string `type:"string"`
  929. // The state value to be used in matching alarms.
  930. StateValue *string `type:"string" enum:"StateValue"`
  931. }
  932. // String returns the string representation
  933. func (s DescribeAlarmsInput) String() string {
  934. return awsutil.Prettify(s)
  935. }
  936. // GoString returns the string representation
  937. func (s DescribeAlarmsInput) GoString() string {
  938. return s.String()
  939. }
  940. // Validate inspects the fields of the type to determine if they are valid.
  941. func (s *DescribeAlarmsInput) Validate() error {
  942. invalidParams := request.ErrInvalidParams{Context: "DescribeAlarmsInput"}
  943. if s.ActionPrefix != nil && len(*s.ActionPrefix) < 1 {
  944. invalidParams.Add(request.NewErrParamMinLen("ActionPrefix", 1))
  945. }
  946. if s.AlarmNamePrefix != nil && len(*s.AlarmNamePrefix) < 1 {
  947. invalidParams.Add(request.NewErrParamMinLen("AlarmNamePrefix", 1))
  948. }
  949. if s.MaxRecords != nil && *s.MaxRecords < 1 {
  950. invalidParams.Add(request.NewErrParamMinValue("MaxRecords", 1))
  951. }
  952. if invalidParams.Len() > 0 {
  953. return invalidParams
  954. }
  955. return nil
  956. }
  957. // The output for DescribeAlarms.
  958. type DescribeAlarmsOutput struct {
  959. _ struct{} `type:"structure"`
  960. // A list of information for the specified alarms.
  961. MetricAlarms []*MetricAlarm `type:"list"`
  962. // A string that marks the start of the next batch of returned results.
  963. NextToken *string `type:"string"`
  964. }
  965. // String returns the string representation
  966. func (s DescribeAlarmsOutput) String() string {
  967. return awsutil.Prettify(s)
  968. }
  969. // GoString returns the string representation
  970. func (s DescribeAlarmsOutput) GoString() string {
  971. return s.String()
  972. }
  973. // The Dimension data type further expands on the identity of a metric using
  974. // a Name, Value pair.
  975. //
  976. // For examples that use one or more dimensions, see PutMetricData.
  977. type Dimension struct {
  978. _ struct{} `type:"structure"`
  979. // The name of the dimension.
  980. Name *string `min:"1" type:"string" required:"true"`
  981. // The value representing the dimension measurement
  982. Value *string `min:"1" type:"string" required:"true"`
  983. }
  984. // String returns the string representation
  985. func (s Dimension) String() string {
  986. return awsutil.Prettify(s)
  987. }
  988. // GoString returns the string representation
  989. func (s Dimension) GoString() string {
  990. return s.String()
  991. }
  992. // Validate inspects the fields of the type to determine if they are valid.
  993. func (s *Dimension) Validate() error {
  994. invalidParams := request.ErrInvalidParams{Context: "Dimension"}
  995. if s.Name == nil {
  996. invalidParams.Add(request.NewErrParamRequired("Name"))
  997. }
  998. if s.Name != nil && len(*s.Name) < 1 {
  999. invalidParams.Add(request.NewErrParamMinLen("Name", 1))
  1000. }
  1001. if s.Value == nil {
  1002. invalidParams.Add(request.NewErrParamRequired("Value"))
  1003. }
  1004. if s.Value != nil && len(*s.Value) < 1 {
  1005. invalidParams.Add(request.NewErrParamMinLen("Value", 1))
  1006. }
  1007. if invalidParams.Len() > 0 {
  1008. return invalidParams
  1009. }
  1010. return nil
  1011. }
  1012. // The DimensionFilter data type is used to filter ListMetrics results.
  1013. type DimensionFilter struct {
  1014. _ struct{} `type:"structure"`
  1015. // The dimension name to be matched.
  1016. Name *string `min:"1" type:"string" required:"true"`
  1017. // The value of the dimension to be matched.
  1018. //
  1019. // Specifying a Name without specifying a Value returns all values associated
  1020. // with that Name.
  1021. Value *string `min:"1" type:"string"`
  1022. }
  1023. // String returns the string representation
  1024. func (s DimensionFilter) String() string {
  1025. return awsutil.Prettify(s)
  1026. }
  1027. // GoString returns the string representation
  1028. func (s DimensionFilter) GoString() string {
  1029. return s.String()
  1030. }
  1031. // Validate inspects the fields of the type to determine if they are valid.
  1032. func (s *DimensionFilter) Validate() error {
  1033. invalidParams := request.ErrInvalidParams{Context: "DimensionFilter"}
  1034. if s.Name == nil {
  1035. invalidParams.Add(request.NewErrParamRequired("Name"))
  1036. }
  1037. if s.Name != nil && len(*s.Name) < 1 {
  1038. invalidParams.Add(request.NewErrParamMinLen("Name", 1))
  1039. }
  1040. if s.Value != nil && len(*s.Value) < 1 {
  1041. invalidParams.Add(request.NewErrParamMinLen("Value", 1))
  1042. }
  1043. if invalidParams.Len() > 0 {
  1044. return invalidParams
  1045. }
  1046. return nil
  1047. }
  1048. type DisableAlarmActionsInput struct {
  1049. _ struct{} `type:"structure"`
  1050. // The names of the alarms to disable actions for.
  1051. AlarmNames []*string `type:"list" required:"true"`
  1052. }
  1053. // String returns the string representation
  1054. func (s DisableAlarmActionsInput) String() string {
  1055. return awsutil.Prettify(s)
  1056. }
  1057. // GoString returns the string representation
  1058. func (s DisableAlarmActionsInput) GoString() string {
  1059. return s.String()
  1060. }
  1061. // Validate inspects the fields of the type to determine if they are valid.
  1062. func (s *DisableAlarmActionsInput) Validate() error {
  1063. invalidParams := request.ErrInvalidParams{Context: "DisableAlarmActionsInput"}
  1064. if s.AlarmNames == nil {
  1065. invalidParams.Add(request.NewErrParamRequired("AlarmNames"))
  1066. }
  1067. if invalidParams.Len() > 0 {
  1068. return invalidParams
  1069. }
  1070. return nil
  1071. }
  1072. type DisableAlarmActionsOutput struct {
  1073. _ struct{} `type:"structure"`
  1074. }
  1075. // String returns the string representation
  1076. func (s DisableAlarmActionsOutput) String() string {
  1077. return awsutil.Prettify(s)
  1078. }
  1079. // GoString returns the string representation
  1080. func (s DisableAlarmActionsOutput) GoString() string {
  1081. return s.String()
  1082. }
  1083. // Describes the inputs for EnableAlarmActions.
  1084. type EnableAlarmActionsInput struct {
  1085. _ struct{} `type:"structure"`
  1086. // The names of the alarms to enable actions for.
  1087. AlarmNames []*string `type:"list" required:"true"`
  1088. }
  1089. // String returns the string representation
  1090. func (s EnableAlarmActionsInput) String() string {
  1091. return awsutil.Prettify(s)
  1092. }
  1093. // GoString returns the string representation
  1094. func (s EnableAlarmActionsInput) GoString() string {
  1095. return s.String()
  1096. }
  1097. // Validate inspects the fields of the type to determine if they are valid.
  1098. func (s *EnableAlarmActionsInput) Validate() error {
  1099. invalidParams := request.ErrInvalidParams{Context: "EnableAlarmActionsInput"}
  1100. if s.AlarmNames == nil {
  1101. invalidParams.Add(request.NewErrParamRequired("AlarmNames"))
  1102. }
  1103. if invalidParams.Len() > 0 {
  1104. return invalidParams
  1105. }
  1106. return nil
  1107. }
  1108. type EnableAlarmActionsOutput struct {
  1109. _ struct{} `type:"structure"`
  1110. }
  1111. // String returns the string representation
  1112. func (s EnableAlarmActionsOutput) String() string {
  1113. return awsutil.Prettify(s)
  1114. }
  1115. // GoString returns the string representation
  1116. func (s EnableAlarmActionsOutput) GoString() string {
  1117. return s.String()
  1118. }
  1119. // Describes the inputs for GetMetricStatistics.
  1120. type GetMetricStatisticsInput struct {
  1121. _ struct{} `type:"structure"`
  1122. // A list of dimensions describing qualities of the metric.
  1123. Dimensions []*Dimension `type:"list"`
  1124. // The time stamp to use for determining the last datapoint to return. The value
  1125. // specified is exclusive; results will include datapoints up to the time stamp
  1126. // specified. The time stamp must be in ISO 8601 UTC format (e.g., 2014-09-03T23:00:00Z).
  1127. EndTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"`
  1128. // The name of the metric, with or without spaces.
  1129. MetricName *string `min:"1" type:"string" required:"true"`
  1130. // The namespace of the metric, with or without spaces.
  1131. Namespace *string `min:"1" type:"string" required:"true"`
  1132. // The granularity, in seconds, of the returned datapoints. A Period can be
  1133. // as short as one minute (60 seconds) or as long as one day (86,400 seconds),
  1134. // and must be a multiple of 60. The default value is 60.
  1135. Period *int64 `min:"60" type:"integer" required:"true"`
  1136. // The time stamp to use for determining the first datapoint to return. The
  1137. // value specified is inclusive; results include datapoints with the time stamp
  1138. // specified. The time stamp must be in ISO 8601 UTC format (e.g., 2014-09-03T23:00:00Z).
  1139. //
  1140. // The specified start time is rounded down to the nearest value. Datapoints
  1141. // are returned for start times up to two weeks in the past. Specified start
  1142. // times that are more than two weeks in the past will not return datapoints
  1143. // for metrics that are older than two weeks.
  1144. //
  1145. // Data that is timestamped 24 hours or more in the past may take in excess
  1146. // of 48 hours to become available from submission time using GetMetricStatistics.
  1147. StartTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"`
  1148. // The metric statistics to return. For information about specific statistics
  1149. // returned by GetMetricStatistics, see Statistics (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#Statistic)
  1150. // in the Amazon CloudWatch Developer Guide.
  1151. Statistics []*string `min:"1" type:"list" required:"true"`
  1152. // The specific unit for a given metric. Metrics may be reported in multiple
  1153. // units. Not supplying a unit results in all units being returned. If the metric
  1154. // only ever reports one unit, specifying a unit will have no effect.
  1155. Unit *string `type:"string" enum:"StandardUnit"`
  1156. }
  1157. // String returns the string representation
  1158. func (s GetMetricStatisticsInput) String() string {
  1159. return awsutil.Prettify(s)
  1160. }
  1161. // GoString returns the string representation
  1162. func (s GetMetricStatisticsInput) GoString() string {
  1163. return s.String()
  1164. }
  1165. // Validate inspects the fields of the type to determine if they are valid.
  1166. func (s *GetMetricStatisticsInput) Validate() error {
  1167. invalidParams := request.ErrInvalidParams{Context: "GetMetricStatisticsInput"}
  1168. if s.EndTime == nil {
  1169. invalidParams.Add(request.NewErrParamRequired("EndTime"))
  1170. }
  1171. if s.MetricName == nil {
  1172. invalidParams.Add(request.NewErrParamRequired("MetricName"))
  1173. }
  1174. if s.MetricName != nil && len(*s.MetricName) < 1 {
  1175. invalidParams.Add(request.NewErrParamMinLen("MetricName", 1))
  1176. }
  1177. if s.Namespace == nil {
  1178. invalidParams.Add(request.NewErrParamRequired("Namespace"))
  1179. }
  1180. if s.Namespace != nil && len(*s.Namespace) < 1 {
  1181. invalidParams.Add(request.NewErrParamMinLen("Namespace", 1))
  1182. }
  1183. if s.Period == nil {
  1184. invalidParams.Add(request.NewErrParamRequired("Period"))
  1185. }
  1186. if s.Period != nil && *s.Period < 60 {
  1187. invalidParams.Add(request.NewErrParamMinValue("Period", 60))
  1188. }
  1189. if s.StartTime == nil {
  1190. invalidParams.Add(request.NewErrParamRequired("StartTime"))
  1191. }
  1192. if s.Statistics == nil {
  1193. invalidParams.Add(request.NewErrParamRequired("Statistics"))
  1194. }
  1195. if s.Statistics != nil && len(s.Statistics) < 1 {
  1196. invalidParams.Add(request.NewErrParamMinLen("Statistics", 1))
  1197. }
  1198. if s.Dimensions != nil {
  1199. for i, v := range s.Dimensions {
  1200. if v == nil {
  1201. continue
  1202. }
  1203. if err := v.Validate(); err != nil {
  1204. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
  1205. }
  1206. }
  1207. }
  1208. if invalidParams.Len() > 0 {
  1209. return invalidParams
  1210. }
  1211. return nil
  1212. }
  1213. // The output for GetMetricStatistics.
  1214. type GetMetricStatisticsOutput struct {
  1215. _ struct{} `type:"structure"`
  1216. // The datapoints for the specified metric.
  1217. Datapoints []*Datapoint `type:"list"`
  1218. // A label describing the specified metric.
  1219. Label *string `type:"string"`
  1220. }
  1221. // String returns the string representation
  1222. func (s GetMetricStatisticsOutput) String() string {
  1223. return awsutil.Prettify(s)
  1224. }
  1225. // GoString returns the string representation
  1226. func (s GetMetricStatisticsOutput) GoString() string {
  1227. return s.String()
  1228. }
  1229. // Describes the inputs for ListMetrics.
  1230. type ListMetricsInput struct {
  1231. _ struct{} `type:"structure"`
  1232. // A list of dimensions to filter against.
  1233. Dimensions []*DimensionFilter `type:"list"`
  1234. // The name of the metric to filter against.
  1235. MetricName *string `min:"1" type:"string"`
  1236. // The namespace to filter against.
  1237. Namespace *string `min:"1" type:"string"`
  1238. // The token returned by a previous call to indicate that there is more data
  1239. // available.
  1240. NextToken *string `type:"string"`
  1241. }
  1242. // String returns the string representation
  1243. func (s ListMetricsInput) String() string {
  1244. return awsutil.Prettify(s)
  1245. }
  1246. // GoString returns the string representation
  1247. func (s ListMetricsInput) GoString() string {
  1248. return s.String()
  1249. }
  1250. // Validate inspects the fields of the type to determine if they are valid.
  1251. func (s *ListMetricsInput) Validate() error {
  1252. invalidParams := request.ErrInvalidParams{Context: "ListMetricsInput"}
  1253. if s.MetricName != nil && len(*s.MetricName) < 1 {
  1254. invalidParams.Add(request.NewErrParamMinLen("MetricName", 1))
  1255. }
  1256. if s.Namespace != nil && len(*s.Namespace) < 1 {
  1257. invalidParams.Add(request.NewErrParamMinLen("Namespace", 1))
  1258. }
  1259. if s.Dimensions != nil {
  1260. for i, v := range s.Dimensions {
  1261. if v == nil {
  1262. continue
  1263. }
  1264. if err := v.Validate(); err != nil {
  1265. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
  1266. }
  1267. }
  1268. }
  1269. if invalidParams.Len() > 0 {
  1270. return invalidParams
  1271. }
  1272. return nil
  1273. }
  1274. // The output for ListMetrics.
  1275. type ListMetricsOutput struct {
  1276. _ struct{} `type:"structure"`
  1277. // A list of metrics used to generate statistics for an AWS account.
  1278. Metrics []*Metric `type:"list"`
  1279. // A string that marks the start of the next batch of returned results.
  1280. NextToken *string `type:"string"`
  1281. }
  1282. // String returns the string representation
  1283. func (s ListMetricsOutput) String() string {
  1284. return awsutil.Prettify(s)
  1285. }
  1286. // GoString returns the string representation
  1287. func (s ListMetricsOutput) GoString() string {
  1288. return s.String()
  1289. }
  1290. // The Metric data type contains information about a specific metric. If you
  1291. // call ListMetrics, Amazon CloudWatch returns information contained by this
  1292. // data type.
  1293. //
  1294. // The example in the Examples section publishes two metrics named buffers
  1295. // and latency. Both metrics are in the examples namespace. Both metrics have
  1296. // two dimensions, InstanceID and InstanceType.
  1297. type Metric struct {
  1298. _ struct{} `type:"structure"`
  1299. // A list of dimensions associated with the metric.
  1300. Dimensions []*Dimension `type:"list"`
  1301. // The name of the metric.
  1302. MetricName *string `min:"1" type:"string"`
  1303. // The namespace of the metric.
  1304. Namespace *string `min:"1" type:"string"`
  1305. }
  1306. // String returns the string representation
  1307. func (s Metric) String() string {
  1308. return awsutil.Prettify(s)
  1309. }
  1310. // GoString returns the string representation
  1311. func (s Metric) GoString() string {
  1312. return s.String()
  1313. }
  1314. // The MetricAlarm data type represents an alarm. You can use PutMetricAlarm
  1315. // to create or update an alarm.
  1316. type MetricAlarm struct {
  1317. _ struct{} `type:"structure"`
  1318. // Indicates whether actions should be executed during any changes to the alarm's
  1319. // state.
  1320. ActionsEnabled *bool `type:"boolean"`
  1321. // The list of actions to execute when this alarm transitions into an ALARM
  1322. // state from any other state. Each action is specified as an Amazon Resource
  1323. // Name (ARN).
  1324. AlarmActions []*string `type:"list"`
  1325. // The Amazon Resource Name (ARN) of the alarm.
  1326. AlarmArn *string `min:"1" type:"string"`
  1327. // The time stamp of the last update to the alarm configuration.
  1328. AlarmConfigurationUpdatedTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  1329. // The description for the alarm.
  1330. AlarmDescription *string `type:"string"`
  1331. // The name of the alarm.
  1332. AlarmName *string `min:"1" type:"string"`
  1333. // The arithmetic operation to use when comparing the specified Statistic and
  1334. // Threshold. The specified Statistic value is used as the first operand.
  1335. ComparisonOperator *string `type:"string" enum:"ComparisonOperator"`
  1336. // The list of dimensions associated with the alarm's associated metric.
  1337. Dimensions []*Dimension `type:"list"`
  1338. // The number of periods over which data is compared to the specified threshold.
  1339. EvaluationPeriods *int64 `min:"1" type:"integer"`
  1340. // The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA
  1341. // state from any other state. Each action is specified as an Amazon Resource
  1342. // Name (ARN).
  1343. //
  1344. // The current WSDL lists this attribute as UnknownActions.
  1345. InsufficientDataActions []*string `type:"list"`
  1346. // The name of the alarm's metric.
  1347. MetricName *string `min:"1" type:"string"`
  1348. // The namespace of alarm's associated metric.
  1349. Namespace *string `min:"1" type:"string"`
  1350. // The list of actions to execute when this alarm transitions into an OK state
  1351. // from any other state. Each action is specified as an Amazon Resource Name
  1352. // (ARN).
  1353. OKActions []*string `type:"list"`
  1354. // The period in seconds over which the statistic is applied.
  1355. Period *int64 `min:"60" type:"integer"`
  1356. // A human-readable explanation for the alarm's state.
  1357. StateReason *string `type:"string"`
  1358. // An explanation for the alarm's state in machine-readable JSON format
  1359. StateReasonData *string `type:"string"`
  1360. // The time stamp of the last update to the alarm's state.
  1361. StateUpdatedTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  1362. // The state value for the alarm.
  1363. StateValue *string `type:"string" enum:"StateValue"`
  1364. // The statistic to apply to the alarm's associated metric.
  1365. Statistic *string `type:"string" enum:"Statistic"`
  1366. // The value against which the specified statistic is compared.
  1367. Threshold *float64 `type:"double"`
  1368. // The unit of the alarm's associated metric.
  1369. Unit *string `type:"string" enum:"StandardUnit"`
  1370. }
  1371. // String returns the string representation
  1372. func (s MetricAlarm) String() string {
  1373. return awsutil.Prettify(s)
  1374. }
  1375. // GoString returns the string representation
  1376. func (s MetricAlarm) GoString() string {
  1377. return s.String()
  1378. }
  1379. // The MetricDatum data type encapsulates the information sent with PutMetricData
  1380. // to either create a new metric or add new values to be aggregated into an
  1381. // existing metric.
  1382. type MetricDatum struct {
  1383. _ struct{} `type:"structure"`
  1384. // A list of dimensions associated with the metric. Note, when using the Dimensions
  1385. // value in a query, you need to append .member.N to it (e.g., Dimensions.member.N).
  1386. Dimensions []*Dimension `type:"list"`
  1387. // The name of the metric.
  1388. MetricName *string `min:"1" type:"string" required:"true"`
  1389. // A set of statistical values describing the metric.
  1390. StatisticValues *StatisticSet `type:"structure"`
  1391. // The time stamp used for the metric in ISO 8601 Universal Coordinated Time
  1392. // (UTC) format. If not specified, the default value is set to the time the
  1393. // metric data was received.
  1394. Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  1395. // The unit of the metric.
  1396. Unit *string `type:"string" enum:"StandardUnit"`
  1397. // The value for the metric.
  1398. //
  1399. // Although the Value parameter accepts numbers of type Double, Amazon CloudWatch
  1400. // rejects values that are either too small or too large. Values must be in
  1401. // the range of 8.515920e-109 to 1.174271e+108 (Base 10) or 2e-360 to 2e360
  1402. // (Base 2). In addition, special values (e.g., NaN, +Infinity, -Infinity) are
  1403. // not supported.
  1404. Value *float64 `type:"double"`
  1405. }
  1406. // String returns the string representation
  1407. func (s MetricDatum) String() string {
  1408. return awsutil.Prettify(s)
  1409. }
  1410. // GoString returns the string representation
  1411. func (s MetricDatum) GoString() string {
  1412. return s.String()
  1413. }
  1414. // Validate inspects the fields of the type to determine if they are valid.
  1415. func (s *MetricDatum) Validate() error {
  1416. invalidParams := request.ErrInvalidParams{Context: "MetricDatum"}
  1417. if s.MetricName == nil {
  1418. invalidParams.Add(request.NewErrParamRequired("MetricName"))
  1419. }
  1420. if s.MetricName != nil && len(*s.MetricName) < 1 {
  1421. invalidParams.Add(request.NewErrParamMinLen("MetricName", 1))
  1422. }
  1423. if s.Dimensions != nil {
  1424. for i, v := range s.Dimensions {
  1425. if v == nil {
  1426. continue
  1427. }
  1428. if err := v.Validate(); err != nil {
  1429. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
  1430. }
  1431. }
  1432. }
  1433. if s.StatisticValues != nil {
  1434. if err := s.StatisticValues.Validate(); err != nil {
  1435. invalidParams.AddNested("StatisticValues", err.(request.ErrInvalidParams))
  1436. }
  1437. }
  1438. if invalidParams.Len() > 0 {
  1439. return invalidParams
  1440. }
  1441. return nil
  1442. }
  1443. // Describes the inputs for PutMetricAlarm.
  1444. type PutMetricAlarmInput struct {
  1445. _ struct{} `type:"structure"`
  1446. // Indicates whether or not actions should be executed during any changes to
  1447. // the alarm's state.
  1448. ActionsEnabled *bool `type:"boolean"`
  1449. // The list of actions to execute when this alarm transitions into an ALARM
  1450. // state from any other state. Each action is specified as an Amazon Resource
  1451. // Name (ARN).
  1452. //
  1453. // Valid Values: arn:aws:automate:region (e.g., us-east-1):ec2:stop | arn:aws:automate:region
  1454. // (e.g., us-east-1):ec2:terminate | arn:aws:automate:region (e.g., us-east-1):ec2:recover
  1455. //
  1456. // Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Stop/1.0
  1457. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Terminate/1.0
  1458. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
  1459. //
  1460. // Note: You must create at least one stop, terminate, or reboot alarm using
  1461. // the Amazon EC2 or CloudWatch console to create the EC2ActionsAccess IAM role
  1462. // for the first time. After this IAM role is created, you can create stop,
  1463. // terminate, or reboot alarms using the CLI.
  1464. AlarmActions []*string `type:"list"`
  1465. // The description for the alarm.
  1466. AlarmDescription *string `type:"string"`
  1467. // The descriptive name for the alarm. This name must be unique within the user's
  1468. // AWS account
  1469. AlarmName *string `min:"1" type:"string" required:"true"`
  1470. // The arithmetic operation to use when comparing the specified Statistic and
  1471. // Threshold. The specified Statistic value is used as the first operand.
  1472. ComparisonOperator *string `type:"string" required:"true" enum:"ComparisonOperator"`
  1473. // The dimensions for the alarm's associated metric.
  1474. Dimensions []*Dimension `type:"list"`
  1475. // The number of periods over which data is compared to the specified threshold.
  1476. EvaluationPeriods *int64 `min:"1" type:"integer" required:"true"`
  1477. // The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA
  1478. // state from any other state. Each action is specified as an Amazon Resource
  1479. // Name (ARN).
  1480. //
  1481. // Valid Values: arn:aws:automate:region (e.g., us-east-1):ec2:stop | arn:aws:automate:region
  1482. // (e.g., us-east-1):ec2:terminate | arn:aws:automate:region (e.g., us-east-1):ec2:recover
  1483. //
  1484. // Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Stop/1.0
  1485. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Terminate/1.0
  1486. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
  1487. //
  1488. // Note: You must create at least one stop, terminate, or reboot alarm using
  1489. // the Amazon EC2 or CloudWatch console to create the EC2ActionsAccess IAM role
  1490. // for the first time. After this IAM role is created, you can create stop,
  1491. // terminate, or reboot alarms using the CLI.
  1492. InsufficientDataActions []*string `type:"list"`
  1493. // The name for the alarm's associated metric.
  1494. MetricName *string `min:"1" type:"string" required:"true"`
  1495. // The namespace for the alarm's associated metric.
  1496. Namespace *string `min:"1" type:"string" required:"true"`
  1497. // The list of actions to execute when this alarm transitions into an OK state
  1498. // from any other state. Each action is specified as an Amazon Resource Name
  1499. // (ARN).
  1500. //
  1501. // Valid Values: arn:aws:automate:region (e.g., us-east-1):ec2:stop | arn:aws:automate:region
  1502. // (e.g., us-east-1):ec2:terminate | arn:aws:automate:region (e.g., us-east-1):ec2:recover
  1503. //
  1504. // Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Stop/1.0
  1505. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Terminate/1.0
  1506. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
  1507. //
  1508. // Note: You must create at least one stop, terminate, or reboot alarm using
  1509. // the Amazon EC2 or CloudWatch console to create the EC2ActionsAccess IAM role
  1510. // for the first time. After this IAM role is created, you can create stop,
  1511. // terminate, or reboot alarms using the CLI.
  1512. OKActions []*string `type:"list"`
  1513. // The period in seconds over which the specified statistic is applied.
  1514. Period *int64 `min:"60" type:"integer" required:"true"`
  1515. // The statistic to apply to the alarm's associated metric.
  1516. Statistic *string `type:"string" required:"true" enum:"Statistic"`
  1517. // The value against which the specified statistic is compared.
  1518. Threshold *float64 `type:"double" required:"true"`
  1519. // The statistic's unit of measure. For example, the units for the Amazon EC2
  1520. // NetworkIn metric are Bytes because NetworkIn tracks the number of bytes that
  1521. // an instance receives on all network interfaces. You can also specify a unit
  1522. // when you create a custom metric. Units help provide conceptual meaning to
  1523. // your data. Metric data points that specify a unit of measure, such as Percent,
  1524. // are aggregated separately.
  1525. //
  1526. // Note: If you specify a unit, you must use a unit that is appropriate for
  1527. // the metric. Otherwise, this can cause an Amazon CloudWatch alarm to get stuck
  1528. // in the INSUFFICIENT DATA state.
  1529. Unit *string `type:"string" enum:"StandardUnit"`
  1530. }
  1531. // String returns the string representation
  1532. func (s PutMetricAlarmInput) String() string {
  1533. return awsutil.Prettify(s)
  1534. }
  1535. // GoString returns the string representation
  1536. func (s PutMetricAlarmInput) GoString() string {
  1537. return s.String()
  1538. }
  1539. // Validate inspects the fields of the type to determine if they are valid.
  1540. func (s *PutMetricAlarmInput) Validate() error {
  1541. invalidParams := request.ErrInvalidParams{Context: "PutMetricAlarmInput"}
  1542. if s.AlarmName == nil {
  1543. invalidParams.Add(request.NewErrParamRequired("AlarmName"))
  1544. }
  1545. if s.AlarmName != nil && len(*s.AlarmName) < 1 {
  1546. invalidParams.Add(request.NewErrParamMinLen("AlarmName", 1))
  1547. }
  1548. if s.ComparisonOperator == nil {
  1549. invalidParams.Add(request.NewErrParamRequired("ComparisonOperator"))
  1550. }
  1551. if s.EvaluationPeriods == nil {
  1552. invalidParams.Add(request.NewErrParamRequired("EvaluationPeriods"))
  1553. }
  1554. if s.EvaluationPeriods != nil && *s.EvaluationPeriods < 1 {
  1555. invalidParams.Add(request.NewErrParamMinValue("EvaluationPeriods", 1))
  1556. }
  1557. if s.MetricName == nil {
  1558. invalidParams.Add(request.NewErrParamRequired("MetricName"))
  1559. }
  1560. if s.MetricName != nil && len(*s.MetricName) < 1 {
  1561. invalidParams.Add(request.NewErrParamMinLen("MetricName", 1))
  1562. }
  1563. if s.Namespace == nil {
  1564. invalidParams.Add(request.NewErrParamRequired("Namespace"))
  1565. }
  1566. if s.Namespace != nil && len(*s.Namespace) < 1 {
  1567. invalidParams.Add(request.NewErrParamMinLen("Namespace", 1))
  1568. }
  1569. if s.Period == nil {
  1570. invalidParams.Add(request.NewErrParamRequired("Period"))
  1571. }
  1572. if s.Period != nil && *s.Period < 60 {
  1573. invalidParams.Add(request.NewErrParamMinValue("Period", 60))
  1574. }
  1575. if s.Statistic == nil {
  1576. invalidParams.Add(request.NewErrParamRequired("Statistic"))
  1577. }
  1578. if s.Threshold == nil {
  1579. invalidParams.Add(request.NewErrParamRequired("Threshold"))
  1580. }
  1581. if s.Dimensions != nil {
  1582. for i, v := range s.Dimensions {
  1583. if v == nil {
  1584. continue
  1585. }
  1586. if err := v.Validate(); err != nil {
  1587. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
  1588. }
  1589. }
  1590. }
  1591. if invalidParams.Len() > 0 {
  1592. return invalidParams
  1593. }
  1594. return nil
  1595. }
  1596. type PutMetricAlarmOutput struct {
  1597. _ struct{} `type:"structure"`
  1598. }
  1599. // String returns the string representation
  1600. func (s PutMetricAlarmOutput) String() string {
  1601. return awsutil.Prettify(s)
  1602. }
  1603. // GoString returns the string representation
  1604. func (s PutMetricAlarmOutput) GoString() string {
  1605. return s.String()
  1606. }
  1607. // Describes the inputs for PutMetricData.
  1608. type PutMetricDataInput struct {
  1609. _ struct{} `type:"structure"`
  1610. // A list of data describing the metric.
  1611. MetricData []*MetricDatum `type:"list" required:"true"`
  1612. // The namespace for the metric data.
  1613. //
  1614. // You cannot specify a namespace that begins with "AWS/". Namespaces that
  1615. // begin with "AWS/" are reserved for other Amazon Web Services products that
  1616. // send metrics to Amazon CloudWatch.
  1617. Namespace *string `min:"1" type:"string" required:"true"`
  1618. }
  1619. // String returns the string representation
  1620. func (s PutMetricDataInput) String() string {
  1621. return awsutil.Prettify(s)
  1622. }
  1623. // GoString returns the string representation
  1624. func (s PutMetricDataInput) GoString() string {
  1625. return s.String()
  1626. }
  1627. // Validate inspects the fields of the type to determine if they are valid.
  1628. func (s *PutMetricDataInput) Validate() error {
  1629. invalidParams := request.ErrInvalidParams{Context: "PutMetricDataInput"}
  1630. if s.MetricData == nil {
  1631. invalidParams.Add(request.NewErrParamRequired("MetricData"))
  1632. }
  1633. if s.Namespace == nil {
  1634. invalidParams.Add(request.NewErrParamRequired("Namespace"))
  1635. }
  1636. if s.Namespace != nil && len(*s.Namespace) < 1 {
  1637. invalidParams.Add(request.NewErrParamMinLen("Namespace", 1))
  1638. }
  1639. if s.MetricData != nil {
  1640. for i, v := range s.MetricData {
  1641. if v == nil {
  1642. continue
  1643. }
  1644. if err := v.Validate(); err != nil {
  1645. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricData", i), err.(request.ErrInvalidParams))
  1646. }
  1647. }
  1648. }
  1649. if invalidParams.Len() > 0 {
  1650. return invalidParams
  1651. }
  1652. return nil
  1653. }
  1654. type PutMetricDataOutput struct {
  1655. _ struct{} `type:"structure"`
  1656. }
  1657. // String returns the string representation
  1658. func (s PutMetricDataOutput) String() string {
  1659. return awsutil.Prettify(s)
  1660. }
  1661. // GoString returns the string representation
  1662. func (s PutMetricDataOutput) GoString() string {
  1663. return s.String()
  1664. }
  1665. // Describes the inputs for SetAlarmState.
  1666. type SetAlarmStateInput struct {
  1667. _ struct{} `type:"structure"`
  1668. // The descriptive name for the alarm. This name must be unique within the user's
  1669. // AWS account. The maximum length is 255 characters.
  1670. AlarmName *string `min:"1" type:"string" required:"true"`
  1671. // The reason that this alarm is set to this specific state (in human-readable
  1672. // text format)
  1673. StateReason *string `type:"string" required:"true"`
  1674. // The reason that this alarm is set to this specific state (in machine-readable
  1675. // JSON format)
  1676. StateReasonData *string `type:"string"`
  1677. // The value of the state.
  1678. StateValue *string `type:"string" required:"true" enum:"StateValue"`
  1679. }
  1680. // String returns the string representation
  1681. func (s SetAlarmStateInput) String() string {
  1682. return awsutil.Prettify(s)
  1683. }
  1684. // GoString returns the string representation
  1685. func (s SetAlarmStateInput) GoString() string {
  1686. return s.String()
  1687. }
  1688. // Validate inspects the fields of the type to determine if they are valid.
  1689. func (s *SetAlarmStateInput) Validate() error {
  1690. invalidParams := request.ErrInvalidParams{Context: "SetAlarmStateInput"}
  1691. if s.AlarmName == nil {
  1692. invalidParams.Add(request.NewErrParamRequired("AlarmName"))
  1693. }
  1694. if s.AlarmName != nil && len(*s.AlarmName) < 1 {
  1695. invalidParams.Add(request.NewErrParamMinLen("AlarmName", 1))
  1696. }
  1697. if s.StateReason == nil {
  1698. invalidParams.Add(request.NewErrParamRequired("StateReason"))
  1699. }
  1700. if s.StateValue == nil {
  1701. invalidParams.Add(request.NewErrParamRequired("StateValue"))
  1702. }
  1703. if invalidParams.Len() > 0 {
  1704. return invalidParams
  1705. }
  1706. return nil
  1707. }
  1708. type SetAlarmStateOutput struct {
  1709. _ struct{} `type:"structure"`
  1710. }
  1711. // String returns the string representation
  1712. func (s SetAlarmStateOutput) String() string {
  1713. return awsutil.Prettify(s)
  1714. }
  1715. // GoString returns the string representation
  1716. func (s SetAlarmStateOutput) GoString() string {
  1717. return s.String()
  1718. }
  1719. // The StatisticSet data type describes the StatisticValues component of MetricDatum,
  1720. // and represents a set of statistics that describes a specific metric.
  1721. type StatisticSet struct {
  1722. _ struct{} `type:"structure"`
  1723. // The maximum value of the sample set.
  1724. Maximum *float64 `type:"double" required:"true"`
  1725. // The minimum value of the sample set.
  1726. Minimum *float64 `type:"double" required:"true"`
  1727. // The number of samples used for the statistic set.
  1728. SampleCount *float64 `type:"double" required:"true"`
  1729. // The sum of values for the sample set.
  1730. Sum *float64 `type:"double" required:"true"`
  1731. }
  1732. // String returns the string representation
  1733. func (s StatisticSet) String() string {
  1734. return awsutil.Prettify(s)
  1735. }
  1736. // GoString returns the string representation
  1737. func (s StatisticSet) GoString() string {
  1738. return s.String()
  1739. }
  1740. // Validate inspects the fields of the type to determine if they are valid.
  1741. func (s *StatisticSet) Validate() error {
  1742. invalidParams := request.ErrInvalidParams{Context: "StatisticSet"}
  1743. if s.Maximum == nil {
  1744. invalidParams.Add(request.NewErrParamRequired("Maximum"))
  1745. }
  1746. if s.Minimum == nil {
  1747. invalidParams.Add(request.NewErrParamRequired("Minimum"))
  1748. }
  1749. if s.SampleCount == nil {
  1750. invalidParams.Add(request.NewErrParamRequired("SampleCount"))
  1751. }
  1752. if s.Sum == nil {
  1753. invalidParams.Add(request.NewErrParamRequired("Sum"))
  1754. }
  1755. if invalidParams.Len() > 0 {
  1756. return invalidParams
  1757. }
  1758. return nil
  1759. }
  1760. const (
  1761. // @enum ComparisonOperator
  1762. ComparisonOperatorGreaterThanOrEqualToThreshold = "GreaterThanOrEqualToThreshold"
  1763. // @enum ComparisonOperator
  1764. ComparisonOperatorGreaterThanThreshold = "GreaterThanThreshold"
  1765. // @enum ComparisonOperator
  1766. ComparisonOperatorLessThanThreshold = "LessThanThreshold"
  1767. // @enum ComparisonOperator
  1768. ComparisonOperatorLessThanOrEqualToThreshold = "LessThanOrEqualToThreshold"
  1769. )
  1770. const (
  1771. // @enum HistoryItemType
  1772. HistoryItemTypeConfigurationUpdate = "ConfigurationUpdate"
  1773. // @enum HistoryItemType
  1774. HistoryItemTypeStateUpdate = "StateUpdate"
  1775. // @enum HistoryItemType
  1776. HistoryItemTypeAction = "Action"
  1777. )
  1778. const (
  1779. // @enum StandardUnit
  1780. StandardUnitSeconds = "Seconds"
  1781. // @enum StandardUnit
  1782. StandardUnitMicroseconds = "Microseconds"
  1783. // @enum StandardUnit
  1784. StandardUnitMilliseconds = "Milliseconds"
  1785. // @enum StandardUnit
  1786. StandardUnitBytes = "Bytes"
  1787. // @enum StandardUnit
  1788. StandardUnitKilobytes = "Kilobytes"
  1789. // @enum StandardUnit
  1790. StandardUnitMegabytes = "Megabytes"
  1791. // @enum StandardUnit
  1792. StandardUnitGigabytes = "Gigabytes"
  1793. // @enum StandardUnit
  1794. StandardUnitTerabytes = "Terabytes"
  1795. // @enum StandardUnit
  1796. StandardUnitBits = "Bits"
  1797. // @enum StandardUnit
  1798. StandardUnitKilobits = "Kilobits"
  1799. // @enum StandardUnit
  1800. StandardUnitMegabits = "Megabits"
  1801. // @enum StandardUnit
  1802. StandardUnitGigabits = "Gigabits"
  1803. // @enum StandardUnit
  1804. StandardUnitTerabits = "Terabits"
  1805. // @enum StandardUnit
  1806. StandardUnitPercent = "Percent"
  1807. // @enum StandardUnit
  1808. StandardUnitCount = "Count"
  1809. // @enum StandardUnit
  1810. StandardUnitBytesSecond = "Bytes/Second"
  1811. // @enum StandardUnit
  1812. StandardUnitKilobytesSecond = "Kilobytes/Second"
  1813. // @enum StandardUnit
  1814. StandardUnitMegabytesSecond = "Megabytes/Second"
  1815. // @enum StandardUnit
  1816. StandardUnitGigabytesSecond = "Gigabytes/Second"
  1817. // @enum StandardUnit
  1818. StandardUnitTerabytesSecond = "Terabytes/Second"
  1819. // @enum StandardUnit
  1820. StandardUnitBitsSecond = "Bits/Second"
  1821. // @enum StandardUnit
  1822. StandardUnitKilobitsSecond = "Kilobits/Second"
  1823. // @enum StandardUnit
  1824. StandardUnitMegabitsSecond = "Megabits/Second"
  1825. // @enum StandardUnit
  1826. StandardUnitGigabitsSecond = "Gigabits/Second"
  1827. // @enum StandardUnit
  1828. StandardUnitTerabitsSecond = "Terabits/Second"
  1829. // @enum StandardUnit
  1830. StandardUnitCountSecond = "Count/Second"
  1831. // @enum StandardUnit
  1832. StandardUnitNone = "None"
  1833. )
  1834. const (
  1835. // @enum StateValue
  1836. StateValueOk = "OK"
  1837. // @enum StateValue
  1838. StateValueAlarm = "ALARM"
  1839. // @enum StateValue
  1840. StateValueInsufficientData = "INSUFFICIENT_DATA"
  1841. )
  1842. const (
  1843. // @enum Statistic
  1844. StatisticSampleCount = "SampleCount"
  1845. // @enum Statistic
  1846. StatisticAverage = "Average"
  1847. // @enum Statistic
  1848. StatisticSum = "Sum"
  1849. // @enum Statistic
  1850. StatisticMinimum = "Minimum"
  1851. // @enum Statistic
  1852. StatisticMaximum = "Maximum"
  1853. )