Skip to content

feat(kpi severity): Add severity for kpi #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions examples/test_findings_v1_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"""

from ibm_cloud_sdk_core import ApiException, read_external_sources
from ibm_cloud_sdk_core.utils import datetime_to_string, string_to_datetime
import os
import pytest
from ibm_scc.findings_v1 import *
Expand Down Expand Up @@ -97,6 +96,24 @@ def test_post_graph_example(self):
except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_list_providers_example(self):
"""
list_providers request example
"""
try:
print('\nlist_providers() result:')
# begin-listProviders

api_list_providers_response = findings_service.list_providers().get_result()

print(json.dumps(api_list_providers_response, indent=2))

# end-listProviders

except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_create_note_example(self):
"""
Expand Down Expand Up @@ -329,24 +346,6 @@ def test_update_occurrence_example(self):
except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_list_providers_example(self):
"""
list_providers request example
"""
try:
print('\nlist_providers() result:')
# begin-listProviders

api_list_providers_response = findings_service.list_providers().get_result()

print(json.dumps(api_list_providers_response, indent=2))

# end-listProviders

except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_delete_occurrence_example(self):
"""
Expand Down
77 changes: 38 additions & 39 deletions ibm_scc/findings_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# IBM OpenAPI SDK Code Generator Version: 3.34.1-ad041667-20210617-195430
# IBM OpenAPI SDK Code Generator Version: 3.40.0-910cf8c2-20211006-154754

"""
The Findings API is used to find and display occurrences of security issues in your IBM
Cloud account by using the artifact metadata specification. Findings are summarized in
cards in the Security and Compliance Center that allow you to see the security status of
your account at a glance and start an investigation into any potential issues.

API Version: 1.0.0
"""

from datetime import datetime
Expand Down Expand Up @@ -78,7 +80,7 @@ def __init__(self,
:param str account_id: Account ID.

:param Authenticator authenticator: The authenticator specifies the authentication mechanism.
Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md
Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md
about initializing the authenticator of your choice.
"""
if account_id is None:
Expand Down Expand Up @@ -148,7 +150,7 @@ def post_graph(self,
headers=headers,
data=data)

response = self.send(request)
response = self.send(request, **kwargs)
return response

#########################
Expand Down Expand Up @@ -215,7 +217,7 @@ def list_providers(self,
headers=headers,
params=params)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand All @@ -228,7 +230,6 @@ def create_note(self,
reported_by: 'Reporter',
*,
related_url: List['ApiNoteRelatedUrl'] = None,
expiration_time: datetime = None,
shared: bool = None,
finding: 'FindingType' = None,
kpi: 'KpiType' = None,
Expand Down Expand Up @@ -261,8 +262,6 @@ def create_note(self,
:param str id: The ID of the note.
:param Reporter reported_by: The entity reporting a note.
:param List[ApiNoteRelatedUrl] related_url: (optional)
:param datetime expiration_time: (optional) Time of expiration for this
note, null if note does not expire.
:param bool shared: (optional) True if this note can be shared by multiple
accounts.
:param FindingType finding: (optional) FindingType provides details about a
Expand Down Expand Up @@ -294,8 +293,6 @@ def create_note(self,
reported_by = convert_model(reported_by)
if related_url is not None:
related_url = [convert_model(x) for x in related_url]
if expiration_time is not None:
expiration_time = datetime_to_string(expiration_time)
if finding is not None:
finding = convert_model(finding)
if kpi is not None:
Expand All @@ -319,7 +316,6 @@ def create_note(self,
'id': id,
'reported_by': reported_by,
'related_url': related_url,
'expiration_time': expiration_time,
'shared': shared,
'finding': finding,
'kpi': kpi,
Expand All @@ -343,7 +339,7 @@ def create_note(self,
headers=headers,
data=data)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand Down Expand Up @@ -400,7 +396,7 @@ def list_notes(self,
headers=headers,
params=params)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand Down Expand Up @@ -452,7 +448,7 @@ def get_note(self,
url=url,
headers=headers)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand All @@ -466,7 +462,6 @@ def update_note(self,
reported_by: 'Reporter',
*,
related_url: List['ApiNoteRelatedUrl'] = None,
expiration_time: datetime = None,
shared: bool = None,
finding: 'FindingType' = None,
kpi: 'KpiType' = None,
Expand Down Expand Up @@ -498,8 +493,6 @@ def update_note(self,
:param str id: The ID of the note.
:param Reporter reported_by: The entity reporting a note.
:param List[ApiNoteRelatedUrl] related_url: (optional)
:param datetime expiration_time: (optional) Time of expiration for this
note, null if note does not expire.
:param bool shared: (optional) True if this note can be shared by multiple
accounts.
:param FindingType finding: (optional) FindingType provides details about a
Expand Down Expand Up @@ -533,8 +526,6 @@ def update_note(self,
reported_by = convert_model(reported_by)
if related_url is not None:
related_url = [convert_model(x) for x in related_url]
if expiration_time is not None:
expiration_time = datetime_to_string(expiration_time)
if finding is not None:
finding = convert_model(finding)
if kpi is not None:
Expand All @@ -558,7 +549,6 @@ def update_note(self,
'id': id,
'reported_by': reported_by,
'related_url': related_url,
'expiration_time': expiration_time,
'shared': shared,
'finding': finding,
'kpi': kpi,
Expand All @@ -582,7 +572,7 @@ def update_note(self,
headers=headers,
data=data)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand Down Expand Up @@ -633,7 +623,7 @@ def delete_note(self,
url=url,
headers=headers)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand Down Expand Up @@ -684,7 +674,7 @@ def get_occurrence_note(self,
url=url,
headers=headers)

response = self.send(request)
response = self.send(request, **kwargs)
return response

#########################
Expand Down Expand Up @@ -802,7 +792,7 @@ def create_occurrence(self,
headers=headers,
data=data)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand Down Expand Up @@ -860,7 +850,7 @@ def list_occurrences(self,
headers=headers,
params=params)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand Down Expand Up @@ -922,7 +912,7 @@ def list_note_occurrences(self,
headers=headers,
params=params)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand Down Expand Up @@ -973,7 +963,7 @@ def get_occurrence(self,
url=url,
headers=headers)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand Down Expand Up @@ -1086,7 +1076,7 @@ def update_occurrence(self,
headers=headers,
data=data)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand Down Expand Up @@ -1137,7 +1127,7 @@ def delete_occurrence(self,
url=url,
headers=headers)

response = self.send(request)
response = self.send(request, **kwargs)
return response


Expand Down Expand Up @@ -1858,27 +1848,34 @@ class KpiType():
"""
KpiType provides details about a KPI note.

:attr str severity: (optional)
:attr str aggregation_type: The aggregation type of the KPI values. - SUM: A
single-value metrics aggregation type that sums up numeric values
that are extracted from KPI occurrences.
"""

def __init__(self,
aggregation_type: str) -> None:
aggregation_type: str,
*,
severity: str = None) -> None:
"""
Initialize a KpiType object.

:param str aggregation_type: The aggregation type of the KPI values. -
SUM: A single-value metrics aggregation type that sums up numeric
values
that are extracted from KPI occurrences.
:param str severity: (optional)
"""
self.severity = severity
self.aggregation_type = aggregation_type

@classmethod
def from_dict(cls, _dict: Dict) -> 'KpiType':
"""Initialize a KpiType object from a json dictionary."""
args = {}
if 'Severity' in _dict:
args['severity'] = _dict.get('Severity')
if 'aggregation_type' in _dict:
args['aggregation_type'] = _dict.get('aggregation_type')
else:
Expand All @@ -1893,6 +1890,8 @@ def _from_dict(cls, _dict):
def to_dict(self) -> Dict:
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'severity') and self.severity is not None:
_dict['Severity'] = self.severity
if hasattr(self, 'aggregation_type') and self.aggregation_type is not None:
_dict['aggregation_type'] = self.aggregation_type
return _dict
Expand All @@ -1915,6 +1914,16 @@ def __ne__(self, other: 'KpiType') -> bool:
"""Return `true` when self and other are not equal, false otherwise."""
return not self == other

class SeverityEnum(str, Enum):
"""
severity.
"""
LOW = 'LOW'
MEDIUM = 'MEDIUM'
HIGH = 'HIGH'
CRITICAL = 'CRITICAL'


class AggregationTypeEnum(str, Enum):
"""
The aggregation type of the KPI values. - SUM: A single-value metrics
Expand Down Expand Up @@ -2625,8 +2634,6 @@ class ApiNote():
account.
- SECTION: The note represents a section in a dashboard.
:attr List[ApiNoteRelatedUrl] related_url: (optional)
:attr datetime expiration_time: (optional) Time of expiration for this note,
null if note does not expire.
:attr datetime create_time: (optional) Output only. The time this note was
created. This field can be used as a filter in list requests.
:attr datetime update_time: (optional) Output only. The time this note was last
Expand All @@ -2651,7 +2658,6 @@ def __init__(self,
reported_by: 'Reporter',
*,
related_url: List['ApiNoteRelatedUrl'] = None,
expiration_time: datetime = None,
create_time: datetime = None,
update_time: datetime = None,
shared: bool = None,
Expand All @@ -2676,8 +2682,6 @@ def __init__(self,
:param str id: The ID of the note.
:param Reporter reported_by: The entity reporting a note.
:param List[ApiNoteRelatedUrl] related_url: (optional)
:param datetime expiration_time: (optional) Time of expiration for this
note, null if note does not expire.
:param bool shared: (optional) True if this note can be shared by multiple
accounts.
:param FindingType finding: (optional) FindingType provides details about a
Expand All @@ -2692,7 +2696,6 @@ def __init__(self,
self.long_description = long_description
self.kind = kind
self.related_url = related_url
self.expiration_time = expiration_time
self.create_time = create_time
self.update_time = update_time
self.id = id
Expand Down Expand Up @@ -2721,8 +2724,6 @@ def from_dict(cls, _dict: Dict) -> 'ApiNote':
raise ValueError('Required property \'kind\' not present in ApiNote JSON')
if 'related_url' in _dict:
args['related_url'] = [ApiNoteRelatedUrl.from_dict(x) for x in _dict.get('related_url')]
if 'expiration_time' in _dict:
args['expiration_time'] = string_to_datetime(_dict.get('expiration_time'))
if 'create_time' in _dict:
args['create_time'] = string_to_datetime(_dict.get('create_time'))
if 'update_time' in _dict:
Expand Down Expand Up @@ -2763,8 +2764,6 @@ def to_dict(self) -> Dict:
_dict['kind'] = self.kind
if hasattr(self, 'related_url') and self.related_url is not None:
_dict['related_url'] = [x.to_dict() for x in self.related_url]
if hasattr(self, 'expiration_time') and self.expiration_time is not None:
_dict['expiration_time'] = datetime_to_string(self.expiration_time)
if hasattr(self, 'create_time') and getattr(self, 'create_time') is not None:
_dict['create_time'] = datetime_to_string(getattr(self, 'create_time'))
if hasattr(self, 'update_time') and getattr(self, 'update_time') is not None:
Expand Down
Loading