You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.4 KiB
59 lines
2.4 KiB
# Copyright (C) 2005-2025 Splunk Inc. All Rights Reserved.
|
|
|
|
from ITOA.itoa_object import ItoaObject
|
|
from ITOA.setup_logging import logger
|
|
|
|
|
|
class ItsiAtIncrementalValues(ItoaObject):
|
|
'''
|
|
Implements ITSI AT Incremental Values
|
|
'''
|
|
|
|
log_prefix = '[ITSI AT Incremental Values] '
|
|
collection_name = 'itsi_at_incremental_values'
|
|
object_type = 'at_incremental_values'
|
|
|
|
def __init__(self, session_key, current_user_name):
|
|
super(ItsiAtIncrementalValues, self).__init__(session_key,
|
|
current_user_name,
|
|
'at_incremental_values',
|
|
collection_name=self.collection_name,
|
|
title_validation_required=False)
|
|
|
|
def do_object_validation(self, owner, objects, validate_name=True, dupname_tag=None,
|
|
transaction_id=None, skip_local_failure=False):
|
|
super(ItsiAtIncrementalValues, self).do_object_validation(
|
|
owner, objects, validate_name, dupname_tag, transaction_id, skip_local_failure)
|
|
|
|
required_fields = ['_key', 'policies']
|
|
for json_data in objects:
|
|
for field in required_fields:
|
|
value = json_data.get(field)
|
|
if value is None:
|
|
self.raise_error_bad_validation(logger, f'Missing required field: {field}', 409)
|
|
policies = json_data.get('policies')
|
|
if not isinstance(policies, dict):
|
|
self.raise_error_bad_validation(
|
|
logger, 'Invalid policies: Policies must be of type dict.', 409
|
|
)
|
|
|
|
def get_kpi_at_incremental_values(self, owner, kpi_id, req_source='unknown', transaction_id=None):
|
|
"""
|
|
Over the parent method of retrieves kpi incremental values by id
|
|
@type owner: basestring
|
|
@param owner: user who is performing this operation
|
|
|
|
@type kpi_id: string
|
|
@param kpi_id: KPI id of object to retrieve
|
|
|
|
@type req_source: string
|
|
@param req_source: identified source initiating the operation
|
|
|
|
@rtype: dictionary
|
|
@return: object matching id on success, empty rows if object is not found, throws exceptions on errors
|
|
"""
|
|
job_data = super(ItsiAtIncrementalValues, self).get(
|
|
owner, kpi_id, req_source, transaction_id
|
|
)
|
|
return job_data
|