summaryrefslogtreecommitdiffstats
path: root/func/minion/modules/echo.py
blob: 471820d8f8fce243ace22030b85f69eb8b0d4d30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
"""
Test module for rendering funcweb
(We can remove this module once other modules are instrumented)
"""

import func_module

class EchoTest(func_module.FuncModule):

    version = "0.0.1"
    api_version = "0.0.1"
    description = "Module that all of its methods returns back the same thing it recieves!"

    def run_string(self, command):
        """
        Run String
        """
        return str(command)

    def run_int(self,command):
        """
        Run Integer
        """
        return int(command)

    def run_float(self,command):
        """
        Run float
        """
        return float(command)

    def run_options(self,command):
        """
        Run options
        """
        return str(command)

    def run_list(self,command):
        """
        Run a list
        """
        return command
    
    
    def run_list_star(self,*command):
        """
        Run a star list :)
        """
        return command

    
    def run_hash(self,command):
        """
        Run hash
        """

        return command
    
    
  
    def run_boolean(self,command):
        """
        Run boolean
        """
        return command

    def register_method_args(self):
        """
        Implementing the argument getter
        """
        return {
                'run_string':{
                    'args':
                    {
                        'command':{
                            'type':'string',
                            'optional':False
                            }
                        },
                    'description':'Returns back a string'
                    },
                'run_int':{
                    'args':
                    {
                        'command':{
                            'type':'int',
                            'optional':False
                            }
                        },
                    'description':'Returns back an integer'
                    },
                'run_float':{
                    'args':
                    {
                        'command':{
                            'type':'float',
                            'optional':False
                        },
                    },
                    'description':'Returns back a float'
                    },
                'run_options':{
                    'args':{
                        'command':{
                            'type':'string',
                            'optional':False,
                            'options':['first_option','second_option','third_option']
                            },   
                    },
                    'description':'Getting the status of the service_name'
                    },
                'run_list':{
                    'args':
                    {
                        'command':{
                            'type':'list',
                            'optional':False
                            }
                        },
                    'description':'Returns back a list'
                    },
                'run_list_star':{
                    'args':
                    {
                        'command':{
                            'type':'list*',
                            'optional':False
                            }
                        },
                    'description':'Prototype for *args'
                    },

                'run_hash':{
                    'args':
                    {
                        'command':{
                            'type':'hash',
                            'optional':False
                            }
                        },
                    'description':'Returns back a hash'
                    },
   

                'run_boolean':{
                    'args':
                    {
                        'command':{
                            'type':'boolean',
                            'optional':False
                            }
                        },
                    'description':'Returns back a boolean'
                    }
                 }