service/gameliftstreams/deserializers.go (5,169 lines of code) (raw):
// Code generated by smithy-go-codegen DO NOT EDIT.
package gameliftstreams
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
"github.com/aws/aws-sdk-go-v2/service/gameliftstreams/types"
smithy "github.com/aws/smithy-go"
smithyio "github.com/aws/smithy-go/io"
"github.com/aws/smithy-go/middleware"
"github.com/aws/smithy-go/ptr"
smithytime "github.com/aws/smithy-go/time"
"github.com/aws/smithy-go/tracing"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io"
"io/ioutil"
"strings"
"time"
)
func deserializeS3Expires(v string) (*time.Time, error) {
t, err := smithytime.ParseHTTPDate(v)
if err != nil {
return nil, nil
}
return &t, nil
}
type awsRestjson1_deserializeOpAddStreamGroupLocations struct {
}
func (*awsRestjson1_deserializeOpAddStreamGroupLocations) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAddStreamGroupLocations) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorAddStreamGroupLocations(response, &metadata)
}
output := &AddStreamGroupLocationsOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentAddStreamGroupLocationsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorAddStreamGroupLocations(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentAddStreamGroupLocationsOutput(v **AddStreamGroupLocationsOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *AddStreamGroupLocationsOutput
if *v == nil {
sv = &AddStreamGroupLocationsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Identifier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Identifier to be of type string, got %T instead", value)
}
sv.Identifier = ptr.String(jtv)
}
case "Locations":
if err := awsRestjson1_deserializeDocumentLocationStates(&sv.Locations, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpAssociateApplications struct {
}
func (*awsRestjson1_deserializeOpAssociateApplications) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAssociateApplications) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorAssociateApplications(response, &metadata)
}
output := &AssociateApplicationsOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentAssociateApplicationsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorAssociateApplications(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentAssociateApplicationsOutput(v **AssociateApplicationsOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *AssociateApplicationsOutput
if *v == nil {
sv = &AssociateApplicationsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ApplicationArns":
if err := awsRestjson1_deserializeDocumentArnList(&sv.ApplicationArns, value); err != nil {
return err
}
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Arn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCreateApplication struct {
}
func (*awsRestjson1_deserializeOpCreateApplication) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorCreateApplication(response, &metadata)
}
output := &CreateApplicationOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentCreateApplicationOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorCreateApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreateApplicationOutput(v **CreateApplicationOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *CreateApplicationOutput
if *v == nil {
sv = &CreateApplicationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ApplicationLogOutputUri":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationLogOutputUri to be of type string, got %T instead", value)
}
sv.ApplicationLogOutputUri = ptr.String(jtv)
}
case "ApplicationLogPaths":
if err := awsRestjson1_deserializeDocumentFilePaths(&sv.ApplicationLogPaths, value); err != nil {
return err
}
case "ApplicationSourceUri":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationSourceUri to be of type string, got %T instead", value)
}
sv.ApplicationSourceUri = ptr.String(jtv)
}
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Identifier to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "AssociatedStreamGroups":
if err := awsRestjson1_deserializeDocumentArnList(&sv.AssociatedStreamGroups, value); err != nil {
return err
}
case "CreatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "ExecutablePath":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExecutablePath to be of type string, got %T instead", value)
}
sv.ExecutablePath = ptr.String(jtv)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "LastUpdatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "ReplicationStatuses":
if err := awsRestjson1_deserializeDocumentReplicationStatuses(&sv.ReplicationStatuses, value); err != nil {
return err
}
case "RuntimeEnvironment":
if err := awsRestjson1_deserializeDocumentRuntimeEnvironment(&sv.RuntimeEnvironment, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationStatus to be of type string, got %T instead", value)
}
sv.Status = types.ApplicationStatus(jtv)
}
case "StatusReason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationStatusReason to be of type string, got %T instead", value)
}
sv.StatusReason = types.ApplicationStatusReason(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCreateStreamGroup struct {
}
func (*awsRestjson1_deserializeOpCreateStreamGroup) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateStreamGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorCreateStreamGroup(response, &metadata)
}
output := &CreateStreamGroupOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentCreateStreamGroupOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorCreateStreamGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreateStreamGroupOutput(v **CreateStreamGroupOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *CreateStreamGroupOutput
if *v == nil {
sv = &CreateStreamGroupOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Identifier to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "AssociatedApplications":
if err := awsRestjson1_deserializeDocumentArnList(&sv.AssociatedApplications, value); err != nil {
return err
}
case "CreatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "DefaultApplication":
if err := awsRestjson1_deserializeDocumentDefaultApplication(&sv.DefaultApplication, value); err != nil {
return err
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "LastUpdatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "LocationStates":
if err := awsRestjson1_deserializeDocumentLocationStates(&sv.LocationStates, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamGroupStatus to be of type string, got %T instead", value)
}
sv.Status = types.StreamGroupStatus(jtv)
}
case "StatusReason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamGroupStatusReason to be of type string, got %T instead", value)
}
sv.StatusReason = types.StreamGroupStatusReason(jtv)
}
case "StreamClass":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamClass to be of type string, got %T instead", value)
}
sv.StreamClass = types.StreamClass(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCreateStreamSessionConnection struct {
}
func (*awsRestjson1_deserializeOpCreateStreamSessionConnection) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateStreamSessionConnection) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorCreateStreamSessionConnection(response, &metadata)
}
output := &CreateStreamSessionConnectionOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentCreateStreamSessionConnectionOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorCreateStreamSessionConnection(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreateStreamSessionConnectionOutput(v **CreateStreamSessionConnectionOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *CreateStreamSessionConnectionOutput
if *v == nil {
sv = &CreateStreamSessionConnectionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "SignalResponse":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SignalResponse to be of type string, got %T instead", value)
}
sv.SignalResponse = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDeleteApplication struct {
}
func (*awsRestjson1_deserializeOpDeleteApplication) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorDeleteApplication(response, &metadata)
}
output := &DeleteApplicationOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDeleteApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDeleteStreamGroup struct {
}
func (*awsRestjson1_deserializeOpDeleteStreamGroup) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteStreamGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorDeleteStreamGroup(response, &metadata)
}
output := &DeleteStreamGroupOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDeleteStreamGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDisassociateApplications struct {
}
func (*awsRestjson1_deserializeOpDisassociateApplications) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDisassociateApplications) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorDisassociateApplications(response, &metadata)
}
output := &DisassociateApplicationsOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentDisassociateApplicationsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDisassociateApplications(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentDisassociateApplicationsOutput(v **DisassociateApplicationsOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *DisassociateApplicationsOutput
if *v == nil {
sv = &DisassociateApplicationsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ApplicationArns":
if err := awsRestjson1_deserializeDocumentArnList(&sv.ApplicationArns, value); err != nil {
return err
}
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Arn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpExportStreamSessionFiles struct {
}
func (*awsRestjson1_deserializeOpExportStreamSessionFiles) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpExportStreamSessionFiles) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorExportStreamSessionFiles(response, &metadata)
}
output := &ExportStreamSessionFilesOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorExportStreamSessionFiles(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpGetApplication struct {
}
func (*awsRestjson1_deserializeOpGetApplication) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorGetApplication(response, &metadata)
}
output := &GetApplicationOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentGetApplicationOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetApplicationOutput(v **GetApplicationOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *GetApplicationOutput
if *v == nil {
sv = &GetApplicationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ApplicationLogOutputUri":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationLogOutputUri to be of type string, got %T instead", value)
}
sv.ApplicationLogOutputUri = ptr.String(jtv)
}
case "ApplicationLogPaths":
if err := awsRestjson1_deserializeDocumentFilePaths(&sv.ApplicationLogPaths, value); err != nil {
return err
}
case "ApplicationSourceUri":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationSourceUri to be of type string, got %T instead", value)
}
sv.ApplicationSourceUri = ptr.String(jtv)
}
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Identifier to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "AssociatedStreamGroups":
if err := awsRestjson1_deserializeDocumentArnList(&sv.AssociatedStreamGroups, value); err != nil {
return err
}
case "CreatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "ExecutablePath":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExecutablePath to be of type string, got %T instead", value)
}
sv.ExecutablePath = ptr.String(jtv)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "LastUpdatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "ReplicationStatuses":
if err := awsRestjson1_deserializeDocumentReplicationStatuses(&sv.ReplicationStatuses, value); err != nil {
return err
}
case "RuntimeEnvironment":
if err := awsRestjson1_deserializeDocumentRuntimeEnvironment(&sv.RuntimeEnvironment, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationStatus to be of type string, got %T instead", value)
}
sv.Status = types.ApplicationStatus(jtv)
}
case "StatusReason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationStatusReason to be of type string, got %T instead", value)
}
sv.StatusReason = types.ApplicationStatusReason(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetStreamGroup struct {
}
func (*awsRestjson1_deserializeOpGetStreamGroup) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetStreamGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorGetStreamGroup(response, &metadata)
}
output := &GetStreamGroupOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentGetStreamGroupOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetStreamGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetStreamGroupOutput(v **GetStreamGroupOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *GetStreamGroupOutput
if *v == nil {
sv = &GetStreamGroupOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Identifier to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "AssociatedApplications":
if err := awsRestjson1_deserializeDocumentArnList(&sv.AssociatedApplications, value); err != nil {
return err
}
case "CreatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "DefaultApplication":
if err := awsRestjson1_deserializeDocumentDefaultApplication(&sv.DefaultApplication, value); err != nil {
return err
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "LastUpdatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "LocationStates":
if err := awsRestjson1_deserializeDocumentLocationStates(&sv.LocationStates, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamGroupStatus to be of type string, got %T instead", value)
}
sv.Status = types.StreamGroupStatus(jtv)
}
case "StatusReason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamGroupStatusReason to be of type string, got %T instead", value)
}
sv.StatusReason = types.StreamGroupStatusReason(jtv)
}
case "StreamClass":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamClass to be of type string, got %T instead", value)
}
sv.StreamClass = types.StreamClass(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetStreamSession struct {
}
func (*awsRestjson1_deserializeOpGetStreamSession) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetStreamSession) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorGetStreamSession(response, &metadata)
}
output := &GetStreamSessionOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentGetStreamSessionOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetStreamSession(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetStreamSessionOutput(v **GetStreamSessionOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *GetStreamSessionOutput
if *v == nil {
sv = &GetStreamSessionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "AdditionalEnvironmentVariables":
if err := awsRestjson1_deserializeDocumentEnvironmentVariables(&sv.AdditionalEnvironmentVariables, value); err != nil {
return err
}
case "AdditionalLaunchArgs":
if err := awsRestjson1_deserializeDocumentGameLaunchArgList(&sv.AdditionalLaunchArgs, value); err != nil {
return err
}
case "ApplicationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Arn to be of type string, got %T instead", value)
}
sv.ApplicationArn = ptr.String(jtv)
}
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Arn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "ConnectionTimeoutSeconds":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected ConnectionTimeoutSeconds to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.ConnectionTimeoutSeconds = ptr.Int32(int32(i64))
}
case "CreatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "ExportFilesMetadata":
if err := awsRestjson1_deserializeDocumentExportFilesMetadata(&sv.ExportFilesMetadata, value); err != nil {
return err
}
case "LastUpdatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "Location":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LocationName to be of type string, got %T instead", value)
}
sv.Location = ptr.String(jtv)
}
case "LogFileLocationUri":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected FileLocationUri to be of type string, got %T instead", value)
}
sv.LogFileLocationUri = ptr.String(jtv)
}
case "Protocol":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Protocol to be of type string, got %T instead", value)
}
sv.Protocol = types.Protocol(jtv)
}
case "SessionLengthSeconds":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected SessionLengthSeconds to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.SessionLengthSeconds = ptr.Int32(int32(i64))
}
case "SignalRequest":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SignalRequest to be of type string, got %T instead", value)
}
sv.SignalRequest = ptr.String(jtv)
}
case "SignalResponse":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SignalResponse to be of type string, got %T instead", value)
}
sv.SignalResponse = ptr.String(jtv)
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamSessionStatus to be of type string, got %T instead", value)
}
sv.Status = types.StreamSessionStatus(jtv)
}
case "StatusReason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamSessionStatusReason to be of type string, got %T instead", value)
}
sv.StatusReason = types.StreamSessionStatusReason(jtv)
}
case "StreamGroupId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.StreamGroupId = ptr.String(jtv)
}
case "UserId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UserId to be of type string, got %T instead", value)
}
sv.UserId = ptr.String(jtv)
}
case "WebSdkProtocolUrl":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected WebSdkProtocolUrl to be of type string, got %T instead", value)
}
sv.WebSdkProtocolUrl = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListApplications struct {
}
func (*awsRestjson1_deserializeOpListApplications) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListApplications) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorListApplications(response, &metadata)
}
output := &ListApplicationsOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentListApplicationsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListApplications(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListApplicationsOutput(v **ListApplicationsOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *ListApplicationsOutput
if *v == nil {
sv = &ListApplicationsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Items":
if err := awsRestjson1_deserializeDocumentApplicationSummaryList(&sv.Items, value); err != nil {
return err
}
case "NextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListStreamGroups struct {
}
func (*awsRestjson1_deserializeOpListStreamGroups) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListStreamGroups) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorListStreamGroups(response, &metadata)
}
output := &ListStreamGroupsOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentListStreamGroupsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListStreamGroups(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListStreamGroupsOutput(v **ListStreamGroupsOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *ListStreamGroupsOutput
if *v == nil {
sv = &ListStreamGroupsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Items":
if err := awsRestjson1_deserializeDocumentStreamGroupSummaryList(&sv.Items, value); err != nil {
return err
}
case "NextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListStreamSessions struct {
}
func (*awsRestjson1_deserializeOpListStreamSessions) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListStreamSessions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorListStreamSessions(response, &metadata)
}
output := &ListStreamSessionsOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentListStreamSessionsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListStreamSessions(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListStreamSessionsOutput(v **ListStreamSessionsOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *ListStreamSessionsOutput
if *v == nil {
sv = &ListStreamSessionsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Items":
if err := awsRestjson1_deserializeDocumentStreamSessionSummaryList(&sv.Items, value); err != nil {
return err
}
case "NextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListStreamSessionsByAccount struct {
}
func (*awsRestjson1_deserializeOpListStreamSessionsByAccount) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListStreamSessionsByAccount) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorListStreamSessionsByAccount(response, &metadata)
}
output := &ListStreamSessionsByAccountOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentListStreamSessionsByAccountOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListStreamSessionsByAccount(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListStreamSessionsByAccountOutput(v **ListStreamSessionsByAccountOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *ListStreamSessionsByAccountOutput
if *v == nil {
sv = &ListStreamSessionsByAccountOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Items":
if err := awsRestjson1_deserializeDocumentStreamSessionSummaryList(&sv.Items, value); err != nil {
return err
}
case "NextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListTagsForResource struct {
}
func (*awsRestjson1_deserializeOpListTagsForResource) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata)
}
output := &ListTagsForResourceOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *ListTagsForResourceOutput
if *v == nil {
sv = &ListTagsForResourceOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Tags":
if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpRemoveStreamGroupLocations struct {
}
func (*awsRestjson1_deserializeOpRemoveStreamGroupLocations) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpRemoveStreamGroupLocations) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorRemoveStreamGroupLocations(response, &metadata)
}
output := &RemoveStreamGroupLocationsOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorRemoveStreamGroupLocations(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpStartStreamSession struct {
}
func (*awsRestjson1_deserializeOpStartStreamSession) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpStartStreamSession) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorStartStreamSession(response, &metadata)
}
output := &StartStreamSessionOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentStartStreamSessionOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorStartStreamSession(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentStartStreamSessionOutput(v **StartStreamSessionOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *StartStreamSessionOutput
if *v == nil {
sv = &StartStreamSessionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "AdditionalEnvironmentVariables":
if err := awsRestjson1_deserializeDocumentEnvironmentVariables(&sv.AdditionalEnvironmentVariables, value); err != nil {
return err
}
case "AdditionalLaunchArgs":
if err := awsRestjson1_deserializeDocumentGameLaunchArgList(&sv.AdditionalLaunchArgs, value); err != nil {
return err
}
case "ApplicationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Arn to be of type string, got %T instead", value)
}
sv.ApplicationArn = ptr.String(jtv)
}
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Arn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "ConnectionTimeoutSeconds":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected ConnectionTimeoutSeconds to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.ConnectionTimeoutSeconds = ptr.Int32(int32(i64))
}
case "CreatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "ExportFilesMetadata":
if err := awsRestjson1_deserializeDocumentExportFilesMetadata(&sv.ExportFilesMetadata, value); err != nil {
return err
}
case "LastUpdatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "Location":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LocationName to be of type string, got %T instead", value)
}
sv.Location = ptr.String(jtv)
}
case "LogFileLocationUri":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected FileLocationUri to be of type string, got %T instead", value)
}
sv.LogFileLocationUri = ptr.String(jtv)
}
case "Protocol":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Protocol to be of type string, got %T instead", value)
}
sv.Protocol = types.Protocol(jtv)
}
case "SessionLengthSeconds":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected SessionLengthSeconds to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.SessionLengthSeconds = ptr.Int32(int32(i64))
}
case "SignalRequest":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SignalRequest to be of type string, got %T instead", value)
}
sv.SignalRequest = ptr.String(jtv)
}
case "SignalResponse":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SignalResponse to be of type string, got %T instead", value)
}
sv.SignalResponse = ptr.String(jtv)
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamSessionStatus to be of type string, got %T instead", value)
}
sv.Status = types.StreamSessionStatus(jtv)
}
case "StatusReason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamSessionStatusReason to be of type string, got %T instead", value)
}
sv.StatusReason = types.StreamSessionStatusReason(jtv)
}
case "StreamGroupId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.StreamGroupId = ptr.String(jtv)
}
case "UserId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UserId to be of type string, got %T instead", value)
}
sv.UserId = ptr.String(jtv)
}
case "WebSdkProtocolUrl":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected WebSdkProtocolUrl to be of type string, got %T instead", value)
}
sv.WebSdkProtocolUrl = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpTagResource struct {
}
func (*awsRestjson1_deserializeOpTagResource) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata)
}
output := &TagResourceOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpTerminateStreamSession struct {
}
func (*awsRestjson1_deserializeOpTerminateStreamSession) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpTerminateStreamSession) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorTerminateStreamSession(response, &metadata)
}
output := &TerminateStreamSessionOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorTerminateStreamSession(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpUntagResource struct {
}
func (*awsRestjson1_deserializeOpUntagResource) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata)
}
output := &UntagResourceOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpUpdateApplication struct {
}
func (*awsRestjson1_deserializeOpUpdateApplication) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorUpdateApplication(response, &metadata)
}
output := &UpdateApplicationOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentUpdateApplicationOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorUpdateApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateApplicationOutput(v **UpdateApplicationOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *UpdateApplicationOutput
if *v == nil {
sv = &UpdateApplicationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ApplicationLogOutputUri":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationLogOutputUri to be of type string, got %T instead", value)
}
sv.ApplicationLogOutputUri = ptr.String(jtv)
}
case "ApplicationLogPaths":
if err := awsRestjson1_deserializeDocumentFilePaths(&sv.ApplicationLogPaths, value); err != nil {
return err
}
case "ApplicationSourceUri":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationSourceUri to be of type string, got %T instead", value)
}
sv.ApplicationSourceUri = ptr.String(jtv)
}
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Identifier to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "AssociatedStreamGroups":
if err := awsRestjson1_deserializeDocumentArnList(&sv.AssociatedStreamGroups, value); err != nil {
return err
}
case "CreatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "ExecutablePath":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExecutablePath to be of type string, got %T instead", value)
}
sv.ExecutablePath = ptr.String(jtv)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "LastUpdatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "ReplicationStatuses":
if err := awsRestjson1_deserializeDocumentReplicationStatuses(&sv.ReplicationStatuses, value); err != nil {
return err
}
case "RuntimeEnvironment":
if err := awsRestjson1_deserializeDocumentRuntimeEnvironment(&sv.RuntimeEnvironment, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationStatus to be of type string, got %T instead", value)
}
sv.Status = types.ApplicationStatus(jtv)
}
case "StatusReason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationStatusReason to be of type string, got %T instead", value)
}
sv.StatusReason = types.ApplicationStatusReason(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpUpdateStreamGroup struct {
}
func (*awsRestjson1_deserializeOpUpdateStreamGroup) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateStreamGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorUpdateStreamGroup(response, &metadata)
}
output := &UpdateStreamGroupOutput{}
out.Result = output
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(response.Body, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return out, metadata, err
}
err = awsRestjson1_deserializeOpDocumentUpdateStreamGroupOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorUpdateStreamGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateStreamGroupOutput(v **UpdateStreamGroupOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *UpdateStreamGroupOutput
if *v == nil {
sv = &UpdateStreamGroupOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Identifier to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "AssociatedApplications":
if err := awsRestjson1_deserializeDocumentArnList(&sv.AssociatedApplications, value); err != nil {
return err
}
case "CreatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "DefaultApplication":
if err := awsRestjson1_deserializeDocumentDefaultApplication(&sv.DefaultApplication, value); err != nil {
return err
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "LastUpdatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "LocationStates":
if err := awsRestjson1_deserializeDocumentLocationStates(&sv.LocationStates, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamGroupStatus to be of type string, got %T instead", value)
}
sv.Status = types.StreamGroupStatus(jtv)
}
case "StatusReason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamGroupStatusReason to be of type string, got %T instead", value)
}
sv.StatusReason = types.StreamGroupStatusReason(jtv)
}
case "StreamClass":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamClass to be of type string, got %T instead", value)
}
sv.StreamClass = types.StreamClass(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.AccessDeniedException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ConflictException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentConflictException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InternalServerException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ResourceNotFoundException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ServiceQuotaExceededException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ThrottlingException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ValidationException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentValidationException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.AccessDeniedException
if *v == nil {
sv = &types.AccessDeniedException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message", "Message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentApplicationSummary(v **types.ApplicationSummary, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ApplicationSummary
if *v == nil {
sv = &types.ApplicationSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Identifier to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "CreatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "LastUpdatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "RuntimeEnvironment":
if err := awsRestjson1_deserializeDocumentRuntimeEnvironment(&sv.RuntimeEnvironment, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ApplicationStatus to be of type string, got %T instead", value)
}
sv.Status = types.ApplicationStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentApplicationSummaryList(v *[]types.ApplicationSummary, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.ApplicationSummary
if *v == nil {
cv = []types.ApplicationSummary{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ApplicationSummary
destAddr := &col
if err := awsRestjson1_deserializeDocumentApplicationSummary(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentArnList(v *[]string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []string
if *v == nil {
cv = []string{}
} else {
cv = *v
}
for _, value := range shape {
var col string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Arn to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ConflictException
if *v == nil {
sv = &types.ConflictException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message", "Message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentDefaultApplication(v **types.DefaultApplication, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.DefaultApplication
if *v == nil {
sv = &types.DefaultApplication{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Arn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentEnvironmentVariables(v *map[string]string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var mv map[string]string
if *v == nil {
mv = map[string]string{}
} else {
mv = *v
}
for key, value := range shape {
var parsedVal string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
parsedVal = jtv
}
mv[key] = parsedVal
}
*v = mv
return nil
}
func awsRestjson1_deserializeDocumentExportFilesMetadata(v **types.ExportFilesMetadata, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ExportFilesMetadata
if *v == nil {
sv = &types.ExportFilesMetadata{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "OutputUri":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected OutputUri to be of type string, got %T instead", value)
}
sv.OutputUri = ptr.String(jtv)
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExportFilesStatus to be of type string, got %T instead", value)
}
sv.Status = types.ExportFilesStatus(jtv)
}
case "StatusReason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExportFilesReason to be of type string, got %T instead", value)
}
sv.StatusReason = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentFilePaths(v *[]string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []string
if *v == nil {
cv = []string{}
} else {
cv = *v
}
for _, value := range shape {
var col string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected FilePath to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentGameLaunchArgList(v *[]string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []string
if *v == nil {
cv = []string{}
} else {
cv = *v
}
for _, value := range shape {
var col string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.InternalServerException
if *v == nil {
sv = &types.InternalServerException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message", "Message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentLocationState(v **types.LocationState, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.LocationState
if *v == nil {
sv = &types.LocationState{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "AllocatedCapacity":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected CapacityValue to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.AllocatedCapacity = ptr.Int32(int32(i64))
}
case "AlwaysOnCapacity":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected AlwaysOnCapacity to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.AlwaysOnCapacity = ptr.Int32(int32(i64))
}
case "IdleCapacity":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected CapacityValue to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.IdleCapacity = ptr.Int32(int32(i64))
}
case "LocationName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LocationName to be of type string, got %T instead", value)
}
sv.LocationName = ptr.String(jtv)
}
case "OnDemandCapacity":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected OnDemandCapacity to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.OnDemandCapacity = ptr.Int32(int32(i64))
}
case "RequestedCapacity":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected CapacityValue to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.RequestedCapacity = ptr.Int32(int32(i64))
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamGroupLocationStatus to be of type string, got %T instead", value)
}
sv.Status = types.StreamGroupLocationStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentLocationStates(v *[]types.LocationState, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.LocationState
if *v == nil {
cv = []types.LocationState{}
} else {
cv = *v
}
for _, value := range shape {
var col types.LocationState
destAddr := &col
if err := awsRestjson1_deserializeDocumentLocationState(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentReplicationStatus(v **types.ReplicationStatus, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ReplicationStatus
if *v == nil {
sv = &types.ReplicationStatus{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Location":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LocationName to be of type string, got %T instead", value)
}
sv.Location = ptr.String(jtv)
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ReplicationStatusType to be of type string, got %T instead", value)
}
sv.Status = types.ReplicationStatusType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentReplicationStatuses(v *[]types.ReplicationStatus, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.ReplicationStatus
if *v == nil {
cv = []types.ReplicationStatus{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ReplicationStatus
destAddr := &col
if err := awsRestjson1_deserializeDocumentReplicationStatus(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ResourceNotFoundException
if *v == nil {
sv = &types.ResourceNotFoundException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message", "Message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentRuntimeEnvironment(v **types.RuntimeEnvironment, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.RuntimeEnvironment
if *v == nil {
sv = &types.RuntimeEnvironment{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuntimeEnvironmentType to be of type string, got %T instead", value)
}
sv.Type = types.RuntimeEnvironmentType(jtv)
}
case "Version":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuntimeEnvironmentVersion to be of type string, got %T instead", value)
}
sv.Version = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentServiceQuotaExceededException(v **types.ServiceQuotaExceededException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ServiceQuotaExceededException
if *v == nil {
sv = &types.ServiceQuotaExceededException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message", "Message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentStreamGroupSummary(v **types.StreamGroupSummary, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.StreamGroupSummary
if *v == nil {
sv = &types.StreamGroupSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Identifier to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "CreatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "DefaultApplication":
if err := awsRestjson1_deserializeDocumentDefaultApplication(&sv.DefaultApplication, value); err != nil {
return err
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Id to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "LastUpdatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamGroupStatus to be of type string, got %T instead", value)
}
sv.Status = types.StreamGroupStatus(jtv)
}
case "StreamClass":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamClass to be of type string, got %T instead", value)
}
sv.StreamClass = types.StreamClass(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentStreamGroupSummaryList(v *[]types.StreamGroupSummary, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.StreamGroupSummary
if *v == nil {
cv = []types.StreamGroupSummary{}
} else {
cv = *v
}
for _, value := range shape {
var col types.StreamGroupSummary
destAddr := &col
if err := awsRestjson1_deserializeDocumentStreamGroupSummary(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentStreamSessionSummary(v **types.StreamSessionSummary, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.StreamSessionSummary
if *v == nil {
sv = &types.StreamSessionSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ApplicationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Arn to be of type string, got %T instead", value)
}
sv.ApplicationArn = ptr.String(jtv)
}
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Arn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "CreatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "ExportFilesMetadata":
if err := awsRestjson1_deserializeDocumentExportFilesMetadata(&sv.ExportFilesMetadata, value); err != nil {
return err
}
case "LastUpdatedAt":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "Location":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LocationName to be of type string, got %T instead", value)
}
sv.Location = ptr.String(jtv)
}
case "Protocol":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Protocol to be of type string, got %T instead", value)
}
sv.Protocol = types.Protocol(jtv)
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StreamSessionStatus to be of type string, got %T instead", value)
}
sv.Status = types.StreamSessionStatus(jtv)
}
case "UserId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UserId to be of type string, got %T instead", value)
}
sv.UserId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentStreamSessionSummaryList(v *[]types.StreamSessionSummary, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.StreamSessionSummary
if *v == nil {
cv = []types.StreamSessionSummary{}
} else {
cv = *v
}
for _, value := range shape {
var col types.StreamSessionSummary
destAddr := &col
if err := awsRestjson1_deserializeDocumentStreamSessionSummary(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentTags(v *map[string]string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var mv map[string]string
if *v == nil {
mv = map[string]string{}
} else {
mv = *v
}
for key, value := range shape {
var parsedVal string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TagValue to be of type string, got %T instead", value)
}
parsedVal = jtv
}
mv[key] = parsedVal
}
*v = mv
return nil
}
func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ThrottlingException
if *v == nil {
sv = &types.ThrottlingException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message", "Message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ValidationException
if *v == nil {
sv = &types.ValidationException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message", "Message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}