func awsRestjson1_deserializeDocumentOrganizationRecommendation()

in service/trustedadvisor/deserializers.go [2375:2589]


func awsRestjson1_deserializeDocumentOrganizationRecommendation(v **types.OrganizationRecommendation, value interface{}) error {
	if v == nil {
		return fmt.Errorf("unexpected nil of type %T", 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.OrganizationRecommendation
	if *v == nil {
		sv = &types.OrganizationRecommendation{}
	} 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 OrganizationRecommendationArn to be of type string, got %T instead", value)
				}
				sv.Arn = ptr.String(jtv)
			}

		case "awsServices":
			if err := awsRestjson1_deserializeDocumentRecommendationAwsServiceList(&sv.AwsServices, value); err != nil {
				return err
			}

		case "checkArn":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected String to be of type string, got %T instead", value)
				}
				sv.CheckArn = ptr.String(jtv)
			}

		case "createdAt":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
				}
				t, err := smithytime.ParseDateTime(jtv)
				if err != nil {
					return err
				}
				sv.CreatedAt = ptr.Time(t)
			}

		case "createdBy":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected String to be of type string, got %T instead", value)
				}
				sv.CreatedBy = ptr.String(jtv)
			}

		case "description":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected String 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 String to be of type string, got %T instead", value)
				}
				sv.Id = ptr.String(jtv)
			}

		case "lastUpdatedAt":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
				}
				t, err := smithytime.ParseDateTime(jtv)
				if err != nil {
					return err
				}
				sv.LastUpdatedAt = ptr.Time(t)
			}

		case "lifecycleStage":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected RecommendationLifecycleStage to be of type string, got %T instead", value)
				}
				sv.LifecycleStage = types.RecommendationLifecycleStage(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)
			}

		case "pillars":
			if err := awsRestjson1_deserializeDocumentRecommendationPillarList(&sv.Pillars, value); err != nil {
				return err
			}

		case "pillarSpecificAggregates":
			if err := awsRestjson1_deserializeDocumentRecommendationPillarSpecificAggregates(&sv.PillarSpecificAggregates, value); err != nil {
				return err
			}

		case "resolvedAt":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
				}
				t, err := smithytime.ParseDateTime(jtv)
				if err != nil {
					return err
				}
				sv.ResolvedAt = ptr.Time(t)
			}

		case "resourcesAggregates":
			if err := awsRestjson1_deserializeDocumentRecommendationResourcesAggregates(&sv.ResourcesAggregates, value); err != nil {
				return err
			}

		case "source":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected RecommendationSource to be of type string, got %T instead", value)
				}
				sv.Source = types.RecommendationSource(jtv)
			}

		case "status":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected RecommendationStatus to be of type string, got %T instead", value)
				}
				sv.Status = types.RecommendationStatus(jtv)
			}

		case "type":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected RecommendationType to be of type string, got %T instead", value)
				}
				sv.Type = types.RecommendationType(jtv)
			}

		case "updatedOnBehalfOf":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected String to be of type string, got %T instead", value)
				}
				sv.UpdatedOnBehalfOf = ptr.String(jtv)
			}

		case "updatedOnBehalfOfJobTitle":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected String to be of type string, got %T instead", value)
				}
				sv.UpdatedOnBehalfOfJobTitle = ptr.String(jtv)
			}

		case "updateReason":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected RecommendationUpdateReason to be of type string, got %T instead", value)
				}
				sv.UpdateReason = ptr.String(jtv)
			}

		case "updateReasonCode":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected UpdateRecommendationLifecycleStageReasonCode to be of type string, got %T instead", value)
				}
				sv.UpdateReasonCode = types.UpdateRecommendationLifecycleStageReasonCode(jtv)
			}

		default:
			_, _ = key, value

		}
	}
	*v = sv
	return nil
}