CycloneDX/Service.pm

filter: Statementstmt 56.8% 50 / 88 Branchbran 0.0% 0 / 38 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 10 / 20 Podpod 100% 1 / 1 totaltotal 41.5% 61 / 147 CC 20 SCAR 52.3
CC
20
Cov
40%
TO_JSON
380.0
__ANON__
6.0
__ANON__
2.0
CRAP 186.0
« CycloneDX/Vulnerability.pm ↑ Summary CycloneDX/CryptoProperties/CertificateProperties.pm »
1 package SBOM::CycloneDX::Service;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use SBOM::CycloneDX::BomRef;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use SBOM::CycloneDX::List;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Types::Standard qw(Str Bool InstanceOf HashRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Types::TypeTiny qw(ArrayLike);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 extends 'SBOM::CycloneDX::Base';
18  
19 has bom_ref => (
20 is => 'rw',
21 isa => InstanceOf ['SBOM::CycloneDX::BomRef'],
22 0 ▶ coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
23 1 );
24  
25 1 has provider => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::OrganizationalEntity']);
26 1 has group => (is => 'rw', isa => Str);
27 1 has name => (is => 'rw', isa => Str, required => 1);
28 1 has version => (is => 'rw', isa => Str);
29 1 has description => (is => 'rw', isa => Str);
30 0 ▶has endpoints => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
Subroutine __ANON__: not called CC=1 SCAR=1.2
31 1 has authenticated => (is => 'rw', isa => Bool);
32 1 has x_trust_boundary => (is => 'rw', isa => Bool);
33 1 has trust_zone => (is => 'rw', isa => Str);
34 0 ▶has data => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
Subroutine __ANON__: not called CC=1 SCAR=1.2
35  
36 has licenses => (
37 is => 'rw',
38 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::License']],
39 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
40 1 );
41  
42 has patent_assertions => (
43 is => 'rw',
44 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::PatentAssertion']],
45 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
46 1 );
47  
48 has external_references => (
49 is => 'rw',
50 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::ExternalReference']],
51 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
52 1 );
53  
54 has services => (
55 is => 'rw',
56 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Service']],
57 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 1 );
59  
60 1 has release_notes => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::ReleaseNotes']);
61  
62 has properties => (
63 is => 'rw',
64 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Property']],
65 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
66 1 );
67  
68 0 ▶has tags => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
Subroutine __ANON__: not called CC=1 SCAR=1.2
69 1 has signature => (is => 'rw', isa => HashRef);
70  
71  
72 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=19 SCAR=59.4
Pod documented
73  
74 0 my $self = shift;
75  
76 0 my $json = {name => $self->name};
77  
78 0 ▶ $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
Branch: 1 branch
BranchTrueFalseTotal
if $self->bom_ref 0 0 0
79 0 ▶ $json->{provider} = $self->provider if $self->provider;
Branch: 1 branch
BranchTrueFalseTotal
if $self->provider 0 0 0
80 0 ▶ $json->{group} = $self->group if $self->group;
Branch: 1 branch
BranchTrueFalseTotal
if $self->group 0 0 0
81 0 ▶ $json->{version} = $self->version if $self->version;
Branch: 1 branch
BranchTrueFalseTotal
if $self->version 0 0 0
82 0 ▶ $json->{description} = $self->description if $self->description;
Branch: 1 branch
BranchTrueFalseTotal
if $self->description 0 0 0
83 0 ▶ $json->{endpoints} = $self->endpoints if @{$self->endpoints};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->endpoints;} 0 0 0
84 0 ▶ $json->{authenticated} = $self->authenticated if $self->authenticated;
Branch: 1 branch
BranchTrueFalseTotal
if $self->authenticated 0 0 0
85 0 ▶ $json->{'x-trust-boundary'} = $self->x_trust_boundary if $self->x_trust_boundary;
Branch: 1 branch
BranchTrueFalseTotal
if $self->x_trust_boundary 0 0 0
86 0 ▶ $json->{trustZone} = $self->trust_zone if $self->trust_zone;
Branch: 1 branch
BranchTrueFalseTotal
if $self->trust_zone 0 0 0
87 0 ▶ $json->{data} = $self->data if @{$self->data};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->data;} 0 0 0
88 0 ▶ $json->{patentAssertions} = $self->patent_assertions if @{$self->patent_assertions};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->patent_assertions;} 0 0 0
89 0 ▶ $json->{licenses} = $self->licenses if @{$self->licenses};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->licenses;} 0 0 0
90 0 ▶ $json->{externalReferences} = $self->external_references if @{$self->external_references};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->external_references;} 0 0 0
91 0 ▶ $json->{services} = $self->services if @{$self->services};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->services;} 0 0 0
92 0 ▶ $json->{releaseNotes} = $self->release_notes if $self->release_notes;
Branch: 1 branch
BranchTrueFalseTotal
if $self->release_notes 0 0 0
93 0 ▶ $json->{properties} = $self->properties if @{$self->properties};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->properties;} 0 0 0
94 0 ▶ $json->{tags} = $self->tags if @{$self->tags};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->tags;} 0 0 0
95 0 ▶ $json->{signature} = $self->signature if $self->signature;
Branch: 1 branch
BranchTrueFalseTotal
if $self->signature 0 0 0
96  
97 0 return $json;
98  
99 }
100  
101 1 1;
102  
103 =encoding utf-8
104  
105 =head1 NAME
106  
107 SBOM::CycloneDX::Service - Service
108  
109 =head1 SYNOPSIS
110  
111 SBOM::CycloneDX::Service->new();
112  
113  
114 =head1 DESCRIPTION
115  
116 L<SBOM::CycloneDX::Service> provides a list of services included or deployed
117 behind the parent service. This is not a dependency tree. It provides a way to
118 specify a hierarchical representation of service assemblies.
119  
120 =head2 METHODS
121  
122 L<SBOM::CycloneDX::Service> inherits all methods from L<SBOM::CycloneDX::Base>
123 and implements the following new ones.
124  
125 =over
126  
127 =item SBOM::CycloneDX::Service->new( %PARAMS )
128  
129 Properties:
130  
131 =over
132  
133 =item * C<authenticated>, A boolean value indicating if the service requires
134 authentication. A value of true indicates the service requires
135 authentication prior to use. A value of false indicates the service does
136 not require authentication.
137  
138 =item * C<bom_ref>, An identifier which can be used to reference the
139 service elsewhere in the BOM. Every bom-ref must be unique within the BOM.
140 Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid
141 conflicts with BOM-Links.
142  
143 =item * C<data>, Specifies information about the data including the
144 directional flow of data and the data classification.
145  
146 =item * C<description>, Specifies a description for the service
147  
148 =item * C<endpoints>, The endpoint URIs of the service. Multiple endpoints
149 are allowed.
150  
151 =item * C<external_references>, External references provide a way to document
152 systems, sites, and information that may be relevant but are not included
153 with the BOM. They may also establish specific relationships within or
154 external to the BOM.
155  
156 =item * C<group>, The grouping name, namespace, or identifier. This will
157 often be a shortened, single name of the company or project that produced
158 the service or domain name. Whitespace and special characters should be
159 avoided.
160  
161 =item * C<licenses>, Service License(s).
162  
163 =item * C<name>, The name of the service. This will often be a shortened,
164 single name of the service.
165  
166 =item * C<patent_assertions>, Service Patent(s).
167  
168 Patent Assertions. A list of assertions made regarding patents associated
169 with this component or service. Assertions distinguish between ownership,
170 licensing, and other relevant interactions with patents.
171  
172 =item * C<properties>, Provides the ability to document properties in a
173 name-value store. This provides flexibility to include data not officially
174 supported in the standard without having to use additional namespaces or
175 create extensions. Unlike key-value stores, properties support duplicate
176 names, each potentially having different values. Property names of interest
177 to the general public are encouraged to be registered in the CycloneDX
178 Property Taxonomy (L<https://github.com/CycloneDX/cyclonedx-property-taxonomy>).
179 Formal registration is optional.
180  
181 =item * C<provider>, The organization that provides the service.
182  
183 =item * C<release_notes>, Specifies release notes.
184  
185 =item * C<services>, A list of services included or deployed behind the
186 parent service. This is not a dependency tree. It provides a way to specify
187 a hierarchical representation of service assemblies.
188  
189 =item * C<signature>, Enveloped signature in JSON Signature Format
190 (JSF) (L<https://cyberphone.github.io/doc/security/jsf.html>).
191  
192 =item * C<tags>,
193  
194 =item * C<trust_zone>, The name of the trust zone the service resides in.
195  
196 =item * C<version>, The service version.
197  
198 =item * C<x_trust_boundary>, A boolean value indicating if use of the service
199 crosses a trust zone or boundary. A value of true indicates that by using
200 the service, a trust boundary is crossed. A value of false indicates that by
201 using the service, a trust boundary is not crossed.
202  
203 =back
204  
205 =item $service->authenticated
206  
207 =item $service->bom_ref
208  
209 =item $service->data
210  
211 =item $service->description
212  
213 =item $service->endpoints
214  
215 =item $service->external_references
216  
217 =item $service->group
218  
219 =item $service->licenses
220  
221 =item $service->name
222  
223 =item $service->patent_assertions
224  
225 =item $service->properties
226  
227 =item $service->provider
228  
229 =item $service->release_notes
230  
231 =item $service->services
232  
233 =item $service->signature
234  
235 =item $service->tags
236  
237 =item $service->trust_zone
238  
239 =item $service->version
240  
241 =item $service->x_trust_boundary
242  
243 =back
244  
245  
246 =head1 SUPPORT
247  
248 =head2 Bugs / Feature Requests
249  
250 Please report any bugs or feature requests through the issue tracker
251 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
252 You will be notified automatically of any progress on your issue.
253  
254 =head2 Source Code
255  
256 This is open source software. The code repository is available for
257 public review and contribution under the terms of the license.
258  
259 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
260  
261 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
262  
263  
264 =head1 AUTHOR
265  
266 =over 4
267  
268 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
269  
270 =back
271  
272  
273 =head1 LICENSE AND COPYRIGHT
274  
275 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
276  
277 This is free software; you can redistribute it and/or modify it under
278 the same terms as the Perl 5 programming language system itself.
279  
280 =cut
« CycloneDX/Vulnerability.pm ↑ Summary CycloneDX/CryptoProperties/CertificateProperties.pm »