api.go 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package pi
  3. import (
  4. "fmt"
  5. "time"
  6. "github.com/aws/aws-sdk-go/aws"
  7. "github.com/aws/aws-sdk-go/aws/awsutil"
  8. "github.com/aws/aws-sdk-go/aws/request"
  9. )
  10. const opDescribeDimensionKeys = "DescribeDimensionKeys"
  11. // DescribeDimensionKeysRequest generates a "aws/request.Request" representing the
  12. // client's request for the DescribeDimensionKeys operation. The "output" return
  13. // value will be populated with the request's response once the request completes
  14. // successfully.
  15. //
  16. // Use "Send" method on the returned Request to send the API call to the service.
  17. // the "output" return value is not valid until after Send returns without error.
  18. //
  19. // See DescribeDimensionKeys for more information on using the DescribeDimensionKeys
  20. // API call, and error handling.
  21. //
  22. // This method is useful when you want to inject custom logic or configuration
  23. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  24. //
  25. //
  26. // // Example sending a request using the DescribeDimensionKeysRequest method.
  27. // req, resp := client.DescribeDimensionKeysRequest(params)
  28. //
  29. // err := req.Send()
  30. // if err == nil { // resp is now filled
  31. // fmt.Println(resp)
  32. // }
  33. //
  34. // See also, https://docs.aws.amazon.com/goto/WebAPI/pi-2018-02-27/DescribeDimensionKeys
  35. func (c *PI) DescribeDimensionKeysRequest(input *DescribeDimensionKeysInput) (req *request.Request, output *DescribeDimensionKeysOutput) {
  36. op := &request.Operation{
  37. Name: opDescribeDimensionKeys,
  38. HTTPMethod: "POST",
  39. HTTPPath: "/",
  40. }
  41. if input == nil {
  42. input = &DescribeDimensionKeysInput{}
  43. }
  44. output = &DescribeDimensionKeysOutput{}
  45. req = c.newRequest(op, input, output)
  46. return
  47. }
  48. // DescribeDimensionKeys API operation for AWS Performance Insights.
  49. //
  50. // For a specific time period, retrieve the top N dimension keys for a metric.
  51. //
  52. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  53. // with awserr.Error's Code and Message methods to get detailed information about
  54. // the error.
  55. //
  56. // See the AWS API reference guide for AWS Performance Insights's
  57. // API operation DescribeDimensionKeys for usage and error information.
  58. //
  59. // Returned Error Codes:
  60. // * ErrCodeInvalidArgumentException "InvalidArgumentException"
  61. // One of the arguments provided is invalid for this request.
  62. //
  63. // * ErrCodeInternalServiceError "InternalServiceError"
  64. // The request failed due to an unknown error.
  65. //
  66. // * ErrCodeNotAuthorizedException "NotAuthorizedException"
  67. // The user is not authorized to perform this request.
  68. //
  69. // See also, https://docs.aws.amazon.com/goto/WebAPI/pi-2018-02-27/DescribeDimensionKeys
  70. func (c *PI) DescribeDimensionKeys(input *DescribeDimensionKeysInput) (*DescribeDimensionKeysOutput, error) {
  71. req, out := c.DescribeDimensionKeysRequest(input)
  72. return out, req.Send()
  73. }
  74. // DescribeDimensionKeysWithContext is the same as DescribeDimensionKeys with the addition of
  75. // the ability to pass a context and additional request options.
  76. //
  77. // See DescribeDimensionKeys 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 *PI) DescribeDimensionKeysWithContext(ctx aws.Context, input *DescribeDimensionKeysInput, opts ...request.Option) (*DescribeDimensionKeysOutput, error) {
  84. req, out := c.DescribeDimensionKeysRequest(input)
  85. req.SetContext(ctx)
  86. req.ApplyOptions(opts...)
  87. return out, req.Send()
  88. }
  89. const opGetResourceMetrics = "GetResourceMetrics"
  90. // GetResourceMetricsRequest generates a "aws/request.Request" representing the
  91. // client's request for the GetResourceMetrics operation. The "output" return
  92. // value will be populated with the request's response once the request completes
  93. // successfully.
  94. //
  95. // Use "Send" method on the returned Request to send the API call to the service.
  96. // the "output" return value is not valid until after Send returns without error.
  97. //
  98. // See GetResourceMetrics for more information on using the GetResourceMetrics
  99. // API call, and error handling.
  100. //
  101. // This method is useful when you want to inject custom logic or configuration
  102. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  103. //
  104. //
  105. // // Example sending a request using the GetResourceMetricsRequest method.
  106. // req, resp := client.GetResourceMetricsRequest(params)
  107. //
  108. // err := req.Send()
  109. // if err == nil { // resp is now filled
  110. // fmt.Println(resp)
  111. // }
  112. //
  113. // See also, https://docs.aws.amazon.com/goto/WebAPI/pi-2018-02-27/GetResourceMetrics
  114. func (c *PI) GetResourceMetricsRequest(input *GetResourceMetricsInput) (req *request.Request, output *GetResourceMetricsOutput) {
  115. op := &request.Operation{
  116. Name: opGetResourceMetrics,
  117. HTTPMethod: "POST",
  118. HTTPPath: "/",
  119. }
  120. if input == nil {
  121. input = &GetResourceMetricsInput{}
  122. }
  123. output = &GetResourceMetricsOutput{}
  124. req = c.newRequest(op, input, output)
  125. return
  126. }
  127. // GetResourceMetrics API operation for AWS Performance Insights.
  128. //
  129. // Retrieve Performance Insights metrics for a set of data sources, over a time
  130. // period. You can provide specific dimension groups and dimensions, and provide
  131. // aggregation and filtering criteria for each group.
  132. //
  133. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  134. // with awserr.Error's Code and Message methods to get detailed information about
  135. // the error.
  136. //
  137. // See the AWS API reference guide for AWS Performance Insights's
  138. // API operation GetResourceMetrics for usage and error information.
  139. //
  140. // Returned Error Codes:
  141. // * ErrCodeInvalidArgumentException "InvalidArgumentException"
  142. // One of the arguments provided is invalid for this request.
  143. //
  144. // * ErrCodeInternalServiceError "InternalServiceError"
  145. // The request failed due to an unknown error.
  146. //
  147. // * ErrCodeNotAuthorizedException "NotAuthorizedException"
  148. // The user is not authorized to perform this request.
  149. //
  150. // See also, https://docs.aws.amazon.com/goto/WebAPI/pi-2018-02-27/GetResourceMetrics
  151. func (c *PI) GetResourceMetrics(input *GetResourceMetricsInput) (*GetResourceMetricsOutput, error) {
  152. req, out := c.GetResourceMetricsRequest(input)
  153. return out, req.Send()
  154. }
  155. // GetResourceMetricsWithContext is the same as GetResourceMetrics with the addition of
  156. // the ability to pass a context and additional request options.
  157. //
  158. // See GetResourceMetrics for details on how to use this API operation.
  159. //
  160. // The context must be non-nil and will be used for request cancellation. If
  161. // the context is nil a panic will occur. In the future the SDK may create
  162. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  163. // for more information on using Contexts.
  164. func (c *PI) GetResourceMetricsWithContext(ctx aws.Context, input *GetResourceMetricsInput, opts ...request.Option) (*GetResourceMetricsOutput, error) {
  165. req, out := c.GetResourceMetricsRequest(input)
  166. req.SetContext(ctx)
  167. req.ApplyOptions(opts...)
  168. return out, req.Send()
  169. }
  170. // A timestamp, and a single numerical value, which together represent a measurement
  171. // at a particular point in time.
  172. type DataPoint struct {
  173. _ struct{} `type:"structure"`
  174. // The time, in epoch format, associated with a particular Value.
  175. //
  176. // Timestamp is a required field
  177. Timestamp *time.Time `type:"timestamp" required:"true"`
  178. // The actual value associated with a particular Timestamp.
  179. //
  180. // Value is a required field
  181. Value *float64 `type:"double" required:"true"`
  182. }
  183. // String returns the string representation
  184. func (s DataPoint) String() string {
  185. return awsutil.Prettify(s)
  186. }
  187. // GoString returns the string representation
  188. func (s DataPoint) GoString() string {
  189. return s.String()
  190. }
  191. // SetTimestamp sets the Timestamp field's value.
  192. func (s *DataPoint) SetTimestamp(v time.Time) *DataPoint {
  193. s.Timestamp = &v
  194. return s
  195. }
  196. // SetValue sets the Value field's value.
  197. func (s *DataPoint) SetValue(v float64) *DataPoint {
  198. s.Value = &v
  199. return s
  200. }
  201. type DescribeDimensionKeysInput struct {
  202. _ struct{} `type:"structure"`
  203. // The date and time specifying the end of the requested time series data. The
  204. // value specified is exclusive - data points less than (but not equal to) EndTime
  205. // will be returned.
  206. //
  207. // The value for EndTime must be later than the value for StartTime.
  208. //
  209. // EndTime is a required field
  210. EndTime *time.Time `type:"timestamp" required:"true"`
  211. // One or more filters to apply in the request. Restrictions:
  212. //
  213. // * Any number of filters by the same dimension, as specified in the GroupBy
  214. // or Partition parameters.
  215. //
  216. // * A single filter for any other dimension in this dimension group.
  217. Filter map[string]*string `type:"map"`
  218. // A specification for how to aggregate the data points from a query result.
  219. // You must specify a valid dimension group. Performance Insights will return
  220. // all of the dimensions within that group, unless you provide the names of
  221. // specific dimensions within that group. You can also request that Performance
  222. // Insights return a limited number of values for a dimension.
  223. //
  224. // GroupBy is a required field
  225. GroupBy *DimensionGroup `type:"structure" required:"true"`
  226. // An immutable, AWS Region-unique identifier for a data source. Performance
  227. // Insights gathers metrics from this data source.
  228. //
  229. // To use an Amazon RDS instance as a data source, you specify its DbiResourceId
  230. // value - for example: db-FAIHNTYBKTGAUSUZQYPDS2GW4A
  231. //
  232. // Identifier is a required field
  233. Identifier *string `type:"string" required:"true"`
  234. // The maximum number of items to return in the response. If more items exist
  235. // than the specified MaxRecords value, a pagination token is included in the
  236. // response so that the remaining results can be retrieved.
  237. MaxResults *int64 `type:"integer"`
  238. // The name of a Performance Insights metric to be measured.
  239. //
  240. // Valid values for Metric are:
  241. //
  242. // * db.load.avg - a scaled representation of the number of active sessions
  243. // for the database engine.
  244. //
  245. // * db.sampledload.avg - the raw number of active sessions for the database
  246. // engine.
  247. //
  248. // Metric is a required field
  249. Metric *string `type:"string" required:"true"`
  250. // An optional pagination token provided by a previous request. If this parameter
  251. // is specified, the response includes only records beyond the token, up to
  252. // the value specified by MaxRecords.
  253. NextToken *string `type:"string"`
  254. // For each dimension specified in GroupBy, specify a secondary dimension to
  255. // further subdivide the partition keys in the response.
  256. PartitionBy *DimensionGroup `type:"structure"`
  257. // The granularity, in seconds, of the data points returned from Performance
  258. // Insights. A period can be as short as one second, or as long as one day (86400
  259. // seconds). Valid values are:
  260. //
  261. // * 1 (one second)
  262. //
  263. // * 60 (one minute)
  264. //
  265. // * 300 (five minutes)
  266. //
  267. // * 3600 (one hour)
  268. //
  269. // * 86400 (twenty-four hours)
  270. //
  271. // If you don't specify PeriodInSeconds, then Performance Insights will choose
  272. // a value for you, with a goal of returning roughly 100-200 data points in
  273. // the response.
  274. PeriodInSeconds *int64 `type:"integer"`
  275. // The AWS service for which Performance Insights will return metrics. The only
  276. // valid value for ServiceType is: RDS
  277. //
  278. // ServiceType is a required field
  279. ServiceType *string `type:"string" required:"true" enum:"ServiceType"`
  280. // The date and time specifying the beginning of the requested time series data.
  281. // You can't specify a StartTime that's earlier than 7 days ago. The value specified
  282. // is inclusive - data points equal to or greater than StartTime will be returned.
  283. //
  284. // The value for StartTime must be earlier than the value for EndTime.
  285. //
  286. // StartTime is a required field
  287. StartTime *time.Time `type:"timestamp" required:"true"`
  288. }
  289. // String returns the string representation
  290. func (s DescribeDimensionKeysInput) String() string {
  291. return awsutil.Prettify(s)
  292. }
  293. // GoString returns the string representation
  294. func (s DescribeDimensionKeysInput) GoString() string {
  295. return s.String()
  296. }
  297. // Validate inspects the fields of the type to determine if they are valid.
  298. func (s *DescribeDimensionKeysInput) Validate() error {
  299. invalidParams := request.ErrInvalidParams{Context: "DescribeDimensionKeysInput"}
  300. if s.EndTime == nil {
  301. invalidParams.Add(request.NewErrParamRequired("EndTime"))
  302. }
  303. if s.GroupBy == nil {
  304. invalidParams.Add(request.NewErrParamRequired("GroupBy"))
  305. }
  306. if s.Identifier == nil {
  307. invalidParams.Add(request.NewErrParamRequired("Identifier"))
  308. }
  309. if s.Metric == nil {
  310. invalidParams.Add(request.NewErrParamRequired("Metric"))
  311. }
  312. if s.ServiceType == nil {
  313. invalidParams.Add(request.NewErrParamRequired("ServiceType"))
  314. }
  315. if s.StartTime == nil {
  316. invalidParams.Add(request.NewErrParamRequired("StartTime"))
  317. }
  318. if s.GroupBy != nil {
  319. if err := s.GroupBy.Validate(); err != nil {
  320. invalidParams.AddNested("GroupBy", err.(request.ErrInvalidParams))
  321. }
  322. }
  323. if s.PartitionBy != nil {
  324. if err := s.PartitionBy.Validate(); err != nil {
  325. invalidParams.AddNested("PartitionBy", err.(request.ErrInvalidParams))
  326. }
  327. }
  328. if invalidParams.Len() > 0 {
  329. return invalidParams
  330. }
  331. return nil
  332. }
  333. // SetEndTime sets the EndTime field's value.
  334. func (s *DescribeDimensionKeysInput) SetEndTime(v time.Time) *DescribeDimensionKeysInput {
  335. s.EndTime = &v
  336. return s
  337. }
  338. // SetFilter sets the Filter field's value.
  339. func (s *DescribeDimensionKeysInput) SetFilter(v map[string]*string) *DescribeDimensionKeysInput {
  340. s.Filter = v
  341. return s
  342. }
  343. // SetGroupBy sets the GroupBy field's value.
  344. func (s *DescribeDimensionKeysInput) SetGroupBy(v *DimensionGroup) *DescribeDimensionKeysInput {
  345. s.GroupBy = v
  346. return s
  347. }
  348. // SetIdentifier sets the Identifier field's value.
  349. func (s *DescribeDimensionKeysInput) SetIdentifier(v string) *DescribeDimensionKeysInput {
  350. s.Identifier = &v
  351. return s
  352. }
  353. // SetMaxResults sets the MaxResults field's value.
  354. func (s *DescribeDimensionKeysInput) SetMaxResults(v int64) *DescribeDimensionKeysInput {
  355. s.MaxResults = &v
  356. return s
  357. }
  358. // SetMetric sets the Metric field's value.
  359. func (s *DescribeDimensionKeysInput) SetMetric(v string) *DescribeDimensionKeysInput {
  360. s.Metric = &v
  361. return s
  362. }
  363. // SetNextToken sets the NextToken field's value.
  364. func (s *DescribeDimensionKeysInput) SetNextToken(v string) *DescribeDimensionKeysInput {
  365. s.NextToken = &v
  366. return s
  367. }
  368. // SetPartitionBy sets the PartitionBy field's value.
  369. func (s *DescribeDimensionKeysInput) SetPartitionBy(v *DimensionGroup) *DescribeDimensionKeysInput {
  370. s.PartitionBy = v
  371. return s
  372. }
  373. // SetPeriodInSeconds sets the PeriodInSeconds field's value.
  374. func (s *DescribeDimensionKeysInput) SetPeriodInSeconds(v int64) *DescribeDimensionKeysInput {
  375. s.PeriodInSeconds = &v
  376. return s
  377. }
  378. // SetServiceType sets the ServiceType field's value.
  379. func (s *DescribeDimensionKeysInput) SetServiceType(v string) *DescribeDimensionKeysInput {
  380. s.ServiceType = &v
  381. return s
  382. }
  383. // SetStartTime sets the StartTime field's value.
  384. func (s *DescribeDimensionKeysInput) SetStartTime(v time.Time) *DescribeDimensionKeysInput {
  385. s.StartTime = &v
  386. return s
  387. }
  388. type DescribeDimensionKeysOutput struct {
  389. _ struct{} `type:"structure"`
  390. // The end time for the returned dimension keys, after alignment to a granular
  391. // boundary (as specified by PeriodInSeconds). AlignedEndTime will be greater
  392. // than or equal to the value of the user-specified Endtime.
  393. AlignedEndTime *time.Time `type:"timestamp"`
  394. // The start time for the returned dimension keys, after alignment to a granular
  395. // boundary (as specified by PeriodInSeconds). AlignedStartTime will be less
  396. // than or equal to the value of the user-specified StartTime.
  397. AlignedStartTime *time.Time `type:"timestamp"`
  398. // The dimension keys that were requested.
  399. Keys []*DimensionKeyDescription `type:"list"`
  400. // An optional pagination token provided by a previous request. If this parameter
  401. // is specified, the response includes only records beyond the token, up to
  402. // the value specified by MaxRecords.
  403. NextToken *string `type:"string"`
  404. // If PartitionBy was present in the request, PartitionKeys contains the breakdown
  405. // of dimension keys by the specified partitions.
  406. PartitionKeys []*ResponsePartitionKey `type:"list"`
  407. }
  408. // String returns the string representation
  409. func (s DescribeDimensionKeysOutput) String() string {
  410. return awsutil.Prettify(s)
  411. }
  412. // GoString returns the string representation
  413. func (s DescribeDimensionKeysOutput) GoString() string {
  414. return s.String()
  415. }
  416. // SetAlignedEndTime sets the AlignedEndTime field's value.
  417. func (s *DescribeDimensionKeysOutput) SetAlignedEndTime(v time.Time) *DescribeDimensionKeysOutput {
  418. s.AlignedEndTime = &v
  419. return s
  420. }
  421. // SetAlignedStartTime sets the AlignedStartTime field's value.
  422. func (s *DescribeDimensionKeysOutput) SetAlignedStartTime(v time.Time) *DescribeDimensionKeysOutput {
  423. s.AlignedStartTime = &v
  424. return s
  425. }
  426. // SetKeys sets the Keys field's value.
  427. func (s *DescribeDimensionKeysOutput) SetKeys(v []*DimensionKeyDescription) *DescribeDimensionKeysOutput {
  428. s.Keys = v
  429. return s
  430. }
  431. // SetNextToken sets the NextToken field's value.
  432. func (s *DescribeDimensionKeysOutput) SetNextToken(v string) *DescribeDimensionKeysOutput {
  433. s.NextToken = &v
  434. return s
  435. }
  436. // SetPartitionKeys sets the PartitionKeys field's value.
  437. func (s *DescribeDimensionKeysOutput) SetPartitionKeys(v []*ResponsePartitionKey) *DescribeDimensionKeysOutput {
  438. s.PartitionKeys = v
  439. return s
  440. }
  441. // A logical grouping of Performance Insights metrics for a related subject
  442. // area. For example, the db.sql dimension group consists of the following dimensions:
  443. // db.sql.id, db.sql.db_id, db.sql.statement, and db.sql.tokenized_id.
  444. type DimensionGroup struct {
  445. _ struct{} `type:"structure"`
  446. // A list of specific dimensions from a dimension group. If this parameter is
  447. // not present, then it signifies that all of the dimensions in the group were
  448. // requested, or are present in the response.
  449. //
  450. // Valid values for elements in the Dimensions array are:
  451. //
  452. // * db.user.id
  453. //
  454. // * db.user.name
  455. //
  456. // * db.host.id
  457. //
  458. // * db.host.name
  459. //
  460. // * db.sql.id
  461. //
  462. // * db.sql.db_id
  463. //
  464. // * db.sql.statement
  465. //
  466. // * db.sql.tokenized_id
  467. //
  468. // * db.sql_tokenized.id
  469. //
  470. // * db.sql_tokenized.db_id
  471. //
  472. // * db.sql_tokenized.statement
  473. //
  474. // * db.wait_event.name
  475. //
  476. // * db.wait_event.type
  477. //
  478. // * db.wait_event_type.name
  479. Dimensions []*string `min:"1" type:"list"`
  480. // The name of the dimension group. Valid values are:
  481. //
  482. // * db.user
  483. //
  484. // * db.host
  485. //
  486. // * db.sql
  487. //
  488. // * db.sql_tokenized
  489. //
  490. // * db.wait_event
  491. //
  492. // * db.wait_event_type
  493. //
  494. // Group is a required field
  495. Group *string `type:"string" required:"true"`
  496. // The maximum number of items to fetch for this dimension group.
  497. Limit *int64 `min:"1" type:"integer"`
  498. }
  499. // String returns the string representation
  500. func (s DimensionGroup) String() string {
  501. return awsutil.Prettify(s)
  502. }
  503. // GoString returns the string representation
  504. func (s DimensionGroup) GoString() string {
  505. return s.String()
  506. }
  507. // Validate inspects the fields of the type to determine if they are valid.
  508. func (s *DimensionGroup) Validate() error {
  509. invalidParams := request.ErrInvalidParams{Context: "DimensionGroup"}
  510. if s.Dimensions != nil && len(s.Dimensions) < 1 {
  511. invalidParams.Add(request.NewErrParamMinLen("Dimensions", 1))
  512. }
  513. if s.Group == nil {
  514. invalidParams.Add(request.NewErrParamRequired("Group"))
  515. }
  516. if s.Limit != nil && *s.Limit < 1 {
  517. invalidParams.Add(request.NewErrParamMinValue("Limit", 1))
  518. }
  519. if invalidParams.Len() > 0 {
  520. return invalidParams
  521. }
  522. return nil
  523. }
  524. // SetDimensions sets the Dimensions field's value.
  525. func (s *DimensionGroup) SetDimensions(v []*string) *DimensionGroup {
  526. s.Dimensions = v
  527. return s
  528. }
  529. // SetGroup sets the Group field's value.
  530. func (s *DimensionGroup) SetGroup(v string) *DimensionGroup {
  531. s.Group = &v
  532. return s
  533. }
  534. // SetLimit sets the Limit field's value.
  535. func (s *DimensionGroup) SetLimit(v int64) *DimensionGroup {
  536. s.Limit = &v
  537. return s
  538. }
  539. // An array of descriptions and aggregated values for each dimension within
  540. // a dimension group.
  541. type DimensionKeyDescription struct {
  542. _ struct{} `type:"structure"`
  543. // A map of name-value pairs for the dimensions in the group.
  544. Dimensions map[string]*string `type:"map"`
  545. // If PartitionBy was specified, PartitionKeys contains the dimensions that
  546. // were.
  547. Partitions []*float64 `type:"list"`
  548. // The aggregated metric value for the dimension(s), over the requested time
  549. // range.
  550. Total *float64 `type:"double"`
  551. }
  552. // String returns the string representation
  553. func (s DimensionKeyDescription) String() string {
  554. return awsutil.Prettify(s)
  555. }
  556. // GoString returns the string representation
  557. func (s DimensionKeyDescription) GoString() string {
  558. return s.String()
  559. }
  560. // SetDimensions sets the Dimensions field's value.
  561. func (s *DimensionKeyDescription) SetDimensions(v map[string]*string) *DimensionKeyDescription {
  562. s.Dimensions = v
  563. return s
  564. }
  565. // SetPartitions sets the Partitions field's value.
  566. func (s *DimensionKeyDescription) SetPartitions(v []*float64) *DimensionKeyDescription {
  567. s.Partitions = v
  568. return s
  569. }
  570. // SetTotal sets the Total field's value.
  571. func (s *DimensionKeyDescription) SetTotal(v float64) *DimensionKeyDescription {
  572. s.Total = &v
  573. return s
  574. }
  575. type GetResourceMetricsInput struct {
  576. _ struct{} `type:"structure"`
  577. // The date and time specifiying the end of the requested time series data.
  578. // The value specified is exclusive - data points less than (but not equal to)
  579. // EndTime will be returned.
  580. //
  581. // The value for EndTime must be later than the value for StartTime.
  582. //
  583. // EndTime is a required field
  584. EndTime *time.Time `type:"timestamp" required:"true"`
  585. // An immutable, AWS Region-unique identifier for a data source. Performance
  586. // Insights gathers metrics from this data source.
  587. //
  588. // To use an Amazon RDS instance as a data source, you specify its DbiResourceId
  589. // value - for example: db-FAIHNTYBKTGAUSUZQYPDS2GW4A
  590. //
  591. // Identifier is a required field
  592. Identifier *string `type:"string" required:"true"`
  593. // The maximum number of items to return in the response. If more items exist
  594. // than the specified MaxRecords value, a pagination token is included in the
  595. // response so that the remaining results can be retrieved.
  596. MaxResults *int64 `type:"integer"`
  597. // An array of one or more queries to perform. Each query must specify a Performance
  598. // Insights metric, and can optionally specify aggregation and filtering criteria.
  599. //
  600. // MetricQueries is a required field
  601. MetricQueries []*MetricQuery `min:"1" type:"list" required:"true"`
  602. // An optional pagination token provided by a previous request. If this parameter
  603. // is specified, the response includes only records beyond the token, up to
  604. // the value specified by MaxRecords.
  605. NextToken *string `type:"string"`
  606. // The granularity, in seconds, of the data points returned from Performance
  607. // Insights. A period can be as short as one second, or as long as one day (86400
  608. // seconds). Valid values are:
  609. //
  610. // * 1 (one second)
  611. //
  612. // * 60 (one minute)
  613. //
  614. // * 300 (five minutes)
  615. //
  616. // * 3600 (one hour)
  617. //
  618. // * 86400 (twenty-four hours)
  619. //
  620. // If you don't specify PeriodInSeconds, then Performance Insights will choose
  621. // a value for you, with a goal of returning roughly 100-200 data points in
  622. // the response.
  623. PeriodInSeconds *int64 `type:"integer"`
  624. // The AWS service for which Performance Insights will return metrics. The only
  625. // valid value for ServiceType is: RDS
  626. //
  627. // ServiceType is a required field
  628. ServiceType *string `type:"string" required:"true" enum:"ServiceType"`
  629. // The date and time specifying the beginning of the requested time series data.
  630. // You can't specify a StartTime that's earlier than 7 days ago. The value specified
  631. // is inclusive - data points equal to or greater than StartTime will be returned.
  632. //
  633. // The value for StartTime must be earlier than the value for EndTime.
  634. //
  635. // StartTime is a required field
  636. StartTime *time.Time `type:"timestamp" required:"true"`
  637. }
  638. // String returns the string representation
  639. func (s GetResourceMetricsInput) String() string {
  640. return awsutil.Prettify(s)
  641. }
  642. // GoString returns the string representation
  643. func (s GetResourceMetricsInput) GoString() string {
  644. return s.String()
  645. }
  646. // Validate inspects the fields of the type to determine if they are valid.
  647. func (s *GetResourceMetricsInput) Validate() error {
  648. invalidParams := request.ErrInvalidParams{Context: "GetResourceMetricsInput"}
  649. if s.EndTime == nil {
  650. invalidParams.Add(request.NewErrParamRequired("EndTime"))
  651. }
  652. if s.Identifier == nil {
  653. invalidParams.Add(request.NewErrParamRequired("Identifier"))
  654. }
  655. if s.MetricQueries == nil {
  656. invalidParams.Add(request.NewErrParamRequired("MetricQueries"))
  657. }
  658. if s.MetricQueries != nil && len(s.MetricQueries) < 1 {
  659. invalidParams.Add(request.NewErrParamMinLen("MetricQueries", 1))
  660. }
  661. if s.ServiceType == nil {
  662. invalidParams.Add(request.NewErrParamRequired("ServiceType"))
  663. }
  664. if s.StartTime == nil {
  665. invalidParams.Add(request.NewErrParamRequired("StartTime"))
  666. }
  667. if s.MetricQueries != nil {
  668. for i, v := range s.MetricQueries {
  669. if v == nil {
  670. continue
  671. }
  672. if err := v.Validate(); err != nil {
  673. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricQueries", i), err.(request.ErrInvalidParams))
  674. }
  675. }
  676. }
  677. if invalidParams.Len() > 0 {
  678. return invalidParams
  679. }
  680. return nil
  681. }
  682. // SetEndTime sets the EndTime field's value.
  683. func (s *GetResourceMetricsInput) SetEndTime(v time.Time) *GetResourceMetricsInput {
  684. s.EndTime = &v
  685. return s
  686. }
  687. // SetIdentifier sets the Identifier field's value.
  688. func (s *GetResourceMetricsInput) SetIdentifier(v string) *GetResourceMetricsInput {
  689. s.Identifier = &v
  690. return s
  691. }
  692. // SetMaxResults sets the MaxResults field's value.
  693. func (s *GetResourceMetricsInput) SetMaxResults(v int64) *GetResourceMetricsInput {
  694. s.MaxResults = &v
  695. return s
  696. }
  697. // SetMetricQueries sets the MetricQueries field's value.
  698. func (s *GetResourceMetricsInput) SetMetricQueries(v []*MetricQuery) *GetResourceMetricsInput {
  699. s.MetricQueries = v
  700. return s
  701. }
  702. // SetNextToken sets the NextToken field's value.
  703. func (s *GetResourceMetricsInput) SetNextToken(v string) *GetResourceMetricsInput {
  704. s.NextToken = &v
  705. return s
  706. }
  707. // SetPeriodInSeconds sets the PeriodInSeconds field's value.
  708. func (s *GetResourceMetricsInput) SetPeriodInSeconds(v int64) *GetResourceMetricsInput {
  709. s.PeriodInSeconds = &v
  710. return s
  711. }
  712. // SetServiceType sets the ServiceType field's value.
  713. func (s *GetResourceMetricsInput) SetServiceType(v string) *GetResourceMetricsInput {
  714. s.ServiceType = &v
  715. return s
  716. }
  717. // SetStartTime sets the StartTime field's value.
  718. func (s *GetResourceMetricsInput) SetStartTime(v time.Time) *GetResourceMetricsInput {
  719. s.StartTime = &v
  720. return s
  721. }
  722. type GetResourceMetricsOutput struct {
  723. _ struct{} `type:"structure"`
  724. // The end time for the returned metrics, after alignment to a granular boundary
  725. // (as specified by PeriodInSeconds). AlignedEndTime will be greater than or
  726. // equal to the value of the user-specified Endtime.
  727. AlignedEndTime *time.Time `type:"timestamp"`
  728. // The start time for the returned metrics, after alignment to a granular boundary
  729. // (as specified by PeriodInSeconds). AlignedStartTime will be less than or
  730. // equal to the value of the user-specified StartTime.
  731. AlignedStartTime *time.Time `type:"timestamp"`
  732. // An immutable, AWS Region-unique identifier for a data source. Performance
  733. // Insights gathers metrics from this data source.
  734. //
  735. // To use an Amazon RDS instance as a data source, you specify its DbiResourceId
  736. // value - for example: db-FAIHNTYBKTGAUSUZQYPDS2GW4A
  737. Identifier *string `type:"string"`
  738. // An array of metric results,, where each array element contains all of the
  739. // data points for a particular dimension.
  740. MetricList []*MetricKeyDataPoints `type:"list"`
  741. // An optional pagination token provided by a previous request. If this parameter
  742. // is specified, the response includes only records beyond the token, up to
  743. // the value specified by MaxRecords.
  744. NextToken *string `type:"string"`
  745. }
  746. // String returns the string representation
  747. func (s GetResourceMetricsOutput) String() string {
  748. return awsutil.Prettify(s)
  749. }
  750. // GoString returns the string representation
  751. func (s GetResourceMetricsOutput) GoString() string {
  752. return s.String()
  753. }
  754. // SetAlignedEndTime sets the AlignedEndTime field's value.
  755. func (s *GetResourceMetricsOutput) SetAlignedEndTime(v time.Time) *GetResourceMetricsOutput {
  756. s.AlignedEndTime = &v
  757. return s
  758. }
  759. // SetAlignedStartTime sets the AlignedStartTime field's value.
  760. func (s *GetResourceMetricsOutput) SetAlignedStartTime(v time.Time) *GetResourceMetricsOutput {
  761. s.AlignedStartTime = &v
  762. return s
  763. }
  764. // SetIdentifier sets the Identifier field's value.
  765. func (s *GetResourceMetricsOutput) SetIdentifier(v string) *GetResourceMetricsOutput {
  766. s.Identifier = &v
  767. return s
  768. }
  769. // SetMetricList sets the MetricList field's value.
  770. func (s *GetResourceMetricsOutput) SetMetricList(v []*MetricKeyDataPoints) *GetResourceMetricsOutput {
  771. s.MetricList = v
  772. return s
  773. }
  774. // SetNextToken sets the NextToken field's value.
  775. func (s *GetResourceMetricsOutput) SetNextToken(v string) *GetResourceMetricsOutput {
  776. s.NextToken = &v
  777. return s
  778. }
  779. // A time-ordered series of data points, correpsonding to a dimension of a Performance
  780. // Insights metric.
  781. type MetricKeyDataPoints struct {
  782. _ struct{} `type:"structure"`
  783. // An array of timestamp-value pairs, representing measurements over a period
  784. // of time.
  785. DataPoints []*DataPoint `type:"list"`
  786. // The dimension(s) to which the data points apply.
  787. Key *ResponseResourceMetricKey `type:"structure"`
  788. }
  789. // String returns the string representation
  790. func (s MetricKeyDataPoints) String() string {
  791. return awsutil.Prettify(s)
  792. }
  793. // GoString returns the string representation
  794. func (s MetricKeyDataPoints) GoString() string {
  795. return s.String()
  796. }
  797. // SetDataPoints sets the DataPoints field's value.
  798. func (s *MetricKeyDataPoints) SetDataPoints(v []*DataPoint) *MetricKeyDataPoints {
  799. s.DataPoints = v
  800. return s
  801. }
  802. // SetKey sets the Key field's value.
  803. func (s *MetricKeyDataPoints) SetKey(v *ResponseResourceMetricKey) *MetricKeyDataPoints {
  804. s.Key = v
  805. return s
  806. }
  807. // A single query to be processed. You must provide the metric to query. If
  808. // no other parameters are specified, Performance Insights returns all of the
  809. // data points for that metric. You can optionally request that the data points
  810. // be aggregated by dimension group ( GroupBy), and return only those data points
  811. // that match your criteria (Filter).
  812. type MetricQuery struct {
  813. _ struct{} `type:"structure"`
  814. // One or more filters to apply in the request. Restrictions:
  815. //
  816. // * Any number of filters by the same dimension, as specified in the GroupBy
  817. // parameter.
  818. //
  819. // * A single filter for any other dimension in this dimension group.
  820. Filter map[string]*string `type:"map"`
  821. // A specification for how to aggregate the data points from a query result.
  822. // You must specify a valid dimension group. Performance Insights will return
  823. // all of the dimensions within that group, unless you provide the names of
  824. // specific dimensions within that group. You can also request that Performance
  825. // Insights return a limited number of values for a dimension.
  826. GroupBy *DimensionGroup `type:"structure"`
  827. // The name of a Performance Insights metric to be measured.
  828. //
  829. // Valid values for Metric are:
  830. //
  831. // * db.load.avg - a scaled representation of the number of active sessions
  832. // for the database engine.
  833. //
  834. // * db.sampledload.avg - the raw number of active sessions for the database
  835. // engine.
  836. //
  837. // Metric is a required field
  838. Metric *string `type:"string" required:"true"`
  839. }
  840. // String returns the string representation
  841. func (s MetricQuery) String() string {
  842. return awsutil.Prettify(s)
  843. }
  844. // GoString returns the string representation
  845. func (s MetricQuery) GoString() string {
  846. return s.String()
  847. }
  848. // Validate inspects the fields of the type to determine if they are valid.
  849. func (s *MetricQuery) Validate() error {
  850. invalidParams := request.ErrInvalidParams{Context: "MetricQuery"}
  851. if s.Metric == nil {
  852. invalidParams.Add(request.NewErrParamRequired("Metric"))
  853. }
  854. if s.GroupBy != nil {
  855. if err := s.GroupBy.Validate(); err != nil {
  856. invalidParams.AddNested("GroupBy", err.(request.ErrInvalidParams))
  857. }
  858. }
  859. if invalidParams.Len() > 0 {
  860. return invalidParams
  861. }
  862. return nil
  863. }
  864. // SetFilter sets the Filter field's value.
  865. func (s *MetricQuery) SetFilter(v map[string]*string) *MetricQuery {
  866. s.Filter = v
  867. return s
  868. }
  869. // SetGroupBy sets the GroupBy field's value.
  870. func (s *MetricQuery) SetGroupBy(v *DimensionGroup) *MetricQuery {
  871. s.GroupBy = v
  872. return s
  873. }
  874. // SetMetric sets the Metric field's value.
  875. func (s *MetricQuery) SetMetric(v string) *MetricQuery {
  876. s.Metric = &v
  877. return s
  878. }
  879. // If PartitionBy was specified in a DescribeDimensionKeys request, the dimensions
  880. // are returned in an array. Each element in the array specifies one dimension.
  881. type ResponsePartitionKey struct {
  882. _ struct{} `type:"structure"`
  883. // A dimension map that contains the dimension(s) for this partition.
  884. //
  885. // Dimensions is a required field
  886. Dimensions map[string]*string `type:"map" required:"true"`
  887. }
  888. // String returns the string representation
  889. func (s ResponsePartitionKey) String() string {
  890. return awsutil.Prettify(s)
  891. }
  892. // GoString returns the string representation
  893. func (s ResponsePartitionKey) GoString() string {
  894. return s.String()
  895. }
  896. // SetDimensions sets the Dimensions field's value.
  897. func (s *ResponsePartitionKey) SetDimensions(v map[string]*string) *ResponsePartitionKey {
  898. s.Dimensions = v
  899. return s
  900. }
  901. // An object describing a Performance Insights metric and one or more dimensions
  902. // for that metric.
  903. type ResponseResourceMetricKey struct {
  904. _ struct{} `type:"structure"`
  905. // The valid dimensions for the metric.
  906. Dimensions map[string]*string `type:"map"`
  907. // The name of a Performance Insights metric to be measured.
  908. //
  909. // Valid values for Metric are:
  910. //
  911. // * db.load.avg - a scaled representation of the number of active sessions
  912. // for the database engine.
  913. //
  914. // * db.sampledload.avg - the raw number of active sessions for the database
  915. // engine.
  916. //
  917. // Metric is a required field
  918. Metric *string `type:"string" required:"true"`
  919. }
  920. // String returns the string representation
  921. func (s ResponseResourceMetricKey) String() string {
  922. return awsutil.Prettify(s)
  923. }
  924. // GoString returns the string representation
  925. func (s ResponseResourceMetricKey) GoString() string {
  926. return s.String()
  927. }
  928. // SetDimensions sets the Dimensions field's value.
  929. func (s *ResponseResourceMetricKey) SetDimensions(v map[string]*string) *ResponseResourceMetricKey {
  930. s.Dimensions = v
  931. return s
  932. }
  933. // SetMetric sets the Metric field's value.
  934. func (s *ResponseResourceMetricKey) SetMetric(v string) *ResponseResourceMetricKey {
  935. s.Metric = &v
  936. return s
  937. }
  938. const (
  939. // ServiceTypeRds is a ServiceType enum value
  940. ServiceTypeRds = "RDS"
  941. )