api_op_StopQuery.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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/smithy-go/middleware"
  8. smithyhttp "github.com/aws/smithy-go/transport/http"
  9. )
  10. // Stops a CloudWatch Logs Insights query that is in progress. If the query has
  11. // already ended, the operation returns an error indicating that the specified
  12. // query is not running.
  13. func (c *Client) StopQuery(ctx context.Context, params *StopQueryInput, optFns ...func(*Options)) (*StopQueryOutput, error) {
  14. if params == nil {
  15. params = &StopQueryInput{}
  16. }
  17. result, metadata, err := c.invokeOperation(ctx, "StopQuery", params, optFns, c.addOperationStopQueryMiddlewares)
  18. if err != nil {
  19. return nil, err
  20. }
  21. out := result.(*StopQueryOutput)
  22. out.ResultMetadata = metadata
  23. return out, nil
  24. }
  25. type StopQueryInput struct {
  26. // The ID number of the query to stop. To find this ID number, use DescribeQueries.
  27. //
  28. // This member is required.
  29. QueryId *string
  30. noSmithyDocumentSerde
  31. }
  32. type StopQueryOutput struct {
  33. // This is true if the query was stopped by the StopQuery operation.
  34. Success bool
  35. // Metadata pertaining to the operation's result.
  36. ResultMetadata middleware.Metadata
  37. noSmithyDocumentSerde
  38. }
  39. func (c *Client) addOperationStopQueryMiddlewares(stack *middleware.Stack, options Options) (err error) {
  40. err = stack.Serialize.Add(&awsAwsjson11_serializeOpStopQuery{}, middleware.After)
  41. if err != nil {
  42. return err
  43. }
  44. err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStopQuery{}, middleware.After)
  45. if err != nil {
  46. return err
  47. }
  48. if err = addSetLoggerMiddleware(stack, options); err != nil {
  49. return err
  50. }
  51. if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
  52. return err
  53. }
  54. if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
  55. return err
  56. }
  57. if err = addResolveEndpointMiddleware(stack, options); err != nil {
  58. return err
  59. }
  60. if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
  61. return err
  62. }
  63. if err = addRetryMiddlewares(stack, options); err != nil {
  64. return err
  65. }
  66. if err = addHTTPSignerV4Middleware(stack, options); err != nil {
  67. return err
  68. }
  69. if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
  70. return err
  71. }
  72. if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
  73. return err
  74. }
  75. if err = addClientUserAgent(stack); err != nil {
  76. return err
  77. }
  78. if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
  79. return err
  80. }
  81. if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
  82. return err
  83. }
  84. if err = addOpStopQueryValidationMiddleware(stack); err != nil {
  85. return err
  86. }
  87. if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStopQuery(options.Region), middleware.Before); err != nil {
  88. return err
  89. }
  90. if err = addRequestIDRetrieverMiddleware(stack); err != nil {
  91. return err
  92. }
  93. if err = addResponseErrorMiddleware(stack); err != nil {
  94. return err
  95. }
  96. if err = addRequestResponseLogging(stack, options); err != nil {
  97. return err
  98. }
  99. return nil
  100. }
  101. func newServiceMetadataMiddleware_opStopQuery(region string) *awsmiddleware.RegisterServiceMetadata {
  102. return &awsmiddleware.RegisterServiceMetadata{
  103. Region: region,
  104. ServiceID: ServiceID,
  105. SigningName: "logs",
  106. OperationName: "StopQuery",
  107. }
  108. }