| 1 |
package sarif |
| 2 |
|
| 3 |
// Artifact ... |
| 4 |
type Artifact struct { |
| 5 |
|
| 6 |
Location *ArtifactLocation `json:"location,omitempty"` |
| 7 |
ParentIndex *uint `json:"parentIndex,omitempty"` |
| 8 |
Offset *uint `json:"offset,omitempty"` |
| 9 |
Length int `json:"length"` |
| 10 |
Roles []string `json:"roles,omitempty"` |
| 11 |
MimeType *string `json:"mimeType,omitempty"` |
| 12 |
Contents *ArtifactContent `json:"contents,omitempty"` |
| 13 |
Encoding *string `json:"encoding,omitempty"` |
| 14 |
SourceLanguage *string `json:"sourceLanguage,omitempty"` |
| 15 |
Hashes map[string]string `json:"hashes,omitempty"` |
| 16 |
LastModifiedTimeUtc *string `json:"lastModifiedTimeUtc,omitempty"` |
| 17 |
Description *Message `json:"description,omitempty"` |
| 18 |
PropertyBag |
| 19 |
} |
| 20 |
|
| 21 |
// NewArtifact creates a new Artifact and returns a pointer to it |
| 22 |
func NewArtifact() *Artifact { |
| 23 |
return &Artifact{} |
| 24 |
} |
| 25 |
|
| 26 |
// WithLocation sets the Location |
| 27 |
func (artifact *Artifact) WithLocation(artifactLocation *ArtifactLocation) *Artifact { |
| 28 |
artifact.Location = artifactLocation |
| 29 |
return artifact |
| 30 |
} |
| 31 |
|
| 32 |
// WithParentIndex sets the ParentIndex |
| 33 |
func (artifact *Artifact) WithParentIndex(parentIndex int) *Artifact { |
| 34 |
i := uint(parentIndex) |
| 35 |
artifact.ParentIndex = &i |
| 36 |
return artifact |
| 37 |
} |
| 38 |
|
| 39 |
// WithOffset sets the Offset |
| 40 |
func (artifact *Artifact) WithOffset(offset int) *Artifact { |
| 41 |
o := uint(offset) |
| 42 |
artifact.Offset = &o |
| 43 |
return artifact |
| 44 |
} |
| 45 |
|
| 46 |
// WithLength sets the Length |
| 47 |
func (artifact *Artifact) WithLength(length int) *Artifact { |
| 48 |
artifact.Length = length |
| 49 |
return artifact |
| 50 |
} |
| 51 |
|
| 52 |
// WithRole sets the Role |
| 53 |
func (artifact *Artifact) WithRole(role string) *Artifact { |
| 54 |
artifact.Roles = append(artifact.Roles, role) |
| 55 |
return artifact |
| 56 |
} |
| 57 |
|
| 58 |
// WithMimeType sets the MimeType |
| 59 |
func (artifact *Artifact) WithMimeType(mimeType string) *Artifact { |
| 60 |
artifact.MimeType = &mimeType |
| 61 |
return artifact |
| 62 |
} |
| 63 |
|
| 64 |
// WithContents sets the Contents |
| 65 |
func (artifact *Artifact) WithContents(artifactContent *ArtifactContent) *Artifact { |
| 66 |
artifact.Contents = artifactContent |
| 67 |
return artifact |
| 68 |
} |
| 69 |
|
| 70 |
// WithEncoding sets the Encoding |
| 71 |
func (artifact *Artifact) WithEncoding(encoding string) *Artifact { |
| 72 |
artifact.Encoding = &encoding |
| 73 |
return artifact |
| 74 |
} |
| 75 |
|
| 76 |
// WithSourceLanguage sets the SourceLanguage |
| 77 |
func (artifact *Artifact) WithSourceLanguage(sourceLanguage string) *Artifact { |
| 78 |
artifact.SourceLanguage = &sourceLanguage |
| 79 |
return artifact |
| 80 |
} |
| 81 |
|
| 82 |
// WithHashes sets the Hashes |
| 83 |
func (artifact *Artifact) WithHashes(hashes map[string]string) *Artifact { |
| 84 |
artifact.Hashes = hashes |
| 85 |
return artifact |
| 86 |
} |
| 87 |
|
| 88 |
// WithLastModifiedTimeUtc sets the LastModifiedTimeUtc |
| 89 |
func (artifact *Artifact) WithLastModifiedTimeUtc(lastModified string) *Artifact { |
| 90 |
artifact.LastModifiedTimeUtc = &lastModified |
| 91 |
return artifact |
| 92 |
} |
| 93 |
|
| 94 |
// WithDescription sets the Description |
| 95 |
func (artifact *Artifact) WithDescription(message *Message) *Artifact { |
| 96 |
artifact.Description = message |
| 97 |
return artifact |
| 98 |
} |
| 99 |
|
| 100 |
// WithDescriptionText sets the DescriptionText |
| 101 |
func (artifact *Artifact) WithDescriptionText(text string) *Artifact { |
| 102 |
if artifact.Description == nil { |
| 103 |
artifact.Description = &Message{} |
| 104 |
} |
| 105 |
artifact.Description.Text = &text |
| 106 |
return artifact |
| 107 |
} |
| 108 |
|
| 109 |
// WithDescriptionMarkdown sets the DescriptionMarkdown |
| 110 |
func (artifact *Artifact) WithDescriptionMarkdown(markdown string) *Artifact { |
| 111 |
if artifact.Description == nil { |
| 112 |
artifact.Description = &Message{} |
| 113 |
} |
| 114 |
artifact.Description.Markdown = &markdown |
| 115 |
return artifact |
| 116 |
} |