func UnstructuredToJob()

in unstructured/google/run/alpha/job.go [384:1129]


func UnstructuredToJob(u *unstructured.Resource) (*dclService.Job, error) {
	r := &dclService.Job{}
	if _, ok := u.Object["annotations"]; ok {
		if rAnnotations, ok := u.Object["annotations"].(map[string]interface{}); ok {
			m := make(map[string]string)
			for k, v := range rAnnotations {
				if s, ok := v.(string); ok {
					m[k] = s
				}
			}
			r.Annotations = m
		} else {
			return nil, fmt.Errorf("r.Annotations: expected map[string]interface{}")
		}
	}
	if _, ok := u.Object["binaryAuthorization"]; ok {
		if rBinaryAuthorization, ok := u.Object["binaryAuthorization"].(map[string]interface{}); ok {
			r.BinaryAuthorization = &dclService.JobBinaryAuthorization{}
			if _, ok := rBinaryAuthorization["breakglassJustification"]; ok {
				if s, ok := rBinaryAuthorization["breakglassJustification"].(string); ok {
					r.BinaryAuthorization.BreakglassJustification = dcl.String(s)
				} else {
					return nil, fmt.Errorf("r.BinaryAuthorization.BreakglassJustification: expected string")
				}
			}
			if _, ok := rBinaryAuthorization["useDefault"]; ok {
				if b, ok := rBinaryAuthorization["useDefault"].(bool); ok {
					r.BinaryAuthorization.UseDefault = dcl.Bool(b)
				} else {
					return nil, fmt.Errorf("r.BinaryAuthorization.UseDefault: expected bool")
				}
			}
		} else {
			return nil, fmt.Errorf("r.BinaryAuthorization: expected map[string]interface{}")
		}
	}
	if _, ok := u.Object["client"]; ok {
		if s, ok := u.Object["client"].(string); ok {
			r.Client = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Client: expected string")
		}
	}
	if _, ok := u.Object["clientVersion"]; ok {
		if s, ok := u.Object["clientVersion"].(string); ok {
			r.ClientVersion = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.ClientVersion: expected string")
		}
	}
	if _, ok := u.Object["conditions"]; ok {
		if s, ok := u.Object["conditions"].([]interface{}); ok {
			for _, o := range s {
				if objval, ok := o.(map[string]interface{}); ok {
					var rConditions dclService.JobConditions
					if _, ok := objval["executionReason"]; ok {
						if s, ok := objval["executionReason"].(string); ok {
							rConditions.ExecutionReason = dclService.JobConditionsExecutionReasonEnumRef(s)
						} else {
							return nil, fmt.Errorf("rConditions.ExecutionReason: expected string")
						}
					}
					if _, ok := objval["lastTransitionTime"]; ok {
						if s, ok := objval["lastTransitionTime"].(string); ok {
							rConditions.LastTransitionTime = dcl.String(s)
						} else {
							return nil, fmt.Errorf("rConditions.LastTransitionTime: expected string")
						}
					}
					if _, ok := objval["message"]; ok {
						if s, ok := objval["message"].(string); ok {
							rConditions.Message = dcl.String(s)
						} else {
							return nil, fmt.Errorf("rConditions.Message: expected string")
						}
					}
					if _, ok := objval["reason"]; ok {
						if s, ok := objval["reason"].(string); ok {
							rConditions.Reason = dclService.JobConditionsReasonEnumRef(s)
						} else {
							return nil, fmt.Errorf("rConditions.Reason: expected string")
						}
					}
					if _, ok := objval["revisionReason"]; ok {
						if s, ok := objval["revisionReason"].(string); ok {
							rConditions.RevisionReason = dclService.JobConditionsRevisionReasonEnumRef(s)
						} else {
							return nil, fmt.Errorf("rConditions.RevisionReason: expected string")
						}
					}
					if _, ok := objval["severity"]; ok {
						if s, ok := objval["severity"].(string); ok {
							rConditions.Severity = dclService.JobConditionsSeverityEnumRef(s)
						} else {
							return nil, fmt.Errorf("rConditions.Severity: expected string")
						}
					}
					if _, ok := objval["state"]; ok {
						if s, ok := objval["state"].(string); ok {
							rConditions.State = dclService.JobConditionsStateEnumRef(s)
						} else {
							return nil, fmt.Errorf("rConditions.State: expected string")
						}
					}
					if _, ok := objval["type"]; ok {
						if s, ok := objval["type"].(string); ok {
							rConditions.Type = dcl.String(s)
						} else {
							return nil, fmt.Errorf("rConditions.Type: expected string")
						}
					}
					r.Conditions = append(r.Conditions, rConditions)
				}
			}
		} else {
			return nil, fmt.Errorf("r.Conditions: expected []interface{}")
		}
	}
	if _, ok := u.Object["createTime"]; ok {
		if s, ok := u.Object["createTime"].(string); ok {
			r.CreateTime = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.CreateTime: expected string")
		}
	}
	if _, ok := u.Object["creator"]; ok {
		if s, ok := u.Object["creator"].(string); ok {
			r.Creator = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Creator: expected string")
		}
	}
	if _, ok := u.Object["deleteTime"]; ok {
		if s, ok := u.Object["deleteTime"].(string); ok {
			r.DeleteTime = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.DeleteTime: expected string")
		}
	}
	if _, ok := u.Object["etag"]; ok {
		if s, ok := u.Object["etag"].(string); ok {
			r.Etag = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Etag: expected string")
		}
	}
	if _, ok := u.Object["executionCount"]; ok {
		if i, ok := u.Object["executionCount"].(int64); ok {
			r.ExecutionCount = dcl.Int64(i)
		} else {
			return nil, fmt.Errorf("r.ExecutionCount: expected int64")
		}
	}
	if _, ok := u.Object["expireTime"]; ok {
		if s, ok := u.Object["expireTime"].(string); ok {
			r.ExpireTime = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.ExpireTime: expected string")
		}
	}
	if _, ok := u.Object["generation"]; ok {
		if i, ok := u.Object["generation"].(int64); ok {
			r.Generation = dcl.Int64(i)
		} else {
			return nil, fmt.Errorf("r.Generation: expected int64")
		}
	}
	if _, ok := u.Object["labels"]; ok {
		if rLabels, ok := u.Object["labels"].(map[string]interface{}); ok {
			m := make(map[string]string)
			for k, v := range rLabels {
				if s, ok := v.(string); ok {
					m[k] = s
				}
			}
			r.Labels = m
		} else {
			return nil, fmt.Errorf("r.Labels: expected map[string]interface{}")
		}
	}
	if _, ok := u.Object["lastModifier"]; ok {
		if s, ok := u.Object["lastModifier"].(string); ok {
			r.LastModifier = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.LastModifier: expected string")
		}
	}
	if _, ok := u.Object["latestCreatedExecution"]; ok {
		if rLatestCreatedExecution, ok := u.Object["latestCreatedExecution"].(map[string]interface{}); ok {
			r.LatestCreatedExecution = &dclService.JobLatestCreatedExecution{}
			if _, ok := rLatestCreatedExecution["createTime"]; ok {
				if s, ok := rLatestCreatedExecution["createTime"].(string); ok {
					r.LatestCreatedExecution.CreateTime = dcl.String(s)
				} else {
					return nil, fmt.Errorf("r.LatestCreatedExecution.CreateTime: expected string")
				}
			}
			if _, ok := rLatestCreatedExecution["name"]; ok {
				if s, ok := rLatestCreatedExecution["name"].(string); ok {
					r.LatestCreatedExecution.Name = dcl.String(s)
				} else {
					return nil, fmt.Errorf("r.LatestCreatedExecution.Name: expected string")
				}
			}
		} else {
			return nil, fmt.Errorf("r.LatestCreatedExecution: expected map[string]interface{}")
		}
	}
	if _, ok := u.Object["latestSucceededExecution"]; ok {
		if rLatestSucceededExecution, ok := u.Object["latestSucceededExecution"].(map[string]interface{}); ok {
			r.LatestSucceededExecution = &dclService.JobLatestSucceededExecution{}
			if _, ok := rLatestSucceededExecution["createTime"]; ok {
				if s, ok := rLatestSucceededExecution["createTime"].(string); ok {
					r.LatestSucceededExecution.CreateTime = dcl.String(s)
				} else {
					return nil, fmt.Errorf("r.LatestSucceededExecution.CreateTime: expected string")
				}
			}
			if _, ok := rLatestSucceededExecution["name"]; ok {
				if s, ok := rLatestSucceededExecution["name"].(string); ok {
					r.LatestSucceededExecution.Name = dcl.String(s)
				} else {
					return nil, fmt.Errorf("r.LatestSucceededExecution.Name: expected string")
				}
			}
		} else {
			return nil, fmt.Errorf("r.LatestSucceededExecution: expected map[string]interface{}")
		}
	}
	if _, ok := u.Object["launchStage"]; ok {
		if s, ok := u.Object["launchStage"].(string); ok {
			r.LaunchStage = dclService.JobLaunchStageEnumRef(s)
		} else {
			return nil, fmt.Errorf("r.LaunchStage: expected string")
		}
	}
	if _, ok := u.Object["location"]; ok {
		if s, ok := u.Object["location"].(string); ok {
			r.Location = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Location: expected string")
		}
	}
	if _, ok := u.Object["name"]; ok {
		if s, ok := u.Object["name"].(string); ok {
			r.Name = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Name: expected string")
		}
	}
	if _, ok := u.Object["observedGeneration"]; ok {
		if i, ok := u.Object["observedGeneration"].(int64); ok {
			r.ObservedGeneration = dcl.Int64(i)
		} else {
			return nil, fmt.Errorf("r.ObservedGeneration: expected int64")
		}
	}
	if _, ok := u.Object["project"]; ok {
		if s, ok := u.Object["project"].(string); ok {
			r.Project = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Project: expected string")
		}
	}
	if _, ok := u.Object["reconciling"]; ok {
		if b, ok := u.Object["reconciling"].(bool); ok {
			r.Reconciling = dcl.Bool(b)
		} else {
			return nil, fmt.Errorf("r.Reconciling: expected bool")
		}
	}
	if _, ok := u.Object["template"]; ok {
		if rTemplate, ok := u.Object["template"].(map[string]interface{}); ok {
			r.Template = &dclService.JobTemplate{}
			if _, ok := rTemplate["annotations"]; ok {
				if rTemplateAnnotations, ok := rTemplate["annotations"].(map[string]interface{}); ok {
					m := make(map[string]string)
					for k, v := range rTemplateAnnotations {
						if s, ok := v.(string); ok {
							m[k] = s
						}
					}
					r.Template.Annotations = m
				} else {
					return nil, fmt.Errorf("r.Template.Annotations: expected map[string]interface{}")
				}
			}
			if _, ok := rTemplate["labels"]; ok {
				if rTemplateLabels, ok := rTemplate["labels"].(map[string]interface{}); ok {
					m := make(map[string]string)
					for k, v := range rTemplateLabels {
						if s, ok := v.(string); ok {
							m[k] = s
						}
					}
					r.Template.Labels = m
				} else {
					return nil, fmt.Errorf("r.Template.Labels: expected map[string]interface{}")
				}
			}
			if _, ok := rTemplate["parallelism"]; ok {
				if i, ok := rTemplate["parallelism"].(int64); ok {
					r.Template.Parallelism = dcl.Int64(i)
				} else {
					return nil, fmt.Errorf("r.Template.Parallelism: expected int64")
				}
			}
			if _, ok := rTemplate["taskCount"]; ok {
				if i, ok := rTemplate["taskCount"].(int64); ok {
					r.Template.TaskCount = dcl.Int64(i)
				} else {
					return nil, fmt.Errorf("r.Template.TaskCount: expected int64")
				}
			}
			if _, ok := rTemplate["template"]; ok {
				if rTemplateTemplate, ok := rTemplate["template"].(map[string]interface{}); ok {
					r.Template.Template = &dclService.JobTemplateTemplate{}
					if _, ok := rTemplateTemplate["containers"]; ok {
						if s, ok := rTemplateTemplate["containers"].([]interface{}); ok {
							for _, o := range s {
								if objval, ok := o.(map[string]interface{}); ok {
									var rTemplateTemplateContainers dclService.JobTemplateTemplateContainers
									if _, ok := objval["args"]; ok {
										if s, ok := objval["args"].([]interface{}); ok {
											for _, ss := range s {
												if strval, ok := ss.(string); ok {
													rTemplateTemplateContainers.Args = append(rTemplateTemplateContainers.Args, strval)
												}
											}
										} else {
											return nil, fmt.Errorf("rTemplateTemplateContainers.Args: expected []interface{}")
										}
									}
									if _, ok := objval["command"]; ok {
										if s, ok := objval["command"].([]interface{}); ok {
											for _, ss := range s {
												if strval, ok := ss.(string); ok {
													rTemplateTemplateContainers.Command = append(rTemplateTemplateContainers.Command, strval)
												}
											}
										} else {
											return nil, fmt.Errorf("rTemplateTemplateContainers.Command: expected []interface{}")
										}
									}
									if _, ok := objval["env"]; ok {
										if s, ok := objval["env"].([]interface{}); ok {
											for _, o := range s {
												if objval, ok := o.(map[string]interface{}); ok {
													var rTemplateTemplateContainersEnv dclService.JobTemplateTemplateContainersEnv
													if _, ok := objval["name"]; ok {
														if s, ok := objval["name"].(string); ok {
															rTemplateTemplateContainersEnv.Name = dcl.String(s)
														} else {
															return nil, fmt.Errorf("rTemplateTemplateContainersEnv.Name: expected string")
														}
													}
													if _, ok := objval["value"]; ok {
														if s, ok := objval["value"].(string); ok {
															rTemplateTemplateContainersEnv.Value = dcl.String(s)
														} else {
															return nil, fmt.Errorf("rTemplateTemplateContainersEnv.Value: expected string")
														}
													}
													if _, ok := objval["valueSource"]; ok {
														if rTemplateTemplateContainersEnvValueSource, ok := objval["valueSource"].(map[string]interface{}); ok {
															rTemplateTemplateContainersEnv.ValueSource = &dclService.JobTemplateTemplateContainersEnvValueSource{}
															if _, ok := rTemplateTemplateContainersEnvValueSource["secretKeyRef"]; ok {
																if rTemplateTemplateContainersEnvValueSourceSecretKeyRef, ok := rTemplateTemplateContainersEnvValueSource["secretKeyRef"].(map[string]interface{}); ok {
																	rTemplateTemplateContainersEnv.ValueSource.SecretKeyRef = &dclService.JobTemplateTemplateContainersEnvValueSourceSecretKeyRef{}
																	if _, ok := rTemplateTemplateContainersEnvValueSourceSecretKeyRef["secret"]; ok {
																		if s, ok := rTemplateTemplateContainersEnvValueSourceSecretKeyRef["secret"].(string); ok {
																			rTemplateTemplateContainersEnv.ValueSource.SecretKeyRef.Secret = dcl.String(s)
																		} else {
																			return nil, fmt.Errorf("rTemplateTemplateContainersEnv.ValueSource.SecretKeyRef.Secret: expected string")
																		}
																	}
																	if _, ok := rTemplateTemplateContainersEnvValueSourceSecretKeyRef["version"]; ok {
																		if s, ok := rTemplateTemplateContainersEnvValueSourceSecretKeyRef["version"].(string); ok {
																			rTemplateTemplateContainersEnv.ValueSource.SecretKeyRef.Version = dcl.String(s)
																		} else {
																			return nil, fmt.Errorf("rTemplateTemplateContainersEnv.ValueSource.SecretKeyRef.Version: expected string")
																		}
																	}
																} else {
																	return nil, fmt.Errorf("rTemplateTemplateContainersEnv.ValueSource.SecretKeyRef: expected map[string]interface{}")
																}
															}
														} else {
															return nil, fmt.Errorf("rTemplateTemplateContainersEnv.ValueSource: expected map[string]interface{}")
														}
													}
													rTemplateTemplateContainers.Env = append(rTemplateTemplateContainers.Env, rTemplateTemplateContainersEnv)
												}
											}
										} else {
											return nil, fmt.Errorf("rTemplateTemplateContainers.Env: expected []interface{}")
										}
									}
									if _, ok := objval["image"]; ok {
										if s, ok := objval["image"].(string); ok {
											rTemplateTemplateContainers.Image = dcl.String(s)
										} else {
											return nil, fmt.Errorf("rTemplateTemplateContainers.Image: expected string")
										}
									}
									if _, ok := objval["name"]; ok {
										if s, ok := objval["name"].(string); ok {
											rTemplateTemplateContainers.Name = dcl.String(s)
										} else {
											return nil, fmt.Errorf("rTemplateTemplateContainers.Name: expected string")
										}
									}
									if _, ok := objval["ports"]; ok {
										if s, ok := objval["ports"].([]interface{}); ok {
											for _, o := range s {
												if objval, ok := o.(map[string]interface{}); ok {
													var rTemplateTemplateContainersPorts dclService.JobTemplateTemplateContainersPorts
													if _, ok := objval["containerPort"]; ok {
														if i, ok := objval["containerPort"].(int64); ok {
															rTemplateTemplateContainersPorts.ContainerPort = dcl.Int64(i)
														} else {
															return nil, fmt.Errorf("rTemplateTemplateContainersPorts.ContainerPort: expected int64")
														}
													}
													if _, ok := objval["name"]; ok {
														if s, ok := objval["name"].(string); ok {
															rTemplateTemplateContainersPorts.Name = dcl.String(s)
														} else {
															return nil, fmt.Errorf("rTemplateTemplateContainersPorts.Name: expected string")
														}
													}
													rTemplateTemplateContainers.Ports = append(rTemplateTemplateContainers.Ports, rTemplateTemplateContainersPorts)
												}
											}
										} else {
											return nil, fmt.Errorf("rTemplateTemplateContainers.Ports: expected []interface{}")
										}
									}
									if _, ok := objval["resources"]; ok {
										if rTemplateTemplateContainersResources, ok := objval["resources"].(map[string]interface{}); ok {
											rTemplateTemplateContainers.Resources = &dclService.JobTemplateTemplateContainersResources{}
											if _, ok := rTemplateTemplateContainersResources["cpuIdle"]; ok {
												if b, ok := rTemplateTemplateContainersResources["cpuIdle"].(bool); ok {
													rTemplateTemplateContainers.Resources.CpuIdle = dcl.Bool(b)
												} else {
													return nil, fmt.Errorf("rTemplateTemplateContainers.Resources.CpuIdle: expected bool")
												}
											}
											if _, ok := rTemplateTemplateContainersResources["limits"]; ok {
												if rTemplateTemplateContainersResourcesLimits, ok := rTemplateTemplateContainersResources["limits"].(map[string]interface{}); ok {
													m := make(map[string]string)
													for k, v := range rTemplateTemplateContainersResourcesLimits {
														if s, ok := v.(string); ok {
															m[k] = s
														}
													}
													rTemplateTemplateContainers.Resources.Limits = m
												} else {
													return nil, fmt.Errorf("rTemplateTemplateContainers.Resources.Limits: expected map[string]interface{}")
												}
											}
										} else {
											return nil, fmt.Errorf("rTemplateTemplateContainers.Resources: expected map[string]interface{}")
										}
									}
									if _, ok := objval["volumeMounts"]; ok {
										if s, ok := objval["volumeMounts"].([]interface{}); ok {
											for _, o := range s {
												if objval, ok := o.(map[string]interface{}); ok {
													var rTemplateTemplateContainersVolumeMounts dclService.JobTemplateTemplateContainersVolumeMounts
													if _, ok := objval["mountPath"]; ok {
														if s, ok := objval["mountPath"].(string); ok {
															rTemplateTemplateContainersVolumeMounts.MountPath = dcl.String(s)
														} else {
															return nil, fmt.Errorf("rTemplateTemplateContainersVolumeMounts.MountPath: expected string")
														}
													}
													if _, ok := objval["name"]; ok {
														if s, ok := objval["name"].(string); ok {
															rTemplateTemplateContainersVolumeMounts.Name = dcl.String(s)
														} else {
															return nil, fmt.Errorf("rTemplateTemplateContainersVolumeMounts.Name: expected string")
														}
													}
													rTemplateTemplateContainers.VolumeMounts = append(rTemplateTemplateContainers.VolumeMounts, rTemplateTemplateContainersVolumeMounts)
												}
											}
										} else {
											return nil, fmt.Errorf("rTemplateTemplateContainers.VolumeMounts: expected []interface{}")
										}
									}
									r.Template.Template.Containers = append(r.Template.Template.Containers, rTemplateTemplateContainers)
								}
							}
						} else {
							return nil, fmt.Errorf("r.Template.Template.Containers: expected []interface{}")
						}
					}
					if _, ok := rTemplateTemplate["encryptionKey"]; ok {
						if s, ok := rTemplateTemplate["encryptionKey"].(string); ok {
							r.Template.Template.EncryptionKey = dcl.String(s)
						} else {
							return nil, fmt.Errorf("r.Template.Template.EncryptionKey: expected string")
						}
					}
					if _, ok := rTemplateTemplate["executionEnvironment"]; ok {
						if s, ok := rTemplateTemplate["executionEnvironment"].(string); ok {
							r.Template.Template.ExecutionEnvironment = dclService.JobTemplateTemplateExecutionEnvironmentEnumRef(s)
						} else {
							return nil, fmt.Errorf("r.Template.Template.ExecutionEnvironment: expected string")
						}
					}
					if _, ok := rTemplateTemplate["maxRetries"]; ok {
						if i, ok := rTemplateTemplate["maxRetries"].(int64); ok {
							r.Template.Template.MaxRetries = dcl.Int64(i)
						} else {
							return nil, fmt.Errorf("r.Template.Template.MaxRetries: expected int64")
						}
					}
					if _, ok := rTemplateTemplate["serviceAccount"]; ok {
						if s, ok := rTemplateTemplate["serviceAccount"].(string); ok {
							r.Template.Template.ServiceAccount = dcl.String(s)
						} else {
							return nil, fmt.Errorf("r.Template.Template.ServiceAccount: expected string")
						}
					}
					if _, ok := rTemplateTemplate["timeout"]; ok {
						if s, ok := rTemplateTemplate["timeout"].(string); ok {
							r.Template.Template.Timeout = dcl.String(s)
						} else {
							return nil, fmt.Errorf("r.Template.Template.Timeout: expected string")
						}
					}
					if _, ok := rTemplateTemplate["volumes"]; ok {
						if s, ok := rTemplateTemplate["volumes"].([]interface{}); ok {
							for _, o := range s {
								if objval, ok := o.(map[string]interface{}); ok {
									var rTemplateTemplateVolumes dclService.JobTemplateTemplateVolumes
									if _, ok := objval["cloudSqlInstance"]; ok {
										if rTemplateTemplateVolumesCloudSqlInstance, ok := objval["cloudSqlInstance"].(map[string]interface{}); ok {
											rTemplateTemplateVolumes.CloudSqlInstance = &dclService.JobTemplateTemplateVolumesCloudSqlInstance{}
											if _, ok := rTemplateTemplateVolumesCloudSqlInstance["instances"]; ok {
												if s, ok := rTemplateTemplateVolumesCloudSqlInstance["instances"].([]interface{}); ok {
													for _, ss := range s {
														if strval, ok := ss.(string); ok {
															rTemplateTemplateVolumes.CloudSqlInstance.Instances = append(rTemplateTemplateVolumes.CloudSqlInstance.Instances, strval)
														}
													}
												} else {
													return nil, fmt.Errorf("rTemplateTemplateVolumes.CloudSqlInstance.Instances: expected []interface{}")
												}
											}
										} else {
											return nil, fmt.Errorf("rTemplateTemplateVolumes.CloudSqlInstance: expected map[string]interface{}")
										}
									}
									if _, ok := objval["name"]; ok {
										if s, ok := objval["name"].(string); ok {
											rTemplateTemplateVolumes.Name = dcl.String(s)
										} else {
											return nil, fmt.Errorf("rTemplateTemplateVolumes.Name: expected string")
										}
									}
									if _, ok := objval["secret"]; ok {
										if rTemplateTemplateVolumesSecret, ok := objval["secret"].(map[string]interface{}); ok {
											rTemplateTemplateVolumes.Secret = &dclService.JobTemplateTemplateVolumesSecret{}
											if _, ok := rTemplateTemplateVolumesSecret["defaultMode"]; ok {
												if i, ok := rTemplateTemplateVolumesSecret["defaultMode"].(int64); ok {
													rTemplateTemplateVolumes.Secret.DefaultMode = dcl.Int64(i)
												} else {
													return nil, fmt.Errorf("rTemplateTemplateVolumes.Secret.DefaultMode: expected int64")
												}
											}
											if _, ok := rTemplateTemplateVolumesSecret["items"]; ok {
												if s, ok := rTemplateTemplateVolumesSecret["items"].([]interface{}); ok {
													for _, o := range s {
														if objval, ok := o.(map[string]interface{}); ok {
															var rTemplateTemplateVolumesSecretItems dclService.JobTemplateTemplateVolumesSecretItems
															if _, ok := objval["mode"]; ok {
																if i, ok := objval["mode"].(int64); ok {
																	rTemplateTemplateVolumesSecretItems.Mode = dcl.Int64(i)
																} else {
																	return nil, fmt.Errorf("rTemplateTemplateVolumesSecretItems.Mode: expected int64")
																}
															}
															if _, ok := objval["path"]; ok {
																if s, ok := objval["path"].(string); ok {
																	rTemplateTemplateVolumesSecretItems.Path = dcl.String(s)
																} else {
																	return nil, fmt.Errorf("rTemplateTemplateVolumesSecretItems.Path: expected string")
																}
															}
															if _, ok := objval["version"]; ok {
																if s, ok := objval["version"].(string); ok {
																	rTemplateTemplateVolumesSecretItems.Version = dcl.String(s)
																} else {
																	return nil, fmt.Errorf("rTemplateTemplateVolumesSecretItems.Version: expected string")
																}
															}
															rTemplateTemplateVolumes.Secret.Items = append(rTemplateTemplateVolumes.Secret.Items, rTemplateTemplateVolumesSecretItems)
														}
													}
												} else {
													return nil, fmt.Errorf("rTemplateTemplateVolumes.Secret.Items: expected []interface{}")
												}
											}
											if _, ok := rTemplateTemplateVolumesSecret["secret"]; ok {
												if s, ok := rTemplateTemplateVolumesSecret["secret"].(string); ok {
													rTemplateTemplateVolumes.Secret.Secret = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rTemplateTemplateVolumes.Secret.Secret: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rTemplateTemplateVolumes.Secret: expected map[string]interface{}")
										}
									}
									r.Template.Template.Volumes = append(r.Template.Template.Volumes, rTemplateTemplateVolumes)
								}
							}
						} else {
							return nil, fmt.Errorf("r.Template.Template.Volumes: expected []interface{}")
						}
					}
					if _, ok := rTemplateTemplate["vpcAccess"]; ok {
						if rTemplateTemplateVPCAccess, ok := rTemplateTemplate["vpcAccess"].(map[string]interface{}); ok {
							r.Template.Template.VPCAccess = &dclService.JobTemplateTemplateVPCAccess{}
							if _, ok := rTemplateTemplateVPCAccess["connector"]; ok {
								if s, ok := rTemplateTemplateVPCAccess["connector"].(string); ok {
									r.Template.Template.VPCAccess.Connector = dcl.String(s)
								} else {
									return nil, fmt.Errorf("r.Template.Template.VPCAccess.Connector: expected string")
								}
							}
							if _, ok := rTemplateTemplateVPCAccess["egress"]; ok {
								if s, ok := rTemplateTemplateVPCAccess["egress"].(string); ok {
									r.Template.Template.VPCAccess.Egress = dclService.JobTemplateTemplateVPCAccessEgressEnumRef(s)
								} else {
									return nil, fmt.Errorf("r.Template.Template.VPCAccess.Egress: expected string")
								}
							}
						} else {
							return nil, fmt.Errorf("r.Template.Template.VPCAccess: expected map[string]interface{}")
						}
					}
				} else {
					return nil, fmt.Errorf("r.Template.Template: expected map[string]interface{}")
				}
			}
		} else {
			return nil, fmt.Errorf("r.Template: expected map[string]interface{}")
		}
	}
	if _, ok := u.Object["terminalCondition"]; ok {
		if rTerminalCondition, ok := u.Object["terminalCondition"].(map[string]interface{}); ok {
			r.TerminalCondition = &dclService.JobTerminalCondition{}
			if _, ok := rTerminalCondition["domainMappingReason"]; ok {
				if s, ok := rTerminalCondition["domainMappingReason"].(string); ok {
					r.TerminalCondition.DomainMappingReason = dclService.JobTerminalConditionDomainMappingReasonEnumRef(s)
				} else {
					return nil, fmt.Errorf("r.TerminalCondition.DomainMappingReason: expected string")
				}
			}
			if _, ok := rTerminalCondition["executionReason"]; ok {
				if s, ok := rTerminalCondition["executionReason"].(string); ok {
					r.TerminalCondition.ExecutionReason = dclService.JobTerminalConditionExecutionReasonEnumRef(s)
				} else {
					return nil, fmt.Errorf("r.TerminalCondition.ExecutionReason: expected string")
				}
			}
			if _, ok := rTerminalCondition["internalReason"]; ok {
				if s, ok := rTerminalCondition["internalReason"].(string); ok {
					r.TerminalCondition.InternalReason = dclService.JobTerminalConditionInternalReasonEnumRef(s)
				} else {
					return nil, fmt.Errorf("r.TerminalCondition.InternalReason: expected string")
				}
			}
			if _, ok := rTerminalCondition["lastTransitionTime"]; ok {
				if s, ok := rTerminalCondition["lastTransitionTime"].(string); ok {
					r.TerminalCondition.LastTransitionTime = dcl.String(s)
				} else {
					return nil, fmt.Errorf("r.TerminalCondition.LastTransitionTime: expected string")
				}
			}
			if _, ok := rTerminalCondition["message"]; ok {
				if s, ok := rTerminalCondition["message"].(string); ok {
					r.TerminalCondition.Message = dcl.String(s)
				} else {
					return nil, fmt.Errorf("r.TerminalCondition.Message: expected string")
				}
			}
			if _, ok := rTerminalCondition["reason"]; ok {
				if s, ok := rTerminalCondition["reason"].(string); ok {
					r.TerminalCondition.Reason = dclService.JobTerminalConditionReasonEnumRef(s)
				} else {
					return nil, fmt.Errorf("r.TerminalCondition.Reason: expected string")
				}
			}
			if _, ok := rTerminalCondition["revisionReason"]; ok {
				if s, ok := rTerminalCondition["revisionReason"].(string); ok {
					r.TerminalCondition.RevisionReason = dclService.JobTerminalConditionRevisionReasonEnumRef(s)
				} else {
					return nil, fmt.Errorf("r.TerminalCondition.RevisionReason: expected string")
				}
			}
			if _, ok := rTerminalCondition["severity"]; ok {
				if s, ok := rTerminalCondition["severity"].(string); ok {
					r.TerminalCondition.Severity = dclService.JobTerminalConditionSeverityEnumRef(s)
				} else {
					return nil, fmt.Errorf("r.TerminalCondition.Severity: expected string")
				}
			}
			if _, ok := rTerminalCondition["state"]; ok {
				if s, ok := rTerminalCondition["state"].(string); ok {
					r.TerminalCondition.State = dclService.JobTerminalConditionStateEnumRef(s)
				} else {
					return nil, fmt.Errorf("r.TerminalCondition.State: expected string")
				}
			}
			if _, ok := rTerminalCondition["type"]; ok {
				if s, ok := rTerminalCondition["type"].(string); ok {
					r.TerminalCondition.Type = dcl.String(s)
				} else {
					return nil, fmt.Errorf("r.TerminalCondition.Type: expected string")
				}
			}
		} else {
			return nil, fmt.Errorf("r.TerminalCondition: expected map[string]interface{}")
		}
	}
	if _, ok := u.Object["uid"]; ok {
		if s, ok := u.Object["uid"].(string); ok {
			r.Uid = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Uid: expected string")
		}
	}
	if _, ok := u.Object["updateTime"]; ok {
		if s, ok := u.Object["updateTime"].(string); ok {
			r.UpdateTime = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.UpdateTime: expected string")
		}
	}
	return r, nil
}