1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
// Code generated by smithy-go-codegen DO NOT EDIT.
package freetier
import (
"bytes"
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/freetier/types"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/encoding/httpbinding"
smithyjson "github.com/aws/smithy-go/encoding/json"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"path"
)
type awsAwsjson10_serializeOpGetFreeTierUsage struct {
}
func (*awsAwsjson10_serializeOpGetFreeTierUsage) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson10_serializeOpGetFreeTierUsage) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
request, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
}
input, ok := in.Parameters.(*GetFreeTierUsageInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
operationPath := "/"
if len(request.Request.URL.Path) == 0 {
request.Request.URL.Path = operationPath
} else {
request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath)
if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' {
request.Request.URL.Path += "/"
}
}
request.Request.Method = "POST"
httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.0")
httpBindingEncoder.SetHeader("X-Amz-Target").String("AWSFreeTierService.GetFreeTierUsage")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson10_serializeOpDocumentGetFreeTierUsageInput(input, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsAwsjson10_serializeDocumentDimensionValues(v *types.DimensionValues, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if len(v.Key) > 0 {
ok := object.Key("Key")
ok.String(string(v.Key))
}
if v.MatchOptions != nil {
ok := object.Key("MatchOptions")
if err := awsAwsjson10_serializeDocumentMatchOptions(v.MatchOptions, ok); err != nil {
return err
}
}
if v.Values != nil {
ok := object.Key("Values")
if err := awsAwsjson10_serializeDocumentValues(v.Values, ok); err != nil {
return err
}
}
return nil
}
func awsAwsjson10_serializeDocumentExpression(v *types.Expression, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.And != nil {
ok := object.Key("And")
if err := awsAwsjson10_serializeDocumentExpressions(v.And, ok); err != nil {
return err
}
}
if v.Dimensions != nil {
ok := object.Key("Dimensions")
if err := awsAwsjson10_serializeDocumentDimensionValues(v.Dimensions, ok); err != nil {
return err
}
}
if v.Not != nil {
ok := object.Key("Not")
if err := awsAwsjson10_serializeDocumentExpression(v.Not, ok); err != nil {
return err
}
}
if v.Or != nil {
ok := object.Key("Or")
if err := awsAwsjson10_serializeDocumentExpressions(v.Or, ok); err != nil {
return err
}
}
return nil
}
func awsAwsjson10_serializeDocumentExpressions(v []types.Expression, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if err := awsAwsjson10_serializeDocumentExpression(&v[i], av); err != nil {
return err
}
}
return nil
}
func awsAwsjson10_serializeDocumentMatchOptions(v []types.MatchOption, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
av.String(string(v[i]))
}
return nil
}
func awsAwsjson10_serializeDocumentValues(v []string, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
av.String(v[i])
}
return nil
}
func awsAwsjson10_serializeOpDocumentGetFreeTierUsageInput(v *GetFreeTierUsageInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Filter != nil {
ok := object.Key("filter")
if err := awsAwsjson10_serializeDocumentExpression(v.Filter, ok); err != nil {
return err
}
}
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
return nil
}
|