| 1 | package sarif |
| 2 | |
| 3 | // Location ... |
| 4 | type Location struct { |
| 5 | PropertyBag |
| 6 | Id *uint `json:"id,omitempty"` |
| 7 | PhysicalLocation *PhysicalLocation `json:"physicalLocation,omitempty"` |
| 8 | LogicalLocations []*LogicalLocation `json:"logicalLocations,omitempty"` |
| 9 | Message *Message `json:"message,omitempty"` |
| 10 | Annotations []*Region `json:"annotations,omitempty"` |
| 11 | Relationships []*LocationRelationship `json:"relationships,omitempty"` |
| 12 | } |
| 13 | |
| 14 | // NewLocation ... |
| 15 | func NewLocation() *Location { |
| 16 | return &Location{} |
| 17 | } |
| 18 | |
| 19 | // NewLocationWithPhysicalLocation ... |
| 20 | func NewLocationWithPhysicalLocation(physicalLocation *PhysicalLocation) *Location { |
| 21 | return NewLocation().WithPhysicalLocation(physicalLocation) |
| 22 | } |
| 23 | |
| 24 | // WithId ... |
| 25 | func (l *Location) WithId(id int) *Location { |
| 26 | i := uint(id) |
| 27 | l.Id = &i |
| 28 | return l |
| 29 | } |
| 30 | |
| 31 | // WithPhysicalLocation ... |
| 32 | func (l *Location) WithPhysicalLocation(physicalLocation *PhysicalLocation) *Location { |
| 33 | l.PhysicalLocation = physicalLocation |
| 34 | return l |
| 35 | } |
| 36 | |
| 37 | // WithMessage ... |
| 38 | func (l *Location) WithMessage(message *Message) *Location { |
| 39 | l.Message = message |
| 40 | return l |
| 41 | } |
| 42 | |
| 43 | // WithAnnotation ... |
| 44 | func (l *Location) WithAnnotation(region *Region) *Location { |
| 45 | l.Annotations = append(l.Annotations, region) |
| 46 | return l |
| 47 | } |
| 48 | |
| 49 | // WithRelationship ... |
| 50 | func (l *Location) WithRelationship(locationRelationship *LocationRelationship) *Location { |
| 51 | l.Relationships = append(l.Relationships, locationRelationship) |
| 52 | return l |
| 53 | } |