func postNote()

in pkg/attestation/import.go [104:124]


func postNote(ctx context.Context, c *ca.Client, nr utils.NoteResource, n *g.Note) error {
	// Create Note
	req := &g.CreateNoteRequest{
		Parent: nr.Project,
		NoteId: nr.NoteID,
		Note:   n,
	}
	_, err := c.GetGrafeasClient().CreateNote(ctx, req)
	if err != nil {
		// If note already exists, skip
		if status.Code(err) == codes.AlreadyExists {
			log.Info().Msgf("Already Exists: %s", nr.Name())
		} else {
			return errors.Wrap(err, "error posting note")
		}
	} else {
		log.Info().Msgf("Created Note: %s", nr.Name())
	}

	return nil
}