api_op_GetQueryResults.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. // Code generated by smithy-go-codegen DO NOT EDIT.
  2. package cloudwatchlogs
  3. import (
  4. "context"
  5. awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
  6. "github.com/aws/aws-sdk-go-v2/aws/signer/v4"
  7. "github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
  8. "github.com/aws/smithy-go/middleware"
  9. smithyhttp "github.com/aws/smithy-go/transport/http"
  10. )
  11. // Returns the results from the specified query. Only the fields requested in the
  12. // query are returned, along with a @ptr field, which is the identifier for the log
  13. // record. You can use the value of @ptr in a GetLogRecord
  14. // (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_GetLogRecord.html)
  15. // operation to get the full log record. GetQueryResults does not start a query
  16. // execution. To run a query, use StartQuery
  17. // (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html).
  18. // If the value of the Status field in the output is Running, this operation
  19. // returns only partial results. If you see a value of Scheduled or Running for the
  20. // status, you can retry the operation later to see the final results.
  21. func (c *Client) GetQueryResults(ctx context.Context, params *GetQueryResultsInput, optFns ...func(*Options)) (*GetQueryResultsOutput, error) {
  22. if params == nil {
  23. params = &GetQueryResultsInput{}
  24. }
  25. result, metadata, err := c.invokeOperation(ctx, "GetQueryResults", params, optFns, c.addOperationGetQueryResultsMiddlewares)
  26. if err != nil {
  27. return nil, err
  28. }
  29. out := result.(*GetQueryResultsOutput)
  30. out.ResultMetadata = metadata
  31. return out, nil
  32. }
  33. type GetQueryResultsInput struct {
  34. // The ID number of the query.
  35. //
  36. // This member is required.
  37. QueryId *string
  38. noSmithyDocumentSerde
  39. }
  40. type GetQueryResultsOutput struct {
  41. // The log events that matched the query criteria during the most recent time it
  42. // ran. The results value is an array of arrays. Each log event is one object in
  43. // the top-level array. Each of these log event objects is an array of field/value
  44. // pairs.
  45. Results [][]types.ResultField
  46. // Includes the number of log events scanned by the query, the number of log events
  47. // that matched the query criteria, and the total number of bytes in the log events
  48. // that were scanned. These values reflect the full raw results of the query.
  49. Statistics *types.QueryStatistics
  50. // The status of the most recent running of the query. Possible values are
  51. // Cancelled, Complete, Failed, Running, Scheduled, Timeout, and Unknown. Queries
  52. // time out after 15 minutes of execution. To avoid having your queries time out,
  53. // reduce the time range being searched or partition your query into a number of
  54. // queries.
  55. Status types.QueryStatus
  56. // Metadata pertaining to the operation's result.
  57. ResultMetadata middleware.Metadata
  58. noSmithyDocumentSerde
  59. }
  60. func (c *Client) addOperationGetQueryResultsMiddlewares(stack *middleware.Stack, options Options) (err error) {
  61. err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetQueryResults{}, middleware.After)
  62. if err != nil {
  63. return err
  64. }
  65. err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetQueryResults{}, middleware.After)
  66. if err != nil {
  67. return err
  68. }
  69. if err = addSetLoggerMiddleware(stack, options); err != nil {
  70. return err
  71. }
  72. if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
  73. return err
  74. }
  75. if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
  76. return err
  77. }
  78. if err = addResolveEndpointMiddleware(stack, options); err != nil {
  79. return err
  80. }
  81. if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
  82. return err
  83. }
  84. if err = addRetryMiddlewares(stack, options); err != nil {
  85. return err
  86. }
  87. if err = addHTTPSignerV4Middleware(stack, options); err != nil {
  88. return err
  89. }
  90. if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
  91. return err
  92. }
  93. if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
  94. return err
  95. }
  96. if err = addClientUserAgent(stack); err != nil {
  97. return err
  98. }
  99. if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
  100. return err
  101. }
  102. if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
  103. return err
  104. }
  105. if err = addOpGetQueryResultsValidationMiddleware(stack); err != nil {
  106. return err
  107. }
  108. if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetQueryResults(options.Region), middleware.Before); err != nil {
  109. return err
  110. }
  111. if err = addRequestIDRetrieverMiddleware(stack); err != nil {
  112. return err
  113. }
  114. if err = addResponseErrorMiddleware(stack); err != nil {
  115. return err
  116. }
  117. if err = addRequestResponseLogging(stack, options); err != nil {
  118. return err
  119. }
  120. return nil
  121. }
  122. func newServiceMetadataMiddleware_opGetQueryResults(region string) *awsmiddleware.RegisterServiceMetadata {
  123. return &awsmiddleware.RegisterServiceMetadata{
  124. Region: region,
  125. ServiceID: ServiceID,
  126. SigningName: "logs",
  127. OperationName: "GetQueryResults",
  128. }
  129. }