Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# Copyright 2019-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"). You 

4# may not use this file except in compliance with the License. A copy of 

5# the License is located at 

6# 

7# http://aws.amazon.com/apache2.0/ 

8# 

9# or in the "license" file accompanying this file. This file is 

10# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 

11# ANY KIND, either express or implied. See the License for the specific 

12# language governing permissions and limitations under the License. 

13 

14from datetime import datetime 

15from enum import Enum 

16 

17from pydantic import BaseModel 

18 

19 

20class ExecutionDay(str, Enum): 

21 """ 

22 Enums for the execution days. 

23 

24 Attributes: 

25 EVERYDAY: It tells us that the device can execute on all the days 

26 WEEKDAYS: It tells us that the device can execute only on the weekdays 

27 WEEKENDS: It tells us that the device can execute only on the weekends 

28 MONDAY: It tells us that the device can execute only on the monday 

29 TUESDAY: It tells us that the device can execute only on the tuesday 

30 WEDNESDAY: It tells us that the device can execute only on the wednesday 

31 THURSDAY: It tells us that the device can execute only on the thursday 

32 FRIDAY: It tells us that the device can execute only on the friday 

33 SATURDAY: It tells us that the device can execute only on the saturday 

34 SUNDAY: It tells us that the device can execute only on the sunday 

35 """ 

36 

37 EVERYDAY = "Everyday" 

38 WEEKDAYS = "Weekdays" 

39 WEEKENDS = "Weekend" 

40 MONDAY = "Monday" 

41 TUESDAY = "Tuesday" 

42 WEDNESDAY = "Wednesday" 

43 THURSDAY = "Thursday" 

44 FRIDAY = "Friday" 

45 SATURDAY = "Saturday" 

46 SUNDAY = "Sunday" 

47 

48 

49class DeviceExecutionWindow(BaseModel): 

50 

51 """ 

52 This class defines when a device can execute a given task. 

53 

54 Attributes: 

55 executionDay: Days of the execution window 

56 windowStartHour: UTC timestamp of the time when the execution window starts 

57 windowEndHour: UTC timestamp of the time when the execution window ends 

58 

59 Examples: 

60 >>> import json 

61 >>> input_json = { 

62 ... "executionDay": "Everyday", 

63 ... "windowStartHour": "1966280412345.6789", 

64 ... "windowEndHour": "1966280414345.6789", 

65 ... } 

66 >>> DeviceExecutionWindow.parse_raw(json.dumps(input_json)) 

67 

68 """ 

69 

70 executionDay: ExecutionDay 

71 windowStartHour: datetime 

72 windowEndHour: datetime