func UnstructuredToGuestPolicy()

in unstructured/google/osconfig/beta/guest_policy.go [443:1312]


func UnstructuredToGuestPolicy(u *unstructured.Resource) (*dclService.GuestPolicy, error) {
	r := &dclService.GuestPolicy{}
	if _, ok := u.Object["assignment"]; ok {
		if rAssignment, ok := u.Object["assignment"].(map[string]interface{}); ok {
			r.Assignment = &dclService.GuestPolicyAssignment{}
			if _, ok := rAssignment["groupLabels"]; ok {
				if s, ok := rAssignment["groupLabels"].([]interface{}); ok {
					for _, o := range s {
						if objval, ok := o.(map[string]interface{}); ok {
							var rAssignmentGroupLabels dclService.GuestPolicyAssignmentGroupLabels
							if _, ok := objval["labels"]; ok {
								if rAssignmentGroupLabelsLabels, ok := objval["labels"].(map[string]interface{}); ok {
									m := make(map[string]string)
									for k, v := range rAssignmentGroupLabelsLabels {
										if s, ok := v.(string); ok {
											m[k] = s
										}
									}
									rAssignmentGroupLabels.Labels = m
								} else {
									return nil, fmt.Errorf("rAssignmentGroupLabels.Labels: expected map[string]interface{}")
								}
							}
							r.Assignment.GroupLabels = append(r.Assignment.GroupLabels, rAssignmentGroupLabels)
						}
					}
				} else {
					return nil, fmt.Errorf("r.Assignment.GroupLabels: expected []interface{}")
				}
			}
			if _, ok := rAssignment["instanceNamePrefixes"]; ok {
				if s, ok := rAssignment["instanceNamePrefixes"].([]interface{}); ok {
					for _, ss := range s {
						if strval, ok := ss.(string); ok {
							r.Assignment.InstanceNamePrefixes = append(r.Assignment.InstanceNamePrefixes, strval)
						}
					}
				} else {
					return nil, fmt.Errorf("r.Assignment.InstanceNamePrefixes: expected []interface{}")
				}
			}
			if _, ok := rAssignment["instances"]; ok {
				if s, ok := rAssignment["instances"].([]interface{}); ok {
					for _, ss := range s {
						if strval, ok := ss.(string); ok {
							r.Assignment.Instances = append(r.Assignment.Instances, strval)
						}
					}
				} else {
					return nil, fmt.Errorf("r.Assignment.Instances: expected []interface{}")
				}
			}
			if _, ok := rAssignment["osTypes"]; ok {
				if s, ok := rAssignment["osTypes"].([]interface{}); ok {
					for _, o := range s {
						if objval, ok := o.(map[string]interface{}); ok {
							var rAssignmentOSTypes dclService.GuestPolicyAssignmentOSTypes
							if _, ok := objval["osArchitecture"]; ok {
								if s, ok := objval["osArchitecture"].(string); ok {
									rAssignmentOSTypes.OSArchitecture = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rAssignmentOSTypes.OSArchitecture: expected string")
								}
							}
							if _, ok := objval["osShortName"]; ok {
								if s, ok := objval["osShortName"].(string); ok {
									rAssignmentOSTypes.OSShortName = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rAssignmentOSTypes.OSShortName: expected string")
								}
							}
							if _, ok := objval["osVersion"]; ok {
								if s, ok := objval["osVersion"].(string); ok {
									rAssignmentOSTypes.OSVersion = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rAssignmentOSTypes.OSVersion: expected string")
								}
							}
							r.Assignment.OSTypes = append(r.Assignment.OSTypes, rAssignmentOSTypes)
						}
					}
				} else {
					return nil, fmt.Errorf("r.Assignment.OSTypes: expected []interface{}")
				}
			}
			if _, ok := rAssignment["zones"]; ok {
				if s, ok := rAssignment["zones"].([]interface{}); ok {
					for _, ss := range s {
						if strval, ok := ss.(string); ok {
							r.Assignment.Zones = append(r.Assignment.Zones, strval)
						}
					}
				} else {
					return nil, fmt.Errorf("r.Assignment.Zones: expected []interface{}")
				}
			}
		} else {
			return nil, fmt.Errorf("r.Assignment: expected map[string]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["description"]; ok {
		if s, ok := u.Object["description"].(string); ok {
			r.Description = dcl.String(s)
		} else {
			return nil, fmt.Errorf("r.Description: 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["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["packageRepositories"]; ok {
		if s, ok := u.Object["packageRepositories"].([]interface{}); ok {
			for _, o := range s {
				if objval, ok := o.(map[string]interface{}); ok {
					var rPackageRepositories dclService.GuestPolicyPackageRepositories
					if _, ok := objval["apt"]; ok {
						if rPackageRepositoriesApt, ok := objval["apt"].(map[string]interface{}); ok {
							rPackageRepositories.Apt = &dclService.GuestPolicyPackageRepositoriesApt{}
							if _, ok := rPackageRepositoriesApt["archiveType"]; ok {
								if s, ok := rPackageRepositoriesApt["archiveType"].(string); ok {
									rPackageRepositories.Apt.ArchiveType = dclService.GuestPolicyPackageRepositoriesAptArchiveTypeEnumRef(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Apt.ArchiveType: expected string")
								}
							}
							if _, ok := rPackageRepositoriesApt["components"]; ok {
								if s, ok := rPackageRepositoriesApt["components"].([]interface{}); ok {
									for _, ss := range s {
										if strval, ok := ss.(string); ok {
											rPackageRepositories.Apt.Components = append(rPackageRepositories.Apt.Components, strval)
										}
									}
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Apt.Components: expected []interface{}")
								}
							}
							if _, ok := rPackageRepositoriesApt["distribution"]; ok {
								if s, ok := rPackageRepositoriesApt["distribution"].(string); ok {
									rPackageRepositories.Apt.Distribution = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Apt.Distribution: expected string")
								}
							}
							if _, ok := rPackageRepositoriesApt["gpgKey"]; ok {
								if s, ok := rPackageRepositoriesApt["gpgKey"].(string); ok {
									rPackageRepositories.Apt.GpgKey = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Apt.GpgKey: expected string")
								}
							}
							if _, ok := rPackageRepositoriesApt["uri"]; ok {
								if s, ok := rPackageRepositoriesApt["uri"].(string); ok {
									rPackageRepositories.Apt.Uri = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Apt.Uri: expected string")
								}
							}
						} else {
							return nil, fmt.Errorf("rPackageRepositories.Apt: expected map[string]interface{}")
						}
					}
					if _, ok := objval["goo"]; ok {
						if rPackageRepositoriesGoo, ok := objval["goo"].(map[string]interface{}); ok {
							rPackageRepositories.Goo = &dclService.GuestPolicyPackageRepositoriesGoo{}
							if _, ok := rPackageRepositoriesGoo["name"]; ok {
								if s, ok := rPackageRepositoriesGoo["name"].(string); ok {
									rPackageRepositories.Goo.Name = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Goo.Name: expected string")
								}
							}
							if _, ok := rPackageRepositoriesGoo["url"]; ok {
								if s, ok := rPackageRepositoriesGoo["url"].(string); ok {
									rPackageRepositories.Goo.Url = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Goo.Url: expected string")
								}
							}
						} else {
							return nil, fmt.Errorf("rPackageRepositories.Goo: expected map[string]interface{}")
						}
					}
					if _, ok := objval["yum"]; ok {
						if rPackageRepositoriesYum, ok := objval["yum"].(map[string]interface{}); ok {
							rPackageRepositories.Yum = &dclService.GuestPolicyPackageRepositoriesYum{}
							if _, ok := rPackageRepositoriesYum["baseUrl"]; ok {
								if s, ok := rPackageRepositoriesYum["baseUrl"].(string); ok {
									rPackageRepositories.Yum.BaseUrl = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Yum.BaseUrl: expected string")
								}
							}
							if _, ok := rPackageRepositoriesYum["displayName"]; ok {
								if s, ok := rPackageRepositoriesYum["displayName"].(string); ok {
									rPackageRepositories.Yum.DisplayName = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Yum.DisplayName: expected string")
								}
							}
							if _, ok := rPackageRepositoriesYum["gpgKeys"]; ok {
								if s, ok := rPackageRepositoriesYum["gpgKeys"].([]interface{}); ok {
									for _, ss := range s {
										if strval, ok := ss.(string); ok {
											rPackageRepositories.Yum.GpgKeys = append(rPackageRepositories.Yum.GpgKeys, strval)
										}
									}
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Yum.GpgKeys: expected []interface{}")
								}
							}
							if _, ok := rPackageRepositoriesYum["id"]; ok {
								if s, ok := rPackageRepositoriesYum["id"].(string); ok {
									rPackageRepositories.Yum.Id = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Yum.Id: expected string")
								}
							}
						} else {
							return nil, fmt.Errorf("rPackageRepositories.Yum: expected map[string]interface{}")
						}
					}
					if _, ok := objval["zypper"]; ok {
						if rPackageRepositoriesZypper, ok := objval["zypper"].(map[string]interface{}); ok {
							rPackageRepositories.Zypper = &dclService.GuestPolicyPackageRepositoriesZypper{}
							if _, ok := rPackageRepositoriesZypper["baseUrl"]; ok {
								if s, ok := rPackageRepositoriesZypper["baseUrl"].(string); ok {
									rPackageRepositories.Zypper.BaseUrl = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Zypper.BaseUrl: expected string")
								}
							}
							if _, ok := rPackageRepositoriesZypper["displayName"]; ok {
								if s, ok := rPackageRepositoriesZypper["displayName"].(string); ok {
									rPackageRepositories.Zypper.DisplayName = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Zypper.DisplayName: expected string")
								}
							}
							if _, ok := rPackageRepositoriesZypper["gpgKeys"]; ok {
								if s, ok := rPackageRepositoriesZypper["gpgKeys"].([]interface{}); ok {
									for _, ss := range s {
										if strval, ok := ss.(string); ok {
											rPackageRepositories.Zypper.GpgKeys = append(rPackageRepositories.Zypper.GpgKeys, strval)
										}
									}
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Zypper.GpgKeys: expected []interface{}")
								}
							}
							if _, ok := rPackageRepositoriesZypper["id"]; ok {
								if s, ok := rPackageRepositoriesZypper["id"].(string); ok {
									rPackageRepositories.Zypper.Id = dcl.String(s)
								} else {
									return nil, fmt.Errorf("rPackageRepositories.Zypper.Id: expected string")
								}
							}
						} else {
							return nil, fmt.Errorf("rPackageRepositories.Zypper: expected map[string]interface{}")
						}
					}
					r.PackageRepositories = append(r.PackageRepositories, rPackageRepositories)
				}
			}
		} else {
			return nil, fmt.Errorf("r.PackageRepositories: expected []interface{}")
		}
	}
	if _, ok := u.Object["packages"]; ok {
		if s, ok := u.Object["packages"].([]interface{}); ok {
			for _, o := range s {
				if objval, ok := o.(map[string]interface{}); ok {
					var rPackages dclService.GuestPolicyPackages
					if _, ok := objval["desiredState"]; ok {
						if s, ok := objval["desiredState"].(string); ok {
							rPackages.DesiredState = dclService.GuestPolicyPackagesDesiredStateEnumRef(s)
						} else {
							return nil, fmt.Errorf("rPackages.DesiredState: expected string")
						}
					}
					if _, ok := objval["manager"]; ok {
						if s, ok := objval["manager"].(string); ok {
							rPackages.Manager = dclService.GuestPolicyPackagesManagerEnumRef(s)
						} else {
							return nil, fmt.Errorf("rPackages.Manager: expected string")
						}
					}
					if _, ok := objval["name"]; ok {
						if s, ok := objval["name"].(string); ok {
							rPackages.Name = dcl.String(s)
						} else {
							return nil, fmt.Errorf("rPackages.Name: expected string")
						}
					}
					r.Packages = append(r.Packages, rPackages)
				}
			}
		} else {
			return nil, fmt.Errorf("r.Packages: expected []interface{}")
		}
	}
	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["recipes"]; ok {
		if s, ok := u.Object["recipes"].([]interface{}); ok {
			for _, o := range s {
				if objval, ok := o.(map[string]interface{}); ok {
					var rRecipes dclService.GuestPolicyRecipes
					if _, ok := objval["artifacts"]; ok {
						if s, ok := objval["artifacts"].([]interface{}); ok {
							for _, o := range s {
								if objval, ok := o.(map[string]interface{}); ok {
									var rRecipesArtifacts dclService.GuestPolicyRecipesArtifacts
									if _, ok := objval["allowInsecure"]; ok {
										if b, ok := objval["allowInsecure"].(bool); ok {
											rRecipesArtifacts.AllowInsecure = dcl.Bool(b)
										} else {
											return nil, fmt.Errorf("rRecipesArtifacts.AllowInsecure: expected bool")
										}
									}
									if _, ok := objval["gcs"]; ok {
										if rRecipesArtifactsGcs, ok := objval["gcs"].(map[string]interface{}); ok {
											rRecipesArtifacts.Gcs = &dclService.GuestPolicyRecipesArtifactsGcs{}
											if _, ok := rRecipesArtifactsGcs["bucket"]; ok {
												if s, ok := rRecipesArtifactsGcs["bucket"].(string); ok {
													rRecipesArtifacts.Gcs.Bucket = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesArtifacts.Gcs.Bucket: expected string")
												}
											}
											if _, ok := rRecipesArtifactsGcs["generation"]; ok {
												if i, ok := rRecipesArtifactsGcs["generation"].(int64); ok {
													rRecipesArtifacts.Gcs.Generation = dcl.Int64(i)
												} else {
													return nil, fmt.Errorf("rRecipesArtifacts.Gcs.Generation: expected int64")
												}
											}
											if _, ok := rRecipesArtifactsGcs["object"]; ok {
												if s, ok := rRecipesArtifactsGcs["object"].(string); ok {
													rRecipesArtifacts.Gcs.Object = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesArtifacts.Gcs.Object: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesArtifacts.Gcs: expected map[string]interface{}")
										}
									}
									if _, ok := objval["id"]; ok {
										if s, ok := objval["id"].(string); ok {
											rRecipesArtifacts.Id = dcl.String(s)
										} else {
											return nil, fmt.Errorf("rRecipesArtifacts.Id: expected string")
										}
									}
									if _, ok := objval["remote"]; ok {
										if rRecipesArtifactsRemote, ok := objval["remote"].(map[string]interface{}); ok {
											rRecipesArtifacts.Remote = &dclService.GuestPolicyRecipesArtifactsRemote{}
											if _, ok := rRecipesArtifactsRemote["checksum"]; ok {
												if s, ok := rRecipesArtifactsRemote["checksum"].(string); ok {
													rRecipesArtifacts.Remote.Checksum = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesArtifacts.Remote.Checksum: expected string")
												}
											}
											if _, ok := rRecipesArtifactsRemote["uri"]; ok {
												if s, ok := rRecipesArtifactsRemote["uri"].(string); ok {
													rRecipesArtifacts.Remote.Uri = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesArtifacts.Remote.Uri: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesArtifacts.Remote: expected map[string]interface{}")
										}
									}
									rRecipes.Artifacts = append(rRecipes.Artifacts, rRecipesArtifacts)
								}
							}
						} else {
							return nil, fmt.Errorf("rRecipes.Artifacts: expected []interface{}")
						}
					}
					if _, ok := objval["desiredState"]; ok {
						if s, ok := objval["desiredState"].(string); ok {
							rRecipes.DesiredState = dclService.GuestPolicyRecipesDesiredStateEnumRef(s)
						} else {
							return nil, fmt.Errorf("rRecipes.DesiredState: expected string")
						}
					}
					if _, ok := objval["installSteps"]; ok {
						if s, ok := objval["installSteps"].([]interface{}); ok {
							for _, o := range s {
								if objval, ok := o.(map[string]interface{}); ok {
									var rRecipesInstallSteps dclService.GuestPolicyRecipesInstallSteps
									if _, ok := objval["archiveExtraction"]; ok {
										if rRecipesInstallStepsArchiveExtraction, ok := objval["archiveExtraction"].(map[string]interface{}); ok {
											rRecipesInstallSteps.ArchiveExtraction = &dclService.GuestPolicyRecipesInstallStepsArchiveExtraction{}
											if _, ok := rRecipesInstallStepsArchiveExtraction["artifactId"]; ok {
												if s, ok := rRecipesInstallStepsArchiveExtraction["artifactId"].(string); ok {
													rRecipesInstallSteps.ArchiveExtraction.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.ArchiveExtraction.ArtifactId: expected string")
												}
											}
											if _, ok := rRecipesInstallStepsArchiveExtraction["destination"]; ok {
												if s, ok := rRecipesInstallStepsArchiveExtraction["destination"].(string); ok {
													rRecipesInstallSteps.ArchiveExtraction.Destination = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.ArchiveExtraction.Destination: expected string")
												}
											}
											if _, ok := rRecipesInstallStepsArchiveExtraction["type"]; ok {
												if s, ok := rRecipesInstallStepsArchiveExtraction["type"].(string); ok {
													rRecipesInstallSteps.ArchiveExtraction.Type = dclService.GuestPolicyRecipesInstallStepsArchiveExtractionTypeEnumRef(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.ArchiveExtraction.Type: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesInstallSteps.ArchiveExtraction: expected map[string]interface{}")
										}
									}
									if _, ok := objval["dpkgInstallation"]; ok {
										if rRecipesInstallStepsDpkgInstallation, ok := objval["dpkgInstallation"].(map[string]interface{}); ok {
											rRecipesInstallSteps.DpkgInstallation = &dclService.GuestPolicyRecipesInstallStepsDpkgInstallation{}
											if _, ok := rRecipesInstallStepsDpkgInstallation["artifactId"]; ok {
												if s, ok := rRecipesInstallStepsDpkgInstallation["artifactId"].(string); ok {
													rRecipesInstallSteps.DpkgInstallation.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.DpkgInstallation.ArtifactId: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesInstallSteps.DpkgInstallation: expected map[string]interface{}")
										}
									}
									if _, ok := objval["fileCopy"]; ok {
										if rRecipesInstallStepsFileCopy, ok := objval["fileCopy"].(map[string]interface{}); ok {
											rRecipesInstallSteps.FileCopy = &dclService.GuestPolicyRecipesInstallStepsFileCopy{}
											if _, ok := rRecipesInstallStepsFileCopy["artifactId"]; ok {
												if s, ok := rRecipesInstallStepsFileCopy["artifactId"].(string); ok {
													rRecipesInstallSteps.FileCopy.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.FileCopy.ArtifactId: expected string")
												}
											}
											if _, ok := rRecipesInstallStepsFileCopy["destination"]; ok {
												if s, ok := rRecipesInstallStepsFileCopy["destination"].(string); ok {
													rRecipesInstallSteps.FileCopy.Destination = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.FileCopy.Destination: expected string")
												}
											}
											if _, ok := rRecipesInstallStepsFileCopy["overwrite"]; ok {
												if b, ok := rRecipesInstallStepsFileCopy["overwrite"].(bool); ok {
													rRecipesInstallSteps.FileCopy.Overwrite = dcl.Bool(b)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.FileCopy.Overwrite: expected bool")
												}
											}
											if _, ok := rRecipesInstallStepsFileCopy["permissions"]; ok {
												if s, ok := rRecipesInstallStepsFileCopy["permissions"].(string); ok {
													rRecipesInstallSteps.FileCopy.Permissions = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.FileCopy.Permissions: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesInstallSteps.FileCopy: expected map[string]interface{}")
										}
									}
									if _, ok := objval["fileExec"]; ok {
										if rRecipesInstallStepsFileExec, ok := objval["fileExec"].(map[string]interface{}); ok {
											rRecipesInstallSteps.FileExec = &dclService.GuestPolicyRecipesInstallStepsFileExec{}
											if _, ok := rRecipesInstallStepsFileExec["allowedExitCodes"]; ok {
												if s, ok := rRecipesInstallStepsFileExec["allowedExitCodes"].([]interface{}); ok {
													for _, ss := range s {
														if intval, ok := ss.(int64); ok {
															rRecipesInstallSteps.FileExec.AllowedExitCodes = append(rRecipesInstallSteps.FileExec.AllowedExitCodes, intval)
														}
													}
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.FileExec.AllowedExitCodes: expected []interface{}")
												}
											}
											if _, ok := rRecipesInstallStepsFileExec["args"]; ok {
												if s, ok := rRecipesInstallStepsFileExec["args"].([]interface{}); ok {
													for _, ss := range s {
														if strval, ok := ss.(string); ok {
															rRecipesInstallSteps.FileExec.Args = append(rRecipesInstallSteps.FileExec.Args, strval)
														}
													}
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.FileExec.Args: expected []interface{}")
												}
											}
											if _, ok := rRecipesInstallStepsFileExec["artifactId"]; ok {
												if s, ok := rRecipesInstallStepsFileExec["artifactId"].(string); ok {
													rRecipesInstallSteps.FileExec.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.FileExec.ArtifactId: expected string")
												}
											}
											if _, ok := rRecipesInstallStepsFileExec["localPath"]; ok {
												if s, ok := rRecipesInstallStepsFileExec["localPath"].(string); ok {
													rRecipesInstallSteps.FileExec.LocalPath = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.FileExec.LocalPath: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesInstallSteps.FileExec: expected map[string]interface{}")
										}
									}
									if _, ok := objval["msiInstallation"]; ok {
										if rRecipesInstallStepsMsiInstallation, ok := objval["msiInstallation"].(map[string]interface{}); ok {
											rRecipesInstallSteps.MsiInstallation = &dclService.GuestPolicyRecipesInstallStepsMsiInstallation{}
											if _, ok := rRecipesInstallStepsMsiInstallation["allowedExitCodes"]; ok {
												if s, ok := rRecipesInstallStepsMsiInstallation["allowedExitCodes"].([]interface{}); ok {
													for _, ss := range s {
														if intval, ok := ss.(int64); ok {
															rRecipesInstallSteps.MsiInstallation.AllowedExitCodes = append(rRecipesInstallSteps.MsiInstallation.AllowedExitCodes, intval)
														}
													}
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.MsiInstallation.AllowedExitCodes: expected []interface{}")
												}
											}
											if _, ok := rRecipesInstallStepsMsiInstallation["artifactId"]; ok {
												if s, ok := rRecipesInstallStepsMsiInstallation["artifactId"].(string); ok {
													rRecipesInstallSteps.MsiInstallation.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.MsiInstallation.ArtifactId: expected string")
												}
											}
											if _, ok := rRecipesInstallStepsMsiInstallation["flags"]; ok {
												if s, ok := rRecipesInstallStepsMsiInstallation["flags"].([]interface{}); ok {
													for _, ss := range s {
														if strval, ok := ss.(string); ok {
															rRecipesInstallSteps.MsiInstallation.Flags = append(rRecipesInstallSteps.MsiInstallation.Flags, strval)
														}
													}
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.MsiInstallation.Flags: expected []interface{}")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesInstallSteps.MsiInstallation: expected map[string]interface{}")
										}
									}
									if _, ok := objval["rpmInstallation"]; ok {
										if rRecipesInstallStepsRpmInstallation, ok := objval["rpmInstallation"].(map[string]interface{}); ok {
											rRecipesInstallSteps.RpmInstallation = &dclService.GuestPolicyRecipesInstallStepsRpmInstallation{}
											if _, ok := rRecipesInstallStepsRpmInstallation["artifactId"]; ok {
												if s, ok := rRecipesInstallStepsRpmInstallation["artifactId"].(string); ok {
													rRecipesInstallSteps.RpmInstallation.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.RpmInstallation.ArtifactId: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesInstallSteps.RpmInstallation: expected map[string]interface{}")
										}
									}
									if _, ok := objval["scriptRun"]; ok {
										if rRecipesInstallStepsScriptRun, ok := objval["scriptRun"].(map[string]interface{}); ok {
											rRecipesInstallSteps.ScriptRun = &dclService.GuestPolicyRecipesInstallStepsScriptRun{}
											if _, ok := rRecipesInstallStepsScriptRun["allowedExitCodes"]; ok {
												if s, ok := rRecipesInstallStepsScriptRun["allowedExitCodes"].([]interface{}); ok {
													for _, ss := range s {
														if intval, ok := ss.(int64); ok {
															rRecipesInstallSteps.ScriptRun.AllowedExitCodes = append(rRecipesInstallSteps.ScriptRun.AllowedExitCodes, intval)
														}
													}
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.ScriptRun.AllowedExitCodes: expected []interface{}")
												}
											}
											if _, ok := rRecipesInstallStepsScriptRun["interpreter"]; ok {
												if s, ok := rRecipesInstallStepsScriptRun["interpreter"].(string); ok {
													rRecipesInstallSteps.ScriptRun.Interpreter = dclService.GuestPolicyRecipesInstallStepsScriptRunInterpreterEnumRef(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.ScriptRun.Interpreter: expected string")
												}
											}
											if _, ok := rRecipesInstallStepsScriptRun["script"]; ok {
												if s, ok := rRecipesInstallStepsScriptRun["script"].(string); ok {
													rRecipesInstallSteps.ScriptRun.Script = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesInstallSteps.ScriptRun.Script: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesInstallSteps.ScriptRun: expected map[string]interface{}")
										}
									}
									rRecipes.InstallSteps = append(rRecipes.InstallSteps, rRecipesInstallSteps)
								}
							}
						} else {
							return nil, fmt.Errorf("rRecipes.InstallSteps: expected []interface{}")
						}
					}
					if _, ok := objval["name"]; ok {
						if s, ok := objval["name"].(string); ok {
							rRecipes.Name = dcl.String(s)
						} else {
							return nil, fmt.Errorf("rRecipes.Name: expected string")
						}
					}
					if _, ok := objval["updateSteps"]; ok {
						if s, ok := objval["updateSteps"].([]interface{}); ok {
							for _, o := range s {
								if objval, ok := o.(map[string]interface{}); ok {
									var rRecipesUpdateSteps dclService.GuestPolicyRecipesUpdateSteps
									if _, ok := objval["archiveExtraction"]; ok {
										if rRecipesUpdateStepsArchiveExtraction, ok := objval["archiveExtraction"].(map[string]interface{}); ok {
											rRecipesUpdateSteps.ArchiveExtraction = &dclService.GuestPolicyRecipesUpdateStepsArchiveExtraction{}
											if _, ok := rRecipesUpdateStepsArchiveExtraction["artifactId"]; ok {
												if s, ok := rRecipesUpdateStepsArchiveExtraction["artifactId"].(string); ok {
													rRecipesUpdateSteps.ArchiveExtraction.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.ArchiveExtraction.ArtifactId: expected string")
												}
											}
											if _, ok := rRecipesUpdateStepsArchiveExtraction["destination"]; ok {
												if s, ok := rRecipesUpdateStepsArchiveExtraction["destination"].(string); ok {
													rRecipesUpdateSteps.ArchiveExtraction.Destination = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.ArchiveExtraction.Destination: expected string")
												}
											}
											if _, ok := rRecipesUpdateStepsArchiveExtraction["type"]; ok {
												if s, ok := rRecipesUpdateStepsArchiveExtraction["type"].(string); ok {
													rRecipesUpdateSteps.ArchiveExtraction.Type = dclService.GuestPolicyRecipesUpdateStepsArchiveExtractionTypeEnumRef(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.ArchiveExtraction.Type: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesUpdateSteps.ArchiveExtraction: expected map[string]interface{}")
										}
									}
									if _, ok := objval["dpkgInstallation"]; ok {
										if rRecipesUpdateStepsDpkgInstallation, ok := objval["dpkgInstallation"].(map[string]interface{}); ok {
											rRecipesUpdateSteps.DpkgInstallation = &dclService.GuestPolicyRecipesUpdateStepsDpkgInstallation{}
											if _, ok := rRecipesUpdateStepsDpkgInstallation["artifactId"]; ok {
												if s, ok := rRecipesUpdateStepsDpkgInstallation["artifactId"].(string); ok {
													rRecipesUpdateSteps.DpkgInstallation.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.DpkgInstallation.ArtifactId: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesUpdateSteps.DpkgInstallation: expected map[string]interface{}")
										}
									}
									if _, ok := objval["fileCopy"]; ok {
										if rRecipesUpdateStepsFileCopy, ok := objval["fileCopy"].(map[string]interface{}); ok {
											rRecipesUpdateSteps.FileCopy = &dclService.GuestPolicyRecipesUpdateStepsFileCopy{}
											if _, ok := rRecipesUpdateStepsFileCopy["artifactId"]; ok {
												if s, ok := rRecipesUpdateStepsFileCopy["artifactId"].(string); ok {
													rRecipesUpdateSteps.FileCopy.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.FileCopy.ArtifactId: expected string")
												}
											}
											if _, ok := rRecipesUpdateStepsFileCopy["destination"]; ok {
												if s, ok := rRecipesUpdateStepsFileCopy["destination"].(string); ok {
													rRecipesUpdateSteps.FileCopy.Destination = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.FileCopy.Destination: expected string")
												}
											}
											if _, ok := rRecipesUpdateStepsFileCopy["overwrite"]; ok {
												if b, ok := rRecipesUpdateStepsFileCopy["overwrite"].(bool); ok {
													rRecipesUpdateSteps.FileCopy.Overwrite = dcl.Bool(b)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.FileCopy.Overwrite: expected bool")
												}
											}
											if _, ok := rRecipesUpdateStepsFileCopy["permissions"]; ok {
												if s, ok := rRecipesUpdateStepsFileCopy["permissions"].(string); ok {
													rRecipesUpdateSteps.FileCopy.Permissions = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.FileCopy.Permissions: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesUpdateSteps.FileCopy: expected map[string]interface{}")
										}
									}
									if _, ok := objval["fileExec"]; ok {
										if rRecipesUpdateStepsFileExec, ok := objval["fileExec"].(map[string]interface{}); ok {
											rRecipesUpdateSteps.FileExec = &dclService.GuestPolicyRecipesUpdateStepsFileExec{}
											if _, ok := rRecipesUpdateStepsFileExec["allowedExitCodes"]; ok {
												if s, ok := rRecipesUpdateStepsFileExec["allowedExitCodes"].([]interface{}); ok {
													for _, ss := range s {
														if intval, ok := ss.(int64); ok {
															rRecipesUpdateSteps.FileExec.AllowedExitCodes = append(rRecipesUpdateSteps.FileExec.AllowedExitCodes, intval)
														}
													}
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.FileExec.AllowedExitCodes: expected []interface{}")
												}
											}
											if _, ok := rRecipesUpdateStepsFileExec["args"]; ok {
												if s, ok := rRecipesUpdateStepsFileExec["args"].([]interface{}); ok {
													for _, ss := range s {
														if strval, ok := ss.(string); ok {
															rRecipesUpdateSteps.FileExec.Args = append(rRecipesUpdateSteps.FileExec.Args, strval)
														}
													}
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.FileExec.Args: expected []interface{}")
												}
											}
											if _, ok := rRecipesUpdateStepsFileExec["artifactId"]; ok {
												if s, ok := rRecipesUpdateStepsFileExec["artifactId"].(string); ok {
													rRecipesUpdateSteps.FileExec.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.FileExec.ArtifactId: expected string")
												}
											}
											if _, ok := rRecipesUpdateStepsFileExec["localPath"]; ok {
												if s, ok := rRecipesUpdateStepsFileExec["localPath"].(string); ok {
													rRecipesUpdateSteps.FileExec.LocalPath = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.FileExec.LocalPath: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesUpdateSteps.FileExec: expected map[string]interface{}")
										}
									}
									if _, ok := objval["msiInstallation"]; ok {
										if rRecipesUpdateStepsMsiInstallation, ok := objval["msiInstallation"].(map[string]interface{}); ok {
											rRecipesUpdateSteps.MsiInstallation = &dclService.GuestPolicyRecipesUpdateStepsMsiInstallation{}
											if _, ok := rRecipesUpdateStepsMsiInstallation["allowedExitCodes"]; ok {
												if s, ok := rRecipesUpdateStepsMsiInstallation["allowedExitCodes"].([]interface{}); ok {
													for _, ss := range s {
														if intval, ok := ss.(int64); ok {
															rRecipesUpdateSteps.MsiInstallation.AllowedExitCodes = append(rRecipesUpdateSteps.MsiInstallation.AllowedExitCodes, intval)
														}
													}
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.MsiInstallation.AllowedExitCodes: expected []interface{}")
												}
											}
											if _, ok := rRecipesUpdateStepsMsiInstallation["artifactId"]; ok {
												if s, ok := rRecipesUpdateStepsMsiInstallation["artifactId"].(string); ok {
													rRecipesUpdateSteps.MsiInstallation.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.MsiInstallation.ArtifactId: expected string")
												}
											}
											if _, ok := rRecipesUpdateStepsMsiInstallation["flags"]; ok {
												if s, ok := rRecipesUpdateStepsMsiInstallation["flags"].([]interface{}); ok {
													for _, ss := range s {
														if strval, ok := ss.(string); ok {
															rRecipesUpdateSteps.MsiInstallation.Flags = append(rRecipesUpdateSteps.MsiInstallation.Flags, strval)
														}
													}
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.MsiInstallation.Flags: expected []interface{}")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesUpdateSteps.MsiInstallation: expected map[string]interface{}")
										}
									}
									if _, ok := objval["rpmInstallation"]; ok {
										if rRecipesUpdateStepsRpmInstallation, ok := objval["rpmInstallation"].(map[string]interface{}); ok {
											rRecipesUpdateSteps.RpmInstallation = &dclService.GuestPolicyRecipesUpdateStepsRpmInstallation{}
											if _, ok := rRecipesUpdateStepsRpmInstallation["artifactId"]; ok {
												if s, ok := rRecipesUpdateStepsRpmInstallation["artifactId"].(string); ok {
													rRecipesUpdateSteps.RpmInstallation.ArtifactId = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.RpmInstallation.ArtifactId: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesUpdateSteps.RpmInstallation: expected map[string]interface{}")
										}
									}
									if _, ok := objval["scriptRun"]; ok {
										if rRecipesUpdateStepsScriptRun, ok := objval["scriptRun"].(map[string]interface{}); ok {
											rRecipesUpdateSteps.ScriptRun = &dclService.GuestPolicyRecipesUpdateStepsScriptRun{}
											if _, ok := rRecipesUpdateStepsScriptRun["allowedExitCodes"]; ok {
												if s, ok := rRecipesUpdateStepsScriptRun["allowedExitCodes"].([]interface{}); ok {
													for _, ss := range s {
														if intval, ok := ss.(int64); ok {
															rRecipesUpdateSteps.ScriptRun.AllowedExitCodes = append(rRecipesUpdateSteps.ScriptRun.AllowedExitCodes, intval)
														}
													}
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.ScriptRun.AllowedExitCodes: expected []interface{}")
												}
											}
											if _, ok := rRecipesUpdateStepsScriptRun["interpreter"]; ok {
												if s, ok := rRecipesUpdateStepsScriptRun["interpreter"].(string); ok {
													rRecipesUpdateSteps.ScriptRun.Interpreter = dclService.GuestPolicyRecipesUpdateStepsScriptRunInterpreterEnumRef(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.ScriptRun.Interpreter: expected string")
												}
											}
											if _, ok := rRecipesUpdateStepsScriptRun["script"]; ok {
												if s, ok := rRecipesUpdateStepsScriptRun["script"].(string); ok {
													rRecipesUpdateSteps.ScriptRun.Script = dcl.String(s)
												} else {
													return nil, fmt.Errorf("rRecipesUpdateSteps.ScriptRun.Script: expected string")
												}
											}
										} else {
											return nil, fmt.Errorf("rRecipesUpdateSteps.ScriptRun: expected map[string]interface{}")
										}
									}
									rRecipes.UpdateSteps = append(rRecipes.UpdateSteps, rRecipesUpdateSteps)
								}
							}
						} else {
							return nil, fmt.Errorf("rRecipes.UpdateSteps: expected []interface{}")
						}
					}
					if _, ok := objval["version"]; ok {
						if s, ok := objval["version"].(string); ok {
							rRecipes.Version = dcl.String(s)
						} else {
							return nil, fmt.Errorf("rRecipes.Version: expected string")
						}
					}
					r.Recipes = append(r.Recipes, rRecipes)
				}
			}
		} else {
			return nil, fmt.Errorf("r.Recipes: expected []interface{}")
		}
	}
	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
}