func awsRestjson1_deserializeDocumentApp()

in service/amplify/deserializers.go [6259:6529]


func awsRestjson1_deserializeDocumentApp(v **types.App, value interface{}) error {
	if v == nil {
		return fmt.Errorf("unexpected nil of type %T", 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.App
	if *v == nil {
		sv = &types.App{}
	} else {
		sv = *v
	}

	for key, value := range shape {
		switch key {
		case "appArn":
			if value != nil {
				jtv, ok := value.(string)
				if !ok {
					return fmt.Errorf("expected AppArn to be of type string, got %T instead", value)
				}
				sv.AppArn = ptr.String(jtv)
			}

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

		case "autoBranchCreationConfig":
			if err := awsRestjson1_deserializeDocumentAutoBranchCreationConfig(&sv.AutoBranchCreationConfig, value); err != nil {
				return err
			}

		case "autoBranchCreationPatterns":
			if err := awsRestjson1_deserializeDocumentAutoBranchCreationPatterns(&sv.AutoBranchCreationPatterns, value); err != nil {
				return err
			}

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

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

		case "cacheConfig":
			if err := awsRestjson1_deserializeDocumentCacheConfig(&sv.CacheConfig, value); err != nil {
				return err
			}

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

		case "createTime":
			if value != nil {
				switch jtv := value.(type) {
				case json.Number:
					f64, err := jtv.Float64()
					if err != nil {
						return err
					}
					sv.CreateTime = ptr.Time(smithytime.ParseEpochSeconds(f64))

				default:
					return fmt.Errorf("expected CreateTime to be a JSON Number, got %T instead", value)

				}
			}

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

		case "customRules":
			if err := awsRestjson1_deserializeDocumentCustomRules(&sv.CustomRules, value); err != nil {
				return err
			}

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

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

		case "enableAutoBranchCreation":
			if value != nil {
				jtv, ok := value.(bool)
				if !ok {
					return fmt.Errorf("expected EnableAutoBranchCreation to be of type *bool, got %T instead", value)
				}
				sv.EnableAutoBranchCreation = ptr.Bool(jtv)
			}

		case "enableBasicAuth":
			if value != nil {
				jtv, ok := value.(bool)
				if !ok {
					return fmt.Errorf("expected EnableBasicAuth to be of type *bool, got %T instead", value)
				}
				sv.EnableBasicAuth = ptr.Bool(jtv)
			}

		case "enableBranchAutoBuild":
			if value != nil {
				jtv, ok := value.(bool)
				if !ok {
					return fmt.Errorf("expected EnableBranchAutoBuild to be of type *bool, got %T instead", value)
				}
				sv.EnableBranchAutoBuild = ptr.Bool(jtv)
			}

		case "enableBranchAutoDeletion":
			if value != nil {
				jtv, ok := value.(bool)
				if !ok {
					return fmt.Errorf("expected EnableBranchAutoDeletion to be of type *bool, got %T instead", value)
				}
				sv.EnableBranchAutoDeletion = ptr.Bool(jtv)
			}

		case "environmentVariables":
			if err := awsRestjson1_deserializeDocumentEnvironmentVariables(&sv.EnvironmentVariables, value); err != nil {
				return err
			}

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

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

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

		case "productionBranch":
			if err := awsRestjson1_deserializeDocumentProductionBranch(&sv.ProductionBranch, value); err != nil {
				return err
			}

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

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

		case "tags":
			if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil {
				return err
			}

		case "updateTime":
			if value != nil {
				switch jtv := value.(type) {
				case json.Number:
					f64, err := jtv.Float64()
					if err != nil {
						return err
					}
					sv.UpdateTime = ptr.Time(smithytime.ParseEpochSeconds(f64))

				default:
					return fmt.Errorf("expected UpdateTime to be a JSON Number, got %T instead", value)

				}
			}

		case "wafConfiguration":
			if err := awsRestjson1_deserializeDocumentWafConfiguration(&sv.WafConfiguration, value); err != nil {
				return err
			}

		case "webhookCreateTime":
			if value != nil {
				switch jtv := value.(type) {
				case json.Number:
					f64, err := jtv.Float64()
					if err != nil {
						return err
					}
					sv.WebhookCreateTime = ptr.Time(smithytime.ParseEpochSeconds(f64))

				default:
					return fmt.Errorf("expected webhookCreateTime to be a JSON Number, got %T instead", value)

				}
			}

		default:
			_, _ = key, value

		}
	}
	*v = sv
	return nil
}