Coverage for watcher/notifications/strategy.py: 100%
11 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
1# -*- encoding: utf-8 -*-
2# Copyright (c) 2016 b<>com
3#
4# Authors: Vincent FRANCOISE <vincent.francoise@b-com.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15# implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
19from watcher.notifications import base as notificationbase
20from watcher.objects import base
21from watcher.objects import fields as wfields
24@base.WatcherObjectRegistry.register_notification
25class StrategyPayload(notificationbase.NotificationPayloadBase):
26 SCHEMA = {
27 'uuid': ('strategy', 'uuid'),
28 'name': ('strategy', 'name'),
29 'display_name': ('strategy', 'display_name'),
30 'parameters_spec': ('strategy', 'parameters_spec'),
32 'created_at': ('strategy', 'created_at'),
33 'updated_at': ('strategy', 'updated_at'),
34 'deleted_at': ('strategy', 'deleted_at'),
35 }
37 # Version 1.0: Initial version
38 VERSION = '1.0'
40 fields = {
41 'uuid': wfields.UUIDField(),
42 'name': wfields.StringField(),
43 'display_name': wfields.StringField(),
44 'parameters_spec': wfields.FlexibleDictField(nullable=True),
46 'created_at': wfields.DateTimeField(nullable=True),
47 'updated_at': wfields.DateTimeField(nullable=True),
48 'deleted_at': wfields.DateTimeField(nullable=True),
49 }
51 def __init__(self, strategy, **kwargs):
52 super(StrategyPayload, self).__init__(**kwargs)
53 self.populate_schema(strategy=strategy)