api_op_GetDataProtectionPolicy.go 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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/smithy-go/middleware"
  9. smithyhttp "github.com/aws/smithy-go/transport/http"
  10. )
  11. // Returns information about a log group data protection policy.
  12. func (c *Client) GetDataProtectionPolicy(ctx context.Context, params *GetDataProtectionPolicyInput, optFns ...func(*Options)) (*GetDataProtectionPolicyOutput, error) {
  13. if params == nil {
  14. params = &GetDataProtectionPolicyInput{}
  15. }
  16. result, metadata, err := c.invokeOperation(ctx, "GetDataProtectionPolicy", params, optFns, c.addOperationGetDataProtectionPolicyMiddlewares)
  17. if err != nil {
  18. return nil, err
  19. }
  20. out := result.(*GetDataProtectionPolicyOutput)
  21. out.ResultMetadata = metadata
  22. return out, nil
  23. }
  24. type GetDataProtectionPolicyInput struct {
  25. // The name or ARN of the log group that contains the data protection policy that
  26. // you want to see.
  27. //
  28. // This member is required.
  29. LogGroupIdentifier *string
  30. noSmithyDocumentSerde
  31. }
  32. type GetDataProtectionPolicyOutput struct {
  33. // The date and time that this policy was most recently updated.
  34. LastUpdatedTime *int64
  35. // The log group name or ARN that you specified in your request.
  36. LogGroupIdentifier *string
  37. // The data protection policy document for this log group.
  38. PolicyDocument *string
  39. // Metadata pertaining to the operation's result.
  40. ResultMetadata middleware.Metadata
  41. noSmithyDocumentSerde
  42. }
  43. func (c *Client) addOperationGetDataProtectionPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
  44. if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  45. return err
  46. }
  47. err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDataProtectionPolicy{}, middleware.After)
  48. if err != nil {
  49. return err
  50. }
  51. err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDataProtectionPolicy{}, middleware.After)
  52. if err != nil {
  53. return err
  54. }
  55. if err := addProtocolFinalizerMiddlewares(stack, options, "GetDataProtectionPolicy"); err != nil {
  56. return fmt.Errorf("add protocol finalizers: %v", err)
  57. }
  58. if err = addlegacyEndpointContextSetter(stack, options); err != nil {
  59. return err
  60. }
  61. if err = addSetLoggerMiddleware(stack, options); err != nil {
  62. return err
  63. }
  64. if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
  65. return err
  66. }
  67. if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
  68. return err
  69. }
  70. if err = addResolveEndpointMiddleware(stack, options); err != nil {
  71. return err
  72. }
  73. if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
  74. return err
  75. }
  76. if err = addRetryMiddlewares(stack, options); err != nil {
  77. return err
  78. }
  79. if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
  80. return err
  81. }
  82. if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
  83. return err
  84. }
  85. if err = addClientUserAgent(stack, options); err != nil {
  86. return err
  87. }
  88. if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
  89. return err
  90. }
  91. if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
  92. return err
  93. }
  94. if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
  95. return err
  96. }
  97. if err = addOpGetDataProtectionPolicyValidationMiddleware(stack); err != nil {
  98. return err
  99. }
  100. if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDataProtectionPolicy(options.Region), middleware.Before); err != nil {
  101. return err
  102. }
  103. if err = awsmiddleware.AddRecursionDetection(stack); err != nil {
  104. return err
  105. }
  106. if err = addRequestIDRetrieverMiddleware(stack); err != nil {
  107. return err
  108. }
  109. if err = addResponseErrorMiddleware(stack); err != nil {
  110. return err
  111. }
  112. if err = addRequestResponseLogging(stack, options); err != nil {
  113. return err
  114. }
  115. if err = addDisableHTTPSMiddleware(stack, options); err != nil {
  116. return err
  117. }
  118. return nil
  119. }
  120. func newServiceMetadataMiddleware_opGetDataProtectionPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
  121. return &awsmiddleware.RegisterServiceMetadata{
  122. Region: region,
  123. ServiceID: ServiceID,
  124. OperationName: "GetDataProtectionPolicy",
  125. }
  126. }