1#
2# Copyright (C) 2017 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain 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,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17from host_controller.tfc import api_message
18
19
20class CommandTask(api_message.ApiMessage):
21    """The task of executing a command defined by TFC API.
22
23    Attributes:
24        _LEASE_HOST_TASK: The fields returned by commandAttempts.list.
25    """
26    _LEASE_HOST_TASK = {
27            "request_id",
28            "command_id",
29            "task_id",
30            "command_line",
31            "request_type",
32            "device_serials"}
33
34    def __init__(self, task_id, command_line, device_serials, **kwargs):
35        super(CommandTask, self).__init__(self._LEASE_HOST_TASK,
36                                          task_id=task_id,
37                                          command_line=command_line,
38                                          device_serials=device_serials,
39                                          **kwargs)
40