// AddSSHKeys 公開鍵 設定
966181
func (d *DiskEditValue) AddSSHKeys(keyID string) {
	if d.SSHKeys == nil {
		d.SSHKeys = []*SSHKey{}
	}
	d.SSHKeys = append(d.SSHKeys, &SSHKey{Resource: NewResourceByStringID(keyID)})
}
641421
func addKey(keys map[rune]kb.Key, r rune, key kb.Key, scanCodeMap map[string][]int64, shouldPanic bool) {
	if _, ok := keys[r]; ok {
		if shouldPanic {
			panic(fmt.Sprintf("rune %U (%s/%s) already defined in keys", r, key.Code, key.Key))
		}
		return
	}

	sc, ok := scanCodeMap[key.Code]
	if ok {
		key.Native = sc[0]
		key.Windows = sc[1]
	}

	keys[r] = key
}
221174
func (d *DiskEditValue) SetSSHKeyByString(keys []string) {
	if d.SSHKeys == nil {
		d.SSHKeys = []*SSHKey{}
	}
	for _, key := range keys {
		d.SSHKeys = append(d.SSHKeys, &SSHKey{PublicKey: key})
	}
}
913211
func (i *Instances) AddSSHKeyToAllInstances(user string, keyData []byte) error {
	return errors.New("unimplemented")
}
254106
func (s *UntagInput) SetKeys(v []*string) *UntagInput {
	s.Keys = v
	return s
}
100558
func (context *OpsManager) SetSSHPrivateKey(key string) {
	lo.G.Debug("Setting SSHKey")
	context.SSHPrivateKey = key
	context.createExecuter()
}
1199421
func (cfg *cloudConfig) SetSSHKeys(keys SSHKeys) {
	if keys.RSA != nil {
		cfg.SetAttr("ssh_keys", map[string]interface{}{
			string(RSAPrivate): keys.RSA.Private,
			string(RSAPublic):  keys.RSA.Public,
		})
	} else {
		cfg.UnsetAttr("ssh_keys")
	}
}
921901
func (s *DescribeDimensionKeysOutput) SetKeys(v []*DimensionKeyDescription) *DescribeDimensionKeysOutput {
	s.Keys = v
	return s
}
221601
func (s *Group) SetKeys(v []*string) *Group {
	s.Keys = v
	return s
}
989782
func (c *client) Add(s interface{}, cert *ssh.Certificate, comment string) error {
	if cert == nil {
		return c.insertKey(s, comment)
	} else {
		return c.insertCert(s, cert, comment)
	}
}
953654
func (s *scope) setKeys(src, dest interface{}) {
	s.srcStack.top().key = fmt.Sprintf(`["%v"]`, src)
	s.destStack.top().key = fmt.Sprintf(`["%v"]`, dest)
}
1130855
func (client *SSHClient) SetSSHPrivateKey(s string) {
	client.Creds.mu.Lock()
	client.Creds.SSHPrivateKey = s
	client.Creds.mu.Unlock()
}
606332
func (o *InfrastructureAccessProfile) CreateSSHKey(child *SSHKey) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
1752
func (s *Source) SetSshKey(v string) *Source {
	s.SshKey = &v
	return s
}
1317484
func (k *Key) AsAgentKeys() ([]*agent.AddedKey, error) {
	// unmarshal certificate bytes into a ssh.PublicKey
	publicKey, _, _, _, err := ssh.ParseAuthorizedKey(k.Cert)
	if err != nil {
		return nil, trace.Wrap(err)
	}

	// unmarshal private key bytes into a *rsa.PrivateKey
	privateKey, err := ssh.ParseRawPrivateKey(k.Priv)
	if err != nil {
		return nil, trace.Wrap(err)
	}

	// put a teleport identifier along with the teleport user into the comment field
	comment := fmt.Sprintf("teleport:%v", publicKey.(*ssh.Certificate).KeyId)

	// On Windows, return the certificate with the private key embedded.
	if runtime.GOOS == teleport.WindowsOS {
		return []*agent.AddedKey{
			&agent.AddedKey{
				PrivateKey:       privateKey,
				Certificate:      publicKey.(*ssh.Certificate),
				Comment:          comment,
				LifetimeSecs:     0,
				ConfirmBeforeUse: false,
			},
		}, nil
	}

	// On Unix, return the certificate (with embedded private key) as well as
	// a private key.
	//
	// This is done because OpenSSH clients older than OpenSSH 7.3/7.3p1
	// (2016-08-01) have a bug in how they use certificates that have been loaded
	// in an agent. Specifically when you add a certificate to an agent, you can't
	// just embed the private key within the certificate, you have to add the
	// certificate and private key to the agent separately. Teleport works around
	// this behavior to ensure OpenSSH interoperability.
	//
	// For more details see the following: https://bugzilla.mindrot.org/show_bug.cgi?id=2550
	// WARNING: callers expect the returned slice to be __exactly as it is__
	return []*agent.AddedKey{
		&agent.AddedKey{
			PrivateKey:       privateKey,
			Certificate:      publicKey.(*ssh.Certificate),
			Comment:          comment,
			LifetimeSecs:     0,
			ConfirmBeforeUse: false,
		},
		&agent.AddedKey{
			PrivateKey:       privateKey,
			Certificate:      nil,
			Comment:          comment,
			LifetimeSecs:     0,
			ConfirmBeforeUse: false,
		},
	}, nil
}
1363845
func (s *DescribedUser) SetSshPublicKeys(v []*SshPublicKey) *DescribedUser {
	s.SshPublicKeys = v
	return s
}
1172397
func (ca *CertAuthorityV2) SetSigningKeys(keys [][]byte) error {
	ca.Spec.SigningKeys = keys
	return nil
}