// copyGMSACredSpecToRegistryKey copies the credential specs to a unique registry value, and returns its name.
421698
func copyGMSACredSpecToRegistryValue(credSpec string) (string, error) {
	valueName, err := gMSARegistryValueName()
	if err != nil {
		return "", err
	}

	// write to the registry
	key, _, err := registryCreateKeyFunc(registry.LOCAL_MACHINE, credentialSpecRegistryLocation, registry.SET_VALUE)
	if err != nil {
		return "", fmt.Errorf("unable to open registry key %q: %v", credentialSpecRegistryLocation, err)
	}
	defer key.Close()
	if err = key.SetStringValue(valueName, credSpec); err != nil {
		return "", fmt.Errorf("unable to write into registry value %q/%q: %v", credentialSpecRegistryLocation, valueName, err)
	}

	return valueName, nil
}
1365624
func (c *NodeupModelContext) BuildCertificatePairTask(ctx *fi.ModelBuilderContext, key, path, filename string) error {
	certificateName := filepath.Join(path, filename+".pem")
	keyName := filepath.Join(path, filename+"-key.pem")

	if err := c.BuildCertificateTask(ctx, key, certificateName); err != nil {
		return err
	}

	return c.BuildPrivateKeyTask(ctx, key, keyName)
}
472860
func (m *Manager) GetRegistryEntry(username string, globalid string, key string) (registryEntry *RegistryEntry, err error) {
	selector, err := createSelector(username, globalid, key)
	result := struct {
		Entries []RegistryEntry
	}{}
	err = m.getRegistryCollection().Find(selector).Select(bson.M{"entries.$": 1}).One(&result)
	if err == mgo.ErrNotFound {
		err = nil
		return
	}
	if result.Entries != nil && len(result.Entries) > 0 {
		registryEntry = &result.Entries[0]
	}
	return

}
553303
func (vals *ValidatorSet) CopyIncrementProposerPriority(times int) *ValidatorSet {
	copy := vals.Copy()
	copy.IncrementProposerPriority(times)
	return copy
}
487482
func getConfiguredCredentialStore(c *ConfigFile, registryHostname string) string {
	if c.CredentialHelpers != nil && registryHostname != "" {
		if helper, exists := c.CredentialHelpers[registryHostname]; exists {
			return helper
		}
	}
	return c.CredentialsStore
}
263635
func copyKeyInfoMap(keyInfoMap map[string]KeyInfo) map[string]KeyInfo {
	copyMap := make(map[string]KeyInfo)
	for keyID, keyInfo := range keyInfoMap {
		copyMap[keyID] = KeyInfo{Role: keyInfo.Role, Gun: keyInfo.Gun}
	}
	return copyMap
}
489046
func licenseCopy(root, startIn, vendorRoot, pkgPath string) error {
	addTo, _ := pathos.TrimCommonSuffix(pathos.SlashToFilepath(pkgPath), startIn)
	startIn = filepath.Clean(filepath.Join(startIn, ".."))
	return licenseWalk(root, startIn, func(folder, name string) error {
		srcPath := filepath.Join(folder, name)
		trimTo := pathos.FileTrimPrefix(getLastVendorRoot(folder), root)

		/*
			Path: "golang.org/x/tools/go/vcs"
			Root: "/tmp/govendor-cache280388238/1"
			StartIn: "/tmp/govendor-cache280388238/1/go/vcs"
			addTo: "golang.org/x/tools"
			$PROJ/vendor + addTo + pathos.FileTrimPrefix(folder, root) + "LICENSE"
		*/
		destPath := filepath.Join(vendorRoot, addTo, trimTo, name)

		// Only copy if file does not exist.
		_, err := os.Stat(srcPath)
		if err != nil {
			return errors.Errorf("Source license path doesn't exist %q", srcPath)
		}
		destDir, _ := filepath.Split(destPath)
		if err = os.MkdirAll(destDir, 0777); err != nil {
			return errors.Wrapf(err, "Failed to create the directory %q", destDir)
		}
		return errors.Wrapf(copyFile(destPath, srcPath, nil), "copyFile dest=%q src=%q", destPath, srcPath)
	})
}
1266911
func genPrivKey(rand io.Reader) PrivKeyEd25519 {
	seed := make([]byte, 32)
	_, err := io.ReadFull(rand, seed[:])
	if err != nil {
		panic(err)
	}

	privKey := ed25519.NewKeyFromSeed(seed)
	var privKeyEd PrivKeyEd25519
	copy(privKeyEd[:], privKey)
	return privKeyEd
}
242149
func (c KBFSGitClient) Gc(ctx context.Context, __arg GcArg) (err error) {
	err = c.Cli.Call(ctx, "keybase.1.KBFSGit.gc", []interface{}{__arg}, nil)
	return
}
820964
func (s *GetObjectInput) SetSSECustomerKey(v string) *GetObjectInput {
	s.SSECustomerKey = &v
	return s
}
888022
func (m *ModelManagerAPI) makeRegionSpec(cloudTag, r string) (*environs.CloudRegionSpec, error) {
	cTag, err := names.ParseCloudTag(cloudTag)
	if err != nil {
		return nil, errors.Trace(err)
	}
	rspec, err := environs.NewCloudRegionSpec(cTag.Id(), r)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return rspec, nil
}
785376
func (b *Builder) copySchemaTables(dbName string) *model.DBInfo {
	oldSchemaTables := b.is.schemaMap[dbName]
	newSchemaTables := &schemaTables{
		dbInfo: oldSchemaTables.dbInfo.Copy(),
		tables: make(map[string]table.Table, len(oldSchemaTables.tables)),
	}
	for k, v := range oldSchemaTables.tables {
		newSchemaTables.tables[k] = v
	}
	b.is.schemaMap[dbName] = newSchemaTables
	return newSchemaTables.dbInfo
}
551531
func (s *UploadPartCopyInput) SetCopySourceSSECustomerKey(v string) *UploadPartCopyInput {
	s.CopySourceSSECustomerKey = &v
	return s
}
945746
func (in *ExecCredentialSpec) DeepCopy() *ExecCredentialSpec {
	if in == nil {
		return nil
	}
	out := new(ExecCredentialSpec)
	in.DeepCopyInto(out)
	return out
}
780292
func resourceAwsSecurityGroupCopyRule(src map[string]interface{}, self bool, k string, v interface{}) map[string]interface{} {
	var keys_to_copy = []string{"description", "from_port", "to_port", "protocol"}

	dst := make(map[string]interface{})
	for _, key := range keys_to_copy {
		if val, ok := src[key]; ok {
			dst[key] = val
		}
	}
	if k != "" {
		dst[k] = v
	}
	if _, ok := src["self"]; ok {
		dst["self"] = self
	}
	return dst
}
332628
func (ra *RegistrationAuthorityImpl) RevokeCertificateWithReg(ctx context.Context, cert x509.Certificate, revocationCode revocation.Reason, regID int64) error {
	serialString := core.SerialToString(cert.SerialNumber)
	var err error
	if features.Enabled(features.RevokeAtRA) {
		err = ra.revokeCertificate(ctx, cert, revocationCode)
	} else {
		err = ra.SA.MarkCertificateRevoked(ctx, serialString, revocationCode)
	}

	state := "Failure"
	defer func() {
		// Needed:
		//   Serial
		//   CN
		//   DNS names
		//   Revocation reason
		//   Registration ID of requester
		//   Error (if there was one)
		ra.log.AuditInfof("%s, Request by registration ID: %d",
			revokeEvent(state, serialString, cert.Subject.CommonName, cert.DNSNames, revocationCode),
			regID)
	}()

	if err != nil {
		state = fmt.Sprintf("Failure -- %s", err)
		return err
	}

	state = "Success"
	ra.stats.Inc("RevokedCertificates", 1)
	return nil
}
489540
func (s *CopyObjectInput) SetSSECustomerKey(v string) *CopyObjectInput {
	s.SSECustomerKey = &v
	return s
}