blob: 81b41a1b8063b5e5f135053a119d0215cb36bee8 [file] [log] [blame]
James E. Blaire511d2f2016-12-08 15:22:26 -08001# Copyright 2012 Hewlett-Packard Development Company, L.P.
2# Copyright 2013 OpenStack Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16import voluptuous as v
17
James E. Blaire511d2f2016-12-08 15:22:26 -080018from zuul.trigger import BaseTrigger
James E. Blairaad3ae22017-05-18 14:11:29 -070019from zuul.driver.timer.timermodel import TimerEventFilter
20from zuul.driver.util import to_list
James E. Blaire511d2f2016-12-08 15:22:26 -080021
22
23class TimerTrigger(BaseTrigger):
24 name = 'timer'
25
26 def getEventFilters(self, trigger_conf):
James E. Blaire511d2f2016-12-08 15:22:26 -080027 efilters = []
James E. Blairaad3ae22017-05-18 14:11:29 -070028 for trigger in to_list(trigger_conf):
29 f = TimerEventFilter(trigger=self,
30 types=['timer'],
31 timespecs=to_list(trigger['time']))
James E. Blaire511d2f2016-12-08 15:22:26 -080032
33 efilters.append(f)
34
35 return efilters
36
37
38def getSchema():
39 timer_trigger = {v.Required('time'): str}
40 return timer_trigger