1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package identitystore
4
5import (
6	"bytes"
7	"context"
8	"fmt"
9	"github.com/aws/aws-sdk-go-v2/service/identitystore/types"
10	smithy "github.com/aws/smithy-go"
11	"github.com/aws/smithy-go/encoding/httpbinding"
12	smithyjson "github.com/aws/smithy-go/encoding/json"
13	"github.com/aws/smithy-go/middleware"
14	smithyhttp "github.com/aws/smithy-go/transport/http"
15)
16
17type awsAwsjson11_serializeOpDescribeGroup struct {
18}
19
20func (*awsAwsjson11_serializeOpDescribeGroup) ID() string {
21	return "OperationSerializer"
22}
23
24func (m *awsAwsjson11_serializeOpDescribeGroup) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
25	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
26) {
27	request, ok := in.Request.(*smithyhttp.Request)
28	if !ok {
29		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
30	}
31
32	input, ok := in.Parameters.(*DescribeGroupInput)
33	_ = input
34	if !ok {
35		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
36	}
37
38	request.Request.URL.Path = "/"
39	request.Request.Method = "POST"
40	httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
41	if err != nil {
42		return out, metadata, &smithy.SerializationError{Err: err}
43	}
44	httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1")
45	httpBindingEncoder.SetHeader("X-Amz-Target").String("AWSIdentityStore.DescribeGroup")
46
47	jsonEncoder := smithyjson.NewEncoder()
48	if err := awsAwsjson11_serializeOpDocumentDescribeGroupInput(input, jsonEncoder.Value); err != nil {
49		return out, metadata, &smithy.SerializationError{Err: err}
50	}
51
52	if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
53		return out, metadata, &smithy.SerializationError{Err: err}
54	}
55
56	if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil {
57		return out, metadata, &smithy.SerializationError{Err: err}
58	}
59	in.Request = request
60
61	return next.HandleSerialize(ctx, in)
62}
63
64type awsAwsjson11_serializeOpDescribeUser struct {
65}
66
67func (*awsAwsjson11_serializeOpDescribeUser) ID() string {
68	return "OperationSerializer"
69}
70
71func (m *awsAwsjson11_serializeOpDescribeUser) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
72	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
73) {
74	request, ok := in.Request.(*smithyhttp.Request)
75	if !ok {
76		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
77	}
78
79	input, ok := in.Parameters.(*DescribeUserInput)
80	_ = input
81	if !ok {
82		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
83	}
84
85	request.Request.URL.Path = "/"
86	request.Request.Method = "POST"
87	httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
88	if err != nil {
89		return out, metadata, &smithy.SerializationError{Err: err}
90	}
91	httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1")
92	httpBindingEncoder.SetHeader("X-Amz-Target").String("AWSIdentityStore.DescribeUser")
93
94	jsonEncoder := smithyjson.NewEncoder()
95	if err := awsAwsjson11_serializeOpDocumentDescribeUserInput(input, jsonEncoder.Value); err != nil {
96		return out, metadata, &smithy.SerializationError{Err: err}
97	}
98
99	if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
100		return out, metadata, &smithy.SerializationError{Err: err}
101	}
102
103	if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil {
104		return out, metadata, &smithy.SerializationError{Err: err}
105	}
106	in.Request = request
107
108	return next.HandleSerialize(ctx, in)
109}
110
111type awsAwsjson11_serializeOpListGroups struct {
112}
113
114func (*awsAwsjson11_serializeOpListGroups) ID() string {
115	return "OperationSerializer"
116}
117
118func (m *awsAwsjson11_serializeOpListGroups) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
119	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
120) {
121	request, ok := in.Request.(*smithyhttp.Request)
122	if !ok {
123		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
124	}
125
126	input, ok := in.Parameters.(*ListGroupsInput)
127	_ = input
128	if !ok {
129		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
130	}
131
132	request.Request.URL.Path = "/"
133	request.Request.Method = "POST"
134	httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
135	if err != nil {
136		return out, metadata, &smithy.SerializationError{Err: err}
137	}
138	httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1")
139	httpBindingEncoder.SetHeader("X-Amz-Target").String("AWSIdentityStore.ListGroups")
140
141	jsonEncoder := smithyjson.NewEncoder()
142	if err := awsAwsjson11_serializeOpDocumentListGroupsInput(input, jsonEncoder.Value); err != nil {
143		return out, metadata, &smithy.SerializationError{Err: err}
144	}
145
146	if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
147		return out, metadata, &smithy.SerializationError{Err: err}
148	}
149
150	if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil {
151		return out, metadata, &smithy.SerializationError{Err: err}
152	}
153	in.Request = request
154
155	return next.HandleSerialize(ctx, in)
156}
157
158type awsAwsjson11_serializeOpListUsers struct {
159}
160
161func (*awsAwsjson11_serializeOpListUsers) ID() string {
162	return "OperationSerializer"
163}
164
165func (m *awsAwsjson11_serializeOpListUsers) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
166	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
167) {
168	request, ok := in.Request.(*smithyhttp.Request)
169	if !ok {
170		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
171	}
172
173	input, ok := in.Parameters.(*ListUsersInput)
174	_ = input
175	if !ok {
176		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
177	}
178
179	request.Request.URL.Path = "/"
180	request.Request.Method = "POST"
181	httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
182	if err != nil {
183		return out, metadata, &smithy.SerializationError{Err: err}
184	}
185	httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1")
186	httpBindingEncoder.SetHeader("X-Amz-Target").String("AWSIdentityStore.ListUsers")
187
188	jsonEncoder := smithyjson.NewEncoder()
189	if err := awsAwsjson11_serializeOpDocumentListUsersInput(input, jsonEncoder.Value); err != nil {
190		return out, metadata, &smithy.SerializationError{Err: err}
191	}
192
193	if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
194		return out, metadata, &smithy.SerializationError{Err: err}
195	}
196
197	if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil {
198		return out, metadata, &smithy.SerializationError{Err: err}
199	}
200	in.Request = request
201
202	return next.HandleSerialize(ctx, in)
203}
204func awsAwsjson11_serializeDocumentFilter(v *types.Filter, value smithyjson.Value) error {
205	object := value.Object()
206	defer object.Close()
207
208	if v.AttributePath != nil {
209		ok := object.Key("AttributePath")
210		ok.String(*v.AttributePath)
211	}
212
213	if v.AttributeValue != nil {
214		ok := object.Key("AttributeValue")
215		ok.String(*v.AttributeValue)
216	}
217
218	return nil
219}
220
221func awsAwsjson11_serializeDocumentFilters(v []types.Filter, value smithyjson.Value) error {
222	array := value.Array()
223	defer array.Close()
224
225	for i := range v {
226		av := array.Value()
227		if err := awsAwsjson11_serializeDocumentFilter(&v[i], av); err != nil {
228			return err
229		}
230	}
231	return nil
232}
233
234func awsAwsjson11_serializeOpDocumentDescribeGroupInput(v *DescribeGroupInput, value smithyjson.Value) error {
235	object := value.Object()
236	defer object.Close()
237
238	if v.GroupId != nil {
239		ok := object.Key("GroupId")
240		ok.String(*v.GroupId)
241	}
242
243	if v.IdentityStoreId != nil {
244		ok := object.Key("IdentityStoreId")
245		ok.String(*v.IdentityStoreId)
246	}
247
248	return nil
249}
250
251func awsAwsjson11_serializeOpDocumentDescribeUserInput(v *DescribeUserInput, value smithyjson.Value) error {
252	object := value.Object()
253	defer object.Close()
254
255	if v.IdentityStoreId != nil {
256		ok := object.Key("IdentityStoreId")
257		ok.String(*v.IdentityStoreId)
258	}
259
260	if v.UserId != nil {
261		ok := object.Key("UserId")
262		ok.String(*v.UserId)
263	}
264
265	return nil
266}
267
268func awsAwsjson11_serializeOpDocumentListGroupsInput(v *ListGroupsInput, value smithyjson.Value) error {
269	object := value.Object()
270	defer object.Close()
271
272	if v.Filters != nil {
273		ok := object.Key("Filters")
274		if err := awsAwsjson11_serializeDocumentFilters(v.Filters, ok); err != nil {
275			return err
276		}
277	}
278
279	if v.IdentityStoreId != nil {
280		ok := object.Key("IdentityStoreId")
281		ok.String(*v.IdentityStoreId)
282	}
283
284	if v.MaxResults != nil {
285		ok := object.Key("MaxResults")
286		ok.Integer(*v.MaxResults)
287	}
288
289	if v.NextToken != nil {
290		ok := object.Key("NextToken")
291		ok.String(*v.NextToken)
292	}
293
294	return nil
295}
296
297func awsAwsjson11_serializeOpDocumentListUsersInput(v *ListUsersInput, value smithyjson.Value) error {
298	object := value.Object()
299	defer object.Close()
300
301	if v.Filters != nil {
302		ok := object.Key("Filters")
303		if err := awsAwsjson11_serializeDocumentFilters(v.Filters, ok); err != nil {
304			return err
305		}
306	}
307
308	if v.IdentityStoreId != nil {
309		ok := object.Key("IdentityStoreId")
310		ok.String(*v.IdentityStoreId)
311	}
312
313	if v.MaxResults != nil {
314		ok := object.Key("MaxResults")
315		ok.Integer(*v.MaxResults)
316	}
317
318	if v.NextToken != nil {
319		ok := object.Key("NextToken")
320		ok.String(*v.NextToken)
321	}
322
323	return nil
324}
325