api_op_UpdateAnomaly.go 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. // Code generated by smithy-go-codegen DO NOT EDIT.
  2. package cloudwatchlogs
  3. import (
  4. "context"
  5. "fmt"
  6. awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
  7. "github.com/aws/aws-sdk-go-v2/aws/signer/v4"
  8. "github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
  9. "github.com/aws/smithy-go/middleware"
  10. smithyhttp "github.com/aws/smithy-go/transport/http"
  11. )
  12. // Use this operation to suppress anomaly detection for a specified anomaly or
  13. // pattern. If you suppress an anomaly, CloudWatch Logs won’t report new
  14. // occurrences of that anomaly and won't update that anomaly with new data. If you
  15. // suppress a pattern, CloudWatch Logs won’t report any anomalies related to that
  16. // pattern. You must specify either anomalyId or patternId , but you can't specify
  17. // both parameters in the same operation. If you have previously used this
  18. // operation to suppress detection of a pattern or anomaly, you can use it again to
  19. // cause CloudWatch Logs to end the suppression. To do this, use this operation and
  20. // specify the anomaly or pattern to stop suppressing, and omit the suppressionType
  21. // and suppressionPeriod parameters.
  22. func (c *Client) UpdateAnomaly(ctx context.Context, params *UpdateAnomalyInput, optFns ...func(*Options)) (*UpdateAnomalyOutput, error) {
  23. if params == nil {
  24. params = &UpdateAnomalyInput{}
  25. }
  26. result, metadata, err := c.invokeOperation(ctx, "UpdateAnomaly", params, optFns, c.addOperationUpdateAnomalyMiddlewares)
  27. if err != nil {
  28. return nil, err
  29. }
  30. out := result.(*UpdateAnomalyOutput)
  31. out.ResultMetadata = metadata
  32. return out, nil
  33. }
  34. type UpdateAnomalyInput struct {
  35. // The ARN of the anomaly detector that this operation is to act on.
  36. //
  37. // This member is required.
  38. AnomalyDetectorArn *string
  39. // If you are suppressing or unsuppressing an anomaly, specify its unique ID here.
  40. // You can find anomaly IDs by using the ListAnomalies (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html)
  41. // operation.
  42. AnomalyId *string
  43. // If you are suppressing or unsuppressing an pattern, specify its unique ID here.
  44. // You can find pattern IDs by using the ListAnomalies (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_ListAnomalies.html)
  45. // operation.
  46. PatternId *string
  47. // If you are temporarily suppressing an anomaly or pattern, use this structure to
  48. // specify how long the suppression is to last.
  49. SuppressionPeriod *types.SuppressionPeriod
  50. // Use this to specify whether the suppression to be temporary or infinite. If you
  51. // specify LIMITED , you must also specify a suppressionPeriod . If you specify
  52. // INFINITE , any value for suppressionPeriod is ignored.
  53. SuppressionType types.SuppressionType
  54. noSmithyDocumentSerde
  55. }
  56. type UpdateAnomalyOutput struct {
  57. // Metadata pertaining to the operation's result.
  58. ResultMetadata middleware.Metadata
  59. noSmithyDocumentSerde
  60. }
  61. func (c *Client) addOperationUpdateAnomalyMiddlewares(stack *middleware.Stack, options Options) (err error) {
  62. if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  63. return err
  64. }
  65. err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateAnomaly{}, middleware.After)
  66. if err != nil {
  67. return err
  68. }
  69. err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateAnomaly{}, middleware.After)
  70. if err != nil {
  71. return err
  72. }
  73. if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateAnomaly"); err != nil {
  74. return fmt.Errorf("add protocol finalizers: %v", err)
  75. }
  76. if err = addlegacyEndpointContextSetter(stack, options); err != nil {
  77. return err
  78. }
  79. if err = addSetLoggerMiddleware(stack, options); err != nil {
  80. return err
  81. }
  82. if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
  83. return err
  84. }
  85. if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
  86. return err
  87. }
  88. if err = addResolveEndpointMiddleware(stack, options); err != nil {
  89. return err
  90. }
  91. if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
  92. return err
  93. }
  94. if err = addRetryMiddlewares(stack, options); err != nil {
  95. return err
  96. }
  97. if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
  98. return err
  99. }
  100. if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
  101. return err
  102. }
  103. if err = addClientUserAgent(stack, options); err != nil {
  104. return err
  105. }
  106. if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
  107. return err
  108. }
  109. if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
  110. return err
  111. }
  112. if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
  113. return err
  114. }
  115. if err = addOpUpdateAnomalyValidationMiddleware(stack); err != nil {
  116. return err
  117. }
  118. if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAnomaly(options.Region), middleware.Before); err != nil {
  119. return err
  120. }
  121. if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
  122. return err
  123. }
  124. if err = addRequestIDRetrieverMiddleware(stack); err != nil {
  125. return err
  126. }
  127. if err = addResponseErrorMiddleware(stack); err != nil {
  128. return err
  129. }
  130. if err = addRequestResponseLogging(stack, options); err != nil {
  131. return err
  132. }
  133. if err = addDisableHTTPSMiddleware(stack, options); err != nil {
  134. return err
  135. }
  136. return nil
  137. }
  138. func newServiceMetadataMiddleware_opUpdateAnomaly(region string) *awsmiddleware.RegisterServiceMetadata {
  139. return &awsmiddleware.RegisterServiceMetadata{
  140. Region: region,
  141. ServiceID: ServiceID,
  142. OperationName: "UpdateAnomaly",
  143. }
  144. }