37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
package artifact
|
|
|
|
import "git.cin.su/m/Assistant/platform/ids"
|
|
|
|
import "errors"
|
|
|
|
type ArtifactID ids.ID
|
|
type MediaArtifact struct {
|
|
ID ArtifactID
|
|
ContentType string
|
|
SizeBytes int64
|
|
ContentDigest string
|
|
SourceRef string
|
|
RecordedAtUnixMillis int64
|
|
}
|
|
|
|
func (a MediaArtifact) Valid() bool {
|
|
return a.ID != "" && a.ContentType != "" && a.SizeBytes > 0 && a.ContentDigest != "" && a.SourceRef != "" && a.RecordedAtUnixMillis > 0
|
|
}
|
|
|
|
type AgentArtifactAttestation struct {
|
|
ArtifactID ArtifactID
|
|
ProducerRunID string
|
|
SourceRevision string
|
|
WorktreeID string
|
|
ContentDigest string
|
|
TestEvidenceRef string
|
|
CreatedAtUnixMillis int64
|
|
}
|
|
|
|
func (a AgentArtifactAttestation) Validate() error {
|
|
if a.ArtifactID == "" || a.ProducerRunID == "" || a.SourceRevision == "" || a.WorktreeID == "" || a.ContentDigest == "" || a.TestEvidenceRef == "" || a.CreatedAtUnixMillis < 1 {
|
|
return errors.New("agent artifact attestation is incomplete")
|
|
}
|
|
return nil
|
|
}
|