Audit API supports new force option
Depends-on:Ia08694d2fb76907ea14e64116af2e722fe930063 Change-Id: Ib2d221ea9c994dea396c54cc8d2d32237025a1d4 Implements: blueprint add-force-field-to-audit
This commit is contained in:
@@ -73,6 +73,8 @@ def hide_fields_in_newer_versions(obj):
|
||||
if not api_utils.allow_start_end_audit_time():
|
||||
obj.start_time = wtypes.Unset
|
||||
obj.end_time = wtypes.Unset
|
||||
if not api_utils.allow_force():
|
||||
obj.force = wtypes.Unset
|
||||
|
||||
|
||||
class AuditPostType(wtypes.Base):
|
||||
@@ -194,7 +196,8 @@ class AuditPostType(wtypes.Base):
|
||||
scope=self.scope,
|
||||
auto_trigger=self.auto_trigger,
|
||||
start_time=self.start_time,
|
||||
end_time=self.end_time)
|
||||
end_time=self.end_time,
|
||||
force=self.force)
|
||||
|
||||
|
||||
class AuditPatchType(types.JsonPatchType):
|
||||
|
||||
@@ -165,3 +165,12 @@ def allow_start_end_audit_time():
|
||||
audits.
|
||||
"""
|
||||
return pecan.request.version.minor >= versions.MINOR_1_START_END_TIMING
|
||||
|
||||
|
||||
def allow_force():
|
||||
"""Check if we should support optional force attribute for Audit.
|
||||
|
||||
Version 1.2 of the API added support for forced audits that allows to
|
||||
launch audit when other action plan is ongoing.
|
||||
"""
|
||||
return pecan.request.version.minor >= versions.MINOR_2_FORCE
|
||||
|
||||
@@ -22,11 +22,13 @@ BASE_VERSION = 1
|
||||
#
|
||||
# v1.0: corresponds to Rocky API
|
||||
# v1.1: Add start/end time for continuous audit
|
||||
# v1.2: Add force field to audit
|
||||
|
||||
MINOR_0_ROCKY = 0
|
||||
MINOR_1_START_END_TIMING = 1
|
||||
MINOR_2_FORCE = 2
|
||||
|
||||
MINOR_MAX_VERSION = MINOR_1_START_END_TIMING
|
||||
MINOR_MAX_VERSION = MINOR_2_FORCE
|
||||
|
||||
# String representations of the minor and maximum versions
|
||||
_MIN_VERSION_STRING = '{}.{}'.format(BASE_VERSION, MINOR_0_ROCKY)
|
||||
|
||||
Reference in New Issue
Block a user