1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package chime
4
5import (
6	"context"
7	"fmt"
8	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
9	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Redacts message content, but not metadata. The message exists in the back end,
15// but the action returns null content, and the state shows as redacted. The
16// x-amz-chime-bearer request header is mandatory. Use the AppInstanceUserArn of
17// the user that makes the API call as the value in the header.
18func (c *Client) RedactChannelMessage(ctx context.Context, params *RedactChannelMessageInput, optFns ...func(*Options)) (*RedactChannelMessageOutput, error) {
19	if params == nil {
20		params = &RedactChannelMessageInput{}
21	}
22
23	result, metadata, err := c.invokeOperation(ctx, "RedactChannelMessage", params, optFns, addOperationRedactChannelMessageMiddlewares)
24	if err != nil {
25		return nil, err
26	}
27
28	out := result.(*RedactChannelMessageOutput)
29	out.ResultMetadata = metadata
30	return out, nil
31}
32
33type RedactChannelMessageInput struct {
34
35	// The ARN of the channel containing the messages that you want to redact.
36	//
37	// This member is required.
38	ChannelArn *string
39
40	// The ID of the message being redacted.
41	//
42	// This member is required.
43	MessageId *string
44
45	// The AppInstanceUserArn of the user that makes the API call.
46	ChimeBearer *string
47}
48
49type RedactChannelMessageOutput struct {
50
51	// The ARN of the channel containing the messages that you want to redact.
52	ChannelArn *string
53
54	// The ID of the message being redacted.
55	MessageId *string
56
57	// Metadata pertaining to the operation's result.
58	ResultMetadata middleware.Metadata
59}
60
61func addOperationRedactChannelMessageMiddlewares(stack *middleware.Stack, options Options) (err error) {
62	err = stack.Serialize.Add(&awsRestjson1_serializeOpRedactChannelMessage{}, middleware.After)
63	if err != nil {
64		return err
65	}
66	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpRedactChannelMessage{}, middleware.After)
67	if err != nil {
68		return err
69	}
70	if err = addSetLoggerMiddleware(stack, options); err != nil {
71		return err
72	}
73	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
74		return err
75	}
76	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
77		return err
78	}
79	if err = addResolveEndpointMiddleware(stack, options); err != nil {
80		return err
81	}
82	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
83		return err
84	}
85	if err = addRetryMiddlewares(stack, options); err != nil {
86		return err
87	}
88	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
89		return err
90	}
91	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
92		return err
93	}
94	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
95		return err
96	}
97	if err = addClientUserAgent(stack); err != nil {
98		return err
99	}
100	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
101		return err
102	}
103	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
104		return err
105	}
106	if err = addEndpointPrefix_opRedactChannelMessageMiddleware(stack); err != nil {
107		return err
108	}
109	if err = addOpRedactChannelMessageValidationMiddleware(stack); err != nil {
110		return err
111	}
112	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRedactChannelMessage(options.Region), middleware.Before); err != nil {
113		return err
114	}
115	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
116		return err
117	}
118	if err = addResponseErrorMiddleware(stack); err != nil {
119		return err
120	}
121	if err = addRequestResponseLogging(stack, options); err != nil {
122		return err
123	}
124	return nil
125}
126
127type endpointPrefix_opRedactChannelMessageMiddleware struct {
128}
129
130func (*endpointPrefix_opRedactChannelMessageMiddleware) ID() string {
131	return "EndpointHostPrefix"
132}
133
134func (m *endpointPrefix_opRedactChannelMessageMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
135	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
136) {
137	if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) {
138		return next.HandleSerialize(ctx, in)
139	}
140
141	req, ok := in.Request.(*smithyhttp.Request)
142	if !ok {
143		return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
144	}
145
146	req.URL.Host = "messaging-" + req.URL.Host
147
148	return next.HandleSerialize(ctx, in)
149}
150func addEndpointPrefix_opRedactChannelMessageMiddleware(stack *middleware.Stack) error {
151	return stack.Serialize.Insert(&endpointPrefix_opRedactChannelMessageMiddleware{}, `OperationSerializer`, middleware.After)
152}
153
154func newServiceMetadataMiddleware_opRedactChannelMessage(region string) *awsmiddleware.RegisterServiceMetadata {
155	return &awsmiddleware.RegisterServiceMetadata{
156		Region:        region,
157		ServiceID:     ServiceID,
158		SigningName:   "chime",
159		OperationName: "RedactChannelMessage",
160	}
161}
162