service/qapps/deserializers.go (8,191 lines of code) (raw):
// Code generated by smithy-go-codegen DO NOT EDIT.
package qapps
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
"github.com/aws/aws-sdk-go-v2/service/qapps/document"
internaldocument "github.com/aws/aws-sdk-go-v2/service/qapps/internal/document"
"github.com/aws/aws-sdk-go-v2/service/qapps/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"
"strconv"
"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_deserializeOpAssociateLibraryItemReview struct {
}
func (*awsRestjson1_deserializeOpAssociateLibraryItemReview) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAssociateLibraryItemReview) 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_deserializeOpErrorAssociateLibraryItemReview(response, &metadata)
}
output := &AssociateLibraryItemReviewOutput{}
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_deserializeOpErrorAssociateLibraryItemReview(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpAssociateQAppWithUser struct {
}
func (*awsRestjson1_deserializeOpAssociateQAppWithUser) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAssociateQAppWithUser) 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_deserializeOpErrorAssociateQAppWithUser(response, &metadata)
}
output := &AssociateQAppWithUserOutput{}
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_deserializeOpErrorAssociateQAppWithUser(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpBatchCreateCategory struct {
}
func (*awsRestjson1_deserializeOpBatchCreateCategory) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpBatchCreateCategory) 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_deserializeOpErrorBatchCreateCategory(response, &metadata)
}
output := &BatchCreateCategoryOutput{}
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_deserializeOpErrorBatchCreateCategory(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpBatchDeleteCategory struct {
}
func (*awsRestjson1_deserializeOpBatchDeleteCategory) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpBatchDeleteCategory) 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_deserializeOpErrorBatchDeleteCategory(response, &metadata)
}
output := &BatchDeleteCategoryOutput{}
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_deserializeOpErrorBatchDeleteCategory(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpBatchUpdateCategory struct {
}
func (*awsRestjson1_deserializeOpBatchUpdateCategory) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpBatchUpdateCategory) 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_deserializeOpErrorBatchUpdateCategory(response, &metadata)
}
output := &BatchUpdateCategoryOutput{}
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_deserializeOpErrorBatchUpdateCategory(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpCreateLibraryItem struct {
}
func (*awsRestjson1_deserializeOpCreateLibraryItem) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateLibraryItem) 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_deserializeOpErrorCreateLibraryItem(response, &metadata)
}
output := &CreateLibraryItemOutput{}
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_deserializeOpDocumentCreateLibraryItemOutput(&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_deserializeOpErrorCreateLibraryItem(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreateLibraryItemOutput(v **CreateLibraryItemOutput, 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 *CreateLibraryItemOutput
if *v == nil {
sv = &CreateLibraryItemOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "createdAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(t)
}
case "createdBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.CreatedBy = ptr.String(jtv)
}
case "isVerified":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsVerified = ptr.Bool(jtv)
}
case "libraryItemId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.LibraryItemId = ptr.String(jtv)
}
case "ratingCount":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.RatingCount = ptr.Int32(int32(i64))
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Status = ptr.String(jtv)
}
case "updatedAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.UpdatedAt = ptr.Time(t)
}
case "updatedBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.UpdatedBy = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCreatePresignedUrl struct {
}
func (*awsRestjson1_deserializeOpCreatePresignedUrl) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreatePresignedUrl) 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_deserializeOpErrorCreatePresignedUrl(response, &metadata)
}
output := &CreatePresignedUrlOutput{}
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_deserializeOpDocumentCreatePresignedUrlOutput(&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_deserializeOpErrorCreatePresignedUrl(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreatePresignedUrlOutput(v **CreatePresignedUrlOutput, 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 *CreatePresignedUrlOutput
if *v == nil {
sv = &CreatePresignedUrlOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "fileId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.FileId = ptr.String(jtv)
}
case "presignedUrl":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.PresignedUrl = ptr.String(jtv)
}
case "presignedUrlExpiration":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.PresignedUrlExpiration = ptr.Time(t)
}
case "presignedUrlFields":
if err := awsRestjson1_deserializeDocumentPresignedUrlFields(&sv.PresignedUrlFields, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCreateQApp struct {
}
func (*awsRestjson1_deserializeOpCreateQApp) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateQApp) 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_deserializeOpErrorCreateQApp(response, &metadata)
}
output := &CreateQAppOutput{}
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_deserializeOpDocumentCreateQAppOutput(&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_deserializeOpErrorCreateQApp(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("ContentTooLargeException", errorCode):
return awsRestjson1_deserializeErrorContentTooLargeException(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreateQAppOutput(v **CreateQAppOutput, 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 *CreateQAppOutput
if *v == nil {
sv = &CreateQAppOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AppArn to be of type string, got %T instead", value)
}
sv.AppArn = ptr.String(jtv)
}
case "appId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.AppId = ptr.String(jtv)
}
case "appVersion":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected AppVersion to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.AppVersion = ptr.Int32(int32(i64))
}
case "createdAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(t)
}
case "createdBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.CreatedBy = ptr.String(jtv)
}
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 "initialPrompt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected InitialPrompt to be of type string, got %T instead", value)
}
sv.InitialPrompt = ptr.String(jtv)
}
case "requiredCapabilities":
if err := awsRestjson1_deserializeDocumentAppRequiredCapabilities(&sv.RequiredCapabilities, value); err != nil {
return err
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AppStatus to be of type string, got %T instead", value)
}
sv.Status = types.AppStatus(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "updatedAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.UpdatedAt = ptr.Time(t)
}
case "updatedBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.UpdatedBy = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDeleteLibraryItem struct {
}
func (*awsRestjson1_deserializeOpDeleteLibraryItem) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteLibraryItem) 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_deserializeOpErrorDeleteLibraryItem(response, &metadata)
}
output := &DeleteLibraryItemOutput{}
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_deserializeOpErrorDeleteLibraryItem(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDeleteQApp struct {
}
func (*awsRestjson1_deserializeOpDeleteQApp) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteQApp) 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_deserializeOpErrorDeleteQApp(response, &metadata)
}
output := &DeleteQAppOutput{}
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_deserializeOpErrorDeleteQApp(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDescribeQAppPermissions struct {
}
func (*awsRestjson1_deserializeOpDescribeQAppPermissions) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDescribeQAppPermissions) 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_deserializeOpErrorDescribeQAppPermissions(response, &metadata)
}
output := &DescribeQAppPermissionsOutput{}
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_deserializeOpDocumentDescribeQAppPermissionsOutput(&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_deserializeOpErrorDescribeQAppPermissions(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentDescribeQAppPermissionsOutput(v **DescribeQAppPermissionsOutput, 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 *DescribeQAppPermissionsOutput
if *v == nil {
sv = &DescribeQAppPermissionsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.AppId = ptr.String(jtv)
}
case "permissions":
if err := awsRestjson1_deserializeDocumentPermissionsOutputList(&sv.Permissions, value); err != nil {
return err
}
case "resourceArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceArn = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDisassociateLibraryItemReview struct {
}
func (*awsRestjson1_deserializeOpDisassociateLibraryItemReview) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDisassociateLibraryItemReview) 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_deserializeOpErrorDisassociateLibraryItemReview(response, &metadata)
}
output := &DisassociateLibraryItemReviewOutput{}
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_deserializeOpErrorDisassociateLibraryItemReview(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDisassociateQAppFromUser struct {
}
func (*awsRestjson1_deserializeOpDisassociateQAppFromUser) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDisassociateQAppFromUser) 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_deserializeOpErrorDisassociateQAppFromUser(response, &metadata)
}
output := &DisassociateQAppFromUserOutput{}
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_deserializeOpErrorDisassociateQAppFromUser(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpExportQAppSessionData struct {
}
func (*awsRestjson1_deserializeOpExportQAppSessionData) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpExportQAppSessionData) 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_deserializeOpErrorExportQAppSessionData(response, &metadata)
}
output := &ExportQAppSessionDataOutput{}
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_deserializeOpDocumentExportQAppSessionDataOutput(&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_deserializeOpErrorExportQAppSessionData(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentExportQAppSessionDataOutput(v **ExportQAppSessionDataOutput, 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 *ExportQAppSessionDataOutput
if *v == nil {
sv = &ExportQAppSessionDataOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "csvFileLink":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.CsvFileLink = ptr.String(jtv)
}
case "expiresAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.ExpiresAt = ptr.Time(t)
}
case "sessionArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SessionArn = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetLibraryItem struct {
}
func (*awsRestjson1_deserializeOpGetLibraryItem) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetLibraryItem) 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_deserializeOpErrorGetLibraryItem(response, &metadata)
}
output := &GetLibraryItemOutput{}
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_deserializeOpDocumentGetLibraryItemOutput(&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_deserializeOpErrorGetLibraryItem(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetLibraryItemOutput(v **GetLibraryItemOutput, 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 *GetLibraryItemOutput
if *v == nil {
sv = &GetLibraryItemOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.AppId = ptr.String(jtv)
}
case "appVersion":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected AppVersion to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.AppVersion = ptr.Int32(int32(i64))
}
case "categories":
if err := awsRestjson1_deserializeDocumentCategoryList(&sv.Categories, value); err != nil {
return err
}
case "createdAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(t)
}
case "createdBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.CreatedBy = ptr.String(jtv)
}
case "isRatedByUser":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsRatedByUser = ptr.Bool(jtv)
}
case "isVerified":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsVerified = ptr.Bool(jtv)
}
case "libraryItemId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.LibraryItemId = ptr.String(jtv)
}
case "ratingCount":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.RatingCount = ptr.Int32(int32(i64))
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Status = ptr.String(jtv)
}
case "updatedAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.UpdatedAt = ptr.Time(t)
}
case "updatedBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.UpdatedBy = ptr.String(jtv)
}
case "userCount":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.UserCount = ptr.Int32(int32(i64))
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetQApp struct {
}
func (*awsRestjson1_deserializeOpGetQApp) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetQApp) 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_deserializeOpErrorGetQApp(response, &metadata)
}
output := &GetQAppOutput{}
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_deserializeOpDocumentGetQAppOutput(&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_deserializeOpErrorGetQApp(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetQAppOutput(v **GetQAppOutput, 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 *GetQAppOutput
if *v == nil {
sv = &GetQAppOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AppArn to be of type string, got %T instead", value)
}
sv.AppArn = ptr.String(jtv)
}
case "appDefinition":
if err := awsRestjson1_deserializeDocumentAppDefinition(&sv.AppDefinition, value); err != nil {
return err
}
case "appId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.AppId = ptr.String(jtv)
}
case "appVersion":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected AppVersion to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.AppVersion = ptr.Int32(int32(i64))
}
case "createdAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(t)
}
case "createdBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.CreatedBy = ptr.String(jtv)
}
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 "initialPrompt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected InitialPrompt to be of type string, got %T instead", value)
}
sv.InitialPrompt = ptr.String(jtv)
}
case "requiredCapabilities":
if err := awsRestjson1_deserializeDocumentAppRequiredCapabilities(&sv.RequiredCapabilities, value); err != nil {
return err
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AppStatus to be of type string, got %T instead", value)
}
sv.Status = types.AppStatus(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "updatedAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.UpdatedAt = ptr.Time(t)
}
case "updatedBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.UpdatedBy = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetQAppSession struct {
}
func (*awsRestjson1_deserializeOpGetQAppSession) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetQAppSession) 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_deserializeOpErrorGetQAppSession(response, &metadata)
}
output := &GetQAppSessionOutput{}
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_deserializeOpDocumentGetQAppSessionOutput(&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_deserializeOpErrorGetQAppSession(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetQAppSessionOutput(v **GetQAppSessionOutput, 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 *GetQAppSessionOutput
if *v == nil {
sv = &GetQAppSessionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appVersion":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected AppVersion to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.AppVersion = ptr.Int32(int32(i64))
}
case "cardStatus":
if err := awsRestjson1_deserializeDocumentCardStatusMap(&sv.CardStatus, value); err != nil {
return err
}
case "latestPublishedAppVersion":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected AppVersion to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.LatestPublishedAppVersion = ptr.Int32(int32(i64))
}
case "sessionArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SessionArn = ptr.String(jtv)
}
case "sessionId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SessionId = ptr.String(jtv)
}
case "sessionName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SessionName to be of type string, got %T instead", value)
}
sv.SessionName = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExecutionStatus to be of type string, got %T instead", value)
}
sv.Status = types.ExecutionStatus(jtv)
}
case "userIsHost":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.UserIsHost = ptr.Bool(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetQAppSessionMetadata struct {
}
func (*awsRestjson1_deserializeOpGetQAppSessionMetadata) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetQAppSessionMetadata) 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_deserializeOpErrorGetQAppSessionMetadata(response, &metadata)
}
output := &GetQAppSessionMetadataOutput{}
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_deserializeOpDocumentGetQAppSessionMetadataOutput(&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_deserializeOpErrorGetQAppSessionMetadata(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetQAppSessionMetadataOutput(v **GetQAppSessionMetadataOutput, 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 *GetQAppSessionMetadataOutput
if *v == nil {
sv = &GetQAppSessionMetadataOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "sessionArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SessionArn = ptr.String(jtv)
}
case "sessionId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.SessionId = ptr.String(jtv)
}
case "sessionName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SessionName to be of type string, got %T instead", value)
}
sv.SessionName = ptr.String(jtv)
}
case "sessionOwner":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.SessionOwner = ptr.Bool(jtv)
}
case "sharingConfiguration":
if err := awsRestjson1_deserializeDocumentSessionSharingConfiguration(&sv.SharingConfiguration, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpImportDocument struct {
}
func (*awsRestjson1_deserializeOpImportDocument) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpImportDocument) 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_deserializeOpErrorImportDocument(response, &metadata)
}
output := &ImportDocumentOutput{}
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_deserializeOpDocumentImportDocumentOutput(&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_deserializeOpErrorImportDocument(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("ContentTooLargeException", errorCode):
return awsRestjson1_deserializeErrorContentTooLargeException(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentImportDocumentOutput(v **ImportDocumentOutput, 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 *ImportDocumentOutput
if *v == nil {
sv = &ImportDocumentOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "fileId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.FileId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListCategories struct {
}
func (*awsRestjson1_deserializeOpListCategories) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListCategories) 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_deserializeOpErrorListCategories(response, &metadata)
}
output := &ListCategoriesOutput{}
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_deserializeOpDocumentListCategoriesOutput(&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_deserializeOpErrorListCategories(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListCategoriesOutput(v **ListCategoriesOutput, 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 *ListCategoriesOutput
if *v == nil {
sv = &ListCategoriesOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "categories":
if err := awsRestjson1_deserializeDocumentCategoriesList(&sv.Categories, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListLibraryItems struct {
}
func (*awsRestjson1_deserializeOpListLibraryItems) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListLibraryItems) 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_deserializeOpErrorListLibraryItems(response, &metadata)
}
output := &ListLibraryItemsOutput{}
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_deserializeOpDocumentListLibraryItemsOutput(&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_deserializeOpErrorListLibraryItems(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListLibraryItemsOutput(v **ListLibraryItemsOutput, 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 *ListLibraryItemsOutput
if *v == nil {
sv = &ListLibraryItemsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "libraryItems":
if err := awsRestjson1_deserializeDocumentLibraryItemList(&sv.LibraryItems, value); err != nil {
return err
}
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListQApps struct {
}
func (*awsRestjson1_deserializeOpListQApps) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListQApps) 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_deserializeOpErrorListQApps(response, &metadata)
}
output := &ListQAppsOutput{}
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_deserializeOpDocumentListQAppsOutput(&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_deserializeOpErrorListQApps(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListQAppsOutput(v **ListQAppsOutput, 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 *ListQAppsOutput
if *v == nil {
sv = &ListQAppsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "apps":
if err := awsRestjson1_deserializeDocumentUserAppsList(&sv.Apps, value); err != nil {
return err
}
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListQAppSessionData struct {
}
func (*awsRestjson1_deserializeOpListQAppSessionData) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListQAppSessionData) 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_deserializeOpErrorListQAppSessionData(response, &metadata)
}
output := &ListQAppSessionDataOutput{}
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_deserializeOpDocumentListQAppSessionDataOutput(&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_deserializeOpErrorListQAppSessionData(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListQAppSessionDataOutput(v **ListQAppSessionDataOutput, 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 *ListQAppSessionDataOutput
if *v == nil {
sv = &ListQAppSessionDataOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "sessionArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SessionArn = ptr.String(jtv)
}
case "sessionData":
if err := awsRestjson1_deserializeDocumentQAppSessionDataList(&sv.SessionData, value); err != nil {
return err
}
case "sessionId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.SessionId = 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("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_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_deserializeOpPredictQApp struct {
}
func (*awsRestjson1_deserializeOpPredictQApp) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpPredictQApp) 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_deserializeOpErrorPredictQApp(response, &metadata)
}
output := &PredictQAppOutput{}
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_deserializeOpDocumentPredictQAppOutput(&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_deserializeOpErrorPredictQApp(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentPredictQAppOutput(v **PredictQAppOutput, 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 *PredictQAppOutput
if *v == nil {
sv = &PredictQAppOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "app":
if err := awsRestjson1_deserializeDocumentPredictAppDefinition(&sv.App, value); err != nil {
return err
}
case "problemStatement":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ProblemStatement = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpStartQAppSession struct {
}
func (*awsRestjson1_deserializeOpStartQAppSession) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpStartQAppSession) 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_deserializeOpErrorStartQAppSession(response, &metadata)
}
output := &StartQAppSessionOutput{}
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_deserializeOpDocumentStartQAppSessionOutput(&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_deserializeOpErrorStartQAppSession(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentStartQAppSessionOutput(v **StartQAppSessionOutput, 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 *StartQAppSessionOutput
if *v == nil {
sv = &StartQAppSessionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "sessionArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SessionArn = ptr.String(jtv)
}
case "sessionId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SessionId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpStopQAppSession struct {
}
func (*awsRestjson1_deserializeOpStopQAppSession) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpStopQAppSession) 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_deserializeOpErrorStopQAppSession(response, &metadata)
}
output := &StopQAppSessionOutput{}
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_deserializeOpErrorStopQAppSession(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
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("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_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("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_deserializeOpUpdateLibraryItem struct {
}
func (*awsRestjson1_deserializeOpUpdateLibraryItem) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateLibraryItem) 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_deserializeOpErrorUpdateLibraryItem(response, &metadata)
}
output := &UpdateLibraryItemOutput{}
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_deserializeOpDocumentUpdateLibraryItemOutput(&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_deserializeOpErrorUpdateLibraryItem(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateLibraryItemOutput(v **UpdateLibraryItemOutput, 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 *UpdateLibraryItemOutput
if *v == nil {
sv = &UpdateLibraryItemOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.AppId = ptr.String(jtv)
}
case "appVersion":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected AppVersion to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.AppVersion = ptr.Int32(int32(i64))
}
case "categories":
if err := awsRestjson1_deserializeDocumentCategoryList(&sv.Categories, value); err != nil {
return err
}
case "createdAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(t)
}
case "createdBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.CreatedBy = ptr.String(jtv)
}
case "isRatedByUser":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsRatedByUser = ptr.Bool(jtv)
}
case "isVerified":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsVerified = ptr.Bool(jtv)
}
case "libraryItemId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.LibraryItemId = ptr.String(jtv)
}
case "ratingCount":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.RatingCount = ptr.Int32(int32(i64))
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Status = ptr.String(jtv)
}
case "updatedAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.UpdatedAt = ptr.Time(t)
}
case "updatedBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.UpdatedBy = ptr.String(jtv)
}
case "userCount":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.UserCount = ptr.Int32(int32(i64))
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpUpdateLibraryItemMetadata struct {
}
func (*awsRestjson1_deserializeOpUpdateLibraryItemMetadata) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateLibraryItemMetadata) 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_deserializeOpErrorUpdateLibraryItemMetadata(response, &metadata)
}
output := &UpdateLibraryItemMetadataOutput{}
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_deserializeOpErrorUpdateLibraryItemMetadata(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpUpdateQApp struct {
}
func (*awsRestjson1_deserializeOpUpdateQApp) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateQApp) 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_deserializeOpErrorUpdateQApp(response, &metadata)
}
output := &UpdateQAppOutput{}
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_deserializeOpDocumentUpdateQAppOutput(&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_deserializeOpErrorUpdateQApp(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("ContentTooLargeException", errorCode):
return awsRestjson1_deserializeErrorContentTooLargeException(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateQAppOutput(v **UpdateQAppOutput, 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 *UpdateQAppOutput
if *v == nil {
sv = &UpdateQAppOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AppArn to be of type string, got %T instead", value)
}
sv.AppArn = ptr.String(jtv)
}
case "appId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.AppId = ptr.String(jtv)
}
case "appVersion":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected AppVersion to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.AppVersion = ptr.Int32(int32(i64))
}
case "createdAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(t)
}
case "createdBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.CreatedBy = ptr.String(jtv)
}
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 "initialPrompt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected InitialPrompt to be of type string, got %T instead", value)
}
sv.InitialPrompt = ptr.String(jtv)
}
case "requiredCapabilities":
if err := awsRestjson1_deserializeDocumentAppRequiredCapabilities(&sv.RequiredCapabilities, value); err != nil {
return err
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AppStatus to be of type string, got %T instead", value)
}
sv.Status = types.AppStatus(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "updatedAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.UpdatedAt = ptr.Time(t)
}
case "updatedBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.UpdatedBy = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpUpdateQAppPermissions struct {
}
func (*awsRestjson1_deserializeOpUpdateQAppPermissions) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateQAppPermissions) 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_deserializeOpErrorUpdateQAppPermissions(response, &metadata)
}
output := &UpdateQAppPermissionsOutput{}
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_deserializeOpDocumentUpdateQAppPermissionsOutput(&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_deserializeOpErrorUpdateQAppPermissions(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateQAppPermissionsOutput(v **UpdateQAppPermissionsOutput, 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 *UpdateQAppPermissionsOutput
if *v == nil {
sv = &UpdateQAppPermissionsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.AppId = ptr.String(jtv)
}
case "permissions":
if err := awsRestjson1_deserializeDocumentPermissionsOutputList(&sv.Permissions, value); err != nil {
return err
}
case "resourceArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceArn = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpUpdateQAppSession struct {
}
func (*awsRestjson1_deserializeOpUpdateQAppSession) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateQAppSession) 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_deserializeOpErrorUpdateQAppSession(response, &metadata)
}
output := &UpdateQAppSessionOutput{}
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_deserializeOpDocumentUpdateQAppSessionOutput(&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_deserializeOpErrorUpdateQAppSession(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateQAppSessionOutput(v **UpdateQAppSessionOutput, 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 *UpdateQAppSessionOutput
if *v == nil {
sv = &UpdateQAppSessionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "sessionArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SessionArn = ptr.String(jtv)
}
case "sessionId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SessionId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpUpdateQAppSessionMetadata struct {
}
func (*awsRestjson1_deserializeOpUpdateQAppSessionMetadata) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateQAppSessionMetadata) 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_deserializeOpErrorUpdateQAppSessionMetadata(response, &metadata)
}
output := &UpdateQAppSessionMetadataOutput{}
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_deserializeOpDocumentUpdateQAppSessionMetadataOutput(&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_deserializeOpErrorUpdateQAppSessionMetadata(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("UnauthorizedException", errorCode):
return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateQAppSessionMetadataOutput(v **UpdateQAppSessionMetadataOutput, 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 *UpdateQAppSessionMetadataOutput
if *v == nil {
sv = &UpdateQAppSessionMetadataOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "sessionArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SessionArn = ptr.String(jtv)
}
case "sessionId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.SessionId = ptr.String(jtv)
}
case "sessionName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SessionName to be of type string, got %T instead", value)
}
sv.SessionName = ptr.String(jtv)
}
case "sharingConfiguration":
if err := awsRestjson1_deserializeDocumentSessionSharingConfiguration(&sv.SharingConfiguration, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeOpHttpBindingsInternalServerException(v *types.InternalServerException, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
if headerValues := response.Header.Values("Retry-After"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
vv, err := strconv.ParseInt(headerValues[0], 0, 32)
if err != nil {
return err
}
v.RetryAfterSeconds = ptr.Int32(int32(vv))
}
return nil
}
func awsRestjson1_deserializeOpHttpBindingsThrottlingException(v *types.ThrottlingException, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
if headerValues := response.Header.Values("Retry-After"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
vv, err := strconv.ParseInt(headerValues[0], 0, 32)
if err != nil {
return err
}
v.RetryAfterSeconds = ptr.Int32(int32(vv))
}
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_deserializeErrorContentTooLargeException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ContentTooLargeException{}
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_deserializeDocumentContentTooLargeException(&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)
if err := awsRestjson1_deserializeOpHttpBindingsInternalServerException(output, response); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid HTTP bindings, %w", err)}
}
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)
if err := awsRestjson1_deserializeOpHttpBindingsThrottlingException(output, response); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid HTTP bindings, %w", err)}
}
return output
}
func awsRestjson1_deserializeErrorUnauthorizedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.UnauthorizedException{}
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_deserializeDocumentUnauthorizedException(&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_deserializeDocumentAppDefinition(v **types.AppDefinition, 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.AppDefinition
if *v == nil {
sv = &types.AppDefinition{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appDefinitionVersion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.AppDefinitionVersion = ptr.String(jtv)
}
case "canEdit":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.CanEdit = ptr.Bool(jtv)
}
case "cards":
if err := awsRestjson1_deserializeDocumentCardModelList(&sv.Cards, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentAppDefinitionInput(v **types.AppDefinitionInput, 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.AppDefinitionInput
if *v == nil {
sv = &types.AppDefinitionInput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "cards":
if err := awsRestjson1_deserializeDocumentCardList(&sv.Cards, value); err != nil {
return err
}
case "initialPrompt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected InitialPrompt to be of type string, got %T instead", value)
}
sv.InitialPrompt = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentAppRequiredCapabilities(v *[]types.AppRequiredCapability, 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.AppRequiredCapability
if *v == nil {
cv = []types.AppRequiredCapability{}
} else {
cv = *v
}
for _, value := range shape {
var col types.AppRequiredCapability
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AppRequiredCapability to be of type string, got %T instead", value)
}
col = types.AppRequiredCapability(jtv)
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentAttributeFilter(v **types.AttributeFilter, 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.AttributeFilter
if *v == nil {
sv = &types.AttributeFilter{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "andAllFilters":
if err := awsRestjson1_deserializeDocumentAttributeFilters(&sv.AndAllFilters, value); err != nil {
return err
}
case "containsAll":
if err := awsRestjson1_deserializeDocumentDocumentAttribute(&sv.ContainsAll, value); err != nil {
return err
}
case "containsAny":
if err := awsRestjson1_deserializeDocumentDocumentAttribute(&sv.ContainsAny, value); err != nil {
return err
}
case "equalsTo":
if err := awsRestjson1_deserializeDocumentDocumentAttribute(&sv.EqualsTo, value); err != nil {
return err
}
case "greaterThan":
if err := awsRestjson1_deserializeDocumentDocumentAttribute(&sv.GreaterThan, value); err != nil {
return err
}
case "greaterThanOrEquals":
if err := awsRestjson1_deserializeDocumentDocumentAttribute(&sv.GreaterThanOrEquals, value); err != nil {
return err
}
case "lessThan":
if err := awsRestjson1_deserializeDocumentDocumentAttribute(&sv.LessThan, value); err != nil {
return err
}
case "lessThanOrEquals":
if err := awsRestjson1_deserializeDocumentDocumentAttribute(&sv.LessThanOrEquals, value); err != nil {
return err
}
case "notFilter":
if err := awsRestjson1_deserializeDocumentAttributeFilter(&sv.NotFilter, value); err != nil {
return err
}
case "orAllFilters":
if err := awsRestjson1_deserializeDocumentAttributeFilters(&sv.OrAllFilters, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentAttributeFilters(v *[]types.AttributeFilter, 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.AttributeFilter
if *v == nil {
cv = []types.AttributeFilter{}
} else {
cv = *v
}
for _, value := range shape {
var col types.AttributeFilter
destAddr := &col
if err := awsRestjson1_deserializeDocumentAttributeFilter(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentCard(v *types.Card, 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 uv types.Card
loop:
for key, value := range shape {
if value == nil {
continue
}
switch key {
case "fileUpload":
var mv types.FileUploadCard
destAddr := &mv
if err := awsRestjson1_deserializeDocumentFileUploadCard(&destAddr, value); err != nil {
return err
}
mv = *destAddr
uv = &types.CardMemberFileUpload{Value: mv}
break loop
case "formInput":
var mv types.FormInputCard
destAddr := &mv
if err := awsRestjson1_deserializeDocumentFormInputCard(&destAddr, value); err != nil {
return err
}
mv = *destAddr
uv = &types.CardMemberFormInput{Value: mv}
break loop
case "qPlugin":
var mv types.QPluginCard
destAddr := &mv
if err := awsRestjson1_deserializeDocumentQPluginCard(&destAddr, value); err != nil {
return err
}
mv = *destAddr
uv = &types.CardMemberQPlugin{Value: mv}
break loop
case "qQuery":
var mv types.QQueryCard
destAddr := &mv
if err := awsRestjson1_deserializeDocumentQQueryCard(&destAddr, value); err != nil {
return err
}
mv = *destAddr
uv = &types.CardMemberQQuery{Value: mv}
break loop
case "textInput":
var mv types.TextInputCard
destAddr := &mv
if err := awsRestjson1_deserializeDocumentTextInputCard(&destAddr, value); err != nil {
return err
}
mv = *destAddr
uv = &types.CardMemberTextInput{Value: mv}
break loop
default:
uv = &types.UnknownUnionMember{Tag: key}
break loop
}
}
*v = uv
return nil
}
func awsRestjson1_deserializeDocumentCardInput(v *types.CardInput, 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 uv types.CardInput
loop:
for key, value := range shape {
if value == nil {
continue
}
switch key {
case "fileUpload":
var mv types.FileUploadCardInput
destAddr := &mv
if err := awsRestjson1_deserializeDocumentFileUploadCardInput(&destAddr, value); err != nil {
return err
}
mv = *destAddr
uv = &types.CardInputMemberFileUpload{Value: mv}
break loop
case "formInput":
var mv types.FormInputCardInput
destAddr := &mv
if err := awsRestjson1_deserializeDocumentFormInputCardInput(&destAddr, value); err != nil {
return err
}
mv = *destAddr
uv = &types.CardInputMemberFormInput{Value: mv}
break loop
case "qPlugin":
var mv types.QPluginCardInput
destAddr := &mv
if err := awsRestjson1_deserializeDocumentQPluginCardInput(&destAddr, value); err != nil {
return err
}
mv = *destAddr
uv = &types.CardInputMemberQPlugin{Value: mv}
break loop
case "qQuery":
var mv types.QQueryCardInput
destAddr := &mv
if err := awsRestjson1_deserializeDocumentQQueryCardInput(&destAddr, value); err != nil {
return err
}
mv = *destAddr
uv = &types.CardInputMemberQQuery{Value: mv}
break loop
case "textInput":
var mv types.TextInputCardInput
destAddr := &mv
if err := awsRestjson1_deserializeDocumentTextInputCardInput(&destAddr, value); err != nil {
return err
}
mv = *destAddr
uv = &types.CardInputMemberTextInput{Value: mv}
break loop
default:
uv = &types.UnknownUnionMember{Tag: key}
break loop
}
}
*v = uv
return nil
}
func awsRestjson1_deserializeDocumentCardList(v *[]types.CardInput, 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.CardInput
if *v == nil {
cv = []types.CardInput{}
} else {
cv = *v
}
for _, value := range shape {
var col types.CardInput
if err := awsRestjson1_deserializeDocumentCardInput(&col, value); err != nil {
return err
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentCardModelList(v *[]types.Card, 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.Card
if *v == nil {
cv = []types.Card{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Card
if err := awsRestjson1_deserializeDocumentCard(&col, value); err != nil {
return err
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentCardStatus(v **types.CardStatus, 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.CardStatus
if *v == nil {
sv = &types.CardStatus{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "currentState":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExecutionStatus to be of type string, got %T instead", value)
}
sv.CurrentState = types.ExecutionStatus(jtv)
}
case "currentValue":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.CurrentValue = ptr.String(jtv)
}
case "submissions":
if err := awsRestjson1_deserializeDocumentSubmissionList(&sv.Submissions, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentCardStatusMap(v *map[string]types.CardStatus, 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]types.CardStatus
if *v == nil {
mv = map[string]types.CardStatus{}
} else {
mv = *v
}
for key, value := range shape {
var parsedVal types.CardStatus
mapVar := parsedVal
destAddr := &mapVar
if err := awsRestjson1_deserializeDocumentCardStatus(&destAddr, value); err != nil {
return err
}
parsedVal = *destAddr
mv[key] = parsedVal
}
*v = mv
return nil
}
func awsRestjson1_deserializeDocumentCategoriesList(v *[]types.Category, 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.Category
if *v == nil {
cv = []types.Category{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Category
destAddr := &col
if err := awsRestjson1_deserializeDocumentCategory(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentCategory(v **types.Category, 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.Category
if *v == nil {
sv = &types.Category{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appCount":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.AppCount = ptr.Int32(int32(i64))
}
case "color":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Color = ptr.String(jtv)
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentCategoryList(v *[]types.Category, 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.Category
if *v == nil {
cv = []types.Category{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Category
destAddr := &col
if err := awsRestjson1_deserializeDocumentCategory(&destAddr, value); err != nil {
return err
}
col = *destAddr
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)
}
case "resourceId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceId = ptr.String(jtv)
}
case "resourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceType = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentContentTooLargeException(v **types.ContentTooLargeException, 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.ContentTooLargeException
if *v == nil {
sv = &types.ContentTooLargeException{}
} 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)
}
case "resourceId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceId = ptr.String(jtv)
}
case "resourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceType = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentDependencyList(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_deserializeDocumentDocumentAttribute(v **types.DocumentAttribute, 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.DocumentAttribute
if *v == nil {
sv = &types.DocumentAttribute{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DocumentAttributeKey to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "value":
if err := awsRestjson1_deserializeDocumentDocumentAttributeValue(&sv.Value, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentDocumentAttributeStringListValue(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 PlatoString to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentDocumentAttributeValue(v *types.DocumentAttributeValue, 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 uv types.DocumentAttributeValue
loop:
for key, value := range shape {
if value == nil {
continue
}
switch key {
case "dateValue":
var mv time.Time
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
mv = smithytime.ParseEpochSeconds(f64)
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
uv = &types.DocumentAttributeValueMemberDateValue{Value: mv}
break loop
case "longValue":
var mv int64
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
mv = i64
}
uv = &types.DocumentAttributeValueMemberLongValue{Value: mv}
break loop
case "stringListValue":
var mv []string
if err := awsRestjson1_deserializeDocumentDocumentAttributeStringListValue(&mv, value); err != nil {
return err
}
uv = &types.DocumentAttributeValueMemberStringListValue{Value: mv}
break loop
case "stringValue":
var mv string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DocumentAttributeStringValue to be of type string, got %T instead", value)
}
mv = jtv
}
uv = &types.DocumentAttributeValueMemberStringValue{Value: mv}
break loop
default:
uv = &types.UnknownUnionMember{Tag: key}
break loop
}
}
*v = uv
return nil
}
func awsRestjson1_deserializeDocumentFileUploadCard(v **types.FileUploadCard, 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.FileUploadCard
if *v == nil {
sv = &types.FileUploadCard{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "allowOverride":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.AllowOverride = ptr.Bool(jtv)
}
case "dependencies":
if err := awsRestjson1_deserializeDocumentDependencyList(&sv.Dependencies, value); err != nil {
return err
}
case "fileId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.FileId = ptr.String(jtv)
}
case "filename":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Filename = ptr.String(jtv)
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardType to be of type string, got %T instead", value)
}
sv.Type = types.CardType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentFileUploadCardInput(v **types.FileUploadCardInput, 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.FileUploadCardInput
if *v == nil {
sv = &types.FileUploadCardInput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "allowOverride":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.AllowOverride = ptr.Bool(jtv)
}
case "fileId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.FileId = ptr.String(jtv)
}
case "filename":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Filename to be of type string, got %T instead", value)
}
sv.Filename = ptr.String(jtv)
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardType to be of type string, got %T instead", value)
}
sv.Type = types.CardType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentFormInputCard(v **types.FormInputCard, 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.FormInputCard
if *v == nil {
sv = &types.FormInputCard{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "computeMode":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected InputCardComputeMode to be of type string, got %T instead", value)
}
sv.ComputeMode = types.InputCardComputeMode(jtv)
}
case "dependencies":
if err := awsRestjson1_deserializeDocumentDependencyList(&sv.Dependencies, value); err != nil {
return err
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "metadata":
if err := awsRestjson1_deserializeDocumentFormInputCardMetadata(&sv.Metadata, value); err != nil {
return err
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardType to be of type string, got %T instead", value)
}
sv.Type = types.CardType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentFormInputCardInput(v **types.FormInputCardInput, 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.FormInputCardInput
if *v == nil {
sv = &types.FormInputCardInput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "computeMode":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected InputCardComputeMode to be of type string, got %T instead", value)
}
sv.ComputeMode = types.InputCardComputeMode(jtv)
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "metadata":
if err := awsRestjson1_deserializeDocumentFormInputCardMetadata(&sv.Metadata, value); err != nil {
return err
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardType to be of type string, got %T instead", value)
}
sv.Type = types.CardType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentFormInputCardMetadata(v **types.FormInputCardMetadata, 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.FormInputCardMetadata
if *v == nil {
sv = &types.FormInputCardMetadata{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "schema":
if err := awsRestjson1_deserializeDocumentFormInputCardMetadataSchema(&sv.Schema, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentFormInputCardMetadataSchema(v *document.Interface, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
*v = internaldocument.NewDocumentUnmarshaler(value)
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)
}
case "retryAfterSeconds":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.RetryAfterSeconds = ptr.Int32(int32(i64))
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentLibraryItemList(v *[]types.LibraryItemMember, 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.LibraryItemMember
if *v == nil {
cv = []types.LibraryItemMember{}
} else {
cv = *v
}
for _, value := range shape {
var col types.LibraryItemMember
destAddr := &col
if err := awsRestjson1_deserializeDocumentLibraryItemMember(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentLibraryItemMember(v **types.LibraryItemMember, 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.LibraryItemMember
if *v == nil {
sv = &types.LibraryItemMember{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.AppId = ptr.String(jtv)
}
case "appVersion":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected AppVersion to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.AppVersion = ptr.Int32(int32(i64))
}
case "categories":
if err := awsRestjson1_deserializeDocumentCategoryList(&sv.Categories, value); err != nil {
return err
}
case "createdAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(t)
}
case "createdBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.CreatedBy = ptr.String(jtv)
}
case "isRatedByUser":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsRatedByUser = ptr.Bool(jtv)
}
case "isVerified":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsVerified = ptr.Bool(jtv)
}
case "libraryItemId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.LibraryItemId = ptr.String(jtv)
}
case "ratingCount":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.RatingCount = ptr.Int32(int32(i64))
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Status = ptr.String(jtv)
}
case "updatedAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.UpdatedAt = ptr.Time(t)
}
case "updatedBy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.UpdatedBy = ptr.String(jtv)
}
case "userCount":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.UserCount = ptr.Int32(int32(i64))
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentMemoryReferenceList(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_deserializeDocumentPermissionOutput(v **types.PermissionOutput, 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.PermissionOutput
if *v == nil {
sv = &types.PermissionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "action":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Action to be of type string, got %T instead", value)
}
sv.Action = types.Action(jtv)
}
case "principal":
if err := awsRestjson1_deserializeDocumentPrincipalOutput(&sv.Principal, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentPermissionsOutputList(v *[]types.PermissionOutput, 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.PermissionOutput
if *v == nil {
cv = []types.PermissionOutput{}
} else {
cv = *v
}
for _, value := range shape {
var col types.PermissionOutput
destAddr := &col
if err := awsRestjson1_deserializeDocumentPermissionOutput(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentPredictAppDefinition(v **types.PredictAppDefinition, 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.PredictAppDefinition
if *v == nil {
sv = &types.PredictAppDefinition{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appDefinition":
if err := awsRestjson1_deserializeDocumentAppDefinitionInput(&sv.AppDefinition, 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 "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentPresignedUrlFields(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_deserializeDocumentPrincipalOutput(v **types.PrincipalOutput, 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.PrincipalOutput
if *v == nil {
sv = &types.PrincipalOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "email":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Email = ptr.String(jtv)
}
case "userId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.UserId = ptr.String(jtv)
}
case "userType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UserType to be of type string, got %T instead", value)
}
sv.UserType = types.UserType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentQAppSessionData(v **types.QAppSessionData, 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.QAppSessionData
if *v == nil {
sv = &types.QAppSessionData{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "cardId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.CardId = ptr.String(jtv)
}
case "submissionId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.SubmissionId = ptr.String(jtv)
}
case "timestamp":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.Timestamp = ptr.Time(t)
}
case "user":
if err := awsRestjson1_deserializeDocumentUser(&sv.User, value); err != nil {
return err
}
case "value":
if err := awsRestjson1_deserializeDocumentDocument(&sv.Value, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentQAppSessionDataList(v *[]types.QAppSessionData, 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.QAppSessionData
if *v == nil {
cv = []types.QAppSessionData{}
} else {
cv = *v
}
for _, value := range shape {
var col types.QAppSessionData
destAddr := &col
if err := awsRestjson1_deserializeDocumentQAppSessionData(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentQPluginCard(v **types.QPluginCard, 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.QPluginCard
if *v == nil {
sv = &types.QPluginCard{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "actionIdentifier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ActionIdentifier to be of type string, got %T instead", value)
}
sv.ActionIdentifier = ptr.String(jtv)
}
case "dependencies":
if err := awsRestjson1_deserializeDocumentDependencyList(&sv.Dependencies, value); err != nil {
return err
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "pluginId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.PluginId = ptr.String(jtv)
}
case "pluginType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PluginType to be of type string, got %T instead", value)
}
sv.PluginType = types.PluginType(jtv)
}
case "prompt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Prompt to be of type string, got %T instead", value)
}
sv.Prompt = ptr.String(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardType to be of type string, got %T instead", value)
}
sv.Type = types.CardType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentQPluginCardInput(v **types.QPluginCardInput, 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.QPluginCardInput
if *v == nil {
sv = &types.QPluginCardInput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "actionIdentifier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ActionIdentifier to be of type string, got %T instead", value)
}
sv.ActionIdentifier = ptr.String(jtv)
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "pluginId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PluginId to be of type string, got %T instead", value)
}
sv.PluginId = ptr.String(jtv)
}
case "prompt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Prompt to be of type string, got %T instead", value)
}
sv.Prompt = ptr.String(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardType to be of type string, got %T instead", value)
}
sv.Type = types.CardType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentQQueryCard(v **types.QQueryCard, 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.QQueryCard
if *v == nil {
sv = &types.QQueryCard{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "attributeFilter":
if err := awsRestjson1_deserializeDocumentAttributeFilter(&sv.AttributeFilter, value); err != nil {
return err
}
case "dependencies":
if err := awsRestjson1_deserializeDocumentDependencyList(&sv.Dependencies, value); err != nil {
return err
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "memoryReferences":
if err := awsRestjson1_deserializeDocumentMemoryReferenceList(&sv.MemoryReferences, value); err != nil {
return err
}
case "outputSource":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardOutputSource to be of type string, got %T instead", value)
}
sv.OutputSource = types.CardOutputSource(jtv)
}
case "prompt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Prompt to be of type string, got %T instead", value)
}
sv.Prompt = ptr.String(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardType to be of type string, got %T instead", value)
}
sv.Type = types.CardType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentQQueryCardInput(v **types.QQueryCardInput, 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.QQueryCardInput
if *v == nil {
sv = &types.QQueryCardInput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "attributeFilter":
if err := awsRestjson1_deserializeDocumentAttributeFilter(&sv.AttributeFilter, value); err != nil {
return err
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "outputSource":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardOutputSource to be of type string, got %T instead", value)
}
sv.OutputSource = types.CardOutputSource(jtv)
}
case "prompt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Prompt to be of type string, got %T instead", value)
}
sv.Prompt = ptr.String(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardType to be of type string, got %T instead", value)
}
sv.Type = types.CardType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
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)
}
case "resourceId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceId = ptr.String(jtv)
}
case "resourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceType = 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)
}
case "quotaCode":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.QuotaCode = ptr.String(jtv)
}
case "resourceId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceId = ptr.String(jtv)
}
case "resourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceType = ptr.String(jtv)
}
case "serviceCode":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ServiceCode = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSessionSharingConfiguration(v **types.SessionSharingConfiguration, 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.SessionSharingConfiguration
if *v == nil {
sv = &types.SessionSharingConfiguration{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "acceptResponses":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected SessionSharingAcceptResponses to be of type *bool, got %T instead", value)
}
sv.AcceptResponses = ptr.Bool(jtv)
}
case "enabled":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected SessionSharingEnabled to be of type *bool, got %T instead", value)
}
sv.Enabled = ptr.Bool(jtv)
}
case "revealCards":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected SessionSharingRevealCards to be of type *bool, got %T instead", value)
}
sv.RevealCards = ptr.Bool(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSubmission(v **types.Submission, 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.Submission
if *v == nil {
sv = &types.Submission{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "submissionId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.SubmissionId = ptr.String(jtv)
}
case "timestamp":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.Timestamp = ptr.Time(t)
}
case "value":
if err := awsRestjson1_deserializeDocumentDocument(&sv.Value, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSubmissionList(v *[]types.Submission, 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.Submission
if *v == nil {
cv = []types.Submission{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Submission
destAddr := &col
if err := awsRestjson1_deserializeDocumentSubmission(&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_deserializeDocumentTextInputCard(v **types.TextInputCard, 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.TextInputCard
if *v == nil {
sv = &types.TextInputCard{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "defaultValue":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Default to be of type string, got %T instead", value)
}
sv.DefaultValue = ptr.String(jtv)
}
case "dependencies":
if err := awsRestjson1_deserializeDocumentDependencyList(&sv.Dependencies, value); err != nil {
return err
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "placeholder":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Placeholder to be of type string, got %T instead", value)
}
sv.Placeholder = ptr.String(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardType to be of type string, got %T instead", value)
}
sv.Type = types.CardType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentTextInputCardInput(v **types.TextInputCardInput, 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.TextInputCardInput
if *v == nil {
sv = &types.TextInputCardInput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "defaultValue":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Default to be of type string, got %T instead", value)
}
sv.DefaultValue = ptr.String(jtv)
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "placeholder":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Placeholder to be of type string, got %T instead", value)
}
sv.Placeholder = ptr.String(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CardType to be of type string, got %T instead", value)
}
sv.Type = types.CardType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
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)
}
case "quotaCode":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.QuotaCode = ptr.String(jtv)
}
case "retryAfterSeconds":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.RetryAfterSeconds = ptr.Int32(int32(i64))
}
case "serviceCode":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ServiceCode = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentUnauthorizedException(v **types.UnauthorizedException, 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.UnauthorizedException
if *v == nil {
sv = &types.UnauthorizedException{}
} 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_deserializeDocumentUser(v **types.User, 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.User
if *v == nil {
sv = &types.User{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
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_deserializeDocumentUserAppItem(v **types.UserAppItem, 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.UserAppItem
if *v == nil {
sv = &types.UserAppItem{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "appArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AppArn to be of type string, got %T instead", value)
}
sv.AppArn = ptr.String(jtv)
}
case "appId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UUID to be of type string, got %T instead", value)
}
sv.AppId = ptr.String(jtv)
}
case "canEdit":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.CanEdit = ptr.Bool(jtv)
}
case "createdAt":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QAppsTimestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreatedAt = ptr.Time(t)
}
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 "isVerified":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsVerified = jtv
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Status = ptr.String(jtv)
}
case "title":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Title to be of type string, got %T instead", value)
}
sv.Title = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentUserAppsList(v *[]types.UserAppItem, 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.UserAppItem
if *v == nil {
cv = []types.UserAppItem{}
} else {
cv = *v
}
for _, value := range shape {
var col types.UserAppItem
destAddr := &col
if err := awsRestjson1_deserializeDocumentUserAppItem(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
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
}
func awsRestjson1_deserializeDocumentDocument(v *document.Interface, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
*v = internaldocument.NewDocumentUnmarshaler(value)
return nil
}