in service/amplify/deserializers.go [7086:7379]
func awsRestjson1_deserializeDocumentBranch(v **types.Branch, 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.Branch
if *v == nil {
sv = &types.Branch{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "activeJobId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ActiveJobId to be of type string, got %T instead", value)
}
sv.ActiveJobId = ptr.String(jtv)
}
case "associatedResources":
if err := awsRestjson1_deserializeDocumentAssociatedResources(&sv.AssociatedResources, value); err != nil {
return err
}
case "backend":
if err := awsRestjson1_deserializeDocumentBackend(&sv.Backend, value); err != nil {
return err
}
case "backendEnvironmentArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected BackendEnvironmentArn to be of type string, got %T instead", value)
}
sv.BackendEnvironmentArn = ptr.String(jtv)
}
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 "branchArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected BranchArn to be of type string, got %T instead", value)
}
sv.BranchArn = ptr.String(jtv)
}
case "branchName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected BranchName to be of type string, got %T instead", value)
}
sv.BranchName = 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 "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 "customDomains":
if err := awsRestjson1_deserializeDocumentCustomDomains(&sv.CustomDomains, value); err != nil {
return err
}
case "description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "destinationBranch":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected BranchName to be of type string, got %T instead", value)
}
sv.DestinationBranch = ptr.String(jtv)
}
case "displayName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DisplayName to be of type string, got %T instead", value)
}
sv.DisplayName = ptr.String(jtv)
}
case "enableAutoBuild":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected EnableAutoBuild to be of type *bool, got %T instead", value)
}
sv.EnableAutoBuild = 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 "enableNotification":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected EnableNotification to be of type *bool, got %T instead", value)
}
sv.EnableNotification = ptr.Bool(jtv)
}
case "enablePerformanceMode":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected EnablePerformanceMode to be of type *bool, got %T instead", value)
}
sv.EnablePerformanceMode = ptr.Bool(jtv)
}
case "enablePullRequestPreview":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected EnablePullRequestPreview to be of type *bool, got %T instead", value)
}
sv.EnablePullRequestPreview = ptr.Bool(jtv)
}
case "enableSkewProtection":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected EnableSkewProtection to be of type *bool, got %T instead", value)
}
sv.EnableSkewProtection = ptr.Bool(jtv)
}
case "environmentVariables":
if err := awsRestjson1_deserializeDocumentEnvironmentVariables(&sv.EnvironmentVariables, value); err != nil {
return err
}
case "framework":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Framework to be of type string, got %T instead", value)
}
sv.Framework = ptr.String(jtv)
}
case "pullRequestEnvironmentName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PullRequestEnvironmentName to be of type string, got %T instead", value)
}
sv.PullRequestEnvironmentName = ptr.String(jtv)
}
case "sourceBranch":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected BranchName to be of type string, got %T instead", value)
}
sv.SourceBranch = ptr.String(jtv)
}
case "stage":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Stage to be of type string, got %T instead", value)
}
sv.Stage = types.Stage(jtv)
}
case "tags":
if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil {
return err
}
case "thumbnailUrl":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ThumbnailUrl to be of type string, got %T instead", value)
}
sv.ThumbnailUrl = ptr.String(jtv)
}
case "totalNumberOfJobs":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TotalNumberOfJobs to be of type string, got %T instead", value)
}
sv.TotalNumberOfJobs = ptr.String(jtv)
}
case "ttl":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TTL to be of type string, got %T instead", value)
}
sv.Ttl = ptr.String(jtv)
}
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)
}
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}