api.go 116 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480
  1. // Code generated by private/model/cli/gen-api/main.go. 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"
  8. "github.com/aws/aws-sdk-go/aws/awsutil"
  9. "github.com/aws/aws-sdk-go/aws/request"
  10. "github.com/aws/aws-sdk-go/private/protocol"
  11. "github.com/aws/aws-sdk-go/private/protocol/query"
  12. )
  13. const opDeleteAlarms = "DeleteAlarms"
  14. // DeleteAlarmsRequest generates a "aws/request.Request" representing the
  15. // client's request for the DeleteAlarms operation. The "output" return
  16. // value can be used to capture response data after the request's "Send" method
  17. // is called.
  18. //
  19. // See DeleteAlarms for usage and error information.
  20. //
  21. // Creating a request object using this method should be used when you want to inject
  22. // custom logic into the request's lifecycle using a custom handler, or if you want to
  23. // access properties on the request object before or after sending the request. If
  24. // you just want the service response, call the DeleteAlarms method directly
  25. // instead.
  26. //
  27. // Note: You must call the "Send" method on the returned request object in order
  28. // to execute the request.
  29. //
  30. // // Example sending a request using the DeleteAlarmsRequest method.
  31. // req, resp := client.DeleteAlarmsRequest(params)
  32. //
  33. // err := req.Send()
  34. // if err == nil { // resp is now filled
  35. // fmt.Println(resp)
  36. // }
  37. //
  38. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAlarms
  39. func (c *CloudWatch) DeleteAlarmsRequest(input *DeleteAlarmsInput) (req *request.Request, output *DeleteAlarmsOutput) {
  40. op := &request.Operation{
  41. Name: opDeleteAlarms,
  42. HTTPMethod: "POST",
  43. HTTPPath: "/",
  44. }
  45. if input == nil {
  46. input = &DeleteAlarmsInput{}
  47. }
  48. output = &DeleteAlarmsOutput{}
  49. req = c.newRequest(op, input, output)
  50. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  51. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  52. return
  53. }
  54. // DeleteAlarms API operation for Amazon CloudWatch.
  55. //
  56. // Deletes the specified alarms. In the event of an error, no alarms are deleted.
  57. //
  58. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  59. // with awserr.Error's Code and Message methods to get detailed information about
  60. // the error.
  61. //
  62. // See the AWS API reference guide for Amazon CloudWatch's
  63. // API operation DeleteAlarms for usage and error information.
  64. //
  65. // Returned Error Codes:
  66. // * ErrCodeResourceNotFound "ResourceNotFound"
  67. // The named resource does not exist.
  68. //
  69. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAlarms
  70. func (c *CloudWatch) DeleteAlarms(input *DeleteAlarmsInput) (*DeleteAlarmsOutput, error) {
  71. req, out := c.DeleteAlarmsRequest(input)
  72. return out, req.Send()
  73. }
  74. // DeleteAlarmsWithContext is the same as DeleteAlarms with the addition of
  75. // the ability to pass a context and additional request options.
  76. //
  77. // See DeleteAlarms for details on how to use this API operation.
  78. //
  79. // The context must be non-nil and will be used for request cancellation. If
  80. // the context is nil a panic will occur. In the future the SDK may create
  81. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  82. // for more information on using Contexts.
  83. func (c *CloudWatch) DeleteAlarmsWithContext(ctx aws.Context, input *DeleteAlarmsInput, opts ...request.Option) (*DeleteAlarmsOutput, error) {
  84. req, out := c.DeleteAlarmsRequest(input)
  85. req.SetContext(ctx)
  86. req.ApplyOptions(opts...)
  87. return out, req.Send()
  88. }
  89. const opDescribeAlarmHistory = "DescribeAlarmHistory"
  90. // DescribeAlarmHistoryRequest generates a "aws/request.Request" representing the
  91. // client's request for the DescribeAlarmHistory operation. The "output" return
  92. // value can be used to capture response data after the request's "Send" method
  93. // is called.
  94. //
  95. // See DescribeAlarmHistory for usage and error information.
  96. //
  97. // Creating a request object using this method should be used when you want to inject
  98. // custom logic into the request's lifecycle using a custom handler, or if you want to
  99. // access properties on the request object before or after sending the request. If
  100. // you just want the service response, call the DescribeAlarmHistory method directly
  101. // instead.
  102. //
  103. // Note: You must call the "Send" method on the returned request object in order
  104. // to execute the request.
  105. //
  106. // // Example sending a request using the DescribeAlarmHistoryRequest method.
  107. // req, resp := client.DescribeAlarmHistoryRequest(params)
  108. //
  109. // err := req.Send()
  110. // if err == nil { // resp is now filled
  111. // fmt.Println(resp)
  112. // }
  113. //
  114. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmHistory
  115. func (c *CloudWatch) DescribeAlarmHistoryRequest(input *DescribeAlarmHistoryInput) (req *request.Request, output *DescribeAlarmHistoryOutput) {
  116. op := &request.Operation{
  117. Name: opDescribeAlarmHistory,
  118. HTTPMethod: "POST",
  119. HTTPPath: "/",
  120. Paginator: &request.Paginator{
  121. InputTokens: []string{"NextToken"},
  122. OutputTokens: []string{"NextToken"},
  123. LimitToken: "MaxRecords",
  124. TruncationToken: "",
  125. },
  126. }
  127. if input == nil {
  128. input = &DescribeAlarmHistoryInput{}
  129. }
  130. output = &DescribeAlarmHistoryOutput{}
  131. req = c.newRequest(op, input, output)
  132. return
  133. }
  134. // DescribeAlarmHistory API operation for Amazon CloudWatch.
  135. //
  136. // Retrieves the history for the specified alarm. You can filter the results
  137. // by date range or item type. If an alarm name is not specified, the histories
  138. // for all alarms are returned.
  139. //
  140. // Note that Amazon CloudWatch retains the history of an alarm even if you delete
  141. // the alarm.
  142. //
  143. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  144. // with awserr.Error's Code and Message methods to get detailed information about
  145. // the error.
  146. //
  147. // See the AWS API reference guide for Amazon CloudWatch's
  148. // API operation DescribeAlarmHistory for usage and error information.
  149. //
  150. // Returned Error Codes:
  151. // * ErrCodeInvalidNextToken "InvalidNextToken"
  152. // The next token specified is invalid.
  153. //
  154. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmHistory
  155. func (c *CloudWatch) DescribeAlarmHistory(input *DescribeAlarmHistoryInput) (*DescribeAlarmHistoryOutput, error) {
  156. req, out := c.DescribeAlarmHistoryRequest(input)
  157. return out, req.Send()
  158. }
  159. // DescribeAlarmHistoryWithContext is the same as DescribeAlarmHistory with the addition of
  160. // the ability to pass a context and additional request options.
  161. //
  162. // See DescribeAlarmHistory for details on how to use this API operation.
  163. //
  164. // The context must be non-nil and will be used for request cancellation. If
  165. // the context is nil a panic will occur. In the future the SDK may create
  166. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  167. // for more information on using Contexts.
  168. func (c *CloudWatch) DescribeAlarmHistoryWithContext(ctx aws.Context, input *DescribeAlarmHistoryInput, opts ...request.Option) (*DescribeAlarmHistoryOutput, error) {
  169. req, out := c.DescribeAlarmHistoryRequest(input)
  170. req.SetContext(ctx)
  171. req.ApplyOptions(opts...)
  172. return out, req.Send()
  173. }
  174. // DescribeAlarmHistoryPages iterates over the pages of a DescribeAlarmHistory operation,
  175. // calling the "fn" function with the response data for each page. To stop
  176. // iterating, return false from the fn function.
  177. //
  178. // See DescribeAlarmHistory method for more information on how to use this operation.
  179. //
  180. // Note: This operation can generate multiple requests to a service.
  181. //
  182. // // Example iterating over at most 3 pages of a DescribeAlarmHistory operation.
  183. // pageNum := 0
  184. // err := client.DescribeAlarmHistoryPages(params,
  185. // func(page *DescribeAlarmHistoryOutput, lastPage bool) bool {
  186. // pageNum++
  187. // fmt.Println(page)
  188. // return pageNum <= 3
  189. // })
  190. //
  191. func (c *CloudWatch) DescribeAlarmHistoryPages(input *DescribeAlarmHistoryInput, fn func(*DescribeAlarmHistoryOutput, bool) bool) error {
  192. return c.DescribeAlarmHistoryPagesWithContext(aws.BackgroundContext(), input, fn)
  193. }
  194. // DescribeAlarmHistoryPagesWithContext same as DescribeAlarmHistoryPages except
  195. // it takes a Context and allows setting request options on the pages.
  196. //
  197. // The context must be non-nil and will be used for request cancellation. If
  198. // the context is nil a panic will occur. In the future the SDK may create
  199. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  200. // for more information on using Contexts.
  201. func (c *CloudWatch) DescribeAlarmHistoryPagesWithContext(ctx aws.Context, input *DescribeAlarmHistoryInput, fn func(*DescribeAlarmHistoryOutput, bool) bool, opts ...request.Option) error {
  202. p := request.Pagination{
  203. NewRequest: func() (*request.Request, error) {
  204. var inCpy *DescribeAlarmHistoryInput
  205. if input != nil {
  206. tmp := *input
  207. inCpy = &tmp
  208. }
  209. req, _ := c.DescribeAlarmHistoryRequest(inCpy)
  210. req.SetContext(ctx)
  211. req.ApplyOptions(opts...)
  212. return req, nil
  213. },
  214. }
  215. cont := true
  216. for p.Next() && cont {
  217. cont = fn(p.Page().(*DescribeAlarmHistoryOutput), !p.HasNextPage())
  218. }
  219. return p.Err()
  220. }
  221. const opDescribeAlarms = "DescribeAlarms"
  222. // DescribeAlarmsRequest generates a "aws/request.Request" representing the
  223. // client's request for the DescribeAlarms operation. The "output" return
  224. // value can be used to capture response data after the request's "Send" method
  225. // is called.
  226. //
  227. // See DescribeAlarms for usage and error information.
  228. //
  229. // Creating a request object using this method should be used when you want to inject
  230. // custom logic into the request's lifecycle using a custom handler, or if you want to
  231. // access properties on the request object before or after sending the request. If
  232. // you just want the service response, call the DescribeAlarms method directly
  233. // instead.
  234. //
  235. // Note: You must call the "Send" method on the returned request object in order
  236. // to execute the request.
  237. //
  238. // // Example sending a request using the DescribeAlarmsRequest method.
  239. // req, resp := client.DescribeAlarmsRequest(params)
  240. //
  241. // err := req.Send()
  242. // if err == nil { // resp is now filled
  243. // fmt.Println(resp)
  244. // }
  245. //
  246. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarms
  247. func (c *CloudWatch) DescribeAlarmsRequest(input *DescribeAlarmsInput) (req *request.Request, output *DescribeAlarmsOutput) {
  248. op := &request.Operation{
  249. Name: opDescribeAlarms,
  250. HTTPMethod: "POST",
  251. HTTPPath: "/",
  252. Paginator: &request.Paginator{
  253. InputTokens: []string{"NextToken"},
  254. OutputTokens: []string{"NextToken"},
  255. LimitToken: "MaxRecords",
  256. TruncationToken: "",
  257. },
  258. }
  259. if input == nil {
  260. input = &DescribeAlarmsInput{}
  261. }
  262. output = &DescribeAlarmsOutput{}
  263. req = c.newRequest(op, input, output)
  264. return
  265. }
  266. // DescribeAlarms API operation for Amazon CloudWatch.
  267. //
  268. // Retrieves the specified alarms. If no alarms are specified, all alarms are
  269. // returned. Alarms can be retrieved by using only a prefix for the alarm name,
  270. // the alarm state, or a prefix for any action.
  271. //
  272. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  273. // with awserr.Error's Code and Message methods to get detailed information about
  274. // the error.
  275. //
  276. // See the AWS API reference guide for Amazon CloudWatch's
  277. // API operation DescribeAlarms for usage and error information.
  278. //
  279. // Returned Error Codes:
  280. // * ErrCodeInvalidNextToken "InvalidNextToken"
  281. // The next token specified is invalid.
  282. //
  283. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarms
  284. func (c *CloudWatch) DescribeAlarms(input *DescribeAlarmsInput) (*DescribeAlarmsOutput, error) {
  285. req, out := c.DescribeAlarmsRequest(input)
  286. return out, req.Send()
  287. }
  288. // DescribeAlarmsWithContext is the same as DescribeAlarms with the addition of
  289. // the ability to pass a context and additional request options.
  290. //
  291. // See DescribeAlarms for details on how to use this API operation.
  292. //
  293. // The context must be non-nil and will be used for request cancellation. If
  294. // the context is nil a panic will occur. In the future the SDK may create
  295. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  296. // for more information on using Contexts.
  297. func (c *CloudWatch) DescribeAlarmsWithContext(ctx aws.Context, input *DescribeAlarmsInput, opts ...request.Option) (*DescribeAlarmsOutput, error) {
  298. req, out := c.DescribeAlarmsRequest(input)
  299. req.SetContext(ctx)
  300. req.ApplyOptions(opts...)
  301. return out, req.Send()
  302. }
  303. // DescribeAlarmsPages iterates over the pages of a DescribeAlarms operation,
  304. // calling the "fn" function with the response data for each page. To stop
  305. // iterating, return false from the fn function.
  306. //
  307. // See DescribeAlarms method for more information on how to use this operation.
  308. //
  309. // Note: This operation can generate multiple requests to a service.
  310. //
  311. // // Example iterating over at most 3 pages of a DescribeAlarms operation.
  312. // pageNum := 0
  313. // err := client.DescribeAlarmsPages(params,
  314. // func(page *DescribeAlarmsOutput, lastPage bool) bool {
  315. // pageNum++
  316. // fmt.Println(page)
  317. // return pageNum <= 3
  318. // })
  319. //
  320. func (c *CloudWatch) DescribeAlarmsPages(input *DescribeAlarmsInput, fn func(*DescribeAlarmsOutput, bool) bool) error {
  321. return c.DescribeAlarmsPagesWithContext(aws.BackgroundContext(), input, fn)
  322. }
  323. // DescribeAlarmsPagesWithContext same as DescribeAlarmsPages except
  324. // it takes a Context and allows setting request options on the pages.
  325. //
  326. // The context must be non-nil and will be used for request cancellation. If
  327. // the context is nil a panic will occur. In the future the SDK may create
  328. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  329. // for more information on using Contexts.
  330. func (c *CloudWatch) DescribeAlarmsPagesWithContext(ctx aws.Context, input *DescribeAlarmsInput, fn func(*DescribeAlarmsOutput, bool) bool, opts ...request.Option) error {
  331. p := request.Pagination{
  332. NewRequest: func() (*request.Request, error) {
  333. var inCpy *DescribeAlarmsInput
  334. if input != nil {
  335. tmp := *input
  336. inCpy = &tmp
  337. }
  338. req, _ := c.DescribeAlarmsRequest(inCpy)
  339. req.SetContext(ctx)
  340. req.ApplyOptions(opts...)
  341. return req, nil
  342. },
  343. }
  344. cont := true
  345. for p.Next() && cont {
  346. cont = fn(p.Page().(*DescribeAlarmsOutput), !p.HasNextPage())
  347. }
  348. return p.Err()
  349. }
  350. const opDescribeAlarmsForMetric = "DescribeAlarmsForMetric"
  351. // DescribeAlarmsForMetricRequest generates a "aws/request.Request" representing the
  352. // client's request for the DescribeAlarmsForMetric operation. The "output" return
  353. // value can be used to capture response data after the request's "Send" method
  354. // is called.
  355. //
  356. // See DescribeAlarmsForMetric for usage and error information.
  357. //
  358. // Creating a request object using this method should be used when you want to inject
  359. // custom logic into the request's lifecycle using a custom handler, or if you want to
  360. // access properties on the request object before or after sending the request. If
  361. // you just want the service response, call the DescribeAlarmsForMetric method directly
  362. // instead.
  363. //
  364. // Note: You must call the "Send" method on the returned request object in order
  365. // to execute the request.
  366. //
  367. // // Example sending a request using the DescribeAlarmsForMetricRequest method.
  368. // req, resp := client.DescribeAlarmsForMetricRequest(params)
  369. //
  370. // err := req.Send()
  371. // if err == nil { // resp is now filled
  372. // fmt.Println(resp)
  373. // }
  374. //
  375. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmsForMetric
  376. func (c *CloudWatch) DescribeAlarmsForMetricRequest(input *DescribeAlarmsForMetricInput) (req *request.Request, output *DescribeAlarmsForMetricOutput) {
  377. op := &request.Operation{
  378. Name: opDescribeAlarmsForMetric,
  379. HTTPMethod: "POST",
  380. HTTPPath: "/",
  381. }
  382. if input == nil {
  383. input = &DescribeAlarmsForMetricInput{}
  384. }
  385. output = &DescribeAlarmsForMetricOutput{}
  386. req = c.newRequest(op, input, output)
  387. return
  388. }
  389. // DescribeAlarmsForMetric API operation for Amazon CloudWatch.
  390. //
  391. // Retrieves the alarms for the specified metric. Specify a statistic, period,
  392. // or unit to filter the results.
  393. //
  394. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  395. // with awserr.Error's Code and Message methods to get detailed information about
  396. // the error.
  397. //
  398. // See the AWS API reference guide for Amazon CloudWatch's
  399. // API operation DescribeAlarmsForMetric for usage and error information.
  400. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmsForMetric
  401. func (c *CloudWatch) DescribeAlarmsForMetric(input *DescribeAlarmsForMetricInput) (*DescribeAlarmsForMetricOutput, error) {
  402. req, out := c.DescribeAlarmsForMetricRequest(input)
  403. return out, req.Send()
  404. }
  405. // DescribeAlarmsForMetricWithContext is the same as DescribeAlarmsForMetric with the addition of
  406. // the ability to pass a context and additional request options.
  407. //
  408. // See DescribeAlarmsForMetric for details on how to use this API operation.
  409. //
  410. // The context must be non-nil and will be used for request cancellation. If
  411. // the context is nil a panic will occur. In the future the SDK may create
  412. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  413. // for more information on using Contexts.
  414. func (c *CloudWatch) DescribeAlarmsForMetricWithContext(ctx aws.Context, input *DescribeAlarmsForMetricInput, opts ...request.Option) (*DescribeAlarmsForMetricOutput, error) {
  415. req, out := c.DescribeAlarmsForMetricRequest(input)
  416. req.SetContext(ctx)
  417. req.ApplyOptions(opts...)
  418. return out, req.Send()
  419. }
  420. const opDisableAlarmActions = "DisableAlarmActions"
  421. // DisableAlarmActionsRequest generates a "aws/request.Request" representing the
  422. // client's request for the DisableAlarmActions operation. The "output" return
  423. // value can be used to capture response data after the request's "Send" method
  424. // is called.
  425. //
  426. // See DisableAlarmActions for usage and error information.
  427. //
  428. // Creating a request object using this method should be used when you want to inject
  429. // custom logic into the request's lifecycle using a custom handler, or if you want to
  430. // access properties on the request object before or after sending the request. If
  431. // you just want the service response, call the DisableAlarmActions method directly
  432. // instead.
  433. //
  434. // Note: You must call the "Send" method on the returned request object in order
  435. // to execute the request.
  436. //
  437. // // Example sending a request using the DisableAlarmActionsRequest method.
  438. // req, resp := client.DisableAlarmActionsRequest(params)
  439. //
  440. // err := req.Send()
  441. // if err == nil { // resp is now filled
  442. // fmt.Println(resp)
  443. // }
  444. //
  445. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DisableAlarmActions
  446. func (c *CloudWatch) DisableAlarmActionsRequest(input *DisableAlarmActionsInput) (req *request.Request, output *DisableAlarmActionsOutput) {
  447. op := &request.Operation{
  448. Name: opDisableAlarmActions,
  449. HTTPMethod: "POST",
  450. HTTPPath: "/",
  451. }
  452. if input == nil {
  453. input = &DisableAlarmActionsInput{}
  454. }
  455. output = &DisableAlarmActionsOutput{}
  456. req = c.newRequest(op, input, output)
  457. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  458. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  459. return
  460. }
  461. // DisableAlarmActions API operation for Amazon CloudWatch.
  462. //
  463. // Disables the actions for the specified alarms. When an alarm's actions are
  464. // disabled, the alarm actions do not execute when the alarm state changes.
  465. //
  466. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  467. // with awserr.Error's Code and Message methods to get detailed information about
  468. // the error.
  469. //
  470. // See the AWS API reference guide for Amazon CloudWatch's
  471. // API operation DisableAlarmActions for usage and error information.
  472. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DisableAlarmActions
  473. func (c *CloudWatch) DisableAlarmActions(input *DisableAlarmActionsInput) (*DisableAlarmActionsOutput, error) {
  474. req, out := c.DisableAlarmActionsRequest(input)
  475. return out, req.Send()
  476. }
  477. // DisableAlarmActionsWithContext is the same as DisableAlarmActions with the addition of
  478. // the ability to pass a context and additional request options.
  479. //
  480. // See DisableAlarmActions for details on how to use this API operation.
  481. //
  482. // The context must be non-nil and will be used for request cancellation. If
  483. // the context is nil a panic will occur. In the future the SDK may create
  484. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  485. // for more information on using Contexts.
  486. func (c *CloudWatch) DisableAlarmActionsWithContext(ctx aws.Context, input *DisableAlarmActionsInput, opts ...request.Option) (*DisableAlarmActionsOutput, error) {
  487. req, out := c.DisableAlarmActionsRequest(input)
  488. req.SetContext(ctx)
  489. req.ApplyOptions(opts...)
  490. return out, req.Send()
  491. }
  492. const opEnableAlarmActions = "EnableAlarmActions"
  493. // EnableAlarmActionsRequest generates a "aws/request.Request" representing the
  494. // client's request for the EnableAlarmActions operation. The "output" return
  495. // value can be used to capture response data after the request's "Send" method
  496. // is called.
  497. //
  498. // See EnableAlarmActions for usage and error information.
  499. //
  500. // Creating a request object using this method should be used when you want to inject
  501. // custom logic into the request's lifecycle using a custom handler, or if you want to
  502. // access properties on the request object before or after sending the request. If
  503. // you just want the service response, call the EnableAlarmActions method directly
  504. // instead.
  505. //
  506. // Note: You must call the "Send" method on the returned request object in order
  507. // to execute the request.
  508. //
  509. // // Example sending a request using the EnableAlarmActionsRequest method.
  510. // req, resp := client.EnableAlarmActionsRequest(params)
  511. //
  512. // err := req.Send()
  513. // if err == nil { // resp is now filled
  514. // fmt.Println(resp)
  515. // }
  516. //
  517. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/EnableAlarmActions
  518. func (c *CloudWatch) EnableAlarmActionsRequest(input *EnableAlarmActionsInput) (req *request.Request, output *EnableAlarmActionsOutput) {
  519. op := &request.Operation{
  520. Name: opEnableAlarmActions,
  521. HTTPMethod: "POST",
  522. HTTPPath: "/",
  523. }
  524. if input == nil {
  525. input = &EnableAlarmActionsInput{}
  526. }
  527. output = &EnableAlarmActionsOutput{}
  528. req = c.newRequest(op, input, output)
  529. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  530. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  531. return
  532. }
  533. // EnableAlarmActions API operation for Amazon CloudWatch.
  534. //
  535. // Enables the actions for the specified alarms.
  536. //
  537. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  538. // with awserr.Error's Code and Message methods to get detailed information about
  539. // the error.
  540. //
  541. // See the AWS API reference guide for Amazon CloudWatch's
  542. // API operation EnableAlarmActions for usage and error information.
  543. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/EnableAlarmActions
  544. func (c *CloudWatch) EnableAlarmActions(input *EnableAlarmActionsInput) (*EnableAlarmActionsOutput, error) {
  545. req, out := c.EnableAlarmActionsRequest(input)
  546. return out, req.Send()
  547. }
  548. // EnableAlarmActionsWithContext is the same as EnableAlarmActions with the addition of
  549. // the ability to pass a context and additional request options.
  550. //
  551. // See EnableAlarmActions for details on how to use this API operation.
  552. //
  553. // The context must be non-nil and will be used for request cancellation. If
  554. // the context is nil a panic will occur. In the future the SDK may create
  555. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  556. // for more information on using Contexts.
  557. func (c *CloudWatch) EnableAlarmActionsWithContext(ctx aws.Context, input *EnableAlarmActionsInput, opts ...request.Option) (*EnableAlarmActionsOutput, error) {
  558. req, out := c.EnableAlarmActionsRequest(input)
  559. req.SetContext(ctx)
  560. req.ApplyOptions(opts...)
  561. return out, req.Send()
  562. }
  563. const opGetMetricStatistics = "GetMetricStatistics"
  564. // GetMetricStatisticsRequest generates a "aws/request.Request" representing the
  565. // client's request for the GetMetricStatistics operation. The "output" return
  566. // value can be used to capture response data after the request's "Send" method
  567. // is called.
  568. //
  569. // See GetMetricStatistics for usage and error information.
  570. //
  571. // Creating a request object using this method should be used when you want to inject
  572. // custom logic into the request's lifecycle using a custom handler, or if you want to
  573. // access properties on the request object before or after sending the request. If
  574. // you just want the service response, call the GetMetricStatistics method directly
  575. // instead.
  576. //
  577. // Note: You must call the "Send" method on the returned request object in order
  578. // to execute the request.
  579. //
  580. // // Example sending a request using the GetMetricStatisticsRequest method.
  581. // req, resp := client.GetMetricStatisticsRequest(params)
  582. //
  583. // err := req.Send()
  584. // if err == nil { // resp is now filled
  585. // fmt.Println(resp)
  586. // }
  587. //
  588. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricStatistics
  589. func (c *CloudWatch) GetMetricStatisticsRequest(input *GetMetricStatisticsInput) (req *request.Request, output *GetMetricStatisticsOutput) {
  590. op := &request.Operation{
  591. Name: opGetMetricStatistics,
  592. HTTPMethod: "POST",
  593. HTTPPath: "/",
  594. }
  595. if input == nil {
  596. input = &GetMetricStatisticsInput{}
  597. }
  598. output = &GetMetricStatisticsOutput{}
  599. req = c.newRequest(op, input, output)
  600. return
  601. }
  602. // GetMetricStatistics API operation for Amazon CloudWatch.
  603. //
  604. // Gets statistics for the specified metric.
  605. //
  606. // Amazon CloudWatch retains metric data as follows:
  607. //
  608. // * Data points with a period of 60 seconds (1 minute) are available for
  609. // 15 days
  610. //
  611. // * Data points with a period of 300 seconds (5 minute) are available for
  612. // 63 days
  613. //
  614. // * Data points with a period of 3600 seconds (1 hour) are available for
  615. // 455 days (15 months)
  616. //
  617. // Note that CloudWatch started retaining 5-minute and 1-hour metric data as
  618. // of 9 July 2016.
  619. //
  620. // The maximum number of data points returned from a single call is 1,440. If
  621. // you request more than 1,440 data points, Amazon CloudWatch returns an error.
  622. // To reduce the number of data points, you can narrow the specified time range
  623. // and make multiple requests across adjacent time ranges, or you can increase
  624. // the specified period. A period can be as short as one minute (60 seconds).
  625. // Note that data points are not returned in chronological order.
  626. //
  627. // Amazon CloudWatch aggregates data points based on the length of the period
  628. // that you specify. For example, if you request statistics with a one-hour
  629. // period, Amazon CloudWatch aggregates all data points with time stamps that
  630. // fall within each one-hour period. Therefore, the number of values aggregated
  631. // by CloudWatch is larger than the number of data points returned.
  632. //
  633. // CloudWatch needs raw data points to calculate percentile statistics. If you
  634. // publish data using a statistic set instead, you cannot retrieve percentile
  635. // statistics for this data unless one of the following conditions is true:
  636. //
  637. // * The SampleCount of the statistic set is 1
  638. //
  639. // * The Min and the Max of the statistic set are equal
  640. //
  641. // For a list of metrics and dimensions supported by AWS services, see the Amazon
  642. // CloudWatch Metrics and Dimensions Reference (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CW_Support_For_AWS.html)
  643. // in the Amazon CloudWatch User Guide.
  644. //
  645. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  646. // with awserr.Error's Code and Message methods to get detailed information about
  647. // the error.
  648. //
  649. // See the AWS API reference guide for Amazon CloudWatch's
  650. // API operation GetMetricStatistics for usage and error information.
  651. //
  652. // Returned Error Codes:
  653. // * ErrCodeInvalidParameterValueException "InvalidParameterValue"
  654. // The value of an input parameter is bad or out-of-range.
  655. //
  656. // * ErrCodeMissingRequiredParameterException "MissingParameter"
  657. // An input parameter that is required is missing.
  658. //
  659. // * ErrCodeInvalidParameterCombinationException "InvalidParameterCombination"
  660. // Parameters that cannot be used together were used together.
  661. //
  662. // * ErrCodeInternalServiceFault "InternalServiceError"
  663. // Request processing has failed due to some unknown error, exception, or failure.
  664. //
  665. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricStatistics
  666. func (c *CloudWatch) GetMetricStatistics(input *GetMetricStatisticsInput) (*GetMetricStatisticsOutput, error) {
  667. req, out := c.GetMetricStatisticsRequest(input)
  668. return out, req.Send()
  669. }
  670. // GetMetricStatisticsWithContext is the same as GetMetricStatistics with the addition of
  671. // the ability to pass a context and additional request options.
  672. //
  673. // See GetMetricStatistics for details on how to use this API operation.
  674. //
  675. // The context must be non-nil and will be used for request cancellation. If
  676. // the context is nil a panic will occur. In the future the SDK may create
  677. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  678. // for more information on using Contexts.
  679. func (c *CloudWatch) GetMetricStatisticsWithContext(ctx aws.Context, input *GetMetricStatisticsInput, opts ...request.Option) (*GetMetricStatisticsOutput, error) {
  680. req, out := c.GetMetricStatisticsRequest(input)
  681. req.SetContext(ctx)
  682. req.ApplyOptions(opts...)
  683. return out, req.Send()
  684. }
  685. const opListMetrics = "ListMetrics"
  686. // ListMetricsRequest generates a "aws/request.Request" representing the
  687. // client's request for the ListMetrics operation. The "output" return
  688. // value can be used to capture response data after the request's "Send" method
  689. // is called.
  690. //
  691. // See ListMetrics for usage and error information.
  692. //
  693. // Creating a request object using this method should be used when you want to inject
  694. // custom logic into the request's lifecycle using a custom handler, or if you want to
  695. // access properties on the request object before or after sending the request. If
  696. // you just want the service response, call the ListMetrics method directly
  697. // instead.
  698. //
  699. // Note: You must call the "Send" method on the returned request object in order
  700. // to execute the request.
  701. //
  702. // // Example sending a request using the ListMetricsRequest method.
  703. // req, resp := client.ListMetricsRequest(params)
  704. //
  705. // err := req.Send()
  706. // if err == nil { // resp is now filled
  707. // fmt.Println(resp)
  708. // }
  709. //
  710. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetrics
  711. func (c *CloudWatch) ListMetricsRequest(input *ListMetricsInput) (req *request.Request, output *ListMetricsOutput) {
  712. op := &request.Operation{
  713. Name: opListMetrics,
  714. HTTPMethod: "POST",
  715. HTTPPath: "/",
  716. Paginator: &request.Paginator{
  717. InputTokens: []string{"NextToken"},
  718. OutputTokens: []string{"NextToken"},
  719. LimitToken: "",
  720. TruncationToken: "",
  721. },
  722. }
  723. if input == nil {
  724. input = &ListMetricsInput{}
  725. }
  726. output = &ListMetricsOutput{}
  727. req = c.newRequest(op, input, output)
  728. return
  729. }
  730. // ListMetrics API operation for Amazon CloudWatch.
  731. //
  732. // List the specified metrics. You can use the returned metrics with GetMetricStatistics
  733. // to obtain statistical data.
  734. //
  735. // Up to 500 results are returned for any one call. To retrieve additional results,
  736. // use the returned token with subsequent calls.
  737. //
  738. // After you create a metric, allow up to fifteen minutes before the metric
  739. // appears. Statistics about the metric, however, are available sooner using
  740. // GetMetricStatistics.
  741. //
  742. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  743. // with awserr.Error's Code and Message methods to get detailed information about
  744. // the error.
  745. //
  746. // See the AWS API reference guide for Amazon CloudWatch's
  747. // API operation ListMetrics for usage and error information.
  748. //
  749. // Returned Error Codes:
  750. // * ErrCodeInternalServiceFault "InternalServiceError"
  751. // Request processing has failed due to some unknown error, exception, or failure.
  752. //
  753. // * ErrCodeInvalidParameterValueException "InvalidParameterValue"
  754. // The value of an input parameter is bad or out-of-range.
  755. //
  756. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetrics
  757. func (c *CloudWatch) ListMetrics(input *ListMetricsInput) (*ListMetricsOutput, error) {
  758. req, out := c.ListMetricsRequest(input)
  759. return out, req.Send()
  760. }
  761. // ListMetricsWithContext is the same as ListMetrics with the addition of
  762. // the ability to pass a context and additional request options.
  763. //
  764. // See ListMetrics for details on how to use this API operation.
  765. //
  766. // The context must be non-nil and will be used for request cancellation. If
  767. // the context is nil a panic will occur. In the future the SDK may create
  768. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  769. // for more information on using Contexts.
  770. func (c *CloudWatch) ListMetricsWithContext(ctx aws.Context, input *ListMetricsInput, opts ...request.Option) (*ListMetricsOutput, error) {
  771. req, out := c.ListMetricsRequest(input)
  772. req.SetContext(ctx)
  773. req.ApplyOptions(opts...)
  774. return out, req.Send()
  775. }
  776. // ListMetricsPages iterates over the pages of a ListMetrics operation,
  777. // calling the "fn" function with the response data for each page. To stop
  778. // iterating, return false from the fn function.
  779. //
  780. // See ListMetrics method for more information on how to use this operation.
  781. //
  782. // Note: This operation can generate multiple requests to a service.
  783. //
  784. // // Example iterating over at most 3 pages of a ListMetrics operation.
  785. // pageNum := 0
  786. // err := client.ListMetricsPages(params,
  787. // func(page *ListMetricsOutput, lastPage bool) bool {
  788. // pageNum++
  789. // fmt.Println(page)
  790. // return pageNum <= 3
  791. // })
  792. //
  793. func (c *CloudWatch) ListMetricsPages(input *ListMetricsInput, fn func(*ListMetricsOutput, bool) bool) error {
  794. return c.ListMetricsPagesWithContext(aws.BackgroundContext(), input, fn)
  795. }
  796. // ListMetricsPagesWithContext same as ListMetricsPages except
  797. // it takes a Context and allows setting request options on the pages.
  798. //
  799. // The context must be non-nil and will be used for request cancellation. If
  800. // the context is nil a panic will occur. In the future the SDK may create
  801. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  802. // for more information on using Contexts.
  803. func (c *CloudWatch) ListMetricsPagesWithContext(ctx aws.Context, input *ListMetricsInput, fn func(*ListMetricsOutput, bool) bool, opts ...request.Option) error {
  804. p := request.Pagination{
  805. NewRequest: func() (*request.Request, error) {
  806. var inCpy *ListMetricsInput
  807. if input != nil {
  808. tmp := *input
  809. inCpy = &tmp
  810. }
  811. req, _ := c.ListMetricsRequest(inCpy)
  812. req.SetContext(ctx)
  813. req.ApplyOptions(opts...)
  814. return req, nil
  815. },
  816. }
  817. cont := true
  818. for p.Next() && cont {
  819. cont = fn(p.Page().(*ListMetricsOutput), !p.HasNextPage())
  820. }
  821. return p.Err()
  822. }
  823. const opPutMetricAlarm = "PutMetricAlarm"
  824. // PutMetricAlarmRequest generates a "aws/request.Request" representing the
  825. // client's request for the PutMetricAlarm operation. The "output" return
  826. // value can be used to capture response data after the request's "Send" method
  827. // is called.
  828. //
  829. // See PutMetricAlarm for usage and error information.
  830. //
  831. // Creating a request object using this method should be used when you want to inject
  832. // custom logic into the request's lifecycle using a custom handler, or if you want to
  833. // access properties on the request object before or after sending the request. If
  834. // you just want the service response, call the PutMetricAlarm method directly
  835. // instead.
  836. //
  837. // Note: You must call the "Send" method on the returned request object in order
  838. // to execute the request.
  839. //
  840. // // Example sending a request using the PutMetricAlarmRequest method.
  841. // req, resp := client.PutMetricAlarmRequest(params)
  842. //
  843. // err := req.Send()
  844. // if err == nil { // resp is now filled
  845. // fmt.Println(resp)
  846. // }
  847. //
  848. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricAlarm
  849. func (c *CloudWatch) PutMetricAlarmRequest(input *PutMetricAlarmInput) (req *request.Request, output *PutMetricAlarmOutput) {
  850. op := &request.Operation{
  851. Name: opPutMetricAlarm,
  852. HTTPMethod: "POST",
  853. HTTPPath: "/",
  854. }
  855. if input == nil {
  856. input = &PutMetricAlarmInput{}
  857. }
  858. output = &PutMetricAlarmOutput{}
  859. req = c.newRequest(op, input, output)
  860. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  861. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  862. return
  863. }
  864. // PutMetricAlarm API operation for Amazon CloudWatch.
  865. //
  866. // Creates or updates an alarm and associates it with the specified metric.
  867. // Optionally, this operation can associate one or more Amazon SNS resources
  868. // with the alarm.
  869. //
  870. // When this operation creates an alarm, the alarm state is immediately set
  871. // to INSUFFICIENT_DATA. The alarm is evaluated and its state is set appropriately.
  872. // Any actions associated with the state are then executed.
  873. //
  874. // When you update an existing alarm, its state is left unchanged, but the update
  875. // completely overwrites the previous configuration of the alarm.
  876. //
  877. // If you are an AWS Identity and Access Management (IAM) user, you must have
  878. // Amazon EC2 permissions for some operations:
  879. //
  880. // * ec2:DescribeInstanceStatus and ec2:DescribeInstances for all alarms
  881. // on EC2 instance status metrics
  882. //
  883. // * ec2:StopInstances for alarms with stop actions
  884. //
  885. // * ec2:TerminateInstances for alarms with terminate actions
  886. //
  887. // * ec2:DescribeInstanceRecoveryAttribute and ec2:RecoverInstances for alarms
  888. // with recover actions
  889. //
  890. // If you have read/write permissions for Amazon CloudWatch but not for Amazon
  891. // EC2, you can still create an alarm, but the stop or terminate actions won't
  892. // be performed. However, if you are later granted the required permissions,
  893. // the alarm actions that you created earlier will be performed.
  894. //
  895. // If you are using an IAM role (for example, an Amazon EC2 instance profile),
  896. // you cannot stop or terminate the instance using alarm actions. However, you
  897. // can still see the alarm state and perform any other actions such as Amazon
  898. // SNS notifications or Auto Scaling policies.
  899. //
  900. // If you are using temporary security credentials granted using the AWS Security
  901. // Token Service (AWS STS), you cannot stop or terminate an Amazon EC2 instance
  902. // using alarm actions.
  903. //
  904. // Note that you must create at least one stop, terminate, or reboot alarm using
  905. // the Amazon EC2 or CloudWatch console to create the EC2ActionsAccess IAM role.
  906. // After this IAM role is created, you can create stop, terminate, or reboot
  907. // alarms using a command-line interface or an API.
  908. //
  909. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  910. // with awserr.Error's Code and Message methods to get detailed information about
  911. // the error.
  912. //
  913. // See the AWS API reference guide for Amazon CloudWatch's
  914. // API operation PutMetricAlarm for usage and error information.
  915. //
  916. // Returned Error Codes:
  917. // * ErrCodeLimitExceededFault "LimitExceeded"
  918. // The quota for alarms for this customer has already been reached.
  919. //
  920. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricAlarm
  921. func (c *CloudWatch) PutMetricAlarm(input *PutMetricAlarmInput) (*PutMetricAlarmOutput, error) {
  922. req, out := c.PutMetricAlarmRequest(input)
  923. return out, req.Send()
  924. }
  925. // PutMetricAlarmWithContext is the same as PutMetricAlarm with the addition of
  926. // the ability to pass a context and additional request options.
  927. //
  928. // See PutMetricAlarm for details on how to use this API operation.
  929. //
  930. // The context must be non-nil and will be used for request cancellation. If
  931. // the context is nil a panic will occur. In the future the SDK may create
  932. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  933. // for more information on using Contexts.
  934. func (c *CloudWatch) PutMetricAlarmWithContext(ctx aws.Context, input *PutMetricAlarmInput, opts ...request.Option) (*PutMetricAlarmOutput, error) {
  935. req, out := c.PutMetricAlarmRequest(input)
  936. req.SetContext(ctx)
  937. req.ApplyOptions(opts...)
  938. return out, req.Send()
  939. }
  940. const opPutMetricData = "PutMetricData"
  941. // PutMetricDataRequest generates a "aws/request.Request" representing the
  942. // client's request for the PutMetricData operation. The "output" return
  943. // value can be used to capture response data after the request's "Send" method
  944. // is called.
  945. //
  946. // See PutMetricData for usage and error information.
  947. //
  948. // Creating a request object using this method should be used when you want to inject
  949. // custom logic into the request's lifecycle using a custom handler, or if you want to
  950. // access properties on the request object before or after sending the request. If
  951. // you just want the service response, call the PutMetricData method directly
  952. // instead.
  953. //
  954. // Note: You must call the "Send" method on the returned request object in order
  955. // to execute the request.
  956. //
  957. // // Example sending a request using the PutMetricDataRequest method.
  958. // req, resp := client.PutMetricDataRequest(params)
  959. //
  960. // err := req.Send()
  961. // if err == nil { // resp is now filled
  962. // fmt.Println(resp)
  963. // }
  964. //
  965. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricData
  966. func (c *CloudWatch) PutMetricDataRequest(input *PutMetricDataInput) (req *request.Request, output *PutMetricDataOutput) {
  967. op := &request.Operation{
  968. Name: opPutMetricData,
  969. HTTPMethod: "POST",
  970. HTTPPath: "/",
  971. }
  972. if input == nil {
  973. input = &PutMetricDataInput{}
  974. }
  975. output = &PutMetricDataOutput{}
  976. req = c.newRequest(op, input, output)
  977. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  978. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  979. return
  980. }
  981. // PutMetricData API operation for Amazon CloudWatch.
  982. //
  983. // Publishes metric data points to Amazon CloudWatch. Amazon CloudWatch associates
  984. // the data points with the specified metric. If the specified metric does not
  985. // exist, Amazon CloudWatch creates the metric. When Amazon CloudWatch creates
  986. // a metric, it can take up to fifteen minutes for the metric to appear in calls
  987. // to ListMetrics.
  988. //
  989. // Each PutMetricData request is limited to 40 KB in size for HTTP POST requests.
  990. //
  991. // Although the Value parameter accepts numbers of type Double, Amazon CloudWatch
  992. // rejects values that are either too small or too large. Values must be in
  993. // the range of 8.515920e-109 to 1.174271e+108 (Base 10) or 2e-360 to 2e360
  994. // (Base 2). In addition, special values (e.g., NaN, +Infinity, -Infinity) are
  995. // not supported.
  996. //
  997. // You can use up to 10 dimensions per metric to further clarify what data the
  998. // metric collects. For more information on specifying dimensions, see Publishing
  999. // Metrics (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html)
  1000. // in the Amazon CloudWatch User Guide.
  1001. //
  1002. // Data points with time stamps from 24 hours ago or longer can take at least
  1003. // 48 hours to become available for GetMetricStatistics from the time they are
  1004. // submitted.
  1005. //
  1006. // CloudWatch needs raw data points to calculate percentile statistics. If you
  1007. // publish data using a statistic set instead, you cannot retrieve percentile
  1008. // statistics for this data unless one of the following conditions is true:
  1009. //
  1010. // * The SampleCount of the statistic set is 1
  1011. //
  1012. // * The Min and the Max of the statistic set are equal
  1013. //
  1014. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1015. // with awserr.Error's Code and Message methods to get detailed information about
  1016. // the error.
  1017. //
  1018. // See the AWS API reference guide for Amazon CloudWatch's
  1019. // API operation PutMetricData for usage and error information.
  1020. //
  1021. // Returned Error Codes:
  1022. // * ErrCodeInvalidParameterValueException "InvalidParameterValue"
  1023. // The value of an input parameter is bad or out-of-range.
  1024. //
  1025. // * ErrCodeMissingRequiredParameterException "MissingParameter"
  1026. // An input parameter that is required is missing.
  1027. //
  1028. // * ErrCodeInvalidParameterCombinationException "InvalidParameterCombination"
  1029. // Parameters that cannot be used together were used together.
  1030. //
  1031. // * ErrCodeInternalServiceFault "InternalServiceError"
  1032. // Request processing has failed due to some unknown error, exception, or failure.
  1033. //
  1034. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricData
  1035. func (c *CloudWatch) PutMetricData(input *PutMetricDataInput) (*PutMetricDataOutput, error) {
  1036. req, out := c.PutMetricDataRequest(input)
  1037. return out, req.Send()
  1038. }
  1039. // PutMetricDataWithContext is the same as PutMetricData with the addition of
  1040. // the ability to pass a context and additional request options.
  1041. //
  1042. // See PutMetricData for details on how to use this API operation.
  1043. //
  1044. // The context must be non-nil and will be used for request cancellation. If
  1045. // the context is nil a panic will occur. In the future the SDK may create
  1046. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1047. // for more information on using Contexts.
  1048. func (c *CloudWatch) PutMetricDataWithContext(ctx aws.Context, input *PutMetricDataInput, opts ...request.Option) (*PutMetricDataOutput, error) {
  1049. req, out := c.PutMetricDataRequest(input)
  1050. req.SetContext(ctx)
  1051. req.ApplyOptions(opts...)
  1052. return out, req.Send()
  1053. }
  1054. const opSetAlarmState = "SetAlarmState"
  1055. // SetAlarmStateRequest generates a "aws/request.Request" representing the
  1056. // client's request for the SetAlarmState operation. The "output" return
  1057. // value can be used to capture response data after the request's "Send" method
  1058. // is called.
  1059. //
  1060. // See SetAlarmState for usage and error information.
  1061. //
  1062. // Creating a request object using this method should be used when you want to inject
  1063. // custom logic into the request's lifecycle using a custom handler, or if you want to
  1064. // access properties on the request object before or after sending the request. If
  1065. // you just want the service response, call the SetAlarmState method directly
  1066. // instead.
  1067. //
  1068. // Note: You must call the "Send" method on the returned request object in order
  1069. // to execute the request.
  1070. //
  1071. // // Example sending a request using the SetAlarmStateRequest method.
  1072. // req, resp := client.SetAlarmStateRequest(params)
  1073. //
  1074. // err := req.Send()
  1075. // if err == nil { // resp is now filled
  1076. // fmt.Println(resp)
  1077. // }
  1078. //
  1079. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/SetAlarmState
  1080. func (c *CloudWatch) SetAlarmStateRequest(input *SetAlarmStateInput) (req *request.Request, output *SetAlarmStateOutput) {
  1081. op := &request.Operation{
  1082. Name: opSetAlarmState,
  1083. HTTPMethod: "POST",
  1084. HTTPPath: "/",
  1085. }
  1086. if input == nil {
  1087. input = &SetAlarmStateInput{}
  1088. }
  1089. output = &SetAlarmStateOutput{}
  1090. req = c.newRequest(op, input, output)
  1091. req.Handlers.Unmarshal.Remove(query.UnmarshalHandler)
  1092. req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
  1093. return
  1094. }
  1095. // SetAlarmState API operation for Amazon CloudWatch.
  1096. //
  1097. // Temporarily sets the state of an alarm for testing purposes. When the updated
  1098. // state differs from the previous value, the action configured for the appropriate
  1099. // state is invoked. For example, if your alarm is configured to send an Amazon
  1100. // SNS message when an alarm is triggered, temporarily changing the alarm state
  1101. // to ALARM sends an Amazon SNS message. The alarm returns to its actual state
  1102. // (often within seconds). Because the alarm state change happens very quickly,
  1103. // it is typically only visible in the alarm's History tab in the Amazon CloudWatch
  1104. // console or through DescribeAlarmHistory.
  1105. //
  1106. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1107. // with awserr.Error's Code and Message methods to get detailed information about
  1108. // the error.
  1109. //
  1110. // See the AWS API reference guide for Amazon CloudWatch's
  1111. // API operation SetAlarmState for usage and error information.
  1112. //
  1113. // Returned Error Codes:
  1114. // * ErrCodeResourceNotFound "ResourceNotFound"
  1115. // The named resource does not exist.
  1116. //
  1117. // * ErrCodeInvalidFormatFault "InvalidFormat"
  1118. // Data was not syntactically valid JSON.
  1119. //
  1120. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/SetAlarmState
  1121. func (c *CloudWatch) SetAlarmState(input *SetAlarmStateInput) (*SetAlarmStateOutput, error) {
  1122. req, out := c.SetAlarmStateRequest(input)
  1123. return out, req.Send()
  1124. }
  1125. // SetAlarmStateWithContext is the same as SetAlarmState with the addition of
  1126. // the ability to pass a context and additional request options.
  1127. //
  1128. // See SetAlarmState for details on how to use this API operation.
  1129. //
  1130. // The context must be non-nil and will be used for request cancellation. If
  1131. // the context is nil a panic will occur. In the future the SDK may create
  1132. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1133. // for more information on using Contexts.
  1134. func (c *CloudWatch) SetAlarmStateWithContext(ctx aws.Context, input *SetAlarmStateInput, opts ...request.Option) (*SetAlarmStateOutput, error) {
  1135. req, out := c.SetAlarmStateRequest(input)
  1136. req.SetContext(ctx)
  1137. req.ApplyOptions(opts...)
  1138. return out, req.Send()
  1139. }
  1140. // Represents the history of a specific alarm.
  1141. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/AlarmHistoryItem
  1142. type AlarmHistoryItem struct {
  1143. _ struct{} `type:"structure"`
  1144. // The descriptive name for the alarm.
  1145. AlarmName *string `min:"1" type:"string"`
  1146. // Data about the alarm, in JSON format.
  1147. HistoryData *string `min:"1" type:"string"`
  1148. // The type of alarm history item.
  1149. HistoryItemType *string `type:"string" enum:"HistoryItemType"`
  1150. // A summary of the alarm history, in text format.
  1151. HistorySummary *string `min:"1" type:"string"`
  1152. // The time stamp for the alarm history item.
  1153. Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  1154. }
  1155. // String returns the string representation
  1156. func (s AlarmHistoryItem) String() string {
  1157. return awsutil.Prettify(s)
  1158. }
  1159. // GoString returns the string representation
  1160. func (s AlarmHistoryItem) GoString() string {
  1161. return s.String()
  1162. }
  1163. // SetAlarmName sets the AlarmName field's value.
  1164. func (s *AlarmHistoryItem) SetAlarmName(v string) *AlarmHistoryItem {
  1165. s.AlarmName = &v
  1166. return s
  1167. }
  1168. // SetHistoryData sets the HistoryData field's value.
  1169. func (s *AlarmHistoryItem) SetHistoryData(v string) *AlarmHistoryItem {
  1170. s.HistoryData = &v
  1171. return s
  1172. }
  1173. // SetHistoryItemType sets the HistoryItemType field's value.
  1174. func (s *AlarmHistoryItem) SetHistoryItemType(v string) *AlarmHistoryItem {
  1175. s.HistoryItemType = &v
  1176. return s
  1177. }
  1178. // SetHistorySummary sets the HistorySummary field's value.
  1179. func (s *AlarmHistoryItem) SetHistorySummary(v string) *AlarmHistoryItem {
  1180. s.HistorySummary = &v
  1181. return s
  1182. }
  1183. // SetTimestamp sets the Timestamp field's value.
  1184. func (s *AlarmHistoryItem) SetTimestamp(v time.Time) *AlarmHistoryItem {
  1185. s.Timestamp = &v
  1186. return s
  1187. }
  1188. // Encapsulates the statistical data that Amazon CloudWatch computes from metric
  1189. // data.
  1190. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/Datapoint
  1191. type Datapoint struct {
  1192. _ struct{} `type:"structure"`
  1193. // The average of the metric values that correspond to the data point.
  1194. Average *float64 `type:"double"`
  1195. // The percentile statistic for the data point.
  1196. ExtendedStatistics map[string]*float64 `type:"map"`
  1197. // The maximum metric value for the data point.
  1198. Maximum *float64 `type:"double"`
  1199. // The minimum metric value for the data point.
  1200. Minimum *float64 `type:"double"`
  1201. // The number of metric values that contributed to the aggregate value of this
  1202. // data point.
  1203. SampleCount *float64 `type:"double"`
  1204. // The sum of the metric values for the data point.
  1205. Sum *float64 `type:"double"`
  1206. // The time stamp used for the data point.
  1207. Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  1208. // The standard unit for the data point.
  1209. Unit *string `type:"string" enum:"StandardUnit"`
  1210. }
  1211. // String returns the string representation
  1212. func (s Datapoint) String() string {
  1213. return awsutil.Prettify(s)
  1214. }
  1215. // GoString returns the string representation
  1216. func (s Datapoint) GoString() string {
  1217. return s.String()
  1218. }
  1219. // SetAverage sets the Average field's value.
  1220. func (s *Datapoint) SetAverage(v float64) *Datapoint {
  1221. s.Average = &v
  1222. return s
  1223. }
  1224. // SetExtendedStatistics sets the ExtendedStatistics field's value.
  1225. func (s *Datapoint) SetExtendedStatistics(v map[string]*float64) *Datapoint {
  1226. s.ExtendedStatistics = v
  1227. return s
  1228. }
  1229. // SetMaximum sets the Maximum field's value.
  1230. func (s *Datapoint) SetMaximum(v float64) *Datapoint {
  1231. s.Maximum = &v
  1232. return s
  1233. }
  1234. // SetMinimum sets the Minimum field's value.
  1235. func (s *Datapoint) SetMinimum(v float64) *Datapoint {
  1236. s.Minimum = &v
  1237. return s
  1238. }
  1239. // SetSampleCount sets the SampleCount field's value.
  1240. func (s *Datapoint) SetSampleCount(v float64) *Datapoint {
  1241. s.SampleCount = &v
  1242. return s
  1243. }
  1244. // SetSum sets the Sum field's value.
  1245. func (s *Datapoint) SetSum(v float64) *Datapoint {
  1246. s.Sum = &v
  1247. return s
  1248. }
  1249. // SetTimestamp sets the Timestamp field's value.
  1250. func (s *Datapoint) SetTimestamp(v time.Time) *Datapoint {
  1251. s.Timestamp = &v
  1252. return s
  1253. }
  1254. // SetUnit sets the Unit field's value.
  1255. func (s *Datapoint) SetUnit(v string) *Datapoint {
  1256. s.Unit = &v
  1257. return s
  1258. }
  1259. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAlarmsInput
  1260. type DeleteAlarmsInput struct {
  1261. _ struct{} `type:"structure"`
  1262. // The alarms to be deleted.
  1263. //
  1264. // AlarmNames is a required field
  1265. AlarmNames []*string `type:"list" required:"true"`
  1266. }
  1267. // String returns the string representation
  1268. func (s DeleteAlarmsInput) String() string {
  1269. return awsutil.Prettify(s)
  1270. }
  1271. // GoString returns the string representation
  1272. func (s DeleteAlarmsInput) GoString() string {
  1273. return s.String()
  1274. }
  1275. // Validate inspects the fields of the type to determine if they are valid.
  1276. func (s *DeleteAlarmsInput) Validate() error {
  1277. invalidParams := request.ErrInvalidParams{Context: "DeleteAlarmsInput"}
  1278. if s.AlarmNames == nil {
  1279. invalidParams.Add(request.NewErrParamRequired("AlarmNames"))
  1280. }
  1281. if invalidParams.Len() > 0 {
  1282. return invalidParams
  1283. }
  1284. return nil
  1285. }
  1286. // SetAlarmNames sets the AlarmNames field's value.
  1287. func (s *DeleteAlarmsInput) SetAlarmNames(v []*string) *DeleteAlarmsInput {
  1288. s.AlarmNames = v
  1289. return s
  1290. }
  1291. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DeleteAlarmsOutput
  1292. type DeleteAlarmsOutput struct {
  1293. _ struct{} `type:"structure"`
  1294. }
  1295. // String returns the string representation
  1296. func (s DeleteAlarmsOutput) String() string {
  1297. return awsutil.Prettify(s)
  1298. }
  1299. // GoString returns the string representation
  1300. func (s DeleteAlarmsOutput) GoString() string {
  1301. return s.String()
  1302. }
  1303. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmHistoryInput
  1304. type DescribeAlarmHistoryInput struct {
  1305. _ struct{} `type:"structure"`
  1306. // The name of the alarm.
  1307. AlarmName *string `min:"1" type:"string"`
  1308. // The ending date to retrieve alarm history.
  1309. EndDate *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  1310. // The type of alarm histories to retrieve.
  1311. HistoryItemType *string `type:"string" enum:"HistoryItemType"`
  1312. // The maximum number of alarm history records to retrieve.
  1313. MaxRecords *int64 `min:"1" type:"integer"`
  1314. // The token returned by a previous call to indicate that there is more data
  1315. // available.
  1316. NextToken *string `type:"string"`
  1317. // The starting date to retrieve alarm history.
  1318. StartDate *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  1319. }
  1320. // String returns the string representation
  1321. func (s DescribeAlarmHistoryInput) String() string {
  1322. return awsutil.Prettify(s)
  1323. }
  1324. // GoString returns the string representation
  1325. func (s DescribeAlarmHistoryInput) GoString() string {
  1326. return s.String()
  1327. }
  1328. // Validate inspects the fields of the type to determine if they are valid.
  1329. func (s *DescribeAlarmHistoryInput) Validate() error {
  1330. invalidParams := request.ErrInvalidParams{Context: "DescribeAlarmHistoryInput"}
  1331. if s.AlarmName != nil && len(*s.AlarmName) < 1 {
  1332. invalidParams.Add(request.NewErrParamMinLen("AlarmName", 1))
  1333. }
  1334. if s.MaxRecords != nil && *s.MaxRecords < 1 {
  1335. invalidParams.Add(request.NewErrParamMinValue("MaxRecords", 1))
  1336. }
  1337. if invalidParams.Len() > 0 {
  1338. return invalidParams
  1339. }
  1340. return nil
  1341. }
  1342. // SetAlarmName sets the AlarmName field's value.
  1343. func (s *DescribeAlarmHistoryInput) SetAlarmName(v string) *DescribeAlarmHistoryInput {
  1344. s.AlarmName = &v
  1345. return s
  1346. }
  1347. // SetEndDate sets the EndDate field's value.
  1348. func (s *DescribeAlarmHistoryInput) SetEndDate(v time.Time) *DescribeAlarmHistoryInput {
  1349. s.EndDate = &v
  1350. return s
  1351. }
  1352. // SetHistoryItemType sets the HistoryItemType field's value.
  1353. func (s *DescribeAlarmHistoryInput) SetHistoryItemType(v string) *DescribeAlarmHistoryInput {
  1354. s.HistoryItemType = &v
  1355. return s
  1356. }
  1357. // SetMaxRecords sets the MaxRecords field's value.
  1358. func (s *DescribeAlarmHistoryInput) SetMaxRecords(v int64) *DescribeAlarmHistoryInput {
  1359. s.MaxRecords = &v
  1360. return s
  1361. }
  1362. // SetNextToken sets the NextToken field's value.
  1363. func (s *DescribeAlarmHistoryInput) SetNextToken(v string) *DescribeAlarmHistoryInput {
  1364. s.NextToken = &v
  1365. return s
  1366. }
  1367. // SetStartDate sets the StartDate field's value.
  1368. func (s *DescribeAlarmHistoryInput) SetStartDate(v time.Time) *DescribeAlarmHistoryInput {
  1369. s.StartDate = &v
  1370. return s
  1371. }
  1372. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmHistoryOutput
  1373. type DescribeAlarmHistoryOutput struct {
  1374. _ struct{} `type:"structure"`
  1375. // The alarm histories, in JSON format.
  1376. AlarmHistoryItems []*AlarmHistoryItem `type:"list"`
  1377. // The token that marks the start of the next batch of returned results.
  1378. NextToken *string `type:"string"`
  1379. }
  1380. // String returns the string representation
  1381. func (s DescribeAlarmHistoryOutput) String() string {
  1382. return awsutil.Prettify(s)
  1383. }
  1384. // GoString returns the string representation
  1385. func (s DescribeAlarmHistoryOutput) GoString() string {
  1386. return s.String()
  1387. }
  1388. // SetAlarmHistoryItems sets the AlarmHistoryItems field's value.
  1389. func (s *DescribeAlarmHistoryOutput) SetAlarmHistoryItems(v []*AlarmHistoryItem) *DescribeAlarmHistoryOutput {
  1390. s.AlarmHistoryItems = v
  1391. return s
  1392. }
  1393. // SetNextToken sets the NextToken field's value.
  1394. func (s *DescribeAlarmHistoryOutput) SetNextToken(v string) *DescribeAlarmHistoryOutput {
  1395. s.NextToken = &v
  1396. return s
  1397. }
  1398. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmsForMetricInput
  1399. type DescribeAlarmsForMetricInput struct {
  1400. _ struct{} `type:"structure"`
  1401. // The dimensions associated with the metric. If the metric has any associated
  1402. // dimensions, you must specify them in order for the call to succeed.
  1403. Dimensions []*Dimension `type:"list"`
  1404. // The percentile statistic for the metric. Specify a value between p0.0 and
  1405. // p100.
  1406. ExtendedStatistic *string `type:"string"`
  1407. // The name of the metric.
  1408. //
  1409. // MetricName is a required field
  1410. MetricName *string `min:"1" type:"string" required:"true"`
  1411. // The namespace of the metric.
  1412. //
  1413. // Namespace is a required field
  1414. Namespace *string `min:"1" type:"string" required:"true"`
  1415. // The period, in seconds, over which the statistic is applied.
  1416. Period *int64 `min:"60" type:"integer"`
  1417. // The statistic for the metric, other than percentiles. For percentile statistics,
  1418. // use ExtendedStatistics.
  1419. Statistic *string `type:"string" enum:"Statistic"`
  1420. // The unit for the metric.
  1421. Unit *string `type:"string" enum:"StandardUnit"`
  1422. }
  1423. // String returns the string representation
  1424. func (s DescribeAlarmsForMetricInput) String() string {
  1425. return awsutil.Prettify(s)
  1426. }
  1427. // GoString returns the string representation
  1428. func (s DescribeAlarmsForMetricInput) GoString() string {
  1429. return s.String()
  1430. }
  1431. // Validate inspects the fields of the type to determine if they are valid.
  1432. func (s *DescribeAlarmsForMetricInput) Validate() error {
  1433. invalidParams := request.ErrInvalidParams{Context: "DescribeAlarmsForMetricInput"}
  1434. if s.MetricName == nil {
  1435. invalidParams.Add(request.NewErrParamRequired("MetricName"))
  1436. }
  1437. if s.MetricName != nil && len(*s.MetricName) < 1 {
  1438. invalidParams.Add(request.NewErrParamMinLen("MetricName", 1))
  1439. }
  1440. if s.Namespace == nil {
  1441. invalidParams.Add(request.NewErrParamRequired("Namespace"))
  1442. }
  1443. if s.Namespace != nil && len(*s.Namespace) < 1 {
  1444. invalidParams.Add(request.NewErrParamMinLen("Namespace", 1))
  1445. }
  1446. if s.Period != nil && *s.Period < 60 {
  1447. invalidParams.Add(request.NewErrParamMinValue("Period", 60))
  1448. }
  1449. if s.Dimensions != nil {
  1450. for i, v := range s.Dimensions {
  1451. if v == nil {
  1452. continue
  1453. }
  1454. if err := v.Validate(); err != nil {
  1455. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
  1456. }
  1457. }
  1458. }
  1459. if invalidParams.Len() > 0 {
  1460. return invalidParams
  1461. }
  1462. return nil
  1463. }
  1464. // SetDimensions sets the Dimensions field's value.
  1465. func (s *DescribeAlarmsForMetricInput) SetDimensions(v []*Dimension) *DescribeAlarmsForMetricInput {
  1466. s.Dimensions = v
  1467. return s
  1468. }
  1469. // SetExtendedStatistic sets the ExtendedStatistic field's value.
  1470. func (s *DescribeAlarmsForMetricInput) SetExtendedStatistic(v string) *DescribeAlarmsForMetricInput {
  1471. s.ExtendedStatistic = &v
  1472. return s
  1473. }
  1474. // SetMetricName sets the MetricName field's value.
  1475. func (s *DescribeAlarmsForMetricInput) SetMetricName(v string) *DescribeAlarmsForMetricInput {
  1476. s.MetricName = &v
  1477. return s
  1478. }
  1479. // SetNamespace sets the Namespace field's value.
  1480. func (s *DescribeAlarmsForMetricInput) SetNamespace(v string) *DescribeAlarmsForMetricInput {
  1481. s.Namespace = &v
  1482. return s
  1483. }
  1484. // SetPeriod sets the Period field's value.
  1485. func (s *DescribeAlarmsForMetricInput) SetPeriod(v int64) *DescribeAlarmsForMetricInput {
  1486. s.Period = &v
  1487. return s
  1488. }
  1489. // SetStatistic sets the Statistic field's value.
  1490. func (s *DescribeAlarmsForMetricInput) SetStatistic(v string) *DescribeAlarmsForMetricInput {
  1491. s.Statistic = &v
  1492. return s
  1493. }
  1494. // SetUnit sets the Unit field's value.
  1495. func (s *DescribeAlarmsForMetricInput) SetUnit(v string) *DescribeAlarmsForMetricInput {
  1496. s.Unit = &v
  1497. return s
  1498. }
  1499. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmsForMetricOutput
  1500. type DescribeAlarmsForMetricOutput struct {
  1501. _ struct{} `type:"structure"`
  1502. // The information for each alarm with the specified metric.
  1503. MetricAlarms []*MetricAlarm `type:"list"`
  1504. }
  1505. // String returns the string representation
  1506. func (s DescribeAlarmsForMetricOutput) String() string {
  1507. return awsutil.Prettify(s)
  1508. }
  1509. // GoString returns the string representation
  1510. func (s DescribeAlarmsForMetricOutput) GoString() string {
  1511. return s.String()
  1512. }
  1513. // SetMetricAlarms sets the MetricAlarms field's value.
  1514. func (s *DescribeAlarmsForMetricOutput) SetMetricAlarms(v []*MetricAlarm) *DescribeAlarmsForMetricOutput {
  1515. s.MetricAlarms = v
  1516. return s
  1517. }
  1518. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmsInput
  1519. type DescribeAlarmsInput struct {
  1520. _ struct{} `type:"structure"`
  1521. // The action name prefix.
  1522. ActionPrefix *string `min:"1" type:"string"`
  1523. // The alarm name prefix. You cannot specify AlarmNames if this parameter is
  1524. // specified.
  1525. AlarmNamePrefix *string `min:"1" type:"string"`
  1526. // The names of the alarms.
  1527. AlarmNames []*string `type:"list"`
  1528. // The maximum number of alarm descriptions to retrieve.
  1529. MaxRecords *int64 `min:"1" type:"integer"`
  1530. // The token returned by a previous call to indicate that there is more data
  1531. // available.
  1532. NextToken *string `type:"string"`
  1533. // The state value to be used in matching alarms.
  1534. StateValue *string `type:"string" enum:"StateValue"`
  1535. }
  1536. // String returns the string representation
  1537. func (s DescribeAlarmsInput) String() string {
  1538. return awsutil.Prettify(s)
  1539. }
  1540. // GoString returns the string representation
  1541. func (s DescribeAlarmsInput) GoString() string {
  1542. return s.String()
  1543. }
  1544. // Validate inspects the fields of the type to determine if they are valid.
  1545. func (s *DescribeAlarmsInput) Validate() error {
  1546. invalidParams := request.ErrInvalidParams{Context: "DescribeAlarmsInput"}
  1547. if s.ActionPrefix != nil && len(*s.ActionPrefix) < 1 {
  1548. invalidParams.Add(request.NewErrParamMinLen("ActionPrefix", 1))
  1549. }
  1550. if s.AlarmNamePrefix != nil && len(*s.AlarmNamePrefix) < 1 {
  1551. invalidParams.Add(request.NewErrParamMinLen("AlarmNamePrefix", 1))
  1552. }
  1553. if s.MaxRecords != nil && *s.MaxRecords < 1 {
  1554. invalidParams.Add(request.NewErrParamMinValue("MaxRecords", 1))
  1555. }
  1556. if invalidParams.Len() > 0 {
  1557. return invalidParams
  1558. }
  1559. return nil
  1560. }
  1561. // SetActionPrefix sets the ActionPrefix field's value.
  1562. func (s *DescribeAlarmsInput) SetActionPrefix(v string) *DescribeAlarmsInput {
  1563. s.ActionPrefix = &v
  1564. return s
  1565. }
  1566. // SetAlarmNamePrefix sets the AlarmNamePrefix field's value.
  1567. func (s *DescribeAlarmsInput) SetAlarmNamePrefix(v string) *DescribeAlarmsInput {
  1568. s.AlarmNamePrefix = &v
  1569. return s
  1570. }
  1571. // SetAlarmNames sets the AlarmNames field's value.
  1572. func (s *DescribeAlarmsInput) SetAlarmNames(v []*string) *DescribeAlarmsInput {
  1573. s.AlarmNames = v
  1574. return s
  1575. }
  1576. // SetMaxRecords sets the MaxRecords field's value.
  1577. func (s *DescribeAlarmsInput) SetMaxRecords(v int64) *DescribeAlarmsInput {
  1578. s.MaxRecords = &v
  1579. return s
  1580. }
  1581. // SetNextToken sets the NextToken field's value.
  1582. func (s *DescribeAlarmsInput) SetNextToken(v string) *DescribeAlarmsInput {
  1583. s.NextToken = &v
  1584. return s
  1585. }
  1586. // SetStateValue sets the StateValue field's value.
  1587. func (s *DescribeAlarmsInput) SetStateValue(v string) *DescribeAlarmsInput {
  1588. s.StateValue = &v
  1589. return s
  1590. }
  1591. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DescribeAlarmsOutput
  1592. type DescribeAlarmsOutput struct {
  1593. _ struct{} `type:"structure"`
  1594. // The information for the specified alarms.
  1595. MetricAlarms []*MetricAlarm `type:"list"`
  1596. // The token that marks the start of the next batch of returned results.
  1597. NextToken *string `type:"string"`
  1598. }
  1599. // String returns the string representation
  1600. func (s DescribeAlarmsOutput) String() string {
  1601. return awsutil.Prettify(s)
  1602. }
  1603. // GoString returns the string representation
  1604. func (s DescribeAlarmsOutput) GoString() string {
  1605. return s.String()
  1606. }
  1607. // SetMetricAlarms sets the MetricAlarms field's value.
  1608. func (s *DescribeAlarmsOutput) SetMetricAlarms(v []*MetricAlarm) *DescribeAlarmsOutput {
  1609. s.MetricAlarms = v
  1610. return s
  1611. }
  1612. // SetNextToken sets the NextToken field's value.
  1613. func (s *DescribeAlarmsOutput) SetNextToken(v string) *DescribeAlarmsOutput {
  1614. s.NextToken = &v
  1615. return s
  1616. }
  1617. // Expands the identity of a metric.
  1618. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/Dimension
  1619. type Dimension struct {
  1620. _ struct{} `type:"structure"`
  1621. // The name of the dimension.
  1622. //
  1623. // Name is a required field
  1624. Name *string `min:"1" type:"string" required:"true"`
  1625. // The value representing the dimension measurement.
  1626. //
  1627. // Value is a required field
  1628. Value *string `min:"1" type:"string" required:"true"`
  1629. }
  1630. // String returns the string representation
  1631. func (s Dimension) String() string {
  1632. return awsutil.Prettify(s)
  1633. }
  1634. // GoString returns the string representation
  1635. func (s Dimension) GoString() string {
  1636. return s.String()
  1637. }
  1638. // Validate inspects the fields of the type to determine if they are valid.
  1639. func (s *Dimension) Validate() error {
  1640. invalidParams := request.ErrInvalidParams{Context: "Dimension"}
  1641. if s.Name == nil {
  1642. invalidParams.Add(request.NewErrParamRequired("Name"))
  1643. }
  1644. if s.Name != nil && len(*s.Name) < 1 {
  1645. invalidParams.Add(request.NewErrParamMinLen("Name", 1))
  1646. }
  1647. if s.Value == nil {
  1648. invalidParams.Add(request.NewErrParamRequired("Value"))
  1649. }
  1650. if s.Value != nil && len(*s.Value) < 1 {
  1651. invalidParams.Add(request.NewErrParamMinLen("Value", 1))
  1652. }
  1653. if invalidParams.Len() > 0 {
  1654. return invalidParams
  1655. }
  1656. return nil
  1657. }
  1658. // SetName sets the Name field's value.
  1659. func (s *Dimension) SetName(v string) *Dimension {
  1660. s.Name = &v
  1661. return s
  1662. }
  1663. // SetValue sets the Value field's value.
  1664. func (s *Dimension) SetValue(v string) *Dimension {
  1665. s.Value = &v
  1666. return s
  1667. }
  1668. // Represents filters for a dimension.
  1669. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DimensionFilter
  1670. type DimensionFilter struct {
  1671. _ struct{} `type:"structure"`
  1672. // The dimension name to be matched.
  1673. //
  1674. // Name is a required field
  1675. Name *string `min:"1" type:"string" required:"true"`
  1676. // The value of the dimension to be matched.
  1677. Value *string `min:"1" type:"string"`
  1678. }
  1679. // String returns the string representation
  1680. func (s DimensionFilter) String() string {
  1681. return awsutil.Prettify(s)
  1682. }
  1683. // GoString returns the string representation
  1684. func (s DimensionFilter) GoString() string {
  1685. return s.String()
  1686. }
  1687. // Validate inspects the fields of the type to determine if they are valid.
  1688. func (s *DimensionFilter) Validate() error {
  1689. invalidParams := request.ErrInvalidParams{Context: "DimensionFilter"}
  1690. if s.Name == nil {
  1691. invalidParams.Add(request.NewErrParamRequired("Name"))
  1692. }
  1693. if s.Name != nil && len(*s.Name) < 1 {
  1694. invalidParams.Add(request.NewErrParamMinLen("Name", 1))
  1695. }
  1696. if s.Value != nil && len(*s.Value) < 1 {
  1697. invalidParams.Add(request.NewErrParamMinLen("Value", 1))
  1698. }
  1699. if invalidParams.Len() > 0 {
  1700. return invalidParams
  1701. }
  1702. return nil
  1703. }
  1704. // SetName sets the Name field's value.
  1705. func (s *DimensionFilter) SetName(v string) *DimensionFilter {
  1706. s.Name = &v
  1707. return s
  1708. }
  1709. // SetValue sets the Value field's value.
  1710. func (s *DimensionFilter) SetValue(v string) *DimensionFilter {
  1711. s.Value = &v
  1712. return s
  1713. }
  1714. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DisableAlarmActionsInput
  1715. type DisableAlarmActionsInput struct {
  1716. _ struct{} `type:"structure"`
  1717. // The names of the alarms.
  1718. //
  1719. // AlarmNames is a required field
  1720. AlarmNames []*string `type:"list" required:"true"`
  1721. }
  1722. // String returns the string representation
  1723. func (s DisableAlarmActionsInput) String() string {
  1724. return awsutil.Prettify(s)
  1725. }
  1726. // GoString returns the string representation
  1727. func (s DisableAlarmActionsInput) GoString() string {
  1728. return s.String()
  1729. }
  1730. // Validate inspects the fields of the type to determine if they are valid.
  1731. func (s *DisableAlarmActionsInput) Validate() error {
  1732. invalidParams := request.ErrInvalidParams{Context: "DisableAlarmActionsInput"}
  1733. if s.AlarmNames == nil {
  1734. invalidParams.Add(request.NewErrParamRequired("AlarmNames"))
  1735. }
  1736. if invalidParams.Len() > 0 {
  1737. return invalidParams
  1738. }
  1739. return nil
  1740. }
  1741. // SetAlarmNames sets the AlarmNames field's value.
  1742. func (s *DisableAlarmActionsInput) SetAlarmNames(v []*string) *DisableAlarmActionsInput {
  1743. s.AlarmNames = v
  1744. return s
  1745. }
  1746. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/DisableAlarmActionsOutput
  1747. type DisableAlarmActionsOutput struct {
  1748. _ struct{} `type:"structure"`
  1749. }
  1750. // String returns the string representation
  1751. func (s DisableAlarmActionsOutput) String() string {
  1752. return awsutil.Prettify(s)
  1753. }
  1754. // GoString returns the string representation
  1755. func (s DisableAlarmActionsOutput) GoString() string {
  1756. return s.String()
  1757. }
  1758. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/EnableAlarmActionsInput
  1759. type EnableAlarmActionsInput struct {
  1760. _ struct{} `type:"structure"`
  1761. // The names of the alarms.
  1762. //
  1763. // AlarmNames is a required field
  1764. AlarmNames []*string `type:"list" required:"true"`
  1765. }
  1766. // String returns the string representation
  1767. func (s EnableAlarmActionsInput) String() string {
  1768. return awsutil.Prettify(s)
  1769. }
  1770. // GoString returns the string representation
  1771. func (s EnableAlarmActionsInput) GoString() string {
  1772. return s.String()
  1773. }
  1774. // Validate inspects the fields of the type to determine if they are valid.
  1775. func (s *EnableAlarmActionsInput) Validate() error {
  1776. invalidParams := request.ErrInvalidParams{Context: "EnableAlarmActionsInput"}
  1777. if s.AlarmNames == nil {
  1778. invalidParams.Add(request.NewErrParamRequired("AlarmNames"))
  1779. }
  1780. if invalidParams.Len() > 0 {
  1781. return invalidParams
  1782. }
  1783. return nil
  1784. }
  1785. // SetAlarmNames sets the AlarmNames field's value.
  1786. func (s *EnableAlarmActionsInput) SetAlarmNames(v []*string) *EnableAlarmActionsInput {
  1787. s.AlarmNames = v
  1788. return s
  1789. }
  1790. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/EnableAlarmActionsOutput
  1791. type EnableAlarmActionsOutput struct {
  1792. _ struct{} `type:"structure"`
  1793. }
  1794. // String returns the string representation
  1795. func (s EnableAlarmActionsOutput) String() string {
  1796. return awsutil.Prettify(s)
  1797. }
  1798. // GoString returns the string representation
  1799. func (s EnableAlarmActionsOutput) GoString() string {
  1800. return s.String()
  1801. }
  1802. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricStatisticsInput
  1803. type GetMetricStatisticsInput struct {
  1804. _ struct{} `type:"structure"`
  1805. // The dimensions. If the metric contains multiple dimensions, you must include
  1806. // a value for each dimension. CloudWatch treats each unique combination of
  1807. // dimensions as a separate metric. You can't retrieve statistics using combinations
  1808. // of dimensions that were not specially published. You must specify the same
  1809. // dimensions that were used when the metrics were created. For an example,
  1810. // see Dimension Combinations (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#dimension-combinations)
  1811. // in the Amazon CloudWatch User Guide. For more information on specifying dimensions,
  1812. // see Publishing Metrics (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html)
  1813. // in the Amazon CloudWatch User Guide.
  1814. Dimensions []*Dimension `type:"list"`
  1815. // The time stamp that determines the last data point to return.
  1816. //
  1817. // The value specified is exclusive; results will include data points up to
  1818. // the specified time stamp. The time stamp must be in ISO 8601 UTC format (for
  1819. // example, 2016-10-10T23:00:00Z).
  1820. //
  1821. // EndTime is a required field
  1822. EndTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"`
  1823. // The percentile statistics. Specify values between p0.0 and p100.
  1824. ExtendedStatistics []*string `min:"1" type:"list"`
  1825. // The name of the metric, with or without spaces.
  1826. //
  1827. // MetricName is a required field
  1828. MetricName *string `min:"1" type:"string" required:"true"`
  1829. // The namespace of the metric, with or without spaces.
  1830. //
  1831. // Namespace is a required field
  1832. Namespace *string `min:"1" type:"string" required:"true"`
  1833. // The granularity, in seconds, of the returned data points. A period can be
  1834. // as short as one minute (60 seconds) and must be a multiple of 60. The default
  1835. // value is 60.
  1836. //
  1837. // If the StartTime parameter specifies a time stamp that is greater than 15
  1838. // days ago, you must specify the period as follows or no data points in that
  1839. // time range is returned:
  1840. //
  1841. // * Start time between 15 and 63 days ago - Use a multiple of 300 seconds
  1842. // (5 minutes).
  1843. //
  1844. // * Start time greater than 63 days ago - Use a multiple of 3600 seconds
  1845. // (1 hour).
  1846. //
  1847. // Period is a required field
  1848. Period *int64 `min:"60" type:"integer" required:"true"`
  1849. // The time stamp that determines the first data point to return. Note that
  1850. // start times are evaluated relative to the time that CloudWatch receives the
  1851. // request.
  1852. //
  1853. // The value specified is inclusive; results include data points with the specified
  1854. // time stamp. The time stamp must be in ISO 8601 UTC format (for example, 2016-10-03T23:00:00Z).
  1855. //
  1856. // CloudWatch rounds the specified time stamp as follows:
  1857. //
  1858. // * Start time less than 15 days ago - Round down to the nearest whole minute.
  1859. // For example, 12:32:34 is rounded down to 12:32:00.
  1860. //
  1861. // * Start time between 15 and 63 days ago - Round down to the nearest 5-minute
  1862. // clock interval. For example, 12:32:34 is rounded down to 12:30:00.
  1863. //
  1864. // * Start time greater than 63 days ago - Round down to the nearest 1-hour
  1865. // clock interval. For example, 12:32:34 is rounded down to 12:00:00.
  1866. //
  1867. // StartTime is a required field
  1868. StartTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"`
  1869. // The metric statistics, other than percentile. For percentile statistics,
  1870. // use ExtendedStatistic.
  1871. Statistics []*string `min:"1" type:"list"`
  1872. // The unit for a given metric. Metrics may be reported in multiple units. Not
  1873. // supplying a unit results in all units being returned. If the metric only
  1874. // ever reports one unit, specifying a unit has no effect.
  1875. Unit *string `type:"string" enum:"StandardUnit"`
  1876. }
  1877. // String returns the string representation
  1878. func (s GetMetricStatisticsInput) String() string {
  1879. return awsutil.Prettify(s)
  1880. }
  1881. // GoString returns the string representation
  1882. func (s GetMetricStatisticsInput) GoString() string {
  1883. return s.String()
  1884. }
  1885. // Validate inspects the fields of the type to determine if they are valid.
  1886. func (s *GetMetricStatisticsInput) Validate() error {
  1887. invalidParams := request.ErrInvalidParams{Context: "GetMetricStatisticsInput"}
  1888. if s.EndTime == nil {
  1889. invalidParams.Add(request.NewErrParamRequired("EndTime"))
  1890. }
  1891. if s.ExtendedStatistics != nil && len(s.ExtendedStatistics) < 1 {
  1892. invalidParams.Add(request.NewErrParamMinLen("ExtendedStatistics", 1))
  1893. }
  1894. if s.MetricName == nil {
  1895. invalidParams.Add(request.NewErrParamRequired("MetricName"))
  1896. }
  1897. if s.MetricName != nil && len(*s.MetricName) < 1 {
  1898. invalidParams.Add(request.NewErrParamMinLen("MetricName", 1))
  1899. }
  1900. if s.Namespace == nil {
  1901. invalidParams.Add(request.NewErrParamRequired("Namespace"))
  1902. }
  1903. if s.Namespace != nil && len(*s.Namespace) < 1 {
  1904. invalidParams.Add(request.NewErrParamMinLen("Namespace", 1))
  1905. }
  1906. if s.Period == nil {
  1907. invalidParams.Add(request.NewErrParamRequired("Period"))
  1908. }
  1909. if s.Period != nil && *s.Period < 60 {
  1910. invalidParams.Add(request.NewErrParamMinValue("Period", 60))
  1911. }
  1912. if s.StartTime == nil {
  1913. invalidParams.Add(request.NewErrParamRequired("StartTime"))
  1914. }
  1915. if s.Statistics != nil && len(s.Statistics) < 1 {
  1916. invalidParams.Add(request.NewErrParamMinLen("Statistics", 1))
  1917. }
  1918. if s.Dimensions != nil {
  1919. for i, v := range s.Dimensions {
  1920. if v == nil {
  1921. continue
  1922. }
  1923. if err := v.Validate(); err != nil {
  1924. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
  1925. }
  1926. }
  1927. }
  1928. if invalidParams.Len() > 0 {
  1929. return invalidParams
  1930. }
  1931. return nil
  1932. }
  1933. // SetDimensions sets the Dimensions field's value.
  1934. func (s *GetMetricStatisticsInput) SetDimensions(v []*Dimension) *GetMetricStatisticsInput {
  1935. s.Dimensions = v
  1936. return s
  1937. }
  1938. // SetEndTime sets the EndTime field's value.
  1939. func (s *GetMetricStatisticsInput) SetEndTime(v time.Time) *GetMetricStatisticsInput {
  1940. s.EndTime = &v
  1941. return s
  1942. }
  1943. // SetExtendedStatistics sets the ExtendedStatistics field's value.
  1944. func (s *GetMetricStatisticsInput) SetExtendedStatistics(v []*string) *GetMetricStatisticsInput {
  1945. s.ExtendedStatistics = v
  1946. return s
  1947. }
  1948. // SetMetricName sets the MetricName field's value.
  1949. func (s *GetMetricStatisticsInput) SetMetricName(v string) *GetMetricStatisticsInput {
  1950. s.MetricName = &v
  1951. return s
  1952. }
  1953. // SetNamespace sets the Namespace field's value.
  1954. func (s *GetMetricStatisticsInput) SetNamespace(v string) *GetMetricStatisticsInput {
  1955. s.Namespace = &v
  1956. return s
  1957. }
  1958. // SetPeriod sets the Period field's value.
  1959. func (s *GetMetricStatisticsInput) SetPeriod(v int64) *GetMetricStatisticsInput {
  1960. s.Period = &v
  1961. return s
  1962. }
  1963. // SetStartTime sets the StartTime field's value.
  1964. func (s *GetMetricStatisticsInput) SetStartTime(v time.Time) *GetMetricStatisticsInput {
  1965. s.StartTime = &v
  1966. return s
  1967. }
  1968. // SetStatistics sets the Statistics field's value.
  1969. func (s *GetMetricStatisticsInput) SetStatistics(v []*string) *GetMetricStatisticsInput {
  1970. s.Statistics = v
  1971. return s
  1972. }
  1973. // SetUnit sets the Unit field's value.
  1974. func (s *GetMetricStatisticsInput) SetUnit(v string) *GetMetricStatisticsInput {
  1975. s.Unit = &v
  1976. return s
  1977. }
  1978. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricStatisticsOutput
  1979. type GetMetricStatisticsOutput struct {
  1980. _ struct{} `type:"structure"`
  1981. // The data points for the specified metric.
  1982. Datapoints []*Datapoint `type:"list"`
  1983. // A label for the specified metric.
  1984. Label *string `type:"string"`
  1985. }
  1986. // String returns the string representation
  1987. func (s GetMetricStatisticsOutput) String() string {
  1988. return awsutil.Prettify(s)
  1989. }
  1990. // GoString returns the string representation
  1991. func (s GetMetricStatisticsOutput) GoString() string {
  1992. return s.String()
  1993. }
  1994. // SetDatapoints sets the Datapoints field's value.
  1995. func (s *GetMetricStatisticsOutput) SetDatapoints(v []*Datapoint) *GetMetricStatisticsOutput {
  1996. s.Datapoints = v
  1997. return s
  1998. }
  1999. // SetLabel sets the Label field's value.
  2000. func (s *GetMetricStatisticsOutput) SetLabel(v string) *GetMetricStatisticsOutput {
  2001. s.Label = &v
  2002. return s
  2003. }
  2004. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetricsInput
  2005. type ListMetricsInput struct {
  2006. _ struct{} `type:"structure"`
  2007. // The dimensions to filter against.
  2008. Dimensions []*DimensionFilter `type:"list"`
  2009. // The name of the metric to filter against.
  2010. MetricName *string `min:"1" type:"string"`
  2011. // The namespace to filter against.
  2012. Namespace *string `min:"1" type:"string"`
  2013. // The token returned by a previous call to indicate that there is more data
  2014. // available.
  2015. NextToken *string `type:"string"`
  2016. }
  2017. // String returns the string representation
  2018. func (s ListMetricsInput) String() string {
  2019. return awsutil.Prettify(s)
  2020. }
  2021. // GoString returns the string representation
  2022. func (s ListMetricsInput) GoString() string {
  2023. return s.String()
  2024. }
  2025. // Validate inspects the fields of the type to determine if they are valid.
  2026. func (s *ListMetricsInput) Validate() error {
  2027. invalidParams := request.ErrInvalidParams{Context: "ListMetricsInput"}
  2028. if s.MetricName != nil && len(*s.MetricName) < 1 {
  2029. invalidParams.Add(request.NewErrParamMinLen("MetricName", 1))
  2030. }
  2031. if s.Namespace != nil && len(*s.Namespace) < 1 {
  2032. invalidParams.Add(request.NewErrParamMinLen("Namespace", 1))
  2033. }
  2034. if s.Dimensions != nil {
  2035. for i, v := range s.Dimensions {
  2036. if v == nil {
  2037. continue
  2038. }
  2039. if err := v.Validate(); err != nil {
  2040. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
  2041. }
  2042. }
  2043. }
  2044. if invalidParams.Len() > 0 {
  2045. return invalidParams
  2046. }
  2047. return nil
  2048. }
  2049. // SetDimensions sets the Dimensions field's value.
  2050. func (s *ListMetricsInput) SetDimensions(v []*DimensionFilter) *ListMetricsInput {
  2051. s.Dimensions = v
  2052. return s
  2053. }
  2054. // SetMetricName sets the MetricName field's value.
  2055. func (s *ListMetricsInput) SetMetricName(v string) *ListMetricsInput {
  2056. s.MetricName = &v
  2057. return s
  2058. }
  2059. // SetNamespace sets the Namespace field's value.
  2060. func (s *ListMetricsInput) SetNamespace(v string) *ListMetricsInput {
  2061. s.Namespace = &v
  2062. return s
  2063. }
  2064. // SetNextToken sets the NextToken field's value.
  2065. func (s *ListMetricsInput) SetNextToken(v string) *ListMetricsInput {
  2066. s.NextToken = &v
  2067. return s
  2068. }
  2069. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/ListMetricsOutput
  2070. type ListMetricsOutput struct {
  2071. _ struct{} `type:"structure"`
  2072. // The metrics.
  2073. Metrics []*Metric `type:"list"`
  2074. // The token that marks the start of the next batch of returned results.
  2075. NextToken *string `type:"string"`
  2076. }
  2077. // String returns the string representation
  2078. func (s ListMetricsOutput) String() string {
  2079. return awsutil.Prettify(s)
  2080. }
  2081. // GoString returns the string representation
  2082. func (s ListMetricsOutput) GoString() string {
  2083. return s.String()
  2084. }
  2085. // SetMetrics sets the Metrics field's value.
  2086. func (s *ListMetricsOutput) SetMetrics(v []*Metric) *ListMetricsOutput {
  2087. s.Metrics = v
  2088. return s
  2089. }
  2090. // SetNextToken sets the NextToken field's value.
  2091. func (s *ListMetricsOutput) SetNextToken(v string) *ListMetricsOutput {
  2092. s.NextToken = &v
  2093. return s
  2094. }
  2095. // Represents a specific metric.
  2096. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/Metric
  2097. type Metric struct {
  2098. _ struct{} `type:"structure"`
  2099. // The dimensions for the metric.
  2100. Dimensions []*Dimension `type:"list"`
  2101. // The name of the metric.
  2102. MetricName *string `min:"1" type:"string"`
  2103. // The namespace of the metric.
  2104. Namespace *string `min:"1" type:"string"`
  2105. }
  2106. // String returns the string representation
  2107. func (s Metric) String() string {
  2108. return awsutil.Prettify(s)
  2109. }
  2110. // GoString returns the string representation
  2111. func (s Metric) GoString() string {
  2112. return s.String()
  2113. }
  2114. // SetDimensions sets the Dimensions field's value.
  2115. func (s *Metric) SetDimensions(v []*Dimension) *Metric {
  2116. s.Dimensions = v
  2117. return s
  2118. }
  2119. // SetMetricName sets the MetricName field's value.
  2120. func (s *Metric) SetMetricName(v string) *Metric {
  2121. s.MetricName = &v
  2122. return s
  2123. }
  2124. // SetNamespace sets the Namespace field's value.
  2125. func (s *Metric) SetNamespace(v string) *Metric {
  2126. s.Namespace = &v
  2127. return s
  2128. }
  2129. // Represents an alarm.
  2130. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/MetricAlarm
  2131. type MetricAlarm struct {
  2132. _ struct{} `type:"structure"`
  2133. // Indicates whether actions should be executed during any changes to the alarm
  2134. // state.
  2135. ActionsEnabled *bool `type:"boolean"`
  2136. // The actions to execute when this alarm transitions to the ALARM state from
  2137. // any other state. Each action is specified as an Amazon Resource Name (ARN).
  2138. AlarmActions []*string `type:"list"`
  2139. // The Amazon Resource Name (ARN) of the alarm.
  2140. AlarmArn *string `min:"1" type:"string"`
  2141. // The time stamp of the last update to the alarm configuration.
  2142. AlarmConfigurationUpdatedTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  2143. // The description of the alarm.
  2144. AlarmDescription *string `type:"string"`
  2145. // The name of the alarm.
  2146. AlarmName *string `min:"1" type:"string"`
  2147. // The arithmetic operation to use when comparing the specified statistic and
  2148. // threshold. The specified statistic value is used as the first operand.
  2149. ComparisonOperator *string `type:"string" enum:"ComparisonOperator"`
  2150. // The dimensions for the metric associated with the alarm.
  2151. Dimensions []*Dimension `type:"list"`
  2152. EvaluateLowSampleCountPercentile *string `min:"1" type:"string"`
  2153. // The number of periods over which data is compared to the specified threshold.
  2154. EvaluationPeriods *int64 `min:"1" type:"integer"`
  2155. // The percentile statistic for the metric associated with the alarm. Specify
  2156. // a value between p0.0 and p100.
  2157. ExtendedStatistic *string `type:"string"`
  2158. // The actions to execute when this alarm transitions to the INSUFFICIENT_DATA
  2159. // state from any other state. Each action is specified as an Amazon Resource
  2160. // Name (ARN).
  2161. InsufficientDataActions []*string `type:"list"`
  2162. // The name of the metric associated with the alarm.
  2163. MetricName *string `min:"1" type:"string"`
  2164. // The namespace of the metric associated with the alarm.
  2165. Namespace *string `min:"1" type:"string"`
  2166. // The actions to execute when this alarm transitions to the OK state from any
  2167. // other state. Each action is specified as an Amazon Resource Name (ARN).
  2168. OKActions []*string `type:"list"`
  2169. // The period, in seconds, over which the statistic is applied.
  2170. Period *int64 `min:"60" type:"integer"`
  2171. // An explanation for the alarm state, in text format.
  2172. StateReason *string `type:"string"`
  2173. // An explanation for the alarm state, in JSON format.
  2174. StateReasonData *string `type:"string"`
  2175. // The time stamp of the last update to the alarm state.
  2176. StateUpdatedTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  2177. // The state value for the alarm.
  2178. StateValue *string `type:"string" enum:"StateValue"`
  2179. // The statistic for the metric associated with the alarm, other than percentile.
  2180. // For percentile statistics, use ExtendedStatistic.
  2181. Statistic *string `type:"string" enum:"Statistic"`
  2182. // The value to compare with the specified statistic.
  2183. Threshold *float64 `type:"double"`
  2184. TreatMissingData *string `min:"1" type:"string"`
  2185. // The unit of the metric associated with the alarm.
  2186. Unit *string `type:"string" enum:"StandardUnit"`
  2187. }
  2188. // String returns the string representation
  2189. func (s MetricAlarm) String() string {
  2190. return awsutil.Prettify(s)
  2191. }
  2192. // GoString returns the string representation
  2193. func (s MetricAlarm) GoString() string {
  2194. return s.String()
  2195. }
  2196. // SetActionsEnabled sets the ActionsEnabled field's value.
  2197. func (s *MetricAlarm) SetActionsEnabled(v bool) *MetricAlarm {
  2198. s.ActionsEnabled = &v
  2199. return s
  2200. }
  2201. // SetAlarmActions sets the AlarmActions field's value.
  2202. func (s *MetricAlarm) SetAlarmActions(v []*string) *MetricAlarm {
  2203. s.AlarmActions = v
  2204. return s
  2205. }
  2206. // SetAlarmArn sets the AlarmArn field's value.
  2207. func (s *MetricAlarm) SetAlarmArn(v string) *MetricAlarm {
  2208. s.AlarmArn = &v
  2209. return s
  2210. }
  2211. // SetAlarmConfigurationUpdatedTimestamp sets the AlarmConfigurationUpdatedTimestamp field's value.
  2212. func (s *MetricAlarm) SetAlarmConfigurationUpdatedTimestamp(v time.Time) *MetricAlarm {
  2213. s.AlarmConfigurationUpdatedTimestamp = &v
  2214. return s
  2215. }
  2216. // SetAlarmDescription sets the AlarmDescription field's value.
  2217. func (s *MetricAlarm) SetAlarmDescription(v string) *MetricAlarm {
  2218. s.AlarmDescription = &v
  2219. return s
  2220. }
  2221. // SetAlarmName sets the AlarmName field's value.
  2222. func (s *MetricAlarm) SetAlarmName(v string) *MetricAlarm {
  2223. s.AlarmName = &v
  2224. return s
  2225. }
  2226. // SetComparisonOperator sets the ComparisonOperator field's value.
  2227. func (s *MetricAlarm) SetComparisonOperator(v string) *MetricAlarm {
  2228. s.ComparisonOperator = &v
  2229. return s
  2230. }
  2231. // SetDimensions sets the Dimensions field's value.
  2232. func (s *MetricAlarm) SetDimensions(v []*Dimension) *MetricAlarm {
  2233. s.Dimensions = v
  2234. return s
  2235. }
  2236. // SetEvaluateLowSampleCountPercentile sets the EvaluateLowSampleCountPercentile field's value.
  2237. func (s *MetricAlarm) SetEvaluateLowSampleCountPercentile(v string) *MetricAlarm {
  2238. s.EvaluateLowSampleCountPercentile = &v
  2239. return s
  2240. }
  2241. // SetEvaluationPeriods sets the EvaluationPeriods field's value.
  2242. func (s *MetricAlarm) SetEvaluationPeriods(v int64) *MetricAlarm {
  2243. s.EvaluationPeriods = &v
  2244. return s
  2245. }
  2246. // SetExtendedStatistic sets the ExtendedStatistic field's value.
  2247. func (s *MetricAlarm) SetExtendedStatistic(v string) *MetricAlarm {
  2248. s.ExtendedStatistic = &v
  2249. return s
  2250. }
  2251. // SetInsufficientDataActions sets the InsufficientDataActions field's value.
  2252. func (s *MetricAlarm) SetInsufficientDataActions(v []*string) *MetricAlarm {
  2253. s.InsufficientDataActions = v
  2254. return s
  2255. }
  2256. // SetMetricName sets the MetricName field's value.
  2257. func (s *MetricAlarm) SetMetricName(v string) *MetricAlarm {
  2258. s.MetricName = &v
  2259. return s
  2260. }
  2261. // SetNamespace sets the Namespace field's value.
  2262. func (s *MetricAlarm) SetNamespace(v string) *MetricAlarm {
  2263. s.Namespace = &v
  2264. return s
  2265. }
  2266. // SetOKActions sets the OKActions field's value.
  2267. func (s *MetricAlarm) SetOKActions(v []*string) *MetricAlarm {
  2268. s.OKActions = v
  2269. return s
  2270. }
  2271. // SetPeriod sets the Period field's value.
  2272. func (s *MetricAlarm) SetPeriod(v int64) *MetricAlarm {
  2273. s.Period = &v
  2274. return s
  2275. }
  2276. // SetStateReason sets the StateReason field's value.
  2277. func (s *MetricAlarm) SetStateReason(v string) *MetricAlarm {
  2278. s.StateReason = &v
  2279. return s
  2280. }
  2281. // SetStateReasonData sets the StateReasonData field's value.
  2282. func (s *MetricAlarm) SetStateReasonData(v string) *MetricAlarm {
  2283. s.StateReasonData = &v
  2284. return s
  2285. }
  2286. // SetStateUpdatedTimestamp sets the StateUpdatedTimestamp field's value.
  2287. func (s *MetricAlarm) SetStateUpdatedTimestamp(v time.Time) *MetricAlarm {
  2288. s.StateUpdatedTimestamp = &v
  2289. return s
  2290. }
  2291. // SetStateValue sets the StateValue field's value.
  2292. func (s *MetricAlarm) SetStateValue(v string) *MetricAlarm {
  2293. s.StateValue = &v
  2294. return s
  2295. }
  2296. // SetStatistic sets the Statistic field's value.
  2297. func (s *MetricAlarm) SetStatistic(v string) *MetricAlarm {
  2298. s.Statistic = &v
  2299. return s
  2300. }
  2301. // SetThreshold sets the Threshold field's value.
  2302. func (s *MetricAlarm) SetThreshold(v float64) *MetricAlarm {
  2303. s.Threshold = &v
  2304. return s
  2305. }
  2306. // SetTreatMissingData sets the TreatMissingData field's value.
  2307. func (s *MetricAlarm) SetTreatMissingData(v string) *MetricAlarm {
  2308. s.TreatMissingData = &v
  2309. return s
  2310. }
  2311. // SetUnit sets the Unit field's value.
  2312. func (s *MetricAlarm) SetUnit(v string) *MetricAlarm {
  2313. s.Unit = &v
  2314. return s
  2315. }
  2316. // Encapsulates the information sent to either create a metric or add new values
  2317. // to be aggregated into an existing metric.
  2318. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/MetricDatum
  2319. type MetricDatum struct {
  2320. _ struct{} `type:"structure"`
  2321. // The dimensions associated with the metric.
  2322. Dimensions []*Dimension `type:"list"`
  2323. // The name of the metric.
  2324. //
  2325. // MetricName is a required field
  2326. MetricName *string `min:"1" type:"string" required:"true"`
  2327. // The statistical values for the metric.
  2328. StatisticValues *StatisticSet `type:"structure"`
  2329. // The time the metric data was received, expressed as the number of milliseconds
  2330. // since Jan 1, 1970 00:00:00 UTC.
  2331. Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"`
  2332. // The unit of the metric.
  2333. Unit *string `type:"string" enum:"StandardUnit"`
  2334. // The value for the metric.
  2335. //
  2336. // Although the parameter accepts numbers of type Double, Amazon CloudWatch
  2337. // rejects values that are either too small or too large. Values must be in
  2338. // the range of 8.515920e-109 to 1.174271e+108 (Base 10) or 2e-360 to 2e360
  2339. // (Base 2). In addition, special values (for example, NaN, +Infinity, -Infinity)
  2340. // are not supported.
  2341. Value *float64 `type:"double"`
  2342. }
  2343. // String returns the string representation
  2344. func (s MetricDatum) String() string {
  2345. return awsutil.Prettify(s)
  2346. }
  2347. // GoString returns the string representation
  2348. func (s MetricDatum) GoString() string {
  2349. return s.String()
  2350. }
  2351. // Validate inspects the fields of the type to determine if they are valid.
  2352. func (s *MetricDatum) Validate() error {
  2353. invalidParams := request.ErrInvalidParams{Context: "MetricDatum"}
  2354. if s.MetricName == nil {
  2355. invalidParams.Add(request.NewErrParamRequired("MetricName"))
  2356. }
  2357. if s.MetricName != nil && len(*s.MetricName) < 1 {
  2358. invalidParams.Add(request.NewErrParamMinLen("MetricName", 1))
  2359. }
  2360. if s.Dimensions != nil {
  2361. for i, v := range s.Dimensions {
  2362. if v == nil {
  2363. continue
  2364. }
  2365. if err := v.Validate(); err != nil {
  2366. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
  2367. }
  2368. }
  2369. }
  2370. if s.StatisticValues != nil {
  2371. if err := s.StatisticValues.Validate(); err != nil {
  2372. invalidParams.AddNested("StatisticValues", err.(request.ErrInvalidParams))
  2373. }
  2374. }
  2375. if invalidParams.Len() > 0 {
  2376. return invalidParams
  2377. }
  2378. return nil
  2379. }
  2380. // SetDimensions sets the Dimensions field's value.
  2381. func (s *MetricDatum) SetDimensions(v []*Dimension) *MetricDatum {
  2382. s.Dimensions = v
  2383. return s
  2384. }
  2385. // SetMetricName sets the MetricName field's value.
  2386. func (s *MetricDatum) SetMetricName(v string) *MetricDatum {
  2387. s.MetricName = &v
  2388. return s
  2389. }
  2390. // SetStatisticValues sets the StatisticValues field's value.
  2391. func (s *MetricDatum) SetStatisticValues(v *StatisticSet) *MetricDatum {
  2392. s.StatisticValues = v
  2393. return s
  2394. }
  2395. // SetTimestamp sets the Timestamp field's value.
  2396. func (s *MetricDatum) SetTimestamp(v time.Time) *MetricDatum {
  2397. s.Timestamp = &v
  2398. return s
  2399. }
  2400. // SetUnit sets the Unit field's value.
  2401. func (s *MetricDatum) SetUnit(v string) *MetricDatum {
  2402. s.Unit = &v
  2403. return s
  2404. }
  2405. // SetValue sets the Value field's value.
  2406. func (s *MetricDatum) SetValue(v float64) *MetricDatum {
  2407. s.Value = &v
  2408. return s
  2409. }
  2410. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricAlarmInput
  2411. type PutMetricAlarmInput struct {
  2412. _ struct{} `type:"structure"`
  2413. // Indicates whether actions should be executed during any changes to the alarm
  2414. // state.
  2415. ActionsEnabled *bool `type:"boolean"`
  2416. // The actions to execute when this alarm transitions to the ALARM state from
  2417. // any other state. Each action is specified as an Amazon Resource Name (ARN).
  2418. //
  2419. // Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate
  2420. // | arn:aws:automate:region:ec2:recover
  2421. //
  2422. // Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Stop/1.0
  2423. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Terminate/1.0
  2424. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
  2425. AlarmActions []*string `type:"list"`
  2426. // The description for the alarm.
  2427. AlarmDescription *string `type:"string"`
  2428. // The name for the alarm. This name must be unique within the AWS account.
  2429. //
  2430. // AlarmName is a required field
  2431. AlarmName *string `min:"1" type:"string" required:"true"`
  2432. // The arithmetic operation to use when comparing the specified statistic and
  2433. // threshold. The specified statistic value is used as the first operand.
  2434. //
  2435. // ComparisonOperator is a required field
  2436. ComparisonOperator *string `type:"string" required:"true" enum:"ComparisonOperator"`
  2437. // The dimensions for the metric associated with the alarm.
  2438. Dimensions []*Dimension `type:"list"`
  2439. // Used only for alarms based on percentiles. If you specify ignore, the alarm
  2440. // state will not change during periods with too few data points to be statistically
  2441. // significant. If you specify evaluate or omit this parameter, the alarm will
  2442. // always be evaluated and possibly change state no matter how many data points
  2443. // are available. For more information, see Percentile-Based CloudWatch Alarms
  2444. // and Low Data Samples (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#percentiles-with-low-samples).
  2445. //
  2446. // Valid Values: evaluate | ignore
  2447. EvaluateLowSampleCountPercentile *string `min:"1" type:"string"`
  2448. // The number of periods over which data is compared to the specified threshold.
  2449. //
  2450. // EvaluationPeriods is a required field
  2451. EvaluationPeriods *int64 `min:"1" type:"integer" required:"true"`
  2452. // The percentile statistic for the metric associated with the alarm. Specify
  2453. // a value between p0.0 and p100.
  2454. ExtendedStatistic *string `type:"string"`
  2455. // The actions to execute when this alarm transitions to the INSUFFICIENT_DATA
  2456. // state from any other state. Each action is specified as an Amazon Resource
  2457. // Name (ARN).
  2458. //
  2459. // Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate
  2460. // | arn:aws:automate:region:ec2:recover
  2461. //
  2462. // Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Stop/1.0
  2463. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Terminate/1.0
  2464. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
  2465. InsufficientDataActions []*string `type:"list"`
  2466. // The name for the metric associated with the alarm.
  2467. //
  2468. // MetricName is a required field
  2469. MetricName *string `min:"1" type:"string" required:"true"`
  2470. // The namespace for the metric associated with the alarm.
  2471. //
  2472. // Namespace is a required field
  2473. Namespace *string `min:"1" type:"string" required:"true"`
  2474. // The actions to execute when this alarm transitions to an OK state from any
  2475. // other state. Each action is specified as an Amazon Resource Name (ARN).
  2476. //
  2477. // Valid Values: arn:aws:automate:region:ec2:stop | arn:aws:automate:region:ec2:terminate
  2478. // | arn:aws:automate:region:ec2:recover
  2479. //
  2480. // Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Stop/1.0
  2481. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Terminate/1.0
  2482. // | arn:aws:swf:us-east-1:{customer-account}:action/actions/AWS_EC2.InstanceId.Reboot/1.0
  2483. OKActions []*string `type:"list"`
  2484. // The period, in seconds, over which the specified statistic is applied.
  2485. //
  2486. // Period is a required field
  2487. Period *int64 `min:"60" type:"integer" required:"true"`
  2488. // The statistic for the metric associated with the alarm, other than percentile.
  2489. // For percentile statistics, use ExtendedStatistic.
  2490. Statistic *string `type:"string" enum:"Statistic"`
  2491. // The value against which the specified statistic is compared.
  2492. //
  2493. // Threshold is a required field
  2494. Threshold *float64 `type:"double" required:"true"`
  2495. // Sets how this alarm is to handle missing data points. If TreatMissingData
  2496. // is omitted, the default behavior of missing is used. For more information,
  2497. // see Configuring How CloudWatch Alarms Treats Missing Data (http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data).
  2498. //
  2499. // Valid Values: breaching | notBreaching | ignore | missing
  2500. TreatMissingData *string `min:"1" type:"string"`
  2501. // The unit of measure for the statistic. For example, the units for the Amazon
  2502. // EC2 NetworkIn metric are Bytes because NetworkIn tracks the number of bytes
  2503. // that an instance receives on all network interfaces. You can also specify
  2504. // a unit when you create a custom metric. Units help provide conceptual meaning
  2505. // to your data. Metric data points that specify a unit of measure, such as
  2506. // Percent, are aggregated separately.
  2507. //
  2508. // If you specify a unit, you must use a unit that is appropriate for the metric.
  2509. // Otherwise, the Amazon CloudWatch alarm can get stuck in the INSUFFICIENT
  2510. // DATA state.
  2511. Unit *string `type:"string" enum:"StandardUnit"`
  2512. }
  2513. // String returns the string representation
  2514. func (s PutMetricAlarmInput) String() string {
  2515. return awsutil.Prettify(s)
  2516. }
  2517. // GoString returns the string representation
  2518. func (s PutMetricAlarmInput) GoString() string {
  2519. return s.String()
  2520. }
  2521. // Validate inspects the fields of the type to determine if they are valid.
  2522. func (s *PutMetricAlarmInput) Validate() error {
  2523. invalidParams := request.ErrInvalidParams{Context: "PutMetricAlarmInput"}
  2524. if s.AlarmName == nil {
  2525. invalidParams.Add(request.NewErrParamRequired("AlarmName"))
  2526. }
  2527. if s.AlarmName != nil && len(*s.AlarmName) < 1 {
  2528. invalidParams.Add(request.NewErrParamMinLen("AlarmName", 1))
  2529. }
  2530. if s.ComparisonOperator == nil {
  2531. invalidParams.Add(request.NewErrParamRequired("ComparisonOperator"))
  2532. }
  2533. if s.EvaluateLowSampleCountPercentile != nil && len(*s.EvaluateLowSampleCountPercentile) < 1 {
  2534. invalidParams.Add(request.NewErrParamMinLen("EvaluateLowSampleCountPercentile", 1))
  2535. }
  2536. if s.EvaluationPeriods == nil {
  2537. invalidParams.Add(request.NewErrParamRequired("EvaluationPeriods"))
  2538. }
  2539. if s.EvaluationPeriods != nil && *s.EvaluationPeriods < 1 {
  2540. invalidParams.Add(request.NewErrParamMinValue("EvaluationPeriods", 1))
  2541. }
  2542. if s.MetricName == nil {
  2543. invalidParams.Add(request.NewErrParamRequired("MetricName"))
  2544. }
  2545. if s.MetricName != nil && len(*s.MetricName) < 1 {
  2546. invalidParams.Add(request.NewErrParamMinLen("MetricName", 1))
  2547. }
  2548. if s.Namespace == nil {
  2549. invalidParams.Add(request.NewErrParamRequired("Namespace"))
  2550. }
  2551. if s.Namespace != nil && len(*s.Namespace) < 1 {
  2552. invalidParams.Add(request.NewErrParamMinLen("Namespace", 1))
  2553. }
  2554. if s.Period == nil {
  2555. invalidParams.Add(request.NewErrParamRequired("Period"))
  2556. }
  2557. if s.Period != nil && *s.Period < 60 {
  2558. invalidParams.Add(request.NewErrParamMinValue("Period", 60))
  2559. }
  2560. if s.Threshold == nil {
  2561. invalidParams.Add(request.NewErrParamRequired("Threshold"))
  2562. }
  2563. if s.TreatMissingData != nil && len(*s.TreatMissingData) < 1 {
  2564. invalidParams.Add(request.NewErrParamMinLen("TreatMissingData", 1))
  2565. }
  2566. if s.Dimensions != nil {
  2567. for i, v := range s.Dimensions {
  2568. if v == nil {
  2569. continue
  2570. }
  2571. if err := v.Validate(); err != nil {
  2572. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
  2573. }
  2574. }
  2575. }
  2576. if invalidParams.Len() > 0 {
  2577. return invalidParams
  2578. }
  2579. return nil
  2580. }
  2581. // SetActionsEnabled sets the ActionsEnabled field's value.
  2582. func (s *PutMetricAlarmInput) SetActionsEnabled(v bool) *PutMetricAlarmInput {
  2583. s.ActionsEnabled = &v
  2584. return s
  2585. }
  2586. // SetAlarmActions sets the AlarmActions field's value.
  2587. func (s *PutMetricAlarmInput) SetAlarmActions(v []*string) *PutMetricAlarmInput {
  2588. s.AlarmActions = v
  2589. return s
  2590. }
  2591. // SetAlarmDescription sets the AlarmDescription field's value.
  2592. func (s *PutMetricAlarmInput) SetAlarmDescription(v string) *PutMetricAlarmInput {
  2593. s.AlarmDescription = &v
  2594. return s
  2595. }
  2596. // SetAlarmName sets the AlarmName field's value.
  2597. func (s *PutMetricAlarmInput) SetAlarmName(v string) *PutMetricAlarmInput {
  2598. s.AlarmName = &v
  2599. return s
  2600. }
  2601. // SetComparisonOperator sets the ComparisonOperator field's value.
  2602. func (s *PutMetricAlarmInput) SetComparisonOperator(v string) *PutMetricAlarmInput {
  2603. s.ComparisonOperator = &v
  2604. return s
  2605. }
  2606. // SetDimensions sets the Dimensions field's value.
  2607. func (s *PutMetricAlarmInput) SetDimensions(v []*Dimension) *PutMetricAlarmInput {
  2608. s.Dimensions = v
  2609. return s
  2610. }
  2611. // SetEvaluateLowSampleCountPercentile sets the EvaluateLowSampleCountPercentile field's value.
  2612. func (s *PutMetricAlarmInput) SetEvaluateLowSampleCountPercentile(v string) *PutMetricAlarmInput {
  2613. s.EvaluateLowSampleCountPercentile = &v
  2614. return s
  2615. }
  2616. // SetEvaluationPeriods sets the EvaluationPeriods field's value.
  2617. func (s *PutMetricAlarmInput) SetEvaluationPeriods(v int64) *PutMetricAlarmInput {
  2618. s.EvaluationPeriods = &v
  2619. return s
  2620. }
  2621. // SetExtendedStatistic sets the ExtendedStatistic field's value.
  2622. func (s *PutMetricAlarmInput) SetExtendedStatistic(v string) *PutMetricAlarmInput {
  2623. s.ExtendedStatistic = &v
  2624. return s
  2625. }
  2626. // SetInsufficientDataActions sets the InsufficientDataActions field's value.
  2627. func (s *PutMetricAlarmInput) SetInsufficientDataActions(v []*string) *PutMetricAlarmInput {
  2628. s.InsufficientDataActions = v
  2629. return s
  2630. }
  2631. // SetMetricName sets the MetricName field's value.
  2632. func (s *PutMetricAlarmInput) SetMetricName(v string) *PutMetricAlarmInput {
  2633. s.MetricName = &v
  2634. return s
  2635. }
  2636. // SetNamespace sets the Namespace field's value.
  2637. func (s *PutMetricAlarmInput) SetNamespace(v string) *PutMetricAlarmInput {
  2638. s.Namespace = &v
  2639. return s
  2640. }
  2641. // SetOKActions sets the OKActions field's value.
  2642. func (s *PutMetricAlarmInput) SetOKActions(v []*string) *PutMetricAlarmInput {
  2643. s.OKActions = v
  2644. return s
  2645. }
  2646. // SetPeriod sets the Period field's value.
  2647. func (s *PutMetricAlarmInput) SetPeriod(v int64) *PutMetricAlarmInput {
  2648. s.Period = &v
  2649. return s
  2650. }
  2651. // SetStatistic sets the Statistic field's value.
  2652. func (s *PutMetricAlarmInput) SetStatistic(v string) *PutMetricAlarmInput {
  2653. s.Statistic = &v
  2654. return s
  2655. }
  2656. // SetThreshold sets the Threshold field's value.
  2657. func (s *PutMetricAlarmInput) SetThreshold(v float64) *PutMetricAlarmInput {
  2658. s.Threshold = &v
  2659. return s
  2660. }
  2661. // SetTreatMissingData sets the TreatMissingData field's value.
  2662. func (s *PutMetricAlarmInput) SetTreatMissingData(v string) *PutMetricAlarmInput {
  2663. s.TreatMissingData = &v
  2664. return s
  2665. }
  2666. // SetUnit sets the Unit field's value.
  2667. func (s *PutMetricAlarmInput) SetUnit(v string) *PutMetricAlarmInput {
  2668. s.Unit = &v
  2669. return s
  2670. }
  2671. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricAlarmOutput
  2672. type PutMetricAlarmOutput struct {
  2673. _ struct{} `type:"structure"`
  2674. }
  2675. // String returns the string representation
  2676. func (s PutMetricAlarmOutput) String() string {
  2677. return awsutil.Prettify(s)
  2678. }
  2679. // GoString returns the string representation
  2680. func (s PutMetricAlarmOutput) GoString() string {
  2681. return s.String()
  2682. }
  2683. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricDataInput
  2684. type PutMetricDataInput struct {
  2685. _ struct{} `type:"structure"`
  2686. // The data for the metric.
  2687. //
  2688. // MetricData is a required field
  2689. MetricData []*MetricDatum `type:"list" required:"true"`
  2690. // The namespace for the metric data.
  2691. //
  2692. // You cannot specify a namespace that begins with "AWS/". Namespaces that begin
  2693. // with "AWS/" are reserved for use by Amazon Web Services products.
  2694. //
  2695. // Namespace is a required field
  2696. Namespace *string `min:"1" type:"string" required:"true"`
  2697. }
  2698. // String returns the string representation
  2699. func (s PutMetricDataInput) String() string {
  2700. return awsutil.Prettify(s)
  2701. }
  2702. // GoString returns the string representation
  2703. func (s PutMetricDataInput) GoString() string {
  2704. return s.String()
  2705. }
  2706. // Validate inspects the fields of the type to determine if they are valid.
  2707. func (s *PutMetricDataInput) Validate() error {
  2708. invalidParams := request.ErrInvalidParams{Context: "PutMetricDataInput"}
  2709. if s.MetricData == nil {
  2710. invalidParams.Add(request.NewErrParamRequired("MetricData"))
  2711. }
  2712. if s.Namespace == nil {
  2713. invalidParams.Add(request.NewErrParamRequired("Namespace"))
  2714. }
  2715. if s.Namespace != nil && len(*s.Namespace) < 1 {
  2716. invalidParams.Add(request.NewErrParamMinLen("Namespace", 1))
  2717. }
  2718. if s.MetricData != nil {
  2719. for i, v := range s.MetricData {
  2720. if v == nil {
  2721. continue
  2722. }
  2723. if err := v.Validate(); err != nil {
  2724. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricData", i), err.(request.ErrInvalidParams))
  2725. }
  2726. }
  2727. }
  2728. if invalidParams.Len() > 0 {
  2729. return invalidParams
  2730. }
  2731. return nil
  2732. }
  2733. // SetMetricData sets the MetricData field's value.
  2734. func (s *PutMetricDataInput) SetMetricData(v []*MetricDatum) *PutMetricDataInput {
  2735. s.MetricData = v
  2736. return s
  2737. }
  2738. // SetNamespace sets the Namespace field's value.
  2739. func (s *PutMetricDataInput) SetNamespace(v string) *PutMetricDataInput {
  2740. s.Namespace = &v
  2741. return s
  2742. }
  2743. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/PutMetricDataOutput
  2744. type PutMetricDataOutput struct {
  2745. _ struct{} `type:"structure"`
  2746. }
  2747. // String returns the string representation
  2748. func (s PutMetricDataOutput) String() string {
  2749. return awsutil.Prettify(s)
  2750. }
  2751. // GoString returns the string representation
  2752. func (s PutMetricDataOutput) GoString() string {
  2753. return s.String()
  2754. }
  2755. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/SetAlarmStateInput
  2756. type SetAlarmStateInput struct {
  2757. _ struct{} `type:"structure"`
  2758. // The name for the alarm. This name must be unique within the AWS account.
  2759. // The maximum length is 255 characters.
  2760. //
  2761. // AlarmName is a required field
  2762. AlarmName *string `min:"1" type:"string" required:"true"`
  2763. // The reason that this alarm is set to this specific state, in text format.
  2764. //
  2765. // StateReason is a required field
  2766. StateReason *string `type:"string" required:"true"`
  2767. // The reason that this alarm is set to this specific state, in JSON format.
  2768. StateReasonData *string `type:"string"`
  2769. // The value of the state.
  2770. //
  2771. // StateValue is a required field
  2772. StateValue *string `type:"string" required:"true" enum:"StateValue"`
  2773. }
  2774. // String returns the string representation
  2775. func (s SetAlarmStateInput) String() string {
  2776. return awsutil.Prettify(s)
  2777. }
  2778. // GoString returns the string representation
  2779. func (s SetAlarmStateInput) GoString() string {
  2780. return s.String()
  2781. }
  2782. // Validate inspects the fields of the type to determine if they are valid.
  2783. func (s *SetAlarmStateInput) Validate() error {
  2784. invalidParams := request.ErrInvalidParams{Context: "SetAlarmStateInput"}
  2785. if s.AlarmName == nil {
  2786. invalidParams.Add(request.NewErrParamRequired("AlarmName"))
  2787. }
  2788. if s.AlarmName != nil && len(*s.AlarmName) < 1 {
  2789. invalidParams.Add(request.NewErrParamMinLen("AlarmName", 1))
  2790. }
  2791. if s.StateReason == nil {
  2792. invalidParams.Add(request.NewErrParamRequired("StateReason"))
  2793. }
  2794. if s.StateValue == nil {
  2795. invalidParams.Add(request.NewErrParamRequired("StateValue"))
  2796. }
  2797. if invalidParams.Len() > 0 {
  2798. return invalidParams
  2799. }
  2800. return nil
  2801. }
  2802. // SetAlarmName sets the AlarmName field's value.
  2803. func (s *SetAlarmStateInput) SetAlarmName(v string) *SetAlarmStateInput {
  2804. s.AlarmName = &v
  2805. return s
  2806. }
  2807. // SetStateReason sets the StateReason field's value.
  2808. func (s *SetAlarmStateInput) SetStateReason(v string) *SetAlarmStateInput {
  2809. s.StateReason = &v
  2810. return s
  2811. }
  2812. // SetStateReasonData sets the StateReasonData field's value.
  2813. func (s *SetAlarmStateInput) SetStateReasonData(v string) *SetAlarmStateInput {
  2814. s.StateReasonData = &v
  2815. return s
  2816. }
  2817. // SetStateValue sets the StateValue field's value.
  2818. func (s *SetAlarmStateInput) SetStateValue(v string) *SetAlarmStateInput {
  2819. s.StateValue = &v
  2820. return s
  2821. }
  2822. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/SetAlarmStateOutput
  2823. type SetAlarmStateOutput struct {
  2824. _ struct{} `type:"structure"`
  2825. }
  2826. // String returns the string representation
  2827. func (s SetAlarmStateOutput) String() string {
  2828. return awsutil.Prettify(s)
  2829. }
  2830. // GoString returns the string representation
  2831. func (s SetAlarmStateOutput) GoString() string {
  2832. return s.String()
  2833. }
  2834. // Represents a set of statistics that describes a specific metric.
  2835. // Please also see https://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/StatisticSet
  2836. type StatisticSet struct {
  2837. _ struct{} `type:"structure"`
  2838. // The maximum value of the sample set.
  2839. //
  2840. // Maximum is a required field
  2841. Maximum *float64 `type:"double" required:"true"`
  2842. // The minimum value of the sample set.
  2843. //
  2844. // Minimum is a required field
  2845. Minimum *float64 `type:"double" required:"true"`
  2846. // The number of samples used for the statistic set.
  2847. //
  2848. // SampleCount is a required field
  2849. SampleCount *float64 `type:"double" required:"true"`
  2850. // The sum of values for the sample set.
  2851. //
  2852. // Sum is a required field
  2853. Sum *float64 `type:"double" required:"true"`
  2854. }
  2855. // String returns the string representation
  2856. func (s StatisticSet) String() string {
  2857. return awsutil.Prettify(s)
  2858. }
  2859. // GoString returns the string representation
  2860. func (s StatisticSet) GoString() string {
  2861. return s.String()
  2862. }
  2863. // Validate inspects the fields of the type to determine if they are valid.
  2864. func (s *StatisticSet) Validate() error {
  2865. invalidParams := request.ErrInvalidParams{Context: "StatisticSet"}
  2866. if s.Maximum == nil {
  2867. invalidParams.Add(request.NewErrParamRequired("Maximum"))
  2868. }
  2869. if s.Minimum == nil {
  2870. invalidParams.Add(request.NewErrParamRequired("Minimum"))
  2871. }
  2872. if s.SampleCount == nil {
  2873. invalidParams.Add(request.NewErrParamRequired("SampleCount"))
  2874. }
  2875. if s.Sum == nil {
  2876. invalidParams.Add(request.NewErrParamRequired("Sum"))
  2877. }
  2878. if invalidParams.Len() > 0 {
  2879. return invalidParams
  2880. }
  2881. return nil
  2882. }
  2883. // SetMaximum sets the Maximum field's value.
  2884. func (s *StatisticSet) SetMaximum(v float64) *StatisticSet {
  2885. s.Maximum = &v
  2886. return s
  2887. }
  2888. // SetMinimum sets the Minimum field's value.
  2889. func (s *StatisticSet) SetMinimum(v float64) *StatisticSet {
  2890. s.Minimum = &v
  2891. return s
  2892. }
  2893. // SetSampleCount sets the SampleCount field's value.
  2894. func (s *StatisticSet) SetSampleCount(v float64) *StatisticSet {
  2895. s.SampleCount = &v
  2896. return s
  2897. }
  2898. // SetSum sets the Sum field's value.
  2899. func (s *StatisticSet) SetSum(v float64) *StatisticSet {
  2900. s.Sum = &v
  2901. return s
  2902. }
  2903. const (
  2904. // ComparisonOperatorGreaterThanOrEqualToThreshold is a ComparisonOperator enum value
  2905. ComparisonOperatorGreaterThanOrEqualToThreshold = "GreaterThanOrEqualToThreshold"
  2906. // ComparisonOperatorGreaterThanThreshold is a ComparisonOperator enum value
  2907. ComparisonOperatorGreaterThanThreshold = "GreaterThanThreshold"
  2908. // ComparisonOperatorLessThanThreshold is a ComparisonOperator enum value
  2909. ComparisonOperatorLessThanThreshold = "LessThanThreshold"
  2910. // ComparisonOperatorLessThanOrEqualToThreshold is a ComparisonOperator enum value
  2911. ComparisonOperatorLessThanOrEqualToThreshold = "LessThanOrEqualToThreshold"
  2912. )
  2913. const (
  2914. // HistoryItemTypeConfigurationUpdate is a HistoryItemType enum value
  2915. HistoryItemTypeConfigurationUpdate = "ConfigurationUpdate"
  2916. // HistoryItemTypeStateUpdate is a HistoryItemType enum value
  2917. HistoryItemTypeStateUpdate = "StateUpdate"
  2918. // HistoryItemTypeAction is a HistoryItemType enum value
  2919. HistoryItemTypeAction = "Action"
  2920. )
  2921. const (
  2922. // StandardUnitSeconds is a StandardUnit enum value
  2923. StandardUnitSeconds = "Seconds"
  2924. // StandardUnitMicroseconds is a StandardUnit enum value
  2925. StandardUnitMicroseconds = "Microseconds"
  2926. // StandardUnitMilliseconds is a StandardUnit enum value
  2927. StandardUnitMilliseconds = "Milliseconds"
  2928. // StandardUnitBytes is a StandardUnit enum value
  2929. StandardUnitBytes = "Bytes"
  2930. // StandardUnitKilobytes is a StandardUnit enum value
  2931. StandardUnitKilobytes = "Kilobytes"
  2932. // StandardUnitMegabytes is a StandardUnit enum value
  2933. StandardUnitMegabytes = "Megabytes"
  2934. // StandardUnitGigabytes is a StandardUnit enum value
  2935. StandardUnitGigabytes = "Gigabytes"
  2936. // StandardUnitTerabytes is a StandardUnit enum value
  2937. StandardUnitTerabytes = "Terabytes"
  2938. // StandardUnitBits is a StandardUnit enum value
  2939. StandardUnitBits = "Bits"
  2940. // StandardUnitKilobits is a StandardUnit enum value
  2941. StandardUnitKilobits = "Kilobits"
  2942. // StandardUnitMegabits is a StandardUnit enum value
  2943. StandardUnitMegabits = "Megabits"
  2944. // StandardUnitGigabits is a StandardUnit enum value
  2945. StandardUnitGigabits = "Gigabits"
  2946. // StandardUnitTerabits is a StandardUnit enum value
  2947. StandardUnitTerabits = "Terabits"
  2948. // StandardUnitPercent is a StandardUnit enum value
  2949. StandardUnitPercent = "Percent"
  2950. // StandardUnitCount is a StandardUnit enum value
  2951. StandardUnitCount = "Count"
  2952. // StandardUnitBytesSecond is a StandardUnit enum value
  2953. StandardUnitBytesSecond = "Bytes/Second"
  2954. // StandardUnitKilobytesSecond is a StandardUnit enum value
  2955. StandardUnitKilobytesSecond = "Kilobytes/Second"
  2956. // StandardUnitMegabytesSecond is a StandardUnit enum value
  2957. StandardUnitMegabytesSecond = "Megabytes/Second"
  2958. // StandardUnitGigabytesSecond is a StandardUnit enum value
  2959. StandardUnitGigabytesSecond = "Gigabytes/Second"
  2960. // StandardUnitTerabytesSecond is a StandardUnit enum value
  2961. StandardUnitTerabytesSecond = "Terabytes/Second"
  2962. // StandardUnitBitsSecond is a StandardUnit enum value
  2963. StandardUnitBitsSecond = "Bits/Second"
  2964. // StandardUnitKilobitsSecond is a StandardUnit enum value
  2965. StandardUnitKilobitsSecond = "Kilobits/Second"
  2966. // StandardUnitMegabitsSecond is a StandardUnit enum value
  2967. StandardUnitMegabitsSecond = "Megabits/Second"
  2968. // StandardUnitGigabitsSecond is a StandardUnit enum value
  2969. StandardUnitGigabitsSecond = "Gigabits/Second"
  2970. // StandardUnitTerabitsSecond is a StandardUnit enum value
  2971. StandardUnitTerabitsSecond = "Terabits/Second"
  2972. // StandardUnitCountSecond is a StandardUnit enum value
  2973. StandardUnitCountSecond = "Count/Second"
  2974. // StandardUnitNone is a StandardUnit enum value
  2975. StandardUnitNone = "None"
  2976. )
  2977. const (
  2978. // StateValueOk is a StateValue enum value
  2979. StateValueOk = "OK"
  2980. // StateValueAlarm is a StateValue enum value
  2981. StateValueAlarm = "ALARM"
  2982. // StateValueInsufficientData is a StateValue enum value
  2983. StateValueInsufficientData = "INSUFFICIENT_DATA"
  2984. )
  2985. const (
  2986. // StatisticSampleCount is a Statistic enum value
  2987. StatisticSampleCount = "SampleCount"
  2988. // StatisticAverage is a Statistic enum value
  2989. StatisticAverage = "Average"
  2990. // StatisticSum is a Statistic enum value
  2991. StatisticSum = "Sum"
  2992. // StatisticMinimum is a Statistic enum value
  2993. StatisticMinimum = "Minimum"
  2994. // StatisticMaximum is a Statistic enum value
  2995. StatisticMaximum = "Maximum"
  2996. )