Completed
Push — master ( b0a0c8...9f3d02 )
by Tomaz
03:56
created

DeviceNameList   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 49
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 48 2
1
from lib.base_action import BaseAction
2
3
4
class DeviceNameList(BaseAction):
5
    def run(self, type=None, service_level=None, in_service=None, customer=None, tags=None,
6
            blade_host_name=None, virtual_host_name=None, building_id=None, building=None,
7
            room_id=None, room=None, rack_id=None, rack=None, serial_no=None,
8
            serial_no_contains=None, asset_no=None, name=None, tags_and=None, uuid=None,
9
            is_it_switch=None, is_it_virtual_host=None, is_it_blade_host=None, hardware=None,
10
            hardware_ids=None, os=None, virtual_subtype=None, last_updated_lt=None,
11
            last_updated_gt=None, first_added_lt=None, first_added_gt=None,
12
            custom_fields_and=None, custom_fields_or=None):
13
        response = self.getAPI("/api/1.0/devices/", {
14
            "type": type,
15
            "service_level": service_level,
16
            "in_service": in_service,
17
            "customer": customer,
18
            "tags": tags,
19
            "blade_host_name": blade_host_name,
20
            "virtual_host_name": virtual_host_name,
21
            "building_id": building_id,
22
            "building": building,
23
            "room_id": room_id,
24
            "room": room,
25
            "rack_id": rack_id,
26
            "rack": rack,
27
            "serial_no": serial_no,
28
            "serial_no_contains": serial_no_contains,
29
            "asset_no": asset_no,
30
            "name": name,
31
            "tags_and": tags_and,
32
            "uuid": uuid,
33
            "is_it_switch": is_it_switch,
34
            "is_it_virtual_host": is_it_virtual_host,
35
            "is_it_blade_host": is_it_blade_host,
36
            "hardware": hardware,
37
            "hardware_ids": hardware_ids,
38
            "os": os,
39
            "virtual_subtype": virtual_subtype,
40
            "last_updated_lt": last_updated_lt,
41
            "last_updated_gt": last_updated_gt,
42
            "first_added_lt": first_added_lt,
43
            "first_added_gt": first_added_gt,
44
            "custom_fields_and": custom_fields_and,
45
            "custom_fields_or": custom_fields_or,
46
        })
47
48
        names = []
49
        for device in response["Devices"]:
50
            names.append(device["name"])
51
52
        return names
53