Passed
Pull Request — master (#196)
by Matěj
02:21
created

PolicyData.content_url()   A

Complexity

Conditions 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 2
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
#
2
# Copyright (C) 2020  Red Hat, Inc.
3
#
4
# This copyrighted material is made available to anyone wishing to use,
5
# modify, copy, or redistribute it subject to the terms and conditions of
6
# the GNU General Public License v.2, or (at your option) any later version.
7
# This program is distributed in the hope that it will be useful, but WITHOUT
8
# ANY WARRANTY expressed or implied, including the implied warranties of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
10
# Public License for more details.  You should have received a copy of the
11
# GNU General Public License along with this program; if not, write to the
12
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
13
# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
14
# source code or documentation are not subject to the GNU General Public
15
# License and may only be used or replicated with the express permission of
16
# Red Hat, Inc.
17
#
18
from dasbus.structure import DBusData
19
from dasbus.typing import *  # pylint: disable=wildcard-import
20
21
__all__ = ["PolicyData"]
22
23
24
class PolicyData(DBusData):
25
    """The security policy data."""
26
27
    def __init__(self):
28
        # values specifying the content
29
        self._content_type = ""
30
        self._content_url = ""
31
        self._datastream_id = ""
32
        self._xccdf_id = ""
33
        self._profile_id = ""
34
        self._content_path = ""
35
        self._cpe_path = ""
36
        self._tailoring_path = ""
37
        self._fingerprint = ""
38
        self._certificates = ""
39
        self._remediate = ""
40
41
    def update_from(self, rhs):
42
        self._content_type = rhs._content_type
43
        self._content_url = rhs._content_url
44
        self._datastream_id = rhs._datastream_id
45
        self._xccdf_id = rhs._xccdf_id
46
        self._profile_id = rhs._profile_id
47
        self._content_path = rhs._content_path
48
        self._cpe_path = rhs._cpe_path
49
        self._tailoring_path = rhs._tailoring_path
50
        self._fingerprint = rhs._fingerprint
51
        self._certificates = rhs._certificates
52
        self._remediate = rhs._remediate
53
54
    @property
55
    def content_type(self) -> Str:
56
        """Type of the security content.
57
58
        If the content type is scap-security-guide, the add-on
59
        will use content provided by the scap-security-guide.
60
        All other attributes except profile will have no effect.
61
62
        Supported values:
63
64
            datastream
65
            archive
66
            rpm
67
            scap-security-guide
68
69
        :return: a string
70
        """
71
        return self._content_type
72
73
    @content_type.setter
74
    def content_type(self, value: Str):
75
        self._content_type = value
76
77
    @property
78
    def content_url(self) -> Str:
79
        """Location of the security content.
80
81
         So far only http, https, and ftp URLs are supported.
82
83
        :return: an URL
84
        """
85
        return self._content_url
86
87
    @content_url.setter
88
    def content_url(self, value: Str):
89
        self._content_url = value
90
91
    @property
92
    def datastream_id(self) -> Str:
93
        """ID of the data stream.
94
95
        It is an ID of the data stream from a datastream
96
        collection referenced by the content url. Used only
97
        if the content type is datastream.
98
99
        :return: a string
100
        """
101
        return self._datastream_id
102
103
    @datastream_id.setter
104
    def datastream_id(self, value: Str):
105
        self._datastream_id = value
106
107
    @property
108
    def xccdf_id(self) -> Str:
109
        """ID of the benchmark that should be used.
110
111
        :return: a string
112
        """
113
        return self._xccdf_id
114
115
    @xccdf_id.setter
116
    def xccdf_id(self, value: Str):
117
        self._xccdf_id = value
118
119
    @property
120
    def profile_id(self) -> Str:
121
        """ID of the profile that should be applied.
122
123
        Use 'default' if the default profile should be used.
124
125
        :return: a string
126
        """
127
        return self._profile_id
128
129
    @profile_id.setter
130
    def profile_id(self, value: Str):
131
        self._profile_id = value
132
133
    @property
134
    def content_path(self) -> Str:
135
        """Path to the datastream or the XCCDF file which should be used.
136
137
        :return: a relative path in the archive
138
        """
139
        return self._content_path
140
141
    @content_path.setter
142
    def content_path(self, value: Str):
143
        self._content_path = value
144
145
    @property
146
    def cpe_path(self) -> Str:
147
        """Path to the datastream or the XCCDF file that should be used.
148
149
        :return: a relative path in the archive
150
        """
151
        return self._cpe_path
152
153
    @cpe_path.setter
154
    def cpe_path(self, value: Str):
155
        self._cpe_path = value
156
157
    @property
158
    def tailoring_path(self) -> Str:
159
        """Path of the tailoring file that should be used.
160
161
        :return: a relative path in the archive
162
        """
163
        return self._tailoring_path
164
165
    @tailoring_path.setter
166
    def tailoring_path(self, value: Str):
167
        self._tailoring_path = value
168
169
    @property
170
    def fingerprint(self) -> Str:
171
        """Checksum of the security content.
172
173
        It is an MD5, SHA1 or SHA2 fingerprint/hash/checksum
174
        of the content referred by the content url.
175
176
        :return: a string
177
        """
178
        return self._fingerprint
179
180
    @fingerprint.setter
181
    def fingerprint(self, value: Str):
182
        self._fingerprint = value
183
184
    @property
185
    def certificates(self) -> Str:
186
        """Path to a PEM file with CA certificate chain.
187
188
        :return: a path
189
        """
190
        return self._certificates
191
192
    @certificates.setter
193
    def certificates(self, value: Str):
194
        self._certificates = value
195
196
    @property
197
    def remediate(self) -> Str:
198
        """What remediations to perform
199
200
        :return: a remediation mode
201
        """
202
        return self._remediate
203
204
    @remediate.setter
205
    def remediate(self, value: Str):
206
        self._remediate = value
207