mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-19 09:11:30 +02:00
24 lines
1021 B
Python
24 lines
1021 B
Python
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
import base
|
||
|
import v2_swagger_client
|
||
|
from v2_swagger_client.rest import ApiException
|
||
|
|
||
|
class SystemCVEAllowlist(base.Base, object):
|
||
|
def __init__(self):
|
||
|
super(SystemCVEAllowlist, self).__init__(api_type = "system_cve_allowlist")
|
||
|
|
||
|
def set_cve_allowlist(self, expires_at=None, expected_status_code=200, *cve_ids, **kwargs):
|
||
|
client = self._get_client(**kwargs)
|
||
|
cve_list = [v2_swagger_client.CVEAllowlistItem(cve_id=c) for c in cve_ids]
|
||
|
allowlist = v2_swagger_client.CVEAllowlist(expires_at=expires_at, items=cve_list)
|
||
|
try:
|
||
|
r = client.put_system_cve_allowlist_with_http_info(allowlist=allowlist, _preload_content=False)
|
||
|
except ApiException as e:
|
||
|
base._assert_status_code(expected_status_code, e.status)
|
||
|
else:
|
||
|
base._assert_status_code(expected_status_code, r.status)
|
||
|
|
||
|
def get_cve_allowlist(self, **kwargs):
|
||
|
client = self._get_client(**kwargs)
|
||
|
return client.get_system_cve_allowlist()
|