| 1 |
package sarif |
| 2 |
|
| 3 |
// Attachment ... |
| 4 |
type Attachment struct { |
| 5 |
ArtifactLocation *ArtifactLocation `json:"artifactLocation,omitempty"` |
| 6 |
Description *Message `json:"description,omitempty"` |
| 7 |
Rectangles []*Rectangle `json:"rectangles,omitempty"` |
| 8 |
PropertyBag |
| 9 |
} |
| 10 |
|
| 11 |
// NewAttachment creates a new Attachment and returns a pointer to it |
| 12 |
func NewAttachment() *Attachment { |
| 13 |
return &Attachment{} |
| 14 |
} |
| 15 |
|
| 16 |
// WithArtifactionLocation sets the ArtifactionLocation |
| 17 |
func (attachment *Attachment) WithArtifactionLocation(artifactLocation *ArtifactLocation) *Attachment { |
| 18 |
attachment.ArtifactLocation = artifactLocation |
| 19 |
return attachment |
| 20 |
} |
| 21 |
|
| 22 |
// WithDescription sets the Description |
| 23 |
func (attachment *Attachment) WithDescription(description *Message) *Attachment { |
| 24 |
attachment.Description = description |
| 25 |
return attachment |
| 26 |
} |
| 27 |
|
| 28 |
// WithDescriptionText sets the DescriptionText |
| 29 |
func (attachment *Attachment) WithDescriptionText(text string) *Attachment { |
| 30 |
if attachment.Description == nil { |
| 31 |
attachment.Description = &Message{} |
| 32 |
} |
| 33 |
attachment.Description.Text = &text |
| 34 |
return attachment |
| 35 |
} |
| 36 |
|
| 37 |
// WithDescriptionMarkdown sets the DescriptionMarkdown |
| 38 |
func (attachment *Attachment) WithDescriptionMarkdown(markdown string) *Attachment { |
| 39 |
if attachment.Description == nil { |
| 40 |
attachment.Description = &Message{} |
| 41 |
} |
| 42 |
attachment.Description.Markdown = &markdown |
| 43 |
return attachment |
| 44 |
} |
| 45 |
|
| 46 |
// WithRectangles sets the Rectangles |
| 47 |
func (attachment *Attachment) WithRectangles(rectangles []*Rectangle) *Attachment { |
| 48 |
attachment.Rectangles = rectangles |
| 49 |
return attachment |
| 50 |
} |
| 51 |
|
| 52 |
// AddRectangle ... |
| 53 |
func (attachment *Attachment) AddRectangle(rectangle *Rectangle) { |
| 54 |
attachment.Rectangles = append(attachment.Rectangles, rectangle) |
| 55 |
} |