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.
39 lines
1.7 KiB
39 lines
1.7 KiB
# Copyright (C) 2005-2025 Splunk Inc. All Rights Reserved.
|
|
|
|
from ITOA.itoa_object import ItoaObject
|
|
from ITOA.setup_logging import logger
|
|
|
|
|
|
class ItsiKpiAtInfo(ItoaObject):
|
|
'''
|
|
Implements ITSI KPI AT Info
|
|
'''
|
|
|
|
log_prefix = '[ITSI KPI AT Info] '
|
|
collection_name = 'itsi_kpi_at_info'
|
|
object_type = 'kpi_at_info'
|
|
|
|
def __init__(self, session_key, current_user_name):
|
|
super(ItsiKpiAtInfo, self).__init__(session_key,
|
|
current_user_name,
|
|
'kpi_at_info',
|
|
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(ItsiKpiAtInfo, self).do_object_validation(
|
|
owner, objects, validate_name, dupname_tag, transaction_id, skip_local_failure)
|
|
|
|
required_fields = ['_key', 'adaptive_thresholding_training_window']
|
|
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)
|
|
training_widow = json_data.get('adaptive_thresholding_training_window')
|
|
if training_widow not in ['-7d', '-14d', '-30d', '-60d']:
|
|
self.raise_error_bad_validation(
|
|
logger, 'Invalid training window: Training window must be either -7d, -14d, -30d or -60d.', 409
|
|
)
|