service/notifications/deserializers.go (7,834 lines of code) (raw):
// Code generated by smithy-go-codegen DO NOT EDIT.
package notifications
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
"github.com/aws/aws-sdk-go-v2/service/notifications/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"
"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_deserializeOpAssociateChannel struct {
}
func (*awsRestjson1_deserializeOpAssociateChannel) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAssociateChannel) 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_deserializeOpErrorAssociateChannel(response, &metadata)
}
output := &AssociateChannelOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorAssociateChannel(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpAssociateManagedNotificationAccountContact struct {
}
func (*awsRestjson1_deserializeOpAssociateManagedNotificationAccountContact) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAssociateManagedNotificationAccountContact) 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_deserializeOpErrorAssociateManagedNotificationAccountContact(response, &metadata)
}
output := &AssociateManagedNotificationAccountContactOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorAssociateManagedNotificationAccountContact(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpAssociateManagedNotificationAdditionalChannel struct {
}
func (*awsRestjson1_deserializeOpAssociateManagedNotificationAdditionalChannel) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAssociateManagedNotificationAdditionalChannel) 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_deserializeOpErrorAssociateManagedNotificationAdditionalChannel(response, &metadata)
}
output := &AssociateManagedNotificationAdditionalChannelOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorAssociateManagedNotificationAdditionalChannel(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpCreateEventRule struct {
}
func (*awsRestjson1_deserializeOpCreateEventRule) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateEventRule) 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_deserializeOpErrorCreateEventRule(response, &metadata)
}
output := &CreateEventRuleOutput{}
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_deserializeOpDocumentCreateEventRuleOutput(&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_deserializeOpErrorCreateEventRule(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreateEventRuleOutput(v **CreateEventRuleOutput, 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 *CreateEventRuleOutput
if *v == nil {
sv = &CreateEventRuleOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventRuleArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "notificationConfigurationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationArn to be of type string, got %T instead", value)
}
sv.NotificationConfigurationArn = ptr.String(jtv)
}
case "statusSummaryByRegion":
if err := awsRestjson1_deserializeDocumentStatusSummaryByRegion(&sv.StatusSummaryByRegion, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCreateNotificationConfiguration struct {
}
func (*awsRestjson1_deserializeOpCreateNotificationConfiguration) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateNotificationConfiguration) 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_deserializeOpErrorCreateNotificationConfiguration(response, &metadata)
}
output := &CreateNotificationConfigurationOutput{}
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_deserializeOpDocumentCreateNotificationConfigurationOutput(&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_deserializeOpErrorCreateNotificationConfiguration(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreateNotificationConfigurationOutput(v **CreateNotificationConfigurationOutput, 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 *CreateNotificationConfigurationOutput
if *v == nil {
sv = &CreateNotificationConfigurationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationStatus to be of type string, got %T instead", value)
}
sv.Status = types.NotificationConfigurationStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDeleteEventRule struct {
}
func (*awsRestjson1_deserializeOpDeleteEventRule) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteEventRule) 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_deserializeOpErrorDeleteEventRule(response, &metadata)
}
output := &DeleteEventRuleOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDeleteEventRule(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_deserializeOpDeleteNotificationConfiguration struct {
}
func (*awsRestjson1_deserializeOpDeleteNotificationConfiguration) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteNotificationConfiguration) 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_deserializeOpErrorDeleteNotificationConfiguration(response, &metadata)
}
output := &DeleteNotificationConfigurationOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDeleteNotificationConfiguration(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_deserializeOpDeregisterNotificationHub struct {
}
func (*awsRestjson1_deserializeOpDeregisterNotificationHub) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeregisterNotificationHub) 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_deserializeOpErrorDeregisterNotificationHub(response, &metadata)
}
output := &DeregisterNotificationHubOutput{}
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_deserializeOpDocumentDeregisterNotificationHubOutput(&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_deserializeOpErrorDeregisterNotificationHub(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentDeregisterNotificationHubOutput(v **DeregisterNotificationHubOutput, 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 *DeregisterNotificationHubOutput
if *v == nil {
sv = &DeregisterNotificationHubOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "notificationHubRegion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Region to be of type string, got %T instead", value)
}
sv.NotificationHubRegion = ptr.String(jtv)
}
case "statusSummary":
if err := awsRestjson1_deserializeDocumentNotificationHubStatusSummary(&sv.StatusSummary, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDisableNotificationsAccessForOrganization struct {
}
func (*awsRestjson1_deserializeOpDisableNotificationsAccessForOrganization) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDisableNotificationsAccessForOrganization) 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_deserializeOpErrorDisableNotificationsAccessForOrganization(response, &metadata)
}
output := &DisableNotificationsAccessForOrganizationOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDisableNotificationsAccessForOrganization(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDisassociateChannel struct {
}
func (*awsRestjson1_deserializeOpDisassociateChannel) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDisassociateChannel) 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_deserializeOpErrorDisassociateChannel(response, &metadata)
}
output := &DisassociateChannelOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDisassociateChannel(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_deserializeOpDisassociateManagedNotificationAccountContact struct {
}
func (*awsRestjson1_deserializeOpDisassociateManagedNotificationAccountContact) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDisassociateManagedNotificationAccountContact) 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_deserializeOpErrorDisassociateManagedNotificationAccountContact(response, &metadata)
}
output := &DisassociateManagedNotificationAccountContactOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDisassociateManagedNotificationAccountContact(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_deserializeOpDisassociateManagedNotificationAdditionalChannel struct {
}
func (*awsRestjson1_deserializeOpDisassociateManagedNotificationAdditionalChannel) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDisassociateManagedNotificationAdditionalChannel) 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_deserializeOpErrorDisassociateManagedNotificationAdditionalChannel(response, &metadata)
}
output := &DisassociateManagedNotificationAdditionalChannelOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDisassociateManagedNotificationAdditionalChannel(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_deserializeOpEnableNotificationsAccessForOrganization struct {
}
func (*awsRestjson1_deserializeOpEnableNotificationsAccessForOrganization) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpEnableNotificationsAccessForOrganization) 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_deserializeOpErrorEnableNotificationsAccessForOrganization(response, &metadata)
}
output := &EnableNotificationsAccessForOrganizationOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorEnableNotificationsAccessForOrganization(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpGetEventRule struct {
}
func (*awsRestjson1_deserializeOpGetEventRule) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetEventRule) 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_deserializeOpErrorGetEventRule(response, &metadata)
}
output := &GetEventRuleOutput{}
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_deserializeOpDocumentGetEventRuleOutput(&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_deserializeOpErrorGetEventRule(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_deserializeOpDocumentGetEventRuleOutput(v **GetEventRuleOutput, 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 *GetEventRuleOutput
if *v == nil {
sv = &GetEventRuleOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventRuleArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "eventPattern":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventRuleEventPattern to be of type string, got %T instead", value)
}
sv.EventPattern = ptr.String(jtv)
}
case "eventType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventType to be of type string, got %T instead", value)
}
sv.EventType = ptr.String(jtv)
}
case "managedRules":
if err := awsRestjson1_deserializeDocumentManagedRuleArns(&sv.ManagedRules, value); err != nil {
return err
}
case "notificationConfigurationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationArn to be of type string, got %T instead", value)
}
sv.NotificationConfigurationArn = ptr.String(jtv)
}
case "regions":
if err := awsRestjson1_deserializeDocumentRegions(&sv.Regions, value); err != nil {
return err
}
case "source":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Source to be of type string, got %T instead", value)
}
sv.Source = ptr.String(jtv)
}
case "statusSummaryByRegion":
if err := awsRestjson1_deserializeDocumentStatusSummaryByRegion(&sv.StatusSummaryByRegion, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetManagedNotificationChildEvent struct {
}
func (*awsRestjson1_deserializeOpGetManagedNotificationChildEvent) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetManagedNotificationChildEvent) 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_deserializeOpErrorGetManagedNotificationChildEvent(response, &metadata)
}
output := &GetManagedNotificationChildEventOutput{}
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_deserializeOpDocumentGetManagedNotificationChildEventOutput(&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_deserializeOpErrorGetManagedNotificationChildEvent(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_deserializeOpDocumentGetManagedNotificationChildEventOutput(v **GetManagedNotificationChildEventOutput, 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 *GetManagedNotificationChildEventOutput
if *v == nil {
sv = &GetManagedNotificationChildEventOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationChildEventArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "content":
if err := awsRestjson1_deserializeDocumentManagedNotificationChildEvent(&sv.Content, value); err != nil {
return err
}
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "managedNotificationConfigurationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationConfigurationOsArn to be of type string, got %T instead", value)
}
sv.ManagedNotificationConfigurationArn = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetManagedNotificationConfiguration struct {
}
func (*awsRestjson1_deserializeOpGetManagedNotificationConfiguration) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetManagedNotificationConfiguration) 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_deserializeOpErrorGetManagedNotificationConfiguration(response, &metadata)
}
output := &GetManagedNotificationConfigurationOutput{}
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_deserializeOpDocumentGetManagedNotificationConfigurationOutput(&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_deserializeOpErrorGetManagedNotificationConfiguration(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_deserializeOpDocumentGetManagedNotificationConfigurationOutput(v **GetManagedNotificationConfigurationOutput, 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 *GetManagedNotificationConfigurationOutput
if *v == nil {
sv = &GetManagedNotificationConfigurationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationConfigurationOsArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "category":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Category = ptr.String(jtv)
}
case "description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationConfigurationDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationConfigurationName to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "subCategory":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SubCategory = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetManagedNotificationEvent struct {
}
func (*awsRestjson1_deserializeOpGetManagedNotificationEvent) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetManagedNotificationEvent) 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_deserializeOpErrorGetManagedNotificationEvent(response, &metadata)
}
output := &GetManagedNotificationEventOutput{}
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_deserializeOpDocumentGetManagedNotificationEventOutput(&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_deserializeOpErrorGetManagedNotificationEvent(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_deserializeOpDocumentGetManagedNotificationEventOutput(v **GetManagedNotificationEventOutput, 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 *GetManagedNotificationEventOutput
if *v == nil {
sv = &GetManagedNotificationEventOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationEventArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "content":
if err := awsRestjson1_deserializeDocumentManagedNotificationEvent(&sv.Content, value); err != nil {
return err
}
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "managedNotificationConfigurationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationConfigurationOsArn to be of type string, got %T instead", value)
}
sv.ManagedNotificationConfigurationArn = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetNotificationConfiguration struct {
}
func (*awsRestjson1_deserializeOpGetNotificationConfiguration) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetNotificationConfiguration) 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_deserializeOpErrorGetNotificationConfiguration(response, &metadata)
}
output := &GetNotificationConfigurationOutput{}
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_deserializeOpDocumentGetNotificationConfigurationOutput(&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_deserializeOpErrorGetNotificationConfiguration(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_deserializeOpDocumentGetNotificationConfigurationOutput(v **GetNotificationConfigurationOutput, 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 *GetNotificationConfigurationOutput
if *v == nil {
sv = &GetNotificationConfigurationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "aggregationDuration":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AggregationDuration to be of type string, got %T instead", value)
}
sv.AggregationDuration = types.AggregationDuration(jtv)
}
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationName to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationStatus to be of type string, got %T instead", value)
}
sv.Status = types.NotificationConfigurationStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetNotificationEvent struct {
}
func (*awsRestjson1_deserializeOpGetNotificationEvent) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetNotificationEvent) 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_deserializeOpErrorGetNotificationEvent(response, &metadata)
}
output := &GetNotificationEventOutput{}
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_deserializeOpDocumentGetNotificationEventOutput(&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_deserializeOpErrorGetNotificationEvent(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_deserializeOpDocumentGetNotificationEventOutput(v **GetNotificationEventOutput, 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 *GetNotificationEventOutput
if *v == nil {
sv = &GetNotificationEventOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationEventArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "content":
if err := awsRestjson1_deserializeDocumentNotificationEventSchema(&sv.Content, value); err != nil {
return err
}
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "notificationConfigurationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationArn to be of type string, got %T instead", value)
}
sv.NotificationConfigurationArn = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetNotificationsAccessForOrganization struct {
}
func (*awsRestjson1_deserializeOpGetNotificationsAccessForOrganization) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetNotificationsAccessForOrganization) 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_deserializeOpErrorGetNotificationsAccessForOrganization(response, &metadata)
}
output := &GetNotificationsAccessForOrganizationOutput{}
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_deserializeOpDocumentGetNotificationsAccessForOrganizationOutput(&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_deserializeOpErrorGetNotificationsAccessForOrganization(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetNotificationsAccessForOrganizationOutput(v **GetNotificationsAccessForOrganizationOutput, 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 *GetNotificationsAccessForOrganizationOutput
if *v == nil {
sv = &GetNotificationsAccessForOrganizationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "notificationsAccessForOrganization":
if err := awsRestjson1_deserializeDocumentNotificationsAccessForOrganization(&sv.NotificationsAccessForOrganization, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListChannels struct {
}
func (*awsRestjson1_deserializeOpListChannels) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListChannels) 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_deserializeOpErrorListChannels(response, &metadata)
}
output := &ListChannelsOutput{}
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_deserializeOpDocumentListChannelsOutput(&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_deserializeOpErrorListChannels(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_deserializeOpDocumentListChannelsOutput(v **ListChannelsOutput, 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 *ListChannelsOutput
if *v == nil {
sv = &ListChannelsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "channels":
if err := awsRestjson1_deserializeDocumentChannels(&sv.Channels, value); err != nil {
return err
}
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListEventRules struct {
}
func (*awsRestjson1_deserializeOpListEventRules) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListEventRules) 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_deserializeOpErrorListEventRules(response, &metadata)
}
output := &ListEventRulesOutput{}
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_deserializeOpDocumentListEventRulesOutput(&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_deserializeOpErrorListEventRules(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_deserializeOpDocumentListEventRulesOutput(v **ListEventRulesOutput, 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 *ListEventRulesOutput
if *v == nil {
sv = &ListEventRulesOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "eventRules":
if err := awsRestjson1_deserializeDocumentEventRules(&sv.EventRules, value); err != nil {
return err
}
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListManagedNotificationChannelAssociations struct {
}
func (*awsRestjson1_deserializeOpListManagedNotificationChannelAssociations) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListManagedNotificationChannelAssociations) 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_deserializeOpErrorListManagedNotificationChannelAssociations(response, &metadata)
}
output := &ListManagedNotificationChannelAssociationsOutput{}
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_deserializeOpDocumentListManagedNotificationChannelAssociationsOutput(&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_deserializeOpErrorListManagedNotificationChannelAssociations(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_deserializeOpDocumentListManagedNotificationChannelAssociationsOutput(v **ListManagedNotificationChannelAssociationsOutput, 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 *ListManagedNotificationChannelAssociationsOutput
if *v == nil {
sv = &ListManagedNotificationChannelAssociationsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "channelAssociations":
if err := awsRestjson1_deserializeDocumentManagedNotificationChannelAssociations(&sv.ChannelAssociations, value); err != nil {
return err
}
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListManagedNotificationChildEvents struct {
}
func (*awsRestjson1_deserializeOpListManagedNotificationChildEvents) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListManagedNotificationChildEvents) 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_deserializeOpErrorListManagedNotificationChildEvents(response, &metadata)
}
output := &ListManagedNotificationChildEventsOutput{}
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_deserializeOpDocumentListManagedNotificationChildEventsOutput(&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_deserializeOpErrorListManagedNotificationChildEvents(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListManagedNotificationChildEventsOutput(v **ListManagedNotificationChildEventsOutput, 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 *ListManagedNotificationChildEventsOutput
if *v == nil {
sv = &ListManagedNotificationChildEventsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "managedNotificationChildEvents":
if err := awsRestjson1_deserializeDocumentManagedNotificationChildEvents(&sv.ManagedNotificationChildEvents, value); err != nil {
return err
}
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListManagedNotificationConfigurations struct {
}
func (*awsRestjson1_deserializeOpListManagedNotificationConfigurations) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListManagedNotificationConfigurations) 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_deserializeOpErrorListManagedNotificationConfigurations(response, &metadata)
}
output := &ListManagedNotificationConfigurationsOutput{}
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_deserializeOpDocumentListManagedNotificationConfigurationsOutput(&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_deserializeOpErrorListManagedNotificationConfigurations(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListManagedNotificationConfigurationsOutput(v **ListManagedNotificationConfigurationsOutput, 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 *ListManagedNotificationConfigurationsOutput
if *v == nil {
sv = &ListManagedNotificationConfigurationsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "managedNotificationConfigurations":
if err := awsRestjson1_deserializeDocumentManagedNotificationConfigurations(&sv.ManagedNotificationConfigurations, value); err != nil {
return err
}
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListManagedNotificationEvents struct {
}
func (*awsRestjson1_deserializeOpListManagedNotificationEvents) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListManagedNotificationEvents) 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_deserializeOpErrorListManagedNotificationEvents(response, &metadata)
}
output := &ListManagedNotificationEventsOutput{}
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_deserializeOpDocumentListManagedNotificationEventsOutput(&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_deserializeOpErrorListManagedNotificationEvents(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListManagedNotificationEventsOutput(v **ListManagedNotificationEventsOutput, 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 *ListManagedNotificationEventsOutput
if *v == nil {
sv = &ListManagedNotificationEventsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "managedNotificationEvents":
if err := awsRestjson1_deserializeDocumentManagedNotificationEvents(&sv.ManagedNotificationEvents, value); err != nil {
return err
}
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListNotificationConfigurations struct {
}
func (*awsRestjson1_deserializeOpListNotificationConfigurations) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListNotificationConfigurations) 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_deserializeOpErrorListNotificationConfigurations(response, &metadata)
}
output := &ListNotificationConfigurationsOutput{}
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_deserializeOpDocumentListNotificationConfigurationsOutput(&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_deserializeOpErrorListNotificationConfigurations(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListNotificationConfigurationsOutput(v **ListNotificationConfigurationsOutput, 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 *ListNotificationConfigurationsOutput
if *v == nil {
sv = &ListNotificationConfigurationsOutput{}
} 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 NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "notificationConfigurations":
if err := awsRestjson1_deserializeDocumentNotificationConfigurations(&sv.NotificationConfigurations, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListNotificationEvents struct {
}
func (*awsRestjson1_deserializeOpListNotificationEvents) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListNotificationEvents) 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_deserializeOpErrorListNotificationEvents(response, &metadata)
}
output := &ListNotificationEventsOutput{}
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_deserializeOpDocumentListNotificationEventsOutput(&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_deserializeOpErrorListNotificationEvents(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListNotificationEventsOutput(v **ListNotificationEventsOutput, 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 *ListNotificationEventsOutput
if *v == nil {
sv = &ListNotificationEventsOutput{}
} 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 NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "notificationEvents":
if err := awsRestjson1_deserializeDocumentNotificationEvents(&sv.NotificationEvents, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListNotificationHubs struct {
}
func (*awsRestjson1_deserializeOpListNotificationHubs) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListNotificationHubs) 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_deserializeOpErrorListNotificationHubs(response, &metadata)
}
output := &ListNotificationHubsOutput{}
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_deserializeOpDocumentListNotificationHubsOutput(&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_deserializeOpErrorListNotificationHubs(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListNotificationHubsOutput(v **ListNotificationHubsOutput, 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 *ListNotificationHubsOutput
if *v == nil {
sv = &ListNotificationHubsOutput{}
} 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 NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "notificationHubs":
if err := awsRestjson1_deserializeDocumentNotificationHubs(&sv.NotificationHubs, value); err != nil {
return err
}
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_deserializeDocumentTagMap(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpRegisterNotificationHub struct {
}
func (*awsRestjson1_deserializeOpRegisterNotificationHub) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpRegisterNotificationHub) 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_deserializeOpErrorRegisterNotificationHub(response, &metadata)
}
output := &RegisterNotificationHubOutput{}
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_deserializeOpDocumentRegisterNotificationHubOutput(&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_deserializeOpErrorRegisterNotificationHub(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentRegisterNotificationHubOutput(v **RegisterNotificationHubOutput, 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 *RegisterNotificationHubOutput
if *v == nil {
sv = &RegisterNotificationHubOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "lastActivationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LastActivationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.LastActivationTime = ptr.Time(t)
}
case "notificationHubRegion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Region to be of type string, got %T instead", value)
}
sv.NotificationHubRegion = ptr.String(jtv)
}
case "statusSummary":
if err := awsRestjson1_deserializeDocumentNotificationHubStatusSummary(&sv.StatusSummary, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpTagResource struct {
}
func (*awsRestjson1_deserializeOpTagResource) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
) {
out, metadata, err = next.HandleDeserialize(ctx, in)
if err != nil {
return out, metadata, err
}
_, span := tracing.StartSpan(ctx, "OperationDeserializer")
endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
defer endTimer()
defer span.End()
response, ok := out.RawResponse.(*smithyhttp.Response)
if !ok {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata)
}
output := &TagResourceOutput{}
out.Result = output
span.End()
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("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_deserializeOpUpdateEventRule struct {
}
func (*awsRestjson1_deserializeOpUpdateEventRule) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateEventRule) 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_deserializeOpErrorUpdateEventRule(response, &metadata)
}
output := &UpdateEventRuleOutput{}
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_deserializeOpDocumentUpdateEventRuleOutput(&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_deserializeOpErrorUpdateEventRule(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateEventRuleOutput(v **UpdateEventRuleOutput, 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 *UpdateEventRuleOutput
if *v == nil {
sv = &UpdateEventRuleOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventRuleArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "notificationConfigurationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationArn to be of type string, got %T instead", value)
}
sv.NotificationConfigurationArn = ptr.String(jtv)
}
case "statusSummaryByRegion":
if err := awsRestjson1_deserializeDocumentStatusSummaryByRegion(&sv.StatusSummaryByRegion, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpUpdateNotificationConfiguration struct {
}
func (*awsRestjson1_deserializeOpUpdateNotificationConfiguration) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateNotificationConfiguration) 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_deserializeOpErrorUpdateNotificationConfiguration(response, &metadata)
}
output := &UpdateNotificationConfigurationOutput{}
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_deserializeOpDocumentUpdateNotificationConfigurationOutput(&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_deserializeOpErrorUpdateNotificationConfiguration(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateNotificationConfigurationOutput(v **UpdateNotificationConfigurationOutput, 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 *UpdateNotificationConfigurationOutput
if *v == nil {
sv = &UpdateNotificationConfigurationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
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_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InternalServerException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ResourceNotFoundException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ServiceQuotaExceededException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ThrottlingException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
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_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 ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentAggregatedNotificationRegions(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 Region to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentAggregationDetail(v **types.AggregationDetail, 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.AggregationDetail
if *v == nil {
sv = &types.AggregationDetail{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "summarizationDimensions":
if err := awsRestjson1_deserializeDocumentSummarizationDimensionDetails(&sv.SummarizationDimensions, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentAggregationKey(v **types.AggregationKey, 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.AggregationKey
if *v == nil {
sv = &types.AggregationKey{}
} 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 String to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "value":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Value = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentAggregationKeys(v *[]types.AggregationKey, 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.AggregationKey
if *v == nil {
cv = []types.AggregationKey{}
} else {
cv = *v
}
for _, value := range shape {
var col types.AggregationKey
destAddr := &col
if err := awsRestjson1_deserializeDocumentAggregationKey(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentAggregationSummary(v **types.AggregationSummary, 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.AggregationSummary
if *v == nil {
sv = &types.AggregationSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "additionalSummarizationDimensions":
if err := awsRestjson1_deserializeDocumentSummarizationDimensionOverviews(&sv.AdditionalSummarizationDimensions, value); err != nil {
return err
}
case "aggregatedAccounts":
if err := awsRestjson1_deserializeDocumentSummarizationDimensionOverview(&sv.AggregatedAccounts, value); err != nil {
return err
}
case "aggregatedBy":
if err := awsRestjson1_deserializeDocumentAggregationKeys(&sv.AggregatedBy, value); err != nil {
return err
}
case "aggregatedOrganizationalUnits":
if err := awsRestjson1_deserializeDocumentSummarizationDimensionOverview(&sv.AggregatedOrganizationalUnits, value); err != nil {
return err
}
case "aggregatedRegions":
if err := awsRestjson1_deserializeDocumentSummarizationDimensionOverview(&sv.AggregatedRegions, value); err != nil {
return err
}
case "eventCount":
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.EventCount = ptr.Int32(int32(i64))
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentChannels(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 ChannelArn to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ConflictException
if *v == nil {
sv = &types.ConflictException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message", "Message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ErrorMessage 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 ResourceId to be of type string, got %T instead", value)
}
sv.ResourceId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentDimension(v **types.Dimension, 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.Dimension
if *v == nil {
sv = &types.Dimension{}
} 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 TextPartReference to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "value":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TextPartReference to be of type string, got %T instead", value)
}
sv.Value = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentDimensions(v *[]types.Dimension, 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.Dimension
if *v == nil {
cv = []types.Dimension{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Dimension
destAddr := &col
if err := awsRestjson1_deserializeDocumentDimension(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentEventRules(v *[]types.EventRuleStructure, 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.EventRuleStructure
if *v == nil {
cv = []types.EventRuleStructure{}
} else {
cv = *v
}
for _, value := range shape {
var col types.EventRuleStructure
destAddr := &col
if err := awsRestjson1_deserializeDocumentEventRuleStructure(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentEventRuleStatusSummary(v **types.EventRuleStatusSummary, 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.EventRuleStatusSummary
if *v == nil {
sv = &types.EventRuleStatusSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "reason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventRuleStatusReason to be of type string, got %T instead", value)
}
sv.Reason = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventRuleStatus to be of type string, got %T instead", value)
}
sv.Status = types.EventRuleStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentEventRuleStructure(v **types.EventRuleStructure, 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.EventRuleStructure
if *v == nil {
sv = &types.EventRuleStructure{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventRuleArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "eventPattern":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventRuleEventPattern to be of type string, got %T instead", value)
}
sv.EventPattern = ptr.String(jtv)
}
case "eventType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventType to be of type string, got %T instead", value)
}
sv.EventType = ptr.String(jtv)
}
case "managedRules":
if err := awsRestjson1_deserializeDocumentManagedRuleArns(&sv.ManagedRules, value); err != nil {
return err
}
case "notificationConfigurationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationArn to be of type string, got %T instead", value)
}
sv.NotificationConfigurationArn = ptr.String(jtv)
}
case "regions":
if err := awsRestjson1_deserializeDocumentRegions(&sv.Regions, value); err != nil {
return err
}
case "source":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Source to be of type string, got %T instead", value)
}
sv.Source = ptr.String(jtv)
}
case "statusSummaryByRegion":
if err := awsRestjson1_deserializeDocumentStatusSummaryByRegion(&sv.StatusSummaryByRegion, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
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 ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationChannelAssociations(v *[]types.ManagedNotificationChannelAssociationSummary, 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.ManagedNotificationChannelAssociationSummary
if *v == nil {
cv = []types.ManagedNotificationChannelAssociationSummary{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ManagedNotificationChannelAssociationSummary
destAddr := &col
if err := awsRestjson1_deserializeDocumentManagedNotificationChannelAssociationSummary(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationChannelAssociationSummary(v **types.ManagedNotificationChannelAssociationSummary, 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.ManagedNotificationChannelAssociationSummary
if *v == nil {
sv = &types.ManagedNotificationChannelAssociationSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "channelIdentifier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ChannelIdentifier = ptr.String(jtv)
}
case "channelType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ChannelType to be of type string, got %T instead", value)
}
sv.ChannelType = types.ChannelType(jtv)
}
case "overrideOption":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ChannelAssociationOverrideOption to be of type string, got %T instead", value)
}
sv.OverrideOption = types.ChannelAssociationOverrideOption(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationChildEvent(v **types.ManagedNotificationChildEvent, 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.ManagedNotificationChildEvent
if *v == nil {
sv = &types.ManagedNotificationChildEvent{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "aggregateManagedNotificationEventArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationEventArn to be of type string, got %T instead", value)
}
sv.AggregateManagedNotificationEventArn = ptr.String(jtv)
}
case "aggregationDetail":
if err := awsRestjson1_deserializeDocumentAggregationDetail(&sv.AggregationDetail, value); err != nil {
return err
}
case "endTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.EndTime = ptr.Time(t)
}
case "eventStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventStatus to be of type string, got %T instead", value)
}
sv.EventStatus = types.EventStatus(jtv)
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationEventId to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "messageComponents":
if err := awsRestjson1_deserializeDocumentMessageComponents(&sv.MessageComponents, value); err != nil {
return err
}
case "notificationType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationType to be of type string, got %T instead", value)
}
sv.NotificationType = types.NotificationType(jtv)
}
case "organizationalUnitId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected OrganizationalUnitId to be of type string, got %T instead", value)
}
sv.OrganizationalUnitId = ptr.String(jtv)
}
case "schemaVersion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SchemaVersion to be of type string, got %T instead", value)
}
sv.SchemaVersion = types.SchemaVersion(jtv)
}
case "sourceEventDetailUrl":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Url to be of type string, got %T instead", value)
}
sv.SourceEventDetailUrl = ptr.String(jtv)
}
case "sourceEventDetailUrlDisplayText":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SourceEventDetailUrlDisplayText = ptr.String(jtv)
}
case "startTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.StartTime = ptr.Time(t)
}
case "textParts":
if err := awsRestjson1_deserializeDocumentTextParts(&sv.TextParts, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationChildEventOverview(v **types.ManagedNotificationChildEventOverview, 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.ManagedNotificationChildEventOverview
if *v == nil {
sv = &types.ManagedNotificationChildEventOverview{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "aggregateManagedNotificationEventArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationEventArn to be of type string, got %T instead", value)
}
sv.AggregateManagedNotificationEventArn = ptr.String(jtv)
}
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationEventArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "childEvent":
if err := awsRestjson1_deserializeDocumentManagedNotificationChildEventSummary(&sv.ChildEvent, value); err != nil {
return err
}
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "managedNotificationConfigurationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationConfigurationOsArn to be of type string, got %T instead", value)
}
sv.ManagedNotificationConfigurationArn = ptr.String(jtv)
}
case "organizationalUnitId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected OrganizationalUnitId to be of type string, got %T instead", value)
}
sv.OrganizationalUnitId = ptr.String(jtv)
}
case "relatedAccount":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AccountId to be of type string, got %T instead", value)
}
sv.RelatedAccount = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationChildEvents(v *[]types.ManagedNotificationChildEventOverview, 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.ManagedNotificationChildEventOverview
if *v == nil {
cv = []types.ManagedNotificationChildEventOverview{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ManagedNotificationChildEventOverview
destAddr := &col
if err := awsRestjson1_deserializeDocumentManagedNotificationChildEventOverview(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationChildEventSummary(v **types.ManagedNotificationChildEventSummary, 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.ManagedNotificationChildEventSummary
if *v == nil {
sv = &types.ManagedNotificationChildEventSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "aggregationDetail":
if err := awsRestjson1_deserializeDocumentAggregationDetail(&sv.AggregationDetail, value); err != nil {
return err
}
case "eventStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventStatus to be of type string, got %T instead", value)
}
sv.EventStatus = types.EventStatus(jtv)
}
case "messageComponents":
if err := awsRestjson1_deserializeDocumentMessageComponentsSummary(&sv.MessageComponents, value); err != nil {
return err
}
case "notificationType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationType to be of type string, got %T instead", value)
}
sv.NotificationType = types.NotificationType(jtv)
}
case "schemaVersion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SchemaVersion to be of type string, got %T instead", value)
}
sv.SchemaVersion = types.SchemaVersion(jtv)
}
case "sourceEventMetadata":
if err := awsRestjson1_deserializeDocumentManagedSourceEventMetadataSummary(&sv.SourceEventMetadata, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationConfigurations(v *[]types.ManagedNotificationConfigurationStructure, 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.ManagedNotificationConfigurationStructure
if *v == nil {
cv = []types.ManagedNotificationConfigurationStructure{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ManagedNotificationConfigurationStructure
destAddr := &col
if err := awsRestjson1_deserializeDocumentManagedNotificationConfigurationStructure(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationConfigurationStructure(v **types.ManagedNotificationConfigurationStructure, 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.ManagedNotificationConfigurationStructure
if *v == nil {
sv = &types.ManagedNotificationConfigurationStructure{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationConfigurationOsArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationConfigurationDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationConfigurationName to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationEvent(v **types.ManagedNotificationEvent, 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.ManagedNotificationEvent
if *v == nil {
sv = &types.ManagedNotificationEvent{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "aggregationEventType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AggregationEventType to be of type string, got %T instead", value)
}
sv.AggregationEventType = types.AggregationEventType(jtv)
}
case "aggregationSummary":
if err := awsRestjson1_deserializeDocumentAggregationSummary(&sv.AggregationSummary, value); err != nil {
return err
}
case "endTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.EndTime = ptr.Time(t)
}
case "eventStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventStatus to be of type string, got %T instead", value)
}
sv.EventStatus = types.EventStatus(jtv)
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationEventId to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "messageComponents":
if err := awsRestjson1_deserializeDocumentMessageComponents(&sv.MessageComponents, value); err != nil {
return err
}
case "notificationType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationType to be of type string, got %T instead", value)
}
sv.NotificationType = types.NotificationType(jtv)
}
case "organizationalUnitId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected OrganizationalUnitId to be of type string, got %T instead", value)
}
sv.OrganizationalUnitId = ptr.String(jtv)
}
case "schemaVersion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SchemaVersion to be of type string, got %T instead", value)
}
sv.SchemaVersion = types.SchemaVersion(jtv)
}
case "sourceEventDetailUrl":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Url to be of type string, got %T instead", value)
}
sv.SourceEventDetailUrl = ptr.String(jtv)
}
case "sourceEventDetailUrlDisplayText":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SourceEventDetailUrlDisplayText = ptr.String(jtv)
}
case "startTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.StartTime = ptr.Time(t)
}
case "textParts":
if err := awsRestjson1_deserializeDocumentTextParts(&sv.TextParts, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationEventOverview(v **types.ManagedNotificationEventOverview, 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.ManagedNotificationEventOverview
if *v == nil {
sv = &types.ManagedNotificationEventOverview{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "aggregatedNotificationRegions":
if err := awsRestjson1_deserializeDocumentAggregatedNotificationRegions(&sv.AggregatedNotificationRegions, value); err != nil {
return err
}
case "aggregationEventType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AggregationEventType to be of type string, got %T instead", value)
}
sv.AggregationEventType = types.AggregationEventType(jtv)
}
case "aggregationSummary":
if err := awsRestjson1_deserializeDocumentAggregationSummary(&sv.AggregationSummary, value); err != nil {
return err
}
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationEventArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "managedNotificationConfigurationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ManagedNotificationConfigurationOsArn to be of type string, got %T instead", value)
}
sv.ManagedNotificationConfigurationArn = ptr.String(jtv)
}
case "notificationEvent":
if err := awsRestjson1_deserializeDocumentManagedNotificationEventSummary(&sv.NotificationEvent, value); err != nil {
return err
}
case "organizationalUnitId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected OrganizationalUnitId to be of type string, got %T instead", value)
}
sv.OrganizationalUnitId = ptr.String(jtv)
}
case "relatedAccount":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AccountId to be of type string, got %T instead", value)
}
sv.RelatedAccount = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationEvents(v *[]types.ManagedNotificationEventOverview, 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.ManagedNotificationEventOverview
if *v == nil {
cv = []types.ManagedNotificationEventOverview{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ManagedNotificationEventOverview
destAddr := &col
if err := awsRestjson1_deserializeDocumentManagedNotificationEventOverview(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentManagedNotificationEventSummary(v **types.ManagedNotificationEventSummary, 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.ManagedNotificationEventSummary
if *v == nil {
sv = &types.ManagedNotificationEventSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "eventStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventStatus to be of type string, got %T instead", value)
}
sv.EventStatus = types.EventStatus(jtv)
}
case "messageComponents":
if err := awsRestjson1_deserializeDocumentMessageComponentsSummary(&sv.MessageComponents, value); err != nil {
return err
}
case "notificationType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationType to be of type string, got %T instead", value)
}
sv.NotificationType = types.NotificationType(jtv)
}
case "schemaVersion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SchemaVersion to be of type string, got %T instead", value)
}
sv.SchemaVersion = types.SchemaVersion(jtv)
}
case "sourceEventMetadata":
if err := awsRestjson1_deserializeDocumentManagedSourceEventMetadataSummary(&sv.SourceEventMetadata, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentManagedRuleArns(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 ManagedRuleArn to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentManagedSourceEventMetadataSummary(v **types.ManagedSourceEventMetadataSummary, 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.ManagedSourceEventMetadataSummary
if *v == nil {
sv = &types.ManagedSourceEventMetadataSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "eventOriginRegion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Region to be of type string, got %T instead", value)
}
sv.EventOriginRegion = ptr.String(jtv)
}
case "eventType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventType to be of type string, got %T instead", value)
}
sv.EventType = ptr.String(jtv)
}
case "source":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Source to be of type string, got %T instead", value)
}
sv.Source = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentMedia(v *[]types.MediaElement, 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.MediaElement
if *v == nil {
cv = []types.MediaElement{}
} else {
cv = *v
}
for _, value := range shape {
var col types.MediaElement
destAddr := &col
if err := awsRestjson1_deserializeDocumentMediaElement(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentMediaElement(v **types.MediaElement, 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.MediaElement
if *v == nil {
sv = &types.MediaElement{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "caption":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TextPartReference to be of type string, got %T instead", value)
}
sv.Caption = ptr.String(jtv)
}
case "mediaId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected MediaId to be of type string, got %T instead", value)
}
sv.MediaId = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected MediaElementType to be of type string, got %T instead", value)
}
sv.Type = types.MediaElementType(jtv)
}
case "url":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Url to be of type string, got %T instead", value)
}
sv.Url = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentMessageComponents(v **types.MessageComponents, 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.MessageComponents
if *v == nil {
sv = &types.MessageComponents{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "completeDescription":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TextPartReference to be of type string, got %T instead", value)
}
sv.CompleteDescription = ptr.String(jtv)
}
case "dimensions":
if err := awsRestjson1_deserializeDocumentDimensions(&sv.Dimensions, value); err != nil {
return err
}
case "headline":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TextPartReference to be of type string, got %T instead", value)
}
sv.Headline = ptr.String(jtv)
}
case "paragraphSummary":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TextPartReference to be of type string, got %T instead", value)
}
sv.ParagraphSummary = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentMessageComponentsSummary(v **types.MessageComponentsSummary, 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.MessageComponentsSummary
if *v == nil {
sv = &types.MessageComponentsSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "headline":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Headline = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentNotificationConfigurations(v *[]types.NotificationConfigurationStructure, 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.NotificationConfigurationStructure
if *v == nil {
cv = []types.NotificationConfigurationStructure{}
} else {
cv = *v
}
for _, value := range shape {
var col types.NotificationConfigurationStructure
destAddr := &col
if err := awsRestjson1_deserializeDocumentNotificationConfigurationStructure(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentNotificationConfigurationStructure(v **types.NotificationConfigurationStructure, 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.NotificationConfigurationStructure
if *v == nil {
sv = &types.NotificationConfigurationStructure{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "aggregationDuration":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AggregationDuration to be of type string, got %T instead", value)
}
sv.AggregationDuration = types.AggregationDuration(jtv)
}
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationName to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationStatus to be of type string, got %T instead", value)
}
sv.Status = types.NotificationConfigurationStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentNotificationEventOverview(v **types.NotificationEventOverview, 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.NotificationEventOverview
if *v == nil {
sv = &types.NotificationEventOverview{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "aggregateNotificationEventArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationEventArn to be of type string, got %T instead", value)
}
sv.AggregateNotificationEventArn = ptr.String(jtv)
}
case "aggregationEventType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AggregationEventType to be of type string, got %T instead", value)
}
sv.AggregationEventType = types.AggregationEventType(jtv)
}
case "aggregationSummary":
if err := awsRestjson1_deserializeDocumentAggregationSummary(&sv.AggregationSummary, value); err != nil {
return err
}
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationEventArn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "notificationConfigurationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationConfigurationArn to be of type string, got %T instead", value)
}
sv.NotificationConfigurationArn = ptr.String(jtv)
}
case "notificationEvent":
if err := awsRestjson1_deserializeDocumentNotificationEventSummary(&sv.NotificationEvent, value); err != nil {
return err
}
case "relatedAccount":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AccountId to be of type string, got %T instead", value)
}
sv.RelatedAccount = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentNotificationEvents(v *[]types.NotificationEventOverview, 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.NotificationEventOverview
if *v == nil {
cv = []types.NotificationEventOverview{}
} else {
cv = *v
}
for _, value := range shape {
var col types.NotificationEventOverview
destAddr := &col
if err := awsRestjson1_deserializeDocumentNotificationEventOverview(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentNotificationEventSchema(v **types.NotificationEventSchema, 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.NotificationEventSchema
if *v == nil {
sv = &types.NotificationEventSchema{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "aggregateNotificationEventArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationEventArn to be of type string, got %T instead", value)
}
sv.AggregateNotificationEventArn = ptr.String(jtv)
}
case "aggregationEventType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AggregationEventType to be of type string, got %T instead", value)
}
sv.AggregationEventType = types.AggregationEventType(jtv)
}
case "aggregationSummary":
if err := awsRestjson1_deserializeDocumentAggregationSummary(&sv.AggregationSummary, value); err != nil {
return err
}
case "endTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.EndTime = ptr.Time(t)
}
case "eventStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventStatus to be of type string, got %T instead", value)
}
sv.EventStatus = types.EventStatus(jtv)
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationEventId to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "media":
if err := awsRestjson1_deserializeDocumentMedia(&sv.Media, value); err != nil {
return err
}
case "messageComponents":
if err := awsRestjson1_deserializeDocumentMessageComponents(&sv.MessageComponents, value); err != nil {
return err
}
case "notificationType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationType to be of type string, got %T instead", value)
}
sv.NotificationType = types.NotificationType(jtv)
}
case "schemaVersion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SchemaVersion to be of type string, got %T instead", value)
}
sv.SchemaVersion = types.SchemaVersion(jtv)
}
case "sourceEventDetailUrl":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Url to be of type string, got %T instead", value)
}
sv.SourceEventDetailUrl = ptr.String(jtv)
}
case "sourceEventDetailUrlDisplayText":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SourceEventDetailUrlDisplayText = ptr.String(jtv)
}
case "sourceEventMetadata":
if err := awsRestjson1_deserializeDocumentSourceEventMetadata(&sv.SourceEventMetadata, value); err != nil {
return err
}
case "startTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.StartTime = ptr.Time(t)
}
case "textParts":
if err := awsRestjson1_deserializeDocumentTextParts(&sv.TextParts, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentNotificationEventSummary(v **types.NotificationEventSummary, 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.NotificationEventSummary
if *v == nil {
sv = &types.NotificationEventSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "eventStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EventStatus to be of type string, got %T instead", value)
}
sv.EventStatus = types.EventStatus(jtv)
}
case "messageComponents":
if err := awsRestjson1_deserializeDocumentMessageComponentsSummary(&sv.MessageComponents, value); err != nil {
return err
}
case "notificationType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationType to be of type string, got %T instead", value)
}
sv.NotificationType = types.NotificationType(jtv)
}
case "schemaVersion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SchemaVersion to be of type string, got %T instead", value)
}
sv.SchemaVersion = types.SchemaVersion(jtv)
}
case "sourceEventMetadata":
if err := awsRestjson1_deserializeDocumentSourceEventMetadataSummary(&sv.SourceEventMetadata, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentNotificationHubOverview(v **types.NotificationHubOverview, 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.NotificationHubOverview
if *v == nil {
sv = &types.NotificationHubOverview{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "creationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CreationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationTime = ptr.Time(t)
}
case "lastActivationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LastActivationTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.LastActivationTime = ptr.Time(t)
}
case "notificationHubRegion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Region to be of type string, got %T instead", value)
}
sv.NotificationHubRegion = ptr.String(jtv)
}
case "statusSummary":
if err := awsRestjson1_deserializeDocumentNotificationHubStatusSummary(&sv.StatusSummary, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentNotificationHubs(v *[]types.NotificationHubOverview, 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.NotificationHubOverview
if *v == nil {
cv = []types.NotificationHubOverview{}
} else {
cv = *v
}
for _, value := range shape {
var col types.NotificationHubOverview
destAddr := &col
if err := awsRestjson1_deserializeDocumentNotificationHubOverview(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentNotificationHubStatusSummary(v **types.NotificationHubStatusSummary, 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.NotificationHubStatusSummary
if *v == nil {
sv = &types.NotificationHubStatusSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "reason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationHubStatusReason to be of type string, got %T instead", value)
}
sv.Reason = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NotificationHubStatus to be of type string, got %T instead", value)
}
sv.Status = types.NotificationHubStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentNotificationsAccessForOrganization(v **types.NotificationsAccessForOrganization, 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.NotificationsAccessForOrganization
if *v == nil {
sv = &types.NotificationsAccessForOrganization{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "accessStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AccessStatus to be of type string, got %T instead", value)
}
sv.AccessStatus = types.AccessStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentRegions(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 Region to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentResource(v **types.Resource, 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.Resource
if *v == nil {
sv = &types.Resource{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Arn to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "detailUrl":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Url to be of type string, got %T instead", value)
}
sv.DetailUrl = ptr.String(jtv)
}
case "id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "tags":
if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil {
return err
}
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 ErrorMessage 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 ResourceId to be of type string, got %T instead", value)
}
sv.ResourceId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResources(v *[]types.Resource, 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.Resource
if *v == nil {
cv = []types.Resource{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Resource
destAddr := &col
if err := awsRestjson1_deserializeDocumentResource(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentSampleAggregationDimensionValues(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_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 ErrorMessage 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 QuotaCode 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 ResourceId 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 ResourceType 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 ServiceCode to be of type string, got %T instead", value)
}
sv.ServiceCode = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSourceEventMetadata(v **types.SourceEventMetadata, 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.SourceEventMetadata
if *v == nil {
sv = &types.SourceEventMetadata{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "eventOccurrenceTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.EventOccurrenceTime = ptr.Time(t)
}
case "eventOriginRegion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Region to be of type string, got %T instead", value)
}
sv.EventOriginRegion = ptr.String(jtv)
}
case "eventType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.EventType = ptr.String(jtv)
}
case "eventTypeVersion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.EventTypeVersion = ptr.String(jtv)
}
case "relatedAccount":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AccountId to be of type string, got %T instead", value)
}
sv.RelatedAccount = ptr.String(jtv)
}
case "relatedResources":
if err := awsRestjson1_deserializeDocumentResources(&sv.RelatedResources, value); err != nil {
return err
}
case "source":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Source to be of type string, got %T instead", value)
}
sv.Source = ptr.String(jtv)
}
case "sourceEventId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SourceEventId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSourceEventMetadataSummary(v **types.SourceEventMetadataSummary, 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.SourceEventMetadataSummary
if *v == nil {
sv = &types.SourceEventMetadataSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "eventOriginRegion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.EventOriginRegion = ptr.String(jtv)
}
case "eventType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.EventType = ptr.String(jtv)
}
case "source":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Source = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentStatusSummaryByRegion(v *map[string]types.EventRuleStatusSummary, 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.EventRuleStatusSummary
if *v == nil {
mv = map[string]types.EventRuleStatusSummary{}
} else {
mv = *v
}
for key, value := range shape {
var parsedVal types.EventRuleStatusSummary
mapVar := parsedVal
destAddr := &mapVar
if err := awsRestjson1_deserializeDocumentEventRuleStatusSummary(&destAddr, value); err != nil {
return err
}
parsedVal = *destAddr
mv[key] = parsedVal
}
*v = mv
return nil
}
func awsRestjson1_deserializeDocumentSummarizationDimensionDetail(v **types.SummarizationDimensionDetail, 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.SummarizationDimensionDetail
if *v == nil {
sv = &types.SummarizationDimensionDetail{}
} 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 String to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "value":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Value = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSummarizationDimensionDetails(v *[]types.SummarizationDimensionDetail, 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.SummarizationDimensionDetail
if *v == nil {
cv = []types.SummarizationDimensionDetail{}
} else {
cv = *v
}
for _, value := range shape {
var col types.SummarizationDimensionDetail
destAddr := &col
if err := awsRestjson1_deserializeDocumentSummarizationDimensionDetail(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentSummarizationDimensionOverview(v **types.SummarizationDimensionOverview, 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.SummarizationDimensionOverview
if *v == nil {
sv = &types.SummarizationDimensionOverview{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "count":
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.Count = ptr.Int32(int32(i64))
}
case "name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "sampleValues":
if err := awsRestjson1_deserializeDocumentSampleAggregationDimensionValues(&sv.SampleValues, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSummarizationDimensionOverviews(v *[]types.SummarizationDimensionOverview, 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.SummarizationDimensionOverview
if *v == nil {
cv = []types.SummarizationDimensionOverview{}
} else {
cv = *v
}
for _, value := range shape {
var col types.SummarizationDimensionOverview
destAddr := &col
if err := awsRestjson1_deserializeDocumentSummarizationDimensionOverview(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentTagMap(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_deserializeDocumentTags(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_deserializeDocumentTextByLocale(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_deserializeDocumentTextParts(v *map[string]types.TextPartValue, 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.TextPartValue
if *v == nil {
mv = map[string]types.TextPartValue{}
} else {
mv = *v
}
for key, value := range shape {
var parsedVal types.TextPartValue
mapVar := parsedVal
destAddr := &mapVar
if err := awsRestjson1_deserializeDocumentTextPartValue(&destAddr, value); err != nil {
return err
}
parsedVal = *destAddr
mv[key] = parsedVal
}
*v = mv
return nil
}
func awsRestjson1_deserializeDocumentTextPartValue(v **types.TextPartValue, 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.TextPartValue
if *v == nil {
sv = &types.TextPartValue{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "displayText":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.DisplayText = ptr.String(jtv)
}
case "textByLocale":
if err := awsRestjson1_deserializeDocumentTextByLocale(&sv.TextByLocale, value); err != nil {
return err
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TextPartType to be of type string, got %T instead", value)
}
sv.Type = types.TextPartType(jtv)
}
case "url":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Url to be of type string, got %T instead", value)
}
sv.Url = ptr.String(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 ErrorMessage 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 QuotaCode 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 ServiceCode to be of type string, got %T instead", value)
}
sv.ServiceCode = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ValidationException
if *v == nil {
sv = &types.ValidationException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "fieldList":
if err := awsRestjson1_deserializeDocumentValidationExceptionFieldList(&sv.FieldList, value); err != nil {
return err
}
case "message", "Message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "reason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ValidationExceptionReason to be of type string, got %T instead", value)
}
sv.Reason = types.ValidationExceptionReason(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentValidationExceptionField(v **types.ValidationExceptionField, 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.ValidationExceptionField
if *v == nil {
sv = &types.ValidationExceptionField{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "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 "name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentValidationExceptionFieldList(v *[]types.ValidationExceptionField, 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.ValidationExceptionField
if *v == nil {
cv = []types.ValidationExceptionField{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ValidationExceptionField
destAddr := &col
if err := awsRestjson1_deserializeDocumentValidationExceptionField(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}