1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """
17 Resource class and its manager for LBaaS 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 ('pools', 'pools',
29 mapper.List(mapper.Resource('neutron.lbaas.pool'))),
30 ('type', 'type', mapper.Noop),
31 ('http_method', 'http_method', mapper.Noop),
32 ('url_path', 'url_path', mapper.Noop),
33 ('expected_codes', 'expected_codes', mapper.Noop),
34 ('delay', 'delay', mapper.Noop),
35 ('timeout', 'timeout', mapper.Noop),
36 ('max_retries', 'max_retries', mapper.Noop),
37 ('project', 'tenant_id', mapper.Resource('project')),
38 ('is_enabled', 'admin_state_up', mapper.Noop),
39 ]
40
41
43 """Resource class for LBaaS Health Monitors in Networking V2 API"""
44
48 """
49 Update a LB health monitor
50
51 @keyword http_method: HTTP method like 'GET'
52 @type http_method: str
53 @keyword url_path: URL path like '/index.html'
54 @type url_path: str
55 @keyword expected_codes: Expected HTTP response code list
56 separated with comma
57 @type expected_codes: str
58 @keyword delay: Seconds to start waiting a response
59 @type delay: int
60 @keyword timeout: Maximum seconds to wait a response
61 @type timeout: int
62 @keyword max_retries: Number of allowed connection failures (up to 10)
63 @type max_retries: int
64 @keyword is_enabled: Monitor is enabled
65 @type is_enabled: bool
66 @rtype: None
67 """
68 super(Resource, self).update(
69 http_method=http_method,
70 url_path=url_path,
71 expected_codes=expected_codes,
72 delay=delay,
73 timeout=timeout,
74 max_retries=max_retries,
75 is_enabled=is_enabled)
76
77
79 """Manager class for LBaaS Health Monitors in Networking V2 API"""
80
81 resource_class = Resource
82 service_type = 'network'
83 _attr_mapping = ATTRIBUTE_MAPPING
84 _json_resource_key = 'health_monitor'
85 _json_resources_key = 'health_monitors'
86 _url_resource_path = '/v2.0/lbaas/health_monitors'
87
91 """
92 Create a LB health monitor
93
94 @keyword type: Monitor type ('PING', 'TCP', 'HTTP', or 'HTTPS')
95 @type type: str
96 @keyword http_method: HTTP method like 'GET'
97 @type http_method: str
98 @keyword url_path: URL path like '/index.html'
99 @type url_path: str
100 @keyword expected_codes: Expected HTTP response code list separated
101 with comma
102 @type expected_codes: str
103 @keyword delay: Seconds to start waiting a response
104 @type delay: int
105 @keyword timeout: Maximum seconds to wait a response
106 @type timeout: int
107 @keyword max_retries: Number of allowed connection failures
108 (up to 10)
109 @type max_retries: int
110 @keyword is_enabled: Whether the Monitor is enabled
111 @type is_enabled: bool
112 @return: Created monitor
113 @rtype: yakumo.neutron.v2.lbaas.health_monitor.Resource
114 """
115 pool = self.parent_resource
116 return super(Manager, self).create(type=type,
117 http_method=http_method,
118 url_path=url_path,
119 expected_codes=expected_codes,
120 delay=delay,
121 timeout=timeout,
122 max_retries=max_retries,
123 is_enabled=is_enabled)
124