lxd/db/certificates.go
func (c *Cluster) CertificatesGet() (certs []*CertInfo, err error) {
	err = c.Transaction(func(tx *ClusterTx) error {
		rows, err := tx.tx.Query(
			"SELECT id, fingerprint, type, name, certificate FROM certificates",
		)
		if err != nil {
			return err
		}

		defer rows.Close()

		for rows.Next() {
			cert := new(CertInfo)
			rows.Scan(
				&cert.ID,
				&cert.Fingerprint,
				&cert.Type,
				&cert.Name,
				&cert.Certificate,
			)
			certs = append(certs, cert)
		}

		return rows.Err()
	})
	if err != nil {
		return certs, err
	}

	return certs, nil
}
func (c *Cluster) CertificatesGet() (certs []*CertInfo, err error) {
	err = c.Transaction(func(tx *ClusterTx) error {
		rows, err := tx.tx.Query(
			"SELECT id, fingerprint, type, name, certificate FROM certificates",
		)
		if err != nil {
			return err
		}

		defer rows.Close()

		for rows.Next() {
			cert := new(CertInfo)
			rows.Scan(
				&cert.ID,
				&cert.Fingerprint,
				&cert.Type,
				&cert.Name,
				&cert.Certificate,
			)
			certs = append(certs, cert)
		}

		return rows.Err()
	})
	if err != nil {
		return certs, err
	}

	return certs, nil
}
func ( c * Cluster ) CertificatesGet ( ) ( certs [ ] * CertInfo , err error ) { err = c . Transaction ( func ( tx * ClusterTx ) error { rows , err := tx . tx . Query ( " " , ) if err != nil { return err } defer rows . Close ( ) for rows . Next ( ) { cert := new ( CertInfo ) rows . Scan ( & cert . ID , & cert . Fingerprint , & cert . Type , & cert . Name , & cert . Certificate , ) certs = append ( certs , cert ) } return rows . Err ( ) } ) if err != nil { return certs , err } return certs , nil }
// CertificatesGet returns all certificates from the DB as CertBaseInfo objects.
CertificatesGet returns all certificates from the DB as CertBaseInfo objects .