File Coverage

blib/lib/STIX/Report.pm
Criterion Covered Total %
statement 41 41 100.0
branch n/a
condition n/a
subroutine 14 14 100.0
pod n/a
total 55 55 100.0


line stmt bran cond sub pod time code
1             package STIX::Report;
2              
3 24     24   565 use 5.010001;
  24         108  
4 24     24   158 use strict;
  24         53  
  24         645  
5 24     24   149 use warnings;
  24         49  
  24         1620  
6 24     24   180 use utf8;
  24         82  
  24         276  
7              
8 24     24   1039 use STIX::Common::List;
  24         60  
  24         854  
9 24     24   149 use STIX::Common::OpenVocabulary;
  24         77  
  24         1011  
10 24     24   168 use Types::Standard qw(Int Str Enum InstanceOf);
  24         58  
  24         229  
11 24     24   90733 use Types::TypeTiny qw(ArrayLike);
  24         70  
  24         194  
12              
13 24     24   13632 use Moo;
  24         61  
  24         235  
14 24     24   11167 use namespace::autoclean;
  24         54  
  24         257  
15              
16             extends 'STIX::Common::Properties';
17              
18 24         2607 use constant SCHEMA =>
19 24     24   2696 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/report.json';
  24         63  
20              
21 24         1698 use constant PROPERTIES => (
22             qw(type spec_version id created modified),
23             qw(created_by_ref revoked labels confidence lang external_references object_marking_refs granular_markings extensions),
24             qw(name description report_types published object_refs)
25 24     24   161 );
  24         85  
26              
27 24     24   140 use constant STIX_OBJECT => 'SDO';
  24         72  
  24         1235  
28 24     24   155 use constant STIX_OBJECT_TYPE => 'report';
  24         52  
  24         7307  
29              
30             has name => (is => 'rw', isa => Str, required => 1);
31             has description => (is => 'rw', isa => Str);
32              
33             has report_types => (
34             is => 'rw',
35             isa => ArrayLike [Enum [STIX::Common::OpenVocabulary->REPORT_TYPE()]],
36             default => sub { STIX::Common::List->new }
37             );
38              
39             has published => (
40             is => 'rw',
41             required => 1,
42             isa => InstanceOf ['STIX::Common::Timestamp'],
43             coerce => sub { ref($_[0]) ? $_[0] : STIX::Common::Timestamp->new($_[0]) },
44             );
45              
46             has object_refs => (
47             is => 'rw',
48             isa => ArrayLike [InstanceOf ['STIX::Object', 'STIX::Common::Identifier']],
49             default => sub { STIX::Common::List->new }
50             );
51              
52             1;
53              
54             =encoding utf-8
55              
56             =head1 NAME
57              
58             STIX::Report - STIX Domain Object (SDO) - Report
59              
60             =head1 SYNOPSIS
61              
62             use STIX::Report;
63              
64             my $report = STIX::Report->new();
65              
66              
67             =head1 DESCRIPTION
68              
69             Reports are collections of threat intelligence focused on one or more
70             topics, such as a description of a threat actor, malware, or attack
71             technique, including context and related details.
72              
73              
74             =head2 METHODS
75              
76             L inherits all methods from L
77             and implements the following new ones.
78              
79             =over
80              
81             =item STIX::Report->new(%properties)
82              
83             Create a new instance of L.
84              
85             =item $report->description
86              
87             A description that provides more details and context about Report.
88              
89             =item $report->id
90              
91             =item $report->name
92              
93             The name used to identify the Report.
94              
95             =item $report->object_refs
96              
97             Specifies the STIX Objects that are referred to by this Report.
98              
99             =item $report->published
100              
101             The date that this report object was officially published by the creator of
102             this report.
103              
104             =item $report->report_types
105              
106             This field is a C (L) that
107             specifies the primary subject of this report. The suggested values for this
108             field are in report-type-ov.
109              
110             =item $report->type
111              
112             The type of this object, which MUST be the literal C.
113              
114             =back
115              
116              
117             =head2 HELPERS
118              
119             =over
120              
121             =item $report->TO_JSON
122              
123             Encode the object in JSON.
124              
125             =item $report->to_hash
126              
127             Return the object HASH.
128              
129             =item $report->to_string
130              
131             Encode the object in JSON.
132              
133             =item $report->validate
134              
135             Validate the object using JSON Schema (see L).
136              
137             =back
138              
139              
140             =head1 SUPPORT
141              
142             =head2 Bugs / Feature Requests
143              
144             Please report any bugs or feature requests through the issue tracker
145             at L.
146             You will be notified automatically of any progress on your issue.
147              
148             =head2 Source Code
149              
150             This is open source software. The code repository is available for
151             public review and contribution under the terms of the license.
152              
153             L
154              
155             git clone https://github.com/giterlizzi/perl-STIX.git
156              
157              
158             =head1 AUTHOR
159              
160             =over 4
161              
162             =item * Giuseppe Di Terlizzi
163              
164             =back
165              
166              
167             =head1 LICENSE AND COPYRIGHT
168              
169             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
170              
171             This is free software; you can redistribute it and/or modify it under
172             the same terms as the Perl 5 programming language system itself.
173              
174             =cut