1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """
17 Resource class and its manager for LB Health Monitors in Networking V2 API
18 """
19
20 from yakumo import base
21 from yakumo.constant import UNDEF
22 from yakumo import mapper
23 from yakumo import utils
24
25
26 ATTRIBUTE_MAPPING = [
27 ('id', 'id', mapper.Noop),
28 ('project', 'tenant_id', mapper.Resource('project')),
29 ('is_enabled', 'admin_state_up', mapper.Noop),
30 ('pools', 'pools',
31 mapper.List(mapper.Resource('neutron.lb.pool'))),
32 ('type', 'type', mapper.Noop),
33 ('http_method', 'http_method', mapper.Noop),
34 ('url_path', 'url_path', mapper.Noop),
35 ('expected_codes', 'expected_codes', mapper.Noop),
36 ('delay', 'delay', mapper.Noop),
37 ('timeout', 'timeout', mapper.Noop),
38 ('max_retries', 'max_retries', mapper.Noop),
39 ]
40
41
43 """Resource class for LB Health Monitors in Networking V2 API"""
44
46 """
47 Update a LB health monitor
48
49 @keyword delay: Seconds to start waiting a response
50 @type delay: int
51 @rtype: None
52 """
53 super(Resource, self).update(delay=delay)
54
55
57 """Manager class for LB Health Monitors in Networking V2 API"""
58
59 resource_class = Resource
60 service_type = 'network'
61 _attr_mapping = ATTRIBUTE_MAPPING
62 _json_resource_key = 'health_monitor'
63 _json_resources_key = 'health_monitors'
64 _url_resource_path = '/v2.0/lb/health_monitors'
65
69 """
70 Create a LB health monitor
71
72 @keyword type: Monitor type ('PING', 'TCP', 'HTTP', or 'HTTPS')
73 @type type: str
74 @keyword http_method: HTTP method like 'GET'
75 @type http_method: str
76 @keyword url_path: URL path like '/index.html'
77 @type url_path: str
78 @keyword expected_codes: Expected HTTP response code list separated
79 with comma
80 @type expected_codes: str
81 @keyword delay: Seconds to start waiting a response
82 @type delay: int
83 @keyword timeout: Maximum seconds to wait a response
84 @type timeout: int
85 @keyword max_retries: Number of allowed connection failures (up to 10)
86 @type max_retries: int
87 @keyword is_enabled: Monitor is enabled
88 @type is_enabled: bool
89 @return: Created monitor
90 @rtype: yakumo.neutron.v2.lb.health_monitor.Resource
91 """
92 return super(Manager, self).create(type=type,
93 http_method=http_method,
94 url_path=url_path,
95 expected_codes=expected_codes,
96 delay=delay,
97 timeout=timeout,
98 max_retries=max_retries,
99 is_enabled=is_enabled)
100