// Code generated by smithy-go-codegen DO NOT EDIT. package auditmanager import ( "bytes" "context" "encoding/json" "fmt" "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" "github.com/aws/aws-sdk-go-v2/service/auditmanager/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" smithyhttp "github.com/aws/smithy-go/transport/http" "io" "strings" ) type awsRestjson1_deserializeOpAssociateAssessmentReportEvidenceFolder struct { } func (*awsRestjson1_deserializeOpAssociateAssessmentReportEvidenceFolder) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpAssociateAssessmentReportEvidenceFolder) 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 } 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_deserializeOpErrorAssociateAssessmentReportEvidenceFolder(response, &metadata) } output := &AssociateAssessmentReportEvidenceFolderOutput{} out.Result = output return out, metadata, err } func awsRestjson1_deserializeOpErrorAssociateAssessmentReportEvidenceFolder(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } type awsRestjson1_deserializeOpBatchAssociateAssessmentReportEvidence struct { } func (*awsRestjson1_deserializeOpBatchAssociateAssessmentReportEvidence) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpBatchAssociateAssessmentReportEvidence) 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 } 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_deserializeOpErrorBatchAssociateAssessmentReportEvidence(response, &metadata) } output := &BatchAssociateAssessmentReportEvidenceOutput{} 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_deserializeOpDocumentBatchAssociateAssessmentReportEvidenceOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorBatchAssociateAssessmentReportEvidence(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentBatchAssociateAssessmentReportEvidenceOutput(v **BatchAssociateAssessmentReportEvidenceOutput, 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 *BatchAssociateAssessmentReportEvidenceOutput if *v == nil { sv = &BatchAssociateAssessmentReportEvidenceOutput{} } else { sv = *v } for key, value := range shape { switch key { case "errors": if err := awsRestjson1_deserializeDocumentAssessmentReportEvidenceErrors(&sv.Errors, value); err != nil { return err } case "evidenceIds": if err := awsRestjson1_deserializeDocumentEvidenceIds(&sv.EvidenceIds, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpBatchCreateDelegationByAssessment struct { } func (*awsRestjson1_deserializeOpBatchCreateDelegationByAssessment) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpBatchCreateDelegationByAssessment) 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 } 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_deserializeOpErrorBatchCreateDelegationByAssessment(response, &metadata) } output := &BatchCreateDelegationByAssessmentOutput{} 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_deserializeOpDocumentBatchCreateDelegationByAssessmentOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorBatchCreateDelegationByAssessment(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentBatchCreateDelegationByAssessmentOutput(v **BatchCreateDelegationByAssessmentOutput, 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 *BatchCreateDelegationByAssessmentOutput if *v == nil { sv = &BatchCreateDelegationByAssessmentOutput{} } else { sv = *v } for key, value := range shape { switch key { case "delegations": if err := awsRestjson1_deserializeDocumentDelegations(&sv.Delegations, value); err != nil { return err } case "errors": if err := awsRestjson1_deserializeDocumentBatchCreateDelegationByAssessmentErrors(&sv.Errors, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpBatchDeleteDelegationByAssessment struct { } func (*awsRestjson1_deserializeOpBatchDeleteDelegationByAssessment) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpBatchDeleteDelegationByAssessment) 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 } 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_deserializeOpErrorBatchDeleteDelegationByAssessment(response, &metadata) } output := &BatchDeleteDelegationByAssessmentOutput{} 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_deserializeOpDocumentBatchDeleteDelegationByAssessmentOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorBatchDeleteDelegationByAssessment(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentBatchDeleteDelegationByAssessmentOutput(v **BatchDeleteDelegationByAssessmentOutput, 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 *BatchDeleteDelegationByAssessmentOutput if *v == nil { sv = &BatchDeleteDelegationByAssessmentOutput{} } else { sv = *v } for key, value := range shape { switch key { case "errors": if err := awsRestjson1_deserializeDocumentBatchDeleteDelegationByAssessmentErrors(&sv.Errors, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpBatchDisassociateAssessmentReportEvidence struct { } func (*awsRestjson1_deserializeOpBatchDisassociateAssessmentReportEvidence) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpBatchDisassociateAssessmentReportEvidence) 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 } 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_deserializeOpErrorBatchDisassociateAssessmentReportEvidence(response, &metadata) } output := &BatchDisassociateAssessmentReportEvidenceOutput{} 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_deserializeOpDocumentBatchDisassociateAssessmentReportEvidenceOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorBatchDisassociateAssessmentReportEvidence(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentBatchDisassociateAssessmentReportEvidenceOutput(v **BatchDisassociateAssessmentReportEvidenceOutput, 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 *BatchDisassociateAssessmentReportEvidenceOutput if *v == nil { sv = &BatchDisassociateAssessmentReportEvidenceOutput{} } else { sv = *v } for key, value := range shape { switch key { case "errors": if err := awsRestjson1_deserializeDocumentAssessmentReportEvidenceErrors(&sv.Errors, value); err != nil { return err } case "evidenceIds": if err := awsRestjson1_deserializeDocumentEvidenceIds(&sv.EvidenceIds, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpBatchImportEvidenceToAssessmentControl struct { } func (*awsRestjson1_deserializeOpBatchImportEvidenceToAssessmentControl) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpBatchImportEvidenceToAssessmentControl) 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 } 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_deserializeOpErrorBatchImportEvidenceToAssessmentControl(response, &metadata) } output := &BatchImportEvidenceToAssessmentControlOutput{} 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_deserializeOpDocumentBatchImportEvidenceToAssessmentControlOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorBatchImportEvidenceToAssessmentControl(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_deserializeOpDocumentBatchImportEvidenceToAssessmentControlOutput(v **BatchImportEvidenceToAssessmentControlOutput, 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 *BatchImportEvidenceToAssessmentControlOutput if *v == nil { sv = &BatchImportEvidenceToAssessmentControlOutput{} } else { sv = *v } for key, value := range shape { switch key { case "errors": if err := awsRestjson1_deserializeDocumentBatchImportEvidenceToAssessmentControlErrors(&sv.Errors, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpCreateAssessment struct { } func (*awsRestjson1_deserializeOpCreateAssessment) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpCreateAssessment) 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 } 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_deserializeOpErrorCreateAssessment(response, &metadata) } output := &CreateAssessmentOutput{} 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_deserializeOpDocumentCreateAssessmentOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorCreateAssessment(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} } errorBody := bytes.NewReader(errorBuffer.Bytes()) errorCode := "UnknownError" errorMessage := errorCode headerCode := response.Header.Get("X-Amzn-ErrorType") if len(headerCode) != 0 { errorCode = restjson.SanitizeErrorCode(headerCode) } var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() jsonCode, message, err := restjson.GetErrorInfo(decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } errorBody.Seek(0, io.SeekStart) if len(headerCode) == 0 && len(jsonCode) != 0 { errorCode = restjson.SanitizeErrorCode(jsonCode) } if len(message) != 0 { errorMessage = message } switch { case strings.EqualFold("AccessDeniedException", errorCode): return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) case strings.EqualFold("ServiceQuotaExceededException", errorCode): return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) case strings.EqualFold("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentCreateAssessmentOutput(v **CreateAssessmentOutput, 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 *CreateAssessmentOutput if *v == nil { sv = &CreateAssessmentOutput{} } else { sv = *v } for key, value := range shape { switch key { case "assessment": if err := awsRestjson1_deserializeDocumentAssessment(&sv.Assessment, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpCreateAssessmentFramework struct { } func (*awsRestjson1_deserializeOpCreateAssessmentFramework) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpCreateAssessmentFramework) 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 } 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_deserializeOpErrorCreateAssessmentFramework(response, &metadata) } output := &CreateAssessmentFrameworkOutput{} 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_deserializeOpDocumentCreateAssessmentFrameworkOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorCreateAssessmentFramework(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} } errorBody := bytes.NewReader(errorBuffer.Bytes()) errorCode := "UnknownError" errorMessage := errorCode headerCode := response.Header.Get("X-Amzn-ErrorType") if len(headerCode) != 0 { errorCode = restjson.SanitizeErrorCode(headerCode) } var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() jsonCode, message, err := restjson.GetErrorInfo(decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } errorBody.Seek(0, io.SeekStart) if len(headerCode) == 0 && len(jsonCode) != 0 { errorCode = restjson.SanitizeErrorCode(jsonCode) } if len(message) != 0 { errorMessage = message } switch { case strings.EqualFold("AccessDeniedException", errorCode): return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) case strings.EqualFold("ServiceQuotaExceededException", errorCode): return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) case strings.EqualFold("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentCreateAssessmentFrameworkOutput(v **CreateAssessmentFrameworkOutput, 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 *CreateAssessmentFrameworkOutput if *v == nil { sv = &CreateAssessmentFrameworkOutput{} } else { sv = *v } for key, value := range shape { switch key { case "framework": if err := awsRestjson1_deserializeDocumentFramework(&sv.Framework, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpCreateAssessmentReport struct { } func (*awsRestjson1_deserializeOpCreateAssessmentReport) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpCreateAssessmentReport) 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 } 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_deserializeOpErrorCreateAssessmentReport(response, &metadata) } output := &CreateAssessmentReportOutput{} 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_deserializeOpDocumentCreateAssessmentReportOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorCreateAssessmentReport(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentCreateAssessmentReportOutput(v **CreateAssessmentReportOutput, 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 *CreateAssessmentReportOutput if *v == nil { sv = &CreateAssessmentReportOutput{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentReport": if err := awsRestjson1_deserializeDocumentAssessmentReport(&sv.AssessmentReport, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpCreateControl struct { } func (*awsRestjson1_deserializeOpCreateControl) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpCreateControl) 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 } 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_deserializeOpErrorCreateControl(response, &metadata) } output := &CreateControlOutput{} 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_deserializeOpDocumentCreateControlOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorCreateControl(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} } errorBody := bytes.NewReader(errorBuffer.Bytes()) errorCode := "UnknownError" errorMessage := errorCode headerCode := response.Header.Get("X-Amzn-ErrorType") if len(headerCode) != 0 { errorCode = restjson.SanitizeErrorCode(headerCode) } var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() jsonCode, message, err := restjson.GetErrorInfo(decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } errorBody.Seek(0, io.SeekStart) if len(headerCode) == 0 && len(jsonCode) != 0 { errorCode = restjson.SanitizeErrorCode(jsonCode) } if len(message) != 0 { errorMessage = message } switch { case strings.EqualFold("AccessDeniedException", errorCode): return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) case strings.EqualFold("ServiceQuotaExceededException", errorCode): return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) case strings.EqualFold("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentCreateControlOutput(v **CreateControlOutput, 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 *CreateControlOutput if *v == nil { sv = &CreateControlOutput{} } else { sv = *v } for key, value := range shape { switch key { case "control": if err := awsRestjson1_deserializeDocumentControl(&sv.Control, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpDeleteAssessment struct { } func (*awsRestjson1_deserializeOpDeleteAssessment) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpDeleteAssessment) 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 } 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_deserializeOpErrorDeleteAssessment(response, &metadata) } output := &DeleteAssessmentOutput{} out.Result = output return out, metadata, err } func awsRestjson1_deserializeOpErrorDeleteAssessment(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } type awsRestjson1_deserializeOpDeleteAssessmentFramework struct { } func (*awsRestjson1_deserializeOpDeleteAssessmentFramework) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpDeleteAssessmentFramework) 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 } 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_deserializeOpErrorDeleteAssessmentFramework(response, &metadata) } output := &DeleteAssessmentFrameworkOutput{} out.Result = output return out, metadata, err } func awsRestjson1_deserializeOpErrorDeleteAssessmentFramework(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } type awsRestjson1_deserializeOpDeleteAssessmentFrameworkShare struct { } func (*awsRestjson1_deserializeOpDeleteAssessmentFrameworkShare) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpDeleteAssessmentFrameworkShare) 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 } 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_deserializeOpErrorDeleteAssessmentFrameworkShare(response, &metadata) } output := &DeleteAssessmentFrameworkShareOutput{} out.Result = output return out, metadata, err } func awsRestjson1_deserializeOpErrorDeleteAssessmentFrameworkShare(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } type awsRestjson1_deserializeOpDeleteAssessmentReport struct { } func (*awsRestjson1_deserializeOpDeleteAssessmentReport) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpDeleteAssessmentReport) 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 } 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_deserializeOpErrorDeleteAssessmentReport(response, &metadata) } output := &DeleteAssessmentReportOutput{} out.Result = output return out, metadata, err } func awsRestjson1_deserializeOpErrorDeleteAssessmentReport(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } type awsRestjson1_deserializeOpDeleteControl struct { } func (*awsRestjson1_deserializeOpDeleteControl) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpDeleteControl) 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 } 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_deserializeOpErrorDeleteControl(response, &metadata) } output := &DeleteControlOutput{} out.Result = output return out, metadata, err } func awsRestjson1_deserializeOpErrorDeleteControl(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } type awsRestjson1_deserializeOpDeregisterAccount struct { } func (*awsRestjson1_deserializeOpDeregisterAccount) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpDeregisterAccount) 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 } 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_deserializeOpErrorDeregisterAccount(response, &metadata) } output := &DeregisterAccountOutput{} 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_deserializeOpDocumentDeregisterAccountOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorDeregisterAccount(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentDeregisterAccountOutput(v **DeregisterAccountOutput, 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 *DeregisterAccountOutput if *v == nil { sv = &DeregisterAccountOutput{} } else { sv = *v } for key, value := range shape { switch key { case "status": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountStatus to be of type string, got %T instead", value) } sv.Status = types.AccountStatus(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpDeregisterOrganizationAdminAccount struct { } func (*awsRestjson1_deserializeOpDeregisterOrganizationAdminAccount) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpDeregisterOrganizationAdminAccount) 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 } 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_deserializeOpErrorDeregisterOrganizationAdminAccount(response, &metadata) } output := &DeregisterOrganizationAdminAccountOutput{} out.Result = output return out, metadata, err } func awsRestjson1_deserializeOpErrorDeregisterOrganizationAdminAccount(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } type awsRestjson1_deserializeOpDisassociateAssessmentReportEvidenceFolder struct { } func (*awsRestjson1_deserializeOpDisassociateAssessmentReportEvidenceFolder) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpDisassociateAssessmentReportEvidenceFolder) 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 } 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_deserializeOpErrorDisassociateAssessmentReportEvidenceFolder(response, &metadata) } output := &DisassociateAssessmentReportEvidenceFolderOutput{} out.Result = output return out, metadata, err } func awsRestjson1_deserializeOpErrorDisassociateAssessmentReportEvidenceFolder(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } type awsRestjson1_deserializeOpGetAccountStatus struct { } func (*awsRestjson1_deserializeOpGetAccountStatus) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetAccountStatus) 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 } 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_deserializeOpErrorGetAccountStatus(response, &metadata) } output := &GetAccountStatusOutput{} 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_deserializeOpDocumentGetAccountStatusOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetAccountStatus(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("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetAccountStatusOutput(v **GetAccountStatusOutput, 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 *GetAccountStatusOutput if *v == nil { sv = &GetAccountStatusOutput{} } else { sv = *v } for key, value := range shape { switch key { case "status": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountStatus to be of type string, got %T instead", value) } sv.Status = types.AccountStatus(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetAssessment struct { } func (*awsRestjson1_deserializeOpGetAssessment) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetAssessment) 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 } 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_deserializeOpErrorGetAssessment(response, &metadata) } output := &GetAssessmentOutput{} 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_deserializeOpDocumentGetAssessmentOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetAssessment(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetAssessmentOutput(v **GetAssessmentOutput, 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 *GetAssessmentOutput if *v == nil { sv = &GetAssessmentOutput{} } else { sv = *v } for key, value := range shape { switch key { case "assessment": if err := awsRestjson1_deserializeDocumentAssessment(&sv.Assessment, value); err != nil { return err } case "userRole": if err := awsRestjson1_deserializeDocumentRole(&sv.UserRole, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetAssessmentFramework struct { } func (*awsRestjson1_deserializeOpGetAssessmentFramework) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetAssessmentFramework) 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 } 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_deserializeOpErrorGetAssessmentFramework(response, &metadata) } output := &GetAssessmentFrameworkOutput{} 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_deserializeOpDocumentGetAssessmentFrameworkOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetAssessmentFramework(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetAssessmentFrameworkOutput(v **GetAssessmentFrameworkOutput, 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 *GetAssessmentFrameworkOutput if *v == nil { sv = &GetAssessmentFrameworkOutput{} } else { sv = *v } for key, value := range shape { switch key { case "framework": if err := awsRestjson1_deserializeDocumentFramework(&sv.Framework, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetAssessmentReportUrl struct { } func (*awsRestjson1_deserializeOpGetAssessmentReportUrl) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetAssessmentReportUrl) 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 } 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_deserializeOpErrorGetAssessmentReportUrl(response, &metadata) } output := &GetAssessmentReportUrlOutput{} 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_deserializeOpDocumentGetAssessmentReportUrlOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetAssessmentReportUrl(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetAssessmentReportUrlOutput(v **GetAssessmentReportUrlOutput, 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 *GetAssessmentReportUrlOutput if *v == nil { sv = &GetAssessmentReportUrlOutput{} } else { sv = *v } for key, value := range shape { switch key { case "preSignedUrl": if err := awsRestjson1_deserializeDocumentURL(&sv.PreSignedUrl, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetChangeLogs struct { } func (*awsRestjson1_deserializeOpGetChangeLogs) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetChangeLogs) 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 } 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_deserializeOpErrorGetChangeLogs(response, &metadata) } output := &GetChangeLogsOutput{} 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_deserializeOpDocumentGetChangeLogsOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetChangeLogs(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetChangeLogsOutput(v **GetChangeLogsOutput, 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 *GetChangeLogsOutput if *v == nil { sv = &GetChangeLogsOutput{} } else { sv = *v } for key, value := range shape { switch key { case "changeLogs": if err := awsRestjson1_deserializeDocumentChangeLogs(&sv.ChangeLogs, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetControl struct { } func (*awsRestjson1_deserializeOpGetControl) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetControl) 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 } 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_deserializeOpErrorGetControl(response, &metadata) } output := &GetControlOutput{} 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_deserializeOpDocumentGetControlOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetControl(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetControlOutput(v **GetControlOutput, 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 *GetControlOutput if *v == nil { sv = &GetControlOutput{} } else { sv = *v } for key, value := range shape { switch key { case "control": if err := awsRestjson1_deserializeDocumentControl(&sv.Control, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetDelegations struct { } func (*awsRestjson1_deserializeOpGetDelegations) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetDelegations) 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 } 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_deserializeOpErrorGetDelegations(response, &metadata) } output := &GetDelegationsOutput{} 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_deserializeOpDocumentGetDelegationsOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetDelegations(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetDelegationsOutput(v **GetDelegationsOutput, 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 *GetDelegationsOutput if *v == nil { sv = &GetDelegationsOutput{} } else { sv = *v } for key, value := range shape { switch key { case "delegations": if err := awsRestjson1_deserializeDocumentDelegationMetadataList(&sv.Delegations, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetEvidence struct { } func (*awsRestjson1_deserializeOpGetEvidence) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetEvidence) 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 } 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_deserializeOpErrorGetEvidence(response, &metadata) } output := &GetEvidenceOutput{} 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_deserializeOpDocumentGetEvidenceOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetEvidence(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetEvidenceOutput(v **GetEvidenceOutput, 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 *GetEvidenceOutput if *v == nil { sv = &GetEvidenceOutput{} } else { sv = *v } for key, value := range shape { switch key { case "evidence": if err := awsRestjson1_deserializeDocumentEvidence(&sv.Evidence, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetEvidenceByEvidenceFolder struct { } func (*awsRestjson1_deserializeOpGetEvidenceByEvidenceFolder) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetEvidenceByEvidenceFolder) 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 } 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_deserializeOpErrorGetEvidenceByEvidenceFolder(response, &metadata) } output := &GetEvidenceByEvidenceFolderOutput{} 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_deserializeOpDocumentGetEvidenceByEvidenceFolderOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetEvidenceByEvidenceFolder(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetEvidenceByEvidenceFolderOutput(v **GetEvidenceByEvidenceFolderOutput, 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 *GetEvidenceByEvidenceFolderOutput if *v == nil { sv = &GetEvidenceByEvidenceFolderOutput{} } else { sv = *v } for key, value := range shape { switch key { case "evidence": if err := awsRestjson1_deserializeDocumentEvidenceList(&sv.Evidence, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetEvidenceFileUploadUrl struct { } func (*awsRestjson1_deserializeOpGetEvidenceFileUploadUrl) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetEvidenceFileUploadUrl) 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 } 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_deserializeOpErrorGetEvidenceFileUploadUrl(response, &metadata) } output := &GetEvidenceFileUploadUrlOutput{} 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_deserializeOpDocumentGetEvidenceFileUploadUrlOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetEvidenceFileUploadUrl(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_deserializeOpDocumentGetEvidenceFileUploadUrlOutput(v **GetEvidenceFileUploadUrlOutput, 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 *GetEvidenceFileUploadUrlOutput if *v == nil { sv = &GetEvidenceFileUploadUrlOutput{} } else { sv = *v } for key, value := range shape { switch key { case "evidenceFileName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.EvidenceFileName = ptr.String(jtv) } case "uploadUrl": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.UploadUrl = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetEvidenceFolder struct { } func (*awsRestjson1_deserializeOpGetEvidenceFolder) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetEvidenceFolder) 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 } 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_deserializeOpErrorGetEvidenceFolder(response, &metadata) } output := &GetEvidenceFolderOutput{} 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_deserializeOpDocumentGetEvidenceFolderOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetEvidenceFolder(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetEvidenceFolderOutput(v **GetEvidenceFolderOutput, 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 *GetEvidenceFolderOutput if *v == nil { sv = &GetEvidenceFolderOutput{} } else { sv = *v } for key, value := range shape { switch key { case "evidenceFolder": if err := awsRestjson1_deserializeDocumentAssessmentEvidenceFolder(&sv.EvidenceFolder, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetEvidenceFoldersByAssessment struct { } func (*awsRestjson1_deserializeOpGetEvidenceFoldersByAssessment) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetEvidenceFoldersByAssessment) 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 } 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_deserializeOpErrorGetEvidenceFoldersByAssessment(response, &metadata) } output := &GetEvidenceFoldersByAssessmentOutput{} 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_deserializeOpDocumentGetEvidenceFoldersByAssessmentOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetEvidenceFoldersByAssessment(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetEvidenceFoldersByAssessmentOutput(v **GetEvidenceFoldersByAssessmentOutput, 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 *GetEvidenceFoldersByAssessmentOutput if *v == nil { sv = &GetEvidenceFoldersByAssessmentOutput{} } else { sv = *v } for key, value := range shape { switch key { case "evidenceFolders": if err := awsRestjson1_deserializeDocumentAssessmentEvidenceFolders(&sv.EvidenceFolders, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetEvidenceFoldersByAssessmentControl struct { } func (*awsRestjson1_deserializeOpGetEvidenceFoldersByAssessmentControl) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetEvidenceFoldersByAssessmentControl) 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 } 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_deserializeOpErrorGetEvidenceFoldersByAssessmentControl(response, &metadata) } output := &GetEvidenceFoldersByAssessmentControlOutput{} 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_deserializeOpDocumentGetEvidenceFoldersByAssessmentControlOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetEvidenceFoldersByAssessmentControl(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetEvidenceFoldersByAssessmentControlOutput(v **GetEvidenceFoldersByAssessmentControlOutput, 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 *GetEvidenceFoldersByAssessmentControlOutput if *v == nil { sv = &GetEvidenceFoldersByAssessmentControlOutput{} } else { sv = *v } for key, value := range shape { switch key { case "evidenceFolders": if err := awsRestjson1_deserializeDocumentAssessmentEvidenceFolders(&sv.EvidenceFolders, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetInsights struct { } func (*awsRestjson1_deserializeOpGetInsights) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetInsights) 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 } 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_deserializeOpErrorGetInsights(response, &metadata) } output := &GetInsightsOutput{} 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_deserializeOpDocumentGetInsightsOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetInsights(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) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetInsightsOutput(v **GetInsightsOutput, 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 *GetInsightsOutput if *v == nil { sv = &GetInsightsOutput{} } else { sv = *v } for key, value := range shape { switch key { case "insights": if err := awsRestjson1_deserializeDocumentInsights(&sv.Insights, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetInsightsByAssessment struct { } func (*awsRestjson1_deserializeOpGetInsightsByAssessment) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetInsightsByAssessment) 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 } 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_deserializeOpErrorGetInsightsByAssessment(response, &metadata) } output := &GetInsightsByAssessmentOutput{} 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_deserializeOpDocumentGetInsightsByAssessmentOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetInsightsByAssessment(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetInsightsByAssessmentOutput(v **GetInsightsByAssessmentOutput, 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 *GetInsightsByAssessmentOutput if *v == nil { sv = &GetInsightsByAssessmentOutput{} } else { sv = *v } for key, value := range shape { switch key { case "insights": if err := awsRestjson1_deserializeDocumentInsightsByAssessment(&sv.Insights, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetOrganizationAdminAccount struct { } func (*awsRestjson1_deserializeOpGetOrganizationAdminAccount) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetOrganizationAdminAccount) 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 } 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_deserializeOpErrorGetOrganizationAdminAccount(response, &metadata) } output := &GetOrganizationAdminAccountOutput{} 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_deserializeOpDocumentGetOrganizationAdminAccountOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetOrganizationAdminAccount(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetOrganizationAdminAccountOutput(v **GetOrganizationAdminAccountOutput, 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 *GetOrganizationAdminAccountOutput if *v == nil { sv = &GetOrganizationAdminAccountOutput{} } else { sv = *v } for key, value := range shape { switch key { case "adminAccountId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) } sv.AdminAccountId = ptr.String(jtv) } case "organizationId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected organizationId to be of type string, got %T instead", value) } sv.OrganizationId = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetServicesInScope struct { } func (*awsRestjson1_deserializeOpGetServicesInScope) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetServicesInScope) 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 } 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_deserializeOpErrorGetServicesInScope(response, &metadata) } output := &GetServicesInScopeOutput{} 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_deserializeOpDocumentGetServicesInScopeOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetServicesInScope(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetServicesInScopeOutput(v **GetServicesInScopeOutput, 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 *GetServicesInScopeOutput if *v == nil { sv = &GetServicesInScopeOutput{} } else { sv = *v } for key, value := range shape { switch key { case "serviceMetadata": if err := awsRestjson1_deserializeDocumentServiceMetadataList(&sv.ServiceMetadata, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpGetSettings struct { } func (*awsRestjson1_deserializeOpGetSettings) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpGetSettings) 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 } 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_deserializeOpErrorGetSettings(response, &metadata) } output := &GetSettingsOutput{} 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_deserializeOpDocumentGetSettingsOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorGetSettings(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) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentGetSettingsOutput(v **GetSettingsOutput, 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 *GetSettingsOutput if *v == nil { sv = &GetSettingsOutput{} } else { sv = *v } for key, value := range shape { switch key { case "settings": if err := awsRestjson1_deserializeDocumentSettings(&sv.Settings, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpListAssessmentControlInsightsByControlDomain struct { } func (*awsRestjson1_deserializeOpListAssessmentControlInsightsByControlDomain) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpListAssessmentControlInsightsByControlDomain) 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 } 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_deserializeOpErrorListAssessmentControlInsightsByControlDomain(response, &metadata) } output := &ListAssessmentControlInsightsByControlDomainOutput{} 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_deserializeOpDocumentListAssessmentControlInsightsByControlDomainOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorListAssessmentControlInsightsByControlDomain(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentListAssessmentControlInsightsByControlDomainOutput(v **ListAssessmentControlInsightsByControlDomainOutput, 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 *ListAssessmentControlInsightsByControlDomainOutput if *v == nil { sv = &ListAssessmentControlInsightsByControlDomainOutput{} } else { sv = *v } for key, value := range shape { switch key { case "controlInsightsByAssessment": if err := awsRestjson1_deserializeDocumentControlInsightsMetadataByAssessment(&sv.ControlInsightsByAssessment, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpListAssessmentFrameworks struct { } func (*awsRestjson1_deserializeOpListAssessmentFrameworks) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpListAssessmentFrameworks) 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 } 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_deserializeOpErrorListAssessmentFrameworks(response, &metadata) } output := &ListAssessmentFrameworksOutput{} 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_deserializeOpDocumentListAssessmentFrameworksOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorListAssessmentFrameworks(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentListAssessmentFrameworksOutput(v **ListAssessmentFrameworksOutput, 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 *ListAssessmentFrameworksOutput if *v == nil { sv = &ListAssessmentFrameworksOutput{} } else { sv = *v } for key, value := range shape { switch key { case "frameworkMetadataList": if err := awsRestjson1_deserializeDocumentFrameworkMetadataList(&sv.FrameworkMetadataList, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpListAssessmentFrameworkShareRequests struct { } func (*awsRestjson1_deserializeOpListAssessmentFrameworkShareRequests) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpListAssessmentFrameworkShareRequests) 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 } 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_deserializeOpErrorListAssessmentFrameworkShareRequests(response, &metadata) } output := &ListAssessmentFrameworkShareRequestsOutput{} 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_deserializeOpDocumentListAssessmentFrameworkShareRequestsOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorListAssessmentFrameworkShareRequests(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentListAssessmentFrameworkShareRequestsOutput(v **ListAssessmentFrameworkShareRequestsOutput, 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 *ListAssessmentFrameworkShareRequestsOutput if *v == nil { sv = &ListAssessmentFrameworkShareRequestsOutput{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentFrameworkShareRequests": if err := awsRestjson1_deserializeDocumentAssessmentFrameworkShareRequestList(&sv.AssessmentFrameworkShareRequests, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpListAssessmentReports struct { } func (*awsRestjson1_deserializeOpListAssessmentReports) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpListAssessmentReports) 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 } 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_deserializeOpErrorListAssessmentReports(response, &metadata) } output := &ListAssessmentReportsOutput{} 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_deserializeOpDocumentListAssessmentReportsOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorListAssessmentReports(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentListAssessmentReportsOutput(v **ListAssessmentReportsOutput, 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 *ListAssessmentReportsOutput if *v == nil { sv = &ListAssessmentReportsOutput{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentReports": if err := awsRestjson1_deserializeDocumentAssessmentReportsMetadata(&sv.AssessmentReports, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpListAssessments struct { } func (*awsRestjson1_deserializeOpListAssessments) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpListAssessments) 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 } 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_deserializeOpErrorListAssessments(response, &metadata) } output := &ListAssessmentsOutput{} 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_deserializeOpDocumentListAssessmentsOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorListAssessments(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentListAssessmentsOutput(v **ListAssessmentsOutput, 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 *ListAssessmentsOutput if *v == nil { sv = &ListAssessmentsOutput{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentMetadata": if err := awsRestjson1_deserializeDocumentListAssessmentMetadata(&sv.AssessmentMetadata, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpListControlDomainInsights struct { } func (*awsRestjson1_deserializeOpListControlDomainInsights) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpListControlDomainInsights) 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 } 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_deserializeOpErrorListControlDomainInsights(response, &metadata) } output := &ListControlDomainInsightsOutput{} 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_deserializeOpDocumentListControlDomainInsightsOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorListControlDomainInsights(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentListControlDomainInsightsOutput(v **ListControlDomainInsightsOutput, 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 *ListControlDomainInsightsOutput if *v == nil { sv = &ListControlDomainInsightsOutput{} } else { sv = *v } for key, value := range shape { switch key { case "controlDomainInsights": if err := awsRestjson1_deserializeDocumentControlDomainInsightsList(&sv.ControlDomainInsights, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpListControlDomainInsightsByAssessment struct { } func (*awsRestjson1_deserializeOpListControlDomainInsightsByAssessment) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpListControlDomainInsightsByAssessment) 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 } 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_deserializeOpErrorListControlDomainInsightsByAssessment(response, &metadata) } output := &ListControlDomainInsightsByAssessmentOutput{} 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_deserializeOpDocumentListControlDomainInsightsByAssessmentOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorListControlDomainInsightsByAssessment(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentListControlDomainInsightsByAssessmentOutput(v **ListControlDomainInsightsByAssessmentOutput, 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 *ListControlDomainInsightsByAssessmentOutput if *v == nil { sv = &ListControlDomainInsightsByAssessmentOutput{} } else { sv = *v } for key, value := range shape { switch key { case "controlDomainInsights": if err := awsRestjson1_deserializeDocumentControlDomainInsightsList(&sv.ControlDomainInsights, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpListControlInsightsByControlDomain struct { } func (*awsRestjson1_deserializeOpListControlInsightsByControlDomain) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpListControlInsightsByControlDomain) 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 } 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_deserializeOpErrorListControlInsightsByControlDomain(response, &metadata) } output := &ListControlInsightsByControlDomainOutput{} 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_deserializeOpDocumentListControlInsightsByControlDomainOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorListControlInsightsByControlDomain(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentListControlInsightsByControlDomainOutput(v **ListControlInsightsByControlDomainOutput, 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 *ListControlInsightsByControlDomainOutput if *v == nil { sv = &ListControlInsightsByControlDomainOutput{} } else { sv = *v } for key, value := range shape { switch key { case "controlInsightsMetadata": if err := awsRestjson1_deserializeDocumentControlInsightsMetadata(&sv.ControlInsightsMetadata, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpListControls struct { } func (*awsRestjson1_deserializeOpListControls) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpListControls) 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 } 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_deserializeOpErrorListControls(response, &metadata) } output := &ListControlsOutput{} 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_deserializeOpDocumentListControlsOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorListControls(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentListControlsOutput(v **ListControlsOutput, 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 *ListControlsOutput if *v == nil { sv = &ListControlsOutput{} } else { sv = *v } for key, value := range shape { switch key { case "controlMetadataList": if err := awsRestjson1_deserializeDocumentControlMetadataList(&sv.ControlMetadataList, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpListKeywordsForDataSource struct { } func (*awsRestjson1_deserializeOpListKeywordsForDataSource) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpListKeywordsForDataSource) 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 } 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_deserializeOpErrorListKeywordsForDataSource(response, &metadata) } output := &ListKeywordsForDataSourceOutput{} 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_deserializeOpDocumentListKeywordsForDataSourceOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorListKeywordsForDataSource(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentListKeywordsForDataSourceOutput(v **ListKeywordsForDataSourceOutput, 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 *ListKeywordsForDataSourceOutput if *v == nil { sv = &ListKeywordsForDataSourceOutput{} } else { sv = *v } for key, value := range shape { switch key { case "keywords": if err := awsRestjson1_deserializeDocumentKeywords(&sv.Keywords, value); err != nil { return err } case "nextToken": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpListNotifications struct { } func (*awsRestjson1_deserializeOpListNotifications) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpListNotifications) 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 } 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_deserializeOpErrorListNotifications(response, &metadata) } output := &ListNotificationsOutput{} 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_deserializeOpDocumentListNotificationsOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorListNotifications(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentListNotificationsOutput(v **ListNotificationsOutput, 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 *ListNotificationsOutput if *v == nil { sv = &ListNotificationsOutput{} } 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 Token to be of type string, got %T instead", value) } sv.NextToken = ptr.String(jtv) } case "notifications": if err := awsRestjson1_deserializeDocumentNotifications(&sv.Notifications, 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 } 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(), } } 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("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(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_deserializeOpRegisterAccount struct { } func (*awsRestjson1_deserializeOpRegisterAccount) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpRegisterAccount) 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 } 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_deserializeOpErrorRegisterAccount(response, &metadata) } output := &RegisterAccountOutput{} 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_deserializeOpDocumentRegisterAccountOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorRegisterAccount(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_deserializeOpDocumentRegisterAccountOutput(v **RegisterAccountOutput, 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 *RegisterAccountOutput if *v == nil { sv = &RegisterAccountOutput{} } else { sv = *v } for key, value := range shape { switch key { case "status": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountStatus to be of type string, got %T instead", value) } sv.Status = types.AccountStatus(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpRegisterOrganizationAdminAccount struct { } func (*awsRestjson1_deserializeOpRegisterOrganizationAdminAccount) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpRegisterOrganizationAdminAccount) 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 } 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_deserializeOpErrorRegisterOrganizationAdminAccount(response, &metadata) } output := &RegisterOrganizationAdminAccountOutput{} 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_deserializeOpDocumentRegisterOrganizationAdminAccountOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorRegisterOrganizationAdminAccount(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentRegisterOrganizationAdminAccountOutput(v **RegisterOrganizationAdminAccountOutput, 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 *RegisterOrganizationAdminAccountOutput if *v == nil { sv = &RegisterOrganizationAdminAccountOutput{} } else { sv = *v } for key, value := range shape { switch key { case "adminAccountId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) } sv.AdminAccountId = ptr.String(jtv) } case "organizationId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected organizationId to be of type string, got %T instead", value) } sv.OrganizationId = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpStartAssessmentFrameworkShare struct { } func (*awsRestjson1_deserializeOpStartAssessmentFrameworkShare) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpStartAssessmentFrameworkShare) 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 } 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_deserializeOpErrorStartAssessmentFrameworkShare(response, &metadata) } output := &StartAssessmentFrameworkShareOutput{} 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_deserializeOpDocumentStartAssessmentFrameworkShareOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorStartAssessmentFrameworkShare(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentStartAssessmentFrameworkShareOutput(v **StartAssessmentFrameworkShareOutput, 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 *StartAssessmentFrameworkShareOutput if *v == nil { sv = &StartAssessmentFrameworkShareOutput{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentFrameworkShareRequest": if err := awsRestjson1_deserializeDocumentAssessmentFrameworkShareRequest(&sv.AssessmentFrameworkShareRequest, 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 } 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 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("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(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 } 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 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("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) case strings.EqualFold("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } type awsRestjson1_deserializeOpUpdateAssessment struct { } func (*awsRestjson1_deserializeOpUpdateAssessment) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpUpdateAssessment) 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 } 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_deserializeOpErrorUpdateAssessment(response, &metadata) } output := &UpdateAssessmentOutput{} 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_deserializeOpDocumentUpdateAssessmentOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorUpdateAssessment(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentUpdateAssessmentOutput(v **UpdateAssessmentOutput, 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 *UpdateAssessmentOutput if *v == nil { sv = &UpdateAssessmentOutput{} } else { sv = *v } for key, value := range shape { switch key { case "assessment": if err := awsRestjson1_deserializeDocumentAssessment(&sv.Assessment, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpUpdateAssessmentControl struct { } func (*awsRestjson1_deserializeOpUpdateAssessmentControl) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpUpdateAssessmentControl) 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 } 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_deserializeOpErrorUpdateAssessmentControl(response, &metadata) } output := &UpdateAssessmentControlOutput{} 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_deserializeOpDocumentUpdateAssessmentControlOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorUpdateAssessmentControl(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentUpdateAssessmentControlOutput(v **UpdateAssessmentControlOutput, 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 *UpdateAssessmentControlOutput if *v == nil { sv = &UpdateAssessmentControlOutput{} } else { sv = *v } for key, value := range shape { switch key { case "control": if err := awsRestjson1_deserializeDocumentAssessmentControl(&sv.Control, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpUpdateAssessmentControlSetStatus struct { } func (*awsRestjson1_deserializeOpUpdateAssessmentControlSetStatus) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpUpdateAssessmentControlSetStatus) 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 } 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_deserializeOpErrorUpdateAssessmentControlSetStatus(response, &metadata) } output := &UpdateAssessmentControlSetStatusOutput{} 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_deserializeOpDocumentUpdateAssessmentControlSetStatusOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorUpdateAssessmentControlSetStatus(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentUpdateAssessmentControlSetStatusOutput(v **UpdateAssessmentControlSetStatusOutput, 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 *UpdateAssessmentControlSetStatusOutput if *v == nil { sv = &UpdateAssessmentControlSetStatusOutput{} } else { sv = *v } for key, value := range shape { switch key { case "controlSet": if err := awsRestjson1_deserializeDocumentAssessmentControlSet(&sv.ControlSet, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpUpdateAssessmentFramework struct { } func (*awsRestjson1_deserializeOpUpdateAssessmentFramework) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpUpdateAssessmentFramework) 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 } 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_deserializeOpErrorUpdateAssessmentFramework(response, &metadata) } output := &UpdateAssessmentFrameworkOutput{} 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_deserializeOpDocumentUpdateAssessmentFrameworkOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorUpdateAssessmentFramework(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentUpdateAssessmentFrameworkOutput(v **UpdateAssessmentFrameworkOutput, 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 *UpdateAssessmentFrameworkOutput if *v == nil { sv = &UpdateAssessmentFrameworkOutput{} } else { sv = *v } for key, value := range shape { switch key { case "framework": if err := awsRestjson1_deserializeDocumentFramework(&sv.Framework, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpUpdateAssessmentFrameworkShare struct { } func (*awsRestjson1_deserializeOpUpdateAssessmentFrameworkShare) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpUpdateAssessmentFrameworkShare) 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 } 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_deserializeOpErrorUpdateAssessmentFrameworkShare(response, &metadata) } output := &UpdateAssessmentFrameworkShareOutput{} 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_deserializeOpDocumentUpdateAssessmentFrameworkShareOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorUpdateAssessmentFrameworkShare(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} } errorBody := bytes.NewReader(errorBuffer.Bytes()) errorCode := "UnknownError" errorMessage := errorCode headerCode := response.Header.Get("X-Amzn-ErrorType") if len(headerCode) != 0 { errorCode = restjson.SanitizeErrorCode(headerCode) } var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() jsonCode, message, err := restjson.GetErrorInfo(decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } errorBody.Seek(0, io.SeekStart) if len(headerCode) == 0 && len(jsonCode) != 0 { errorCode = restjson.SanitizeErrorCode(jsonCode) } if len(message) != 0 { errorMessage = message } switch { case strings.EqualFold("AccessDeniedException", errorCode): return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) case strings.EqualFold("ServiceQuotaExceededException", errorCode): return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) case strings.EqualFold("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentUpdateAssessmentFrameworkShareOutput(v **UpdateAssessmentFrameworkShareOutput, 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 *UpdateAssessmentFrameworkShareOutput if *v == nil { sv = &UpdateAssessmentFrameworkShareOutput{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentFrameworkShareRequest": if err := awsRestjson1_deserializeDocumentAssessmentFrameworkShareRequest(&sv.AssessmentFrameworkShareRequest, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpUpdateAssessmentStatus struct { } func (*awsRestjson1_deserializeOpUpdateAssessmentStatus) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpUpdateAssessmentStatus) 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 } 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_deserializeOpErrorUpdateAssessmentStatus(response, &metadata) } output := &UpdateAssessmentStatusOutput{} 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_deserializeOpDocumentUpdateAssessmentStatusOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorUpdateAssessmentStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} } errorBody := bytes.NewReader(errorBuffer.Bytes()) errorCode := "UnknownError" errorMessage := errorCode headerCode := response.Header.Get("X-Amzn-ErrorType") if len(headerCode) != 0 { errorCode = restjson.SanitizeErrorCode(headerCode) } var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() jsonCode, message, err := restjson.GetErrorInfo(decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } errorBody.Seek(0, io.SeekStart) if len(headerCode) == 0 && len(jsonCode) != 0 { errorCode = restjson.SanitizeErrorCode(jsonCode) } if len(message) != 0 { errorMessage = message } switch { case strings.EqualFold("AccessDeniedException", errorCode): return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) case strings.EqualFold("ResourceNotFoundException", errorCode): return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) case strings.EqualFold("ServiceQuotaExceededException", errorCode): return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) case strings.EqualFold("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentUpdateAssessmentStatusOutput(v **UpdateAssessmentStatusOutput, 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 *UpdateAssessmentStatusOutput if *v == nil { sv = &UpdateAssessmentStatusOutput{} } else { sv = *v } for key, value := range shape { switch key { case "assessment": if err := awsRestjson1_deserializeDocumentAssessment(&sv.Assessment, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpUpdateControl struct { } func (*awsRestjson1_deserializeOpUpdateControl) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpUpdateControl) 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 } 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_deserializeOpErrorUpdateControl(response, &metadata) } output := &UpdateControlOutput{} 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_deserializeOpDocumentUpdateControlOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorUpdateControl(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentUpdateControlOutput(v **UpdateControlOutput, 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 *UpdateControlOutput if *v == nil { sv = &UpdateControlOutput{} } else { sv = *v } for key, value := range shape { switch key { case "control": if err := awsRestjson1_deserializeDocumentControl(&sv.Control, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpUpdateSettings struct { } func (*awsRestjson1_deserializeOpUpdateSettings) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpUpdateSettings) 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 } 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_deserializeOpErrorUpdateSettings(response, &metadata) } output := &UpdateSettingsOutput{} 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_deserializeOpDocumentUpdateSettingsOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorUpdateSettings(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentUpdateSettingsOutput(v **UpdateSettingsOutput, 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 *UpdateSettingsOutput if *v == nil { sv = &UpdateSettingsOutput{} } else { sv = *v } for key, value := range shape { switch key { case "settings": if err := awsRestjson1_deserializeDocumentSettings(&sv.Settings, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } type awsRestjson1_deserializeOpValidateAssessmentReportIntegrity struct { } func (*awsRestjson1_deserializeOpValidateAssessmentReportIntegrity) ID() string { return "OperationDeserializer" } func (m *awsRestjson1_deserializeOpValidateAssessmentReportIntegrity) 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 } 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_deserializeOpErrorValidateAssessmentReportIntegrity(response, &metadata) } output := &ValidateAssessmentReportIntegrityOutput{} 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_deserializeOpDocumentValidateAssessmentReportIntegrityOutput(&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(), } } return out, metadata, err } func awsRestjson1_deserializeOpErrorValidateAssessmentReportIntegrity(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("ValidationException", errorCode): return awsRestjson1_deserializeErrorValidationException(response, errorBody) default: genericError := &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } return genericError } } func awsRestjson1_deserializeOpDocumentValidateAssessmentReportIntegrityOutput(v **ValidateAssessmentReportIntegrityOutput, 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 *ValidateAssessmentReportIntegrityOutput if *v == nil { sv = &ValidateAssessmentReportIntegrityOutput{} } else { sv = *v } for key, value := range shape { switch key { case "signatureAlgorithm": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.SignatureAlgorithm = ptr.String(jtv) } case "signatureDateTime": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.SignatureDateTime = ptr.String(jtv) } case "signatureKeyId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.SignatureKeyId = ptr.String(jtv) } case "signatureValid": if value != nil { jtv, ok := value.(bool) if !ok { return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) } sv.SignatureValid = ptr.Bool(jtv) } case "validationErrors": if err := awsRestjson1_deserializeDocumentValidationErrors(&sv.ValidationErrors, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { output := &types.AccessDeniedException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() var shape interface{} if err := decoder.Decode(&shape); err != nil && err != io.EOF { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } errorBody.Seek(0, io.SeekStart) return output } func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { output := &types.InternalServerException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() var shape interface{} if err := decoder.Decode(&shape); err != nil && err != io.EOF { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } errorBody.Seek(0, io.SeekStart) return output } func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { output := &types.ResourceNotFoundException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() var shape interface{} if err := decoder.Decode(&shape); err != nil && err != io.EOF { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } errorBody.Seek(0, io.SeekStart) return output } func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { output := &types.ServiceQuotaExceededException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() var shape interface{} if err := decoder.Decode(&shape); err != nil && err != io.EOF { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } errorBody.Seek(0, io.SeekStart) return output } func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { output := &types.ThrottlingException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() var shape interface{} if err := decoder.Decode(&shape); err != nil && err != io.EOF { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } errorBody.Seek(0, io.SeekStart) return output } func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { output := &types.ValidationException{} var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) body := io.TeeReader(errorBody, ringBuffer) decoder := json.NewDecoder(body) decoder.UseNumber() var shape interface{} if err := decoder.Decode(&shape); err != nil && err != io.EOF { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } err := awsRestjson1_deserializeDocumentValidationException(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) err = &smithy.DeserializationError{ Err: fmt.Errorf("failed to decode response body, %w", err), Snapshot: snapshot.Bytes(), } return err } errorBody.Seek(0, io.SeekStart) return output } func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } if value == nil { return nil } shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } var sv *types.AccessDeniedException if *v == nil { sv = &types.AccessDeniedException{} } else { sv = *v } for key, value := range shape { switch key { case "message": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.Message = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessment(v **types.Assessment, 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.Assessment if *v == nil { sv = &types.Assessment{} } 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 AuditManagerArn to be of type string, got %T instead", value) } sv.Arn = ptr.String(jtv) } case "awsAccount": if err := awsRestjson1_deserializeDocumentAWSAccount(&sv.AwsAccount, value); err != nil { return err } case "framework": if err := awsRestjson1_deserializeDocumentAssessmentFramework(&sv.Framework, value); err != nil { return err } case "metadata": if err := awsRestjson1_deserializeDocumentAssessmentMetadata(&sv.Metadata, value); err != nil { return err } case "tags": if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentControl(v **types.AssessmentControl, 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.AssessmentControl if *v == nil { sv = &types.AssessmentControl{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentReportEvidenceCount": 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.AssessmentReportEvidenceCount = int32(i64) } case "comments": if err := awsRestjson1_deserializeDocumentControlComments(&sv.Comments, value); err != nil { return err } case "description": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlDescription to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } case "evidenceCount": 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.EvidenceCount = int32(i64) } case "evidenceSources": if err := awsRestjson1_deserializeDocumentEvidenceSources(&sv.EvidenceSources, value); err != nil { return err } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } case "response": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlResponse to be of type string, got %T instead", value) } sv.Response = types.ControlResponse(jtv) } case "status": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlStatus to be of type string, got %T instead", value) } sv.Status = types.ControlStatus(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentControls(v *[]types.AssessmentControl, 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.AssessmentControl if *v == nil { cv = []types.AssessmentControl{} } else { cv = *v } for _, value := range shape { var col types.AssessmentControl destAddr := &col if err := awsRestjson1_deserializeDocumentAssessmentControl(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentAssessmentControlSet(v **types.AssessmentControlSet, 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.AssessmentControlSet if *v == nil { sv = &types.AssessmentControlSet{} } else { sv = *v } for key, value := range shape { switch key { case "controls": if err := awsRestjson1_deserializeDocumentAssessmentControls(&sv.Controls, value); err != nil { return err } case "delegations": if err := awsRestjson1_deserializeDocumentDelegations(&sv.Delegations, value); err != nil { return err } case "description": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlSetId to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "manualEvidenceCount": 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.ManualEvidenceCount = int32(i64) } case "roles": if err := awsRestjson1_deserializeDocumentRoles(&sv.Roles, value); err != nil { return err } case "status": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlSetStatus to be of type string, got %T instead", value) } sv.Status = types.ControlSetStatus(jtv) } case "systemEvidenceCount": 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.SystemEvidenceCount = int32(i64) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentControlSets(v *[]types.AssessmentControlSet, 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.AssessmentControlSet if *v == nil { cv = []types.AssessmentControlSet{} } else { cv = *v } for _, value := range shape { var col types.AssessmentControlSet destAddr := &col if err := awsRestjson1_deserializeDocumentAssessmentControlSet(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentAssessmentEvidenceFolder(v **types.AssessmentEvidenceFolder, 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.AssessmentEvidenceFolder if *v == nil { sv = &types.AssessmentEvidenceFolder{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.AssessmentId = ptr.String(jtv) } case "assessmentReportSelectionCount": 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.AssessmentReportSelectionCount = int32(i64) } case "author": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.Author = ptr.String(jtv) } case "controlId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.ControlId = ptr.String(jtv) } case "controlName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlName to be of type string, got %T instead", value) } sv.ControlName = ptr.String(jtv) } case "controlSetId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlSetId to be of type string, got %T instead", value) } sv.ControlSetId = ptr.String(jtv) } case "dataSource": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.DataSource = ptr.String(jtv) } case "date": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.Date = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "evidenceAwsServiceSourceCount": 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.EvidenceAwsServiceSourceCount = int32(i64) } case "evidenceByTypeComplianceCheckCount": 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.EvidenceByTypeComplianceCheckCount = int32(i64) } case "evidenceByTypeComplianceCheckIssuesCount": 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.EvidenceByTypeComplianceCheckIssuesCount = int32(i64) } case "evidenceByTypeConfigurationDataCount": 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.EvidenceByTypeConfigurationDataCount = int32(i64) } case "evidenceByTypeManualCount": 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.EvidenceByTypeManualCount = int32(i64) } case "evidenceByTypeUserActivityCount": 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.EvidenceByTypeUserActivityCount = int32(i64) } case "evidenceResourcesIncludedCount": 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.EvidenceResourcesIncludedCount = int32(i64) } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentEvidenceFolderName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } case "totalEvidence": 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.TotalEvidence = int32(i64) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentEvidenceFolders(v *[]types.AssessmentEvidenceFolder, 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.AssessmentEvidenceFolder if *v == nil { cv = []types.AssessmentEvidenceFolder{} } else { cv = *v } for _, value := range shape { var col types.AssessmentEvidenceFolder destAddr := &col if err := awsRestjson1_deserializeDocumentAssessmentEvidenceFolder(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentAssessmentFramework(v **types.AssessmentFramework, 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.AssessmentFramework if *v == nil { sv = &types.AssessmentFramework{} } 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 AuditManagerArn to be of type string, got %T instead", value) } sv.Arn = ptr.String(jtv) } case "controlSets": if err := awsRestjson1_deserializeDocumentAssessmentControlSets(&sv.ControlSets, value); err != nil { return err } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "metadata": if err := awsRestjson1_deserializeDocumentFrameworkMetadata(&sv.Metadata, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentFrameworkMetadata(v **types.AssessmentFrameworkMetadata, 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.AssessmentFrameworkMetadata if *v == nil { sv = &types.AssessmentFrameworkMetadata{} } 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 AuditManagerArn to be of type string, got %T instead", value) } sv.Arn = ptr.String(jtv) } case "complianceType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ComplianceType to be of type string, got %T instead", value) } sv.ComplianceType = ptr.String(jtv) } case "controlsCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected ControlsCount to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.ControlsCount = int32(i64) } case "controlSetsCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected ControlSetsCount to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.ControlSetsCount = int32(i64) } case "createdAt": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "description": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected FrameworkDescription to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "lastUpdatedAt": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "logo": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Filename to be of type string, got %T instead", value) } sv.Logo = ptr.String(jtv) } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected FrameworkName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } case "type": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected FrameworkType to be of type string, got %T instead", value) } sv.Type = types.FrameworkType(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentFrameworkShareRequest(v **types.AssessmentFrameworkShareRequest, 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.AssessmentFrameworkShareRequest if *v == nil { sv = &types.AssessmentFrameworkShareRequest{} } else { sv = *v } for key, value := range shape { switch key { case "comment": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ShareRequestComment to be of type string, got %T instead", value) } sv.Comment = ptr.String(jtv) } case "complianceType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ComplianceType to be of type string, got %T instead", value) } sv.ComplianceType = ptr.String(jtv) } case "creationTime": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "customControlsCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.CustomControlsCount = ptr.Int32(int32(i64)) } case "destinationAccount": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) } sv.DestinationAccount = ptr.String(jtv) } case "destinationRegion": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Region to be of type string, got %T instead", value) } sv.DestinationRegion = ptr.String(jtv) } case "expirationTime": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.ExpirationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "frameworkDescription": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected FrameworkDescription to be of type string, got %T instead", value) } sv.FrameworkDescription = ptr.String(jtv) } case "frameworkId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.FrameworkId = ptr.String(jtv) } case "frameworkName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected FrameworkName to be of type string, got %T instead", value) } sv.FrameworkName = ptr.String(jtv) } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "lastUpdated": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdated = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "sourceAccount": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) } sv.SourceAccount = ptr.String(jtv) } case "standardControlsCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.StandardControlsCount = ptr.Int32(int32(i64)) } case "status": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ShareRequestStatus to be of type string, got %T instead", value) } sv.Status = types.ShareRequestStatus(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentFrameworkShareRequestList(v *[]types.AssessmentFrameworkShareRequest, 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.AssessmentFrameworkShareRequest if *v == nil { cv = []types.AssessmentFrameworkShareRequest{} } else { cv = *v } for _, value := range shape { var col types.AssessmentFrameworkShareRequest destAddr := &col if err := awsRestjson1_deserializeDocumentAssessmentFrameworkShareRequest(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentAssessmentMetadata(v **types.AssessmentMetadata, 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.AssessmentMetadata if *v == nil { sv = &types.AssessmentMetadata{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentReportsDestination": if err := awsRestjson1_deserializeDocumentAssessmentReportsDestination(&sv.AssessmentReportsDestination, value); err != nil { return err } case "complianceType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ComplianceType to be of type string, got %T instead", value) } sv.ComplianceType = ptr.String(jtv) } case "creationTime": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "delegations": if err := awsRestjson1_deserializeDocumentDelegations(&sv.Delegations, value); err != nil { return err } case "description": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentDescription to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "lastUpdated": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdated = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } case "roles": if err := awsRestjson1_deserializeDocumentRoles(&sv.Roles, value); err != nil { return err } case "scope": if err := awsRestjson1_deserializeDocumentScope(&sv.Scope, value); err != nil { return err } case "status": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentStatus to be of type string, got %T instead", value) } sv.Status = types.AssessmentStatus(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentMetadataItem(v **types.AssessmentMetadataItem, 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.AssessmentMetadataItem if *v == nil { sv = &types.AssessmentMetadataItem{} } else { sv = *v } for key, value := range shape { switch key { case "complianceType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ComplianceType to be of type string, got %T instead", value) } sv.ComplianceType = ptr.String(jtv) } case "creationTime": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "delegations": if err := awsRestjson1_deserializeDocumentDelegations(&sv.Delegations, value); err != nil { return err } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "lastUpdated": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdated = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } case "roles": if err := awsRestjson1_deserializeDocumentRoles(&sv.Roles, value); err != nil { return err } case "status": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentStatus to be of type string, got %T instead", value) } sv.Status = types.AssessmentStatus(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentReport(v **types.AssessmentReport, 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.AssessmentReport if *v == nil { sv = &types.AssessmentReport{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.AssessmentId = ptr.String(jtv) } case "assessmentName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentName to be of type string, got %T instead", value) } sv.AssessmentName = ptr.String(jtv) } case "author": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Username to be of type string, got %T instead", value) } sv.Author = ptr.String(jtv) } case "awsAccountId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) } sv.AwsAccountId = ptr.String(jtv) } case "creationTime": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "description": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentReportDescription to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentReportName 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 AssessmentReportStatus to be of type string, got %T instead", value) } sv.Status = types.AssessmentReportStatus(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentReportEvidenceError(v **types.AssessmentReportEvidenceError, 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.AssessmentReportEvidenceError if *v == nil { sv = &types.AssessmentReportEvidenceError{} } else { sv = *v } for key, value := range shape { switch key { case "errorCode": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ErrorCode to be of type string, got %T instead", value) } sv.ErrorCode = ptr.String(jtv) } case "errorMessage": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) } sv.ErrorMessage = ptr.String(jtv) } case "evidenceId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.EvidenceId = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentReportEvidenceErrors(v *[]types.AssessmentReportEvidenceError, 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.AssessmentReportEvidenceError if *v == nil { cv = []types.AssessmentReportEvidenceError{} } else { cv = *v } for _, value := range shape { var col types.AssessmentReportEvidenceError destAddr := &col if err := awsRestjson1_deserializeDocumentAssessmentReportEvidenceError(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentAssessmentReportMetadata(v **types.AssessmentReportMetadata, 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.AssessmentReportMetadata if *v == nil { sv = &types.AssessmentReportMetadata{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.AssessmentId = ptr.String(jtv) } case "assessmentName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentName to be of type string, got %T instead", value) } sv.AssessmentName = ptr.String(jtv) } case "author": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Username to be of type string, got %T instead", value) } sv.Author = ptr.String(jtv) } case "creationTime": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "description": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentReportDescription to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentReportName 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 AssessmentReportStatus to be of type string, got %T instead", value) } sv.Status = types.AssessmentReportStatus(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentReportsDestination(v **types.AssessmentReportsDestination, 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.AssessmentReportsDestination if *v == nil { sv = &types.AssessmentReportsDestination{} } else { sv = *v } for key, value := range shape { switch key { case "destination": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected S3Url to be of type string, got %T instead", value) } sv.Destination = ptr.String(jtv) } case "destinationType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentReportDestinationType to be of type string, got %T instead", value) } sv.DestinationType = types.AssessmentReportDestinationType(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAssessmentReportsMetadata(v *[]types.AssessmentReportMetadata, 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.AssessmentReportMetadata if *v == nil { cv = []types.AssessmentReportMetadata{} } else { cv = *v } for _, value := range shape { var col types.AssessmentReportMetadata destAddr := &col if err := awsRestjson1_deserializeDocumentAssessmentReportMetadata(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentAWSAccount(v **types.AWSAccount, 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.AWSAccount if *v == nil { sv = &types.AWSAccount{} } else { sv = *v } for key, value := range shape { switch key { case "emailAddress": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected EmailAddress to be of type string, got %T instead", value) } sv.EmailAddress = ptr.String(jtv) } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAWSAccounts(v *[]types.AWSAccount, 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.AWSAccount if *v == nil { cv = []types.AWSAccount{} } else { cv = *v } for _, value := range shape { var col types.AWSAccount destAddr := &col if err := awsRestjson1_deserializeDocumentAWSAccount(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentAWSService(v **types.AWSService, 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.AWSService if *v == nil { sv = &types.AWSService{} } else { sv = *v } for key, value := range shape { switch key { case "serviceName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AWSServiceName to be of type string, got %T instead", value) } sv.ServiceName = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentAWSServices(v *[]types.AWSService, 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.AWSService if *v == nil { cv = []types.AWSService{} } else { cv = *v } for _, value := range shape { var col types.AWSService destAddr := &col if err := awsRestjson1_deserializeDocumentAWSService(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentBatchCreateDelegationByAssessmentError(v **types.BatchCreateDelegationByAssessmentError, 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.BatchCreateDelegationByAssessmentError if *v == nil { sv = &types.BatchCreateDelegationByAssessmentError{} } else { sv = *v } for key, value := range shape { switch key { case "createDelegationRequest": if err := awsRestjson1_deserializeDocumentCreateDelegationRequest(&sv.CreateDelegationRequest, value); err != nil { return err } case "errorCode": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ErrorCode to be of type string, got %T instead", value) } sv.ErrorCode = ptr.String(jtv) } case "errorMessage": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) } sv.ErrorMessage = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentBatchCreateDelegationByAssessmentErrors(v *[]types.BatchCreateDelegationByAssessmentError, 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.BatchCreateDelegationByAssessmentError if *v == nil { cv = []types.BatchCreateDelegationByAssessmentError{} } else { cv = *v } for _, value := range shape { var col types.BatchCreateDelegationByAssessmentError destAddr := &col if err := awsRestjson1_deserializeDocumentBatchCreateDelegationByAssessmentError(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentBatchDeleteDelegationByAssessmentError(v **types.BatchDeleteDelegationByAssessmentError, 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.BatchDeleteDelegationByAssessmentError if *v == nil { sv = &types.BatchDeleteDelegationByAssessmentError{} } else { sv = *v } for key, value := range shape { switch key { case "delegationId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.DelegationId = ptr.String(jtv) } case "errorCode": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ErrorCode to be of type string, got %T instead", value) } sv.ErrorCode = ptr.String(jtv) } case "errorMessage": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) } sv.ErrorMessage = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentBatchDeleteDelegationByAssessmentErrors(v *[]types.BatchDeleteDelegationByAssessmentError, 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.BatchDeleteDelegationByAssessmentError if *v == nil { cv = []types.BatchDeleteDelegationByAssessmentError{} } else { cv = *v } for _, value := range shape { var col types.BatchDeleteDelegationByAssessmentError destAddr := &col if err := awsRestjson1_deserializeDocumentBatchDeleteDelegationByAssessmentError(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentBatchImportEvidenceToAssessmentControlError(v **types.BatchImportEvidenceToAssessmentControlError, 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.BatchImportEvidenceToAssessmentControlError if *v == nil { sv = &types.BatchImportEvidenceToAssessmentControlError{} } else { sv = *v } for key, value := range shape { switch key { case "errorCode": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ErrorCode to be of type string, got %T instead", value) } sv.ErrorCode = ptr.String(jtv) } case "errorMessage": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) } sv.ErrorMessage = ptr.String(jtv) } case "manualEvidence": if err := awsRestjson1_deserializeDocumentManualEvidence(&sv.ManualEvidence, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentBatchImportEvidenceToAssessmentControlErrors(v *[]types.BatchImportEvidenceToAssessmentControlError, 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.BatchImportEvidenceToAssessmentControlError if *v == nil { cv = []types.BatchImportEvidenceToAssessmentControlError{} } else { cv = *v } for _, value := range shape { var col types.BatchImportEvidenceToAssessmentControlError destAddr := &col if err := awsRestjson1_deserializeDocumentBatchImportEvidenceToAssessmentControlError(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentChangeLog(v **types.ChangeLog, 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.ChangeLog if *v == nil { sv = &types.ChangeLog{} } else { sv = *v } for key, value := range shape { switch key { case "action": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ActionEnum to be of type string, got %T instead", value) } sv.Action = types.ActionEnum(jtv) } case "createdAt": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "createdBy": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected IamArn to be of type string, got %T instead", value) } sv.CreatedBy = ptr.String(jtv) } case "objectName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.ObjectName = ptr.String(jtv) } case "objectType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ObjectTypeEnum to be of type string, got %T instead", value) } sv.ObjectType = types.ObjectTypeEnum(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentChangeLogs(v *[]types.ChangeLog, 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.ChangeLog if *v == nil { cv = []types.ChangeLog{} } else { cv = *v } for _, value := range shape { var col types.ChangeLog destAddr := &col if err := awsRestjson1_deserializeDocumentChangeLog(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentControl(v **types.Control, 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.Control if *v == nil { sv = &types.Control{} } else { sv = *v } for key, value := range shape { switch key { case "actionPlanInstructions": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ActionPlanInstructions to be of type string, got %T instead", value) } sv.ActionPlanInstructions = ptr.String(jtv) } case "actionPlanTitle": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ActionPlanTitle to be of type string, got %T instead", value) } sv.ActionPlanTitle = ptr.String(jtv) } case "arn": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AuditManagerArn to be of type string, got %T instead", value) } sv.Arn = ptr.String(jtv) } case "controlMappingSources": if err := awsRestjson1_deserializeDocumentControlMappingSources(&sv.ControlMappingSources, value); err != nil { return err } case "controlSources": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlSources to be of type string, got %T instead", value) } sv.ControlSources = ptr.String(jtv) } case "createdAt": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "createdBy": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected CreatedBy to be of type string, got %T instead", value) } sv.CreatedBy = ptr.String(jtv) } case "description": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlDescription to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "lastUpdatedAt": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "lastUpdatedBy": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected LastUpdatedBy to be of type string, got %T instead", value) } sv.LastUpdatedBy = ptr.String(jtv) } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } case "tags": if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { return err } case "testingInformation": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected TestingInformation to be of type string, got %T instead", value) } sv.TestingInformation = ptr.String(jtv) } case "type": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlType to be of type string, got %T instead", value) } sv.Type = types.ControlType(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentControlComment(v **types.ControlComment, 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.ControlComment if *v == nil { sv = &types.ControlComment{} } else { sv = *v } for key, value := range shape { switch key { case "authorName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Username to be of type string, got %T instead", value) } sv.AuthorName = ptr.String(jtv) } case "commentBody": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlCommentBody to be of type string, got %T instead", value) } sv.CommentBody = ptr.String(jtv) } case "postedDate": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.PostedDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentControlComments(v *[]types.ControlComment, 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.ControlComment if *v == nil { cv = []types.ControlComment{} } else { cv = *v } for _, value := range shape { var col types.ControlComment destAddr := &col if err := awsRestjson1_deserializeDocumentControlComment(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentControlDomainInsights(v **types.ControlDomainInsights, 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.ControlDomainInsights if *v == nil { sv = &types.ControlDomainInsights{} } else { sv = *v } for key, value := range shape { switch key { case "controlsCountByNoncompliantEvidence": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.ControlsCountByNoncompliantEvidence = ptr.Int32(int32(i64)) } case "evidenceInsights": if err := awsRestjson1_deserializeDocumentEvidenceInsights(&sv.EvidenceInsights, value); err != nil { return err } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "lastUpdated": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdated = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } case "totalControlsCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.TotalControlsCount = ptr.Int32(int32(i64)) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentControlDomainInsightsList(v *[]types.ControlDomainInsights, 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.ControlDomainInsights if *v == nil { cv = []types.ControlDomainInsights{} } else { cv = *v } for _, value := range shape { var col types.ControlDomainInsights destAddr := &col if err := awsRestjson1_deserializeDocumentControlDomainInsights(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentControlInsightsMetadata(v *[]types.ControlInsightsMetadataItem, 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.ControlInsightsMetadataItem if *v == nil { cv = []types.ControlInsightsMetadataItem{} } else { cv = *v } for _, value := range shape { var col types.ControlInsightsMetadataItem destAddr := &col if err := awsRestjson1_deserializeDocumentControlInsightsMetadataItem(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentControlInsightsMetadataByAssessment(v *[]types.ControlInsightsMetadataByAssessmentItem, 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.ControlInsightsMetadataByAssessmentItem if *v == nil { cv = []types.ControlInsightsMetadataByAssessmentItem{} } else { cv = *v } for _, value := range shape { var col types.ControlInsightsMetadataByAssessmentItem destAddr := &col if err := awsRestjson1_deserializeDocumentControlInsightsMetadataByAssessmentItem(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentControlInsightsMetadataByAssessmentItem(v **types.ControlInsightsMetadataByAssessmentItem, 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.ControlInsightsMetadataByAssessmentItem if *v == nil { sv = &types.ControlInsightsMetadataByAssessmentItem{} } else { sv = *v } for key, value := range shape { switch key { case "controlSetName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.ControlSetName = ptr.String(jtv) } case "evidenceInsights": if err := awsRestjson1_deserializeDocumentEvidenceInsights(&sv.EvidenceInsights, value); err != nil { return err } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "lastUpdated": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdated = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentControlInsightsMetadataItem(v **types.ControlInsightsMetadataItem, 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.ControlInsightsMetadataItem if *v == nil { sv = &types.ControlInsightsMetadataItem{} } else { sv = *v } for key, value := range shape { switch key { case "evidenceInsights": if err := awsRestjson1_deserializeDocumentEvidenceInsights(&sv.EvidenceInsights, value); err != nil { return err } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "lastUpdated": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdated = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentControlMappingSource(v **types.ControlMappingSource, 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.ControlMappingSource if *v == nil { sv = &types.ControlMappingSource{} } else { sv = *v } for key, value := range shape { switch key { case "sourceDescription": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected SourceDescription to be of type string, got %T instead", value) } sv.SourceDescription = ptr.String(jtv) } case "sourceFrequency": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected SourceFrequency to be of type string, got %T instead", value) } sv.SourceFrequency = types.SourceFrequency(jtv) } case "sourceId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.SourceId = ptr.String(jtv) } case "sourceKeyword": if err := awsRestjson1_deserializeDocumentSourceKeyword(&sv.SourceKeyword, value); err != nil { return err } case "sourceName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected SourceName to be of type string, got %T instead", value) } sv.SourceName = ptr.String(jtv) } case "sourceSetUpOption": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected SourceSetUpOption to be of type string, got %T instead", value) } sv.SourceSetUpOption = types.SourceSetUpOption(jtv) } case "sourceType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected SourceType to be of type string, got %T instead", value) } sv.SourceType = types.SourceType(jtv) } case "troubleshootingText": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected TroubleshootingText to be of type string, got %T instead", value) } sv.TroubleshootingText = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentControlMappingSources(v *[]types.ControlMappingSource, 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.ControlMappingSource if *v == nil { cv = []types.ControlMappingSource{} } else { cv = *v } for _, value := range shape { var col types.ControlMappingSource destAddr := &col if err := awsRestjson1_deserializeDocumentControlMappingSource(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentControlMetadata(v **types.ControlMetadata, 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.ControlMetadata if *v == nil { sv = &types.ControlMetadata{} } 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 AuditManagerArn to be of type string, got %T instead", value) } sv.Arn = ptr.String(jtv) } case "controlSources": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlSources to be of type string, got %T instead", value) } sv.ControlSources = ptr.String(jtv) } case "createdAt": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "lastUpdatedAt": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentControlMetadataList(v *[]types.ControlMetadata, 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.ControlMetadata if *v == nil { cv = []types.ControlMetadata{} } else { cv = *v } for _, value := range shape { var col types.ControlMetadata destAddr := &col if err := awsRestjson1_deserializeDocumentControlMetadata(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentControls(v *[]types.Control, 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.Control if *v == nil { cv = []types.Control{} } else { cv = *v } for _, value := range shape { var col types.Control destAddr := &col if err := awsRestjson1_deserializeDocumentControl(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentControlSet(v **types.ControlSet, 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.ControlSet if *v == nil { sv = &types.ControlSet{} } else { sv = *v } for key, value := range shape { switch key { case "controls": if err := awsRestjson1_deserializeDocumentControls(&sv.Controls, value); err != nil { return err } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlSetName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentControlSets(v *[]types.ControlSet, 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.ControlSet if *v == nil { cv = []types.ControlSet{} } else { cv = *v } for _, value := range shape { var col types.ControlSet destAddr := &col if err := awsRestjson1_deserializeDocumentControlSet(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentCreateDelegationRequest(v **types.CreateDelegationRequest, 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.CreateDelegationRequest if *v == nil { sv = &types.CreateDelegationRequest{} } else { sv = *v } for key, value := range shape { switch key { case "comment": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected DelegationComment to be of type string, got %T instead", value) } sv.Comment = ptr.String(jtv) } case "controlSetId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlSetId to be of type string, got %T instead", value) } sv.ControlSetId = ptr.String(jtv) } case "roleArn": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected IamArn to be of type string, got %T instead", value) } sv.RoleArn = ptr.String(jtv) } case "roleType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected RoleType to be of type string, got %T instead", value) } sv.RoleType = types.RoleType(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentDefaultExportDestination(v **types.DefaultExportDestination, 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.DefaultExportDestination if *v == nil { sv = &types.DefaultExportDestination{} } else { sv = *v } for key, value := range shape { switch key { case "destination": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected S3Url to be of type string, got %T instead", value) } sv.Destination = ptr.String(jtv) } case "destinationType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ExportDestinationType to be of type string, got %T instead", value) } sv.DestinationType = types.ExportDestinationType(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentDelegation(v **types.Delegation, 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.Delegation if *v == nil { sv = &types.Delegation{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.AssessmentId = ptr.String(jtv) } case "assessmentName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentName to be of type string, got %T instead", value) } sv.AssessmentName = ptr.String(jtv) } case "comment": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected DelegationComment to be of type string, got %T instead", value) } sv.Comment = ptr.String(jtv) } case "controlSetId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlSetId to be of type string, got %T instead", value) } sv.ControlSetId = ptr.String(jtv) } case "createdBy": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected CreatedBy to be of type string, got %T instead", value) } sv.CreatedBy = ptr.String(jtv) } case "creationTime": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "lastUpdated": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdated = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "roleArn": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected IamArn to be of type string, got %T instead", value) } sv.RoleArn = ptr.String(jtv) } case "roleType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected RoleType to be of type string, got %T instead", value) } sv.RoleType = types.RoleType(jtv) } case "status": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected DelegationStatus to be of type string, got %T instead", value) } sv.Status = types.DelegationStatus(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentDelegationMetadata(v **types.DelegationMetadata, 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.DelegationMetadata if *v == nil { sv = &types.DelegationMetadata{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.AssessmentId = ptr.String(jtv) } case "assessmentName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentName to be of type string, got %T instead", value) } sv.AssessmentName = ptr.String(jtv) } case "controlSetName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.ControlSetName = ptr.String(jtv) } case "creationTime": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "roleArn": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected IamArn to be of type string, got %T instead", value) } sv.RoleArn = ptr.String(jtv) } case "status": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected DelegationStatus to be of type string, got %T instead", value) } sv.Status = types.DelegationStatus(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentDelegationMetadataList(v *[]types.DelegationMetadata, 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.DelegationMetadata if *v == nil { cv = []types.DelegationMetadata{} } else { cv = *v } for _, value := range shape { var col types.DelegationMetadata destAddr := &col if err := awsRestjson1_deserializeDocumentDelegationMetadata(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentDelegations(v *[]types.Delegation, 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.Delegation if *v == nil { cv = []types.Delegation{} } else { cv = *v } for _, value := range shape { var col types.Delegation destAddr := &col if err := awsRestjson1_deserializeDocumentDelegation(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentDeregistrationPolicy(v **types.DeregistrationPolicy, 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.DeregistrationPolicy if *v == nil { sv = &types.DeregistrationPolicy{} } else { sv = *v } for key, value := range shape { switch key { case "deleteResources": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected DeleteResources to be of type string, got %T instead", value) } sv.DeleteResources = types.DeleteResources(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentEvidence(v **types.Evidence, 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.Evidence if *v == nil { sv = &types.Evidence{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentReportSelection": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.AssessmentReportSelection = ptr.String(jtv) } case "attributes": if err := awsRestjson1_deserializeDocumentEvidenceAttributes(&sv.Attributes, value); err != nil { return err } case "awsAccountId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) } sv.AwsAccountId = ptr.String(jtv) } case "awsOrganization": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.AwsOrganization = ptr.String(jtv) } case "complianceCheck": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.ComplianceCheck = ptr.String(jtv) } case "dataSource": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.DataSource = ptr.String(jtv) } case "eventName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected EventName to be of type string, got %T instead", value) } sv.EventName = ptr.String(jtv) } case "eventSource": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AWSServiceName to be of type string, got %T instead", value) } sv.EventSource = ptr.String(jtv) } case "evidenceAwsAccountId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) } sv.EvidenceAwsAccountId = ptr.String(jtv) } case "evidenceByType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.EvidenceByType = ptr.String(jtv) } case "evidenceFolderId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.EvidenceFolderId = ptr.String(jtv) } case "iamId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected IamArn to be of type string, got %T instead", value) } sv.IamId = ptr.String(jtv) } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "resourcesIncluded": if err := awsRestjson1_deserializeDocumentResources(&sv.ResourcesIncluded, value); err != nil { return err } case "time": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.Time = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentEvidenceAttributes(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 EvidenceAttributeValue to be of type string, got %T instead", value) } parsedVal = jtv } mv[key] = parsedVal } *v = mv return nil } func awsRestjson1_deserializeDocumentEvidenceFinderEnablement(v **types.EvidenceFinderEnablement, 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.EvidenceFinderEnablement if *v == nil { sv = &types.EvidenceFinderEnablement{} } else { sv = *v } for key, value := range shape { switch key { case "backfillStatus": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected EvidenceFinderBackfillStatus to be of type string, got %T instead", value) } sv.BackfillStatus = types.EvidenceFinderBackfillStatus(jtv) } case "enablementStatus": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected EvidenceFinderEnablementStatus to be of type string, got %T instead", value) } sv.EnablementStatus = types.EvidenceFinderEnablementStatus(jtv) } case "error": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) } sv.Error = ptr.String(jtv) } case "eventDataStoreArn": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected CloudTrailArn to be of type string, got %T instead", value) } sv.EventDataStoreArn = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentEvidenceIds(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 UUID to be of type string, got %T instead", value) } col = jtv } cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentEvidenceInsights(v **types.EvidenceInsights, 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.EvidenceInsights if *v == nil { sv = &types.EvidenceInsights{} } else { sv = *v } for key, value := range shape { switch key { case "compliantEvidenceCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.CompliantEvidenceCount = ptr.Int32(int32(i64)) } case "inconclusiveEvidenceCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.InconclusiveEvidenceCount = ptr.Int32(int32(i64)) } case "noncompliantEvidenceCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.NoncompliantEvidenceCount = ptr.Int32(int32(i64)) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentEvidenceList(v *[]types.Evidence, 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.Evidence if *v == nil { cv = []types.Evidence{} } else { cv = *v } for _, value := range shape { var col types.Evidence destAddr := &col if err := awsRestjson1_deserializeDocumentEvidence(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentEvidenceSources(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 NonEmptyString to be of type string, got %T instead", value) } col = jtv } cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentFramework(v **types.Framework, 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.Framework if *v == nil { sv = &types.Framework{} } 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 AuditManagerArn to be of type string, got %T instead", value) } sv.Arn = ptr.String(jtv) } case "complianceType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ComplianceType to be of type string, got %T instead", value) } sv.ComplianceType = ptr.String(jtv) } case "controlSets": if err := awsRestjson1_deserializeDocumentControlSets(&sv.ControlSets, value); err != nil { return err } case "controlSources": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlSources to be of type string, got %T instead", value) } sv.ControlSources = ptr.String(jtv) } case "createdAt": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "createdBy": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected CreatedBy to be of type string, got %T instead", value) } sv.CreatedBy = ptr.String(jtv) } case "description": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected FrameworkDescription to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "lastUpdatedAt": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "lastUpdatedBy": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected LastUpdatedBy to be of type string, got %T instead", value) } sv.LastUpdatedBy = ptr.String(jtv) } case "logo": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Filename to be of type string, got %T instead", value) } sv.Logo = ptr.String(jtv) } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected FrameworkName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } case "tags": if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { return err } case "type": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected FrameworkType to be of type string, got %T instead", value) } sv.Type = types.FrameworkType(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentFrameworkMetadata(v **types.FrameworkMetadata, 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.FrameworkMetadata if *v == nil { sv = &types.FrameworkMetadata{} } else { sv = *v } for key, value := range shape { switch key { case "complianceType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ComplianceType to be of type string, got %T instead", value) } sv.ComplianceType = ptr.String(jtv) } case "description": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentFrameworkDescription to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } case "logo": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected Filename to be of type string, got %T instead", value) } sv.Logo = ptr.String(jtv) } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentFrameworkMetadataList(v *[]types.AssessmentFrameworkMetadata, 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.AssessmentFrameworkMetadata if *v == nil { cv = []types.AssessmentFrameworkMetadata{} } else { cv = *v } for _, value := range shape { var col types.AssessmentFrameworkMetadata destAddr := &col if err := awsRestjson1_deserializeDocumentAssessmentFrameworkMetadata(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentInsights(v **types.Insights, 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.Insights if *v == nil { sv = &types.Insights{} } else { sv = *v } for key, value := range shape { switch key { case "activeAssessmentsCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.ActiveAssessmentsCount = ptr.Int32(int32(i64)) } case "assessmentControlsCountByNoncompliantEvidence": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.AssessmentControlsCountByNoncompliantEvidence = ptr.Int32(int32(i64)) } case "compliantEvidenceCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.CompliantEvidenceCount = ptr.Int32(int32(i64)) } case "inconclusiveEvidenceCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.InconclusiveEvidenceCount = ptr.Int32(int32(i64)) } case "lastUpdated": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdated = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "noncompliantEvidenceCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.NoncompliantEvidenceCount = ptr.Int32(int32(i64)) } case "totalAssessmentControlsCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.TotalAssessmentControlsCount = ptr.Int32(int32(i64)) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentInsightsByAssessment(v **types.InsightsByAssessment, 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.InsightsByAssessment if *v == nil { sv = &types.InsightsByAssessment{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentControlsCountByNoncompliantEvidence": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.AssessmentControlsCountByNoncompliantEvidence = ptr.Int32(int32(i64)) } case "compliantEvidenceCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.CompliantEvidenceCount = ptr.Int32(int32(i64)) } case "inconclusiveEvidenceCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.InconclusiveEvidenceCount = ptr.Int32(int32(i64)) } case "lastUpdated": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.LastUpdated = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "noncompliantEvidenceCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.NoncompliantEvidenceCount = ptr.Int32(int32(i64)) } case "totalAssessmentControlsCount": if value != nil { jtv, ok := value.(json.Number) if !ok { return fmt.Errorf("expected NullableInteger to be json.Number, got %T instead", value) } i64, err := jtv.Int64() if err != nil { return err } sv.TotalAssessmentControlsCount = ptr.Int32(int32(i64)) } 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": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.Message = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentKeywords(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 KeywordValue to be of type string, got %T instead", value) } col = jtv } cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentListAssessmentMetadata(v *[]types.AssessmentMetadataItem, 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.AssessmentMetadataItem if *v == nil { cv = []types.AssessmentMetadataItem{} } else { cv = *v } for _, value := range shape { var col types.AssessmentMetadataItem destAddr := &col if err := awsRestjson1_deserializeDocumentAssessmentMetadataItem(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentManualEvidence(v **types.ManualEvidence, 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.ManualEvidence if *v == nil { sv = &types.ManualEvidence{} } else { sv = *v } for key, value := range shape { switch key { case "evidenceFileName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ManualEvidenceLocalFileName to be of type string, got %T instead", value) } sv.EvidenceFileName = ptr.String(jtv) } case "s3ResourcePath": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected S3Url to be of type string, got %T instead", value) } sv.S3ResourcePath = ptr.String(jtv) } case "textResponse": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ManualEvidenceTextResponse to be of type string, got %T instead", value) } sv.TextResponse = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentNotification(v **types.Notification, 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.Notification if *v == nil { sv = &types.Notification{} } else { sv = *v } for key, value := range shape { switch key { case "assessmentId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UUID to be of type string, got %T instead", value) } sv.AssessmentId = ptr.String(jtv) } case "assessmentName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AssessmentName to be of type string, got %T instead", value) } sv.AssessmentName = ptr.String(jtv) } case "controlSetId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected ControlSetId to be of type string, got %T instead", value) } sv.ControlSetId = ptr.String(jtv) } case "controlSetName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.ControlSetName = ptr.String(jtv) } case "description": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } case "eventTime": if value != nil { switch jtv := value.(type) { case json.Number: f64, err := jtv.Float64() if err != nil { return err } sv.EventTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) default: return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) } } case "id": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected TimestampUUID to be of type string, got %T instead", value) } sv.Id = ptr.String(jtv) } case "source": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.Source = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentNotifications(v *[]types.Notification, 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.Notification if *v == nil { cv = []types.Notification{} } else { cv = *v } for _, value := range shape { var col types.Notification destAddr := &col if err := awsRestjson1_deserializeDocumentNotification(&destAddr, value); err != nil { return err } col = *destAddr 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 GenericArn to be of type string, got %T instead", value) } sv.Arn = ptr.String(jtv) } case "complianceCheck": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.ComplianceCheck = 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_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": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.Message = ptr.String(jtv) } case "resourceId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.ResourceId = ptr.String(jtv) } case "resourceType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.ResourceType = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_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_deserializeDocumentRole(v **types.Role, 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.Role if *v == nil { sv = &types.Role{} } else { sv = *v } for key, value := range shape { switch key { case "roleArn": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected IamArn to be of type string, got %T instead", value) } sv.RoleArn = ptr.String(jtv) } case "roleType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected RoleType to be of type string, got %T instead", value) } sv.RoleType = types.RoleType(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentRoles(v *[]types.Role, 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.Role if *v == nil { cv = []types.Role{} } else { cv = *v } for _, value := range shape { var col types.Role destAddr := &col if err := awsRestjson1_deserializeDocumentRole(&destAddr, value); err != nil { return err } col = *destAddr cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentScope(v **types.Scope, 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.Scope if *v == nil { sv = &types.Scope{} } else { sv = *v } for key, value := range shape { switch key { case "awsAccounts": if err := awsRestjson1_deserializeDocumentAWSAccounts(&sv.AwsAccounts, value); err != nil { return err } case "awsServices": if err := awsRestjson1_deserializeDocumentAWSServices(&sv.AwsServices, value); err != nil { return err } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentServiceMetadata(v **types.ServiceMetadata, 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.ServiceMetadata if *v == nil { sv = &types.ServiceMetadata{} } else { sv = *v } for key, value := range shape { switch key { case "category": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString 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 NonEmptyString to be of type string, got %T instead", value) } sv.Description = ptr.String(jtv) } case "displayName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) } sv.DisplayName = ptr.String(jtv) } case "name": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected AWSServiceName to be of type string, got %T instead", value) } sv.Name = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentServiceMetadataList(v *[]types.ServiceMetadata, 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.ServiceMetadata if *v == nil { cv = []types.ServiceMetadata{} } else { cv = *v } for _, value := range shape { var col types.ServiceMetadata destAddr := &col if err := awsRestjson1_deserializeDocumentServiceMetadata(&destAddr, value); err != nil { return err } col = *destAddr 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": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.Message = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentSettings(v **types.Settings, 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.Settings if *v == nil { sv = &types.Settings{} } else { sv = *v } for key, value := range shape { switch key { case "defaultAssessmentReportsDestination": if err := awsRestjson1_deserializeDocumentAssessmentReportsDestination(&sv.DefaultAssessmentReportsDestination, value); err != nil { return err } case "defaultExportDestination": if err := awsRestjson1_deserializeDocumentDefaultExportDestination(&sv.DefaultExportDestination, value); err != nil { return err } case "defaultProcessOwners": if err := awsRestjson1_deserializeDocumentRoles(&sv.DefaultProcessOwners, value); err != nil { return err } case "deregistrationPolicy": if err := awsRestjson1_deserializeDocumentDeregistrationPolicy(&sv.DeregistrationPolicy, value); err != nil { return err } case "evidenceFinderEnablement": if err := awsRestjson1_deserializeDocumentEvidenceFinderEnablement(&sv.EvidenceFinderEnablement, value); err != nil { return err } case "isAwsOrgEnabled": if value != nil { jtv, ok := value.(bool) if !ok { return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) } sv.IsAwsOrgEnabled = ptr.Bool(jtv) } case "kmsKey": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected KmsKey to be of type string, got %T instead", value) } sv.KmsKey = ptr.String(jtv) } case "snsTopic": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected SNSTopic to be of type string, got %T instead", value) } sv.SnsTopic = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentSourceKeyword(v **types.SourceKeyword, 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.SourceKeyword if *v == nil { sv = &types.SourceKeyword{} } else { sv = *v } for key, value := range shape { switch key { case "keywordInputType": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected KeywordInputType to be of type string, got %T instead", value) } sv.KeywordInputType = types.KeywordInputType(jtv) } case "keywordValue": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected KeywordValue to be of type string, got %T instead", value) } sv.KeywordValue = ptr.String(jtv) } default: _, _ = key, value } } *v = sv 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_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": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } sv.Message = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentURL(v **types.URL, 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.URL if *v == nil { sv = &types.URL{} } else { sv = *v } for key, value := range shape { switch key { case "hyperlinkName": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected HyperlinkName to be of type string, got %T instead", value) } sv.HyperlinkName = ptr.String(jtv) } case "link": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected UrlLink to be of type string, got %T instead", value) } sv.Link = ptr.String(jtv) } default: _, _ = key, value } } *v = sv return nil } func awsRestjson1_deserializeDocumentValidationErrors(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 NonEmptyString to be of type string, got %T instead", value) } col = jtv } cv = append(cv, col) } *v = cv return nil } func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } if value == nil { return nil } shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } var sv *types.ValidationException if *v == nil { sv = &types.ValidationException{} } else { sv = *v } for key, value := range shape { switch key { case "fields": if err := awsRestjson1_deserializeDocumentValidationExceptionFieldList(&sv.Fields, value); err != nil { return err } 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 "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 }