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