def pool_health_monitor_create(request, **kwargs): """Create a health monitor and associate with pool :param request: request context :param type: type of monitor :param delay: delay of monitor :param timeout: timeout of monitor :param max_retries: max retries [1..10] :param http_method: http method :param url_path: url path :param expected_codes: http return code :param admin_state_up: admin state """ body = {'health_monitor': {'type': kwargs['type'], 'delay': kwargs['delay'], 'timeout': kwargs['timeout'], 'max_retries': kwargs['max_retries'], 'http_method': kwargs['http_method'], 'url_path': kwargs['url_path'], 'expected_codes': kwargs['expected_codes'], 'admin_state_up': kwargs['admin_state_up'] }} mon = quantumclient(request).create_health_monitor(body).get( 'health_monitor') body = {'health_monitor': {'id': mon['id']}} quantumclient(request).associate_health_monitor( kwargs['pool_id'], body) return PoolMonitor(mon)
def pool_health_monitor_create(request, **kwargs): """Create a health monitor and associate with pool :param request: request context :param type: type of monitor :param delay: delay of monitor :param timeout: timeout of monitor :param max_retries: max retries [1..10] :param http_method: http method :param url_path: url path :param expected_codes: http return code :param admin_state_up: admin state """ body = { 'health_monitor': { 'type': kwargs['type'], 'delay': kwargs['delay'], 'timeout': kwargs['timeout'], 'max_retries': kwargs['max_retries'], 'http_method': kwargs['http_method'], 'url_path': kwargs['url_path'], 'expected_codes': kwargs['expected_codes'], 'admin_state_up': kwargs['admin_state_up'] } } mon = quantumclient(request).create_health_monitor(body).get( 'health_monitor') body = {'health_monitor': {'id': mon['id']}} quantumclient(request).associate_health_monitor(kwargs['pool_id'], body) return PoolMonitor(mon)
def vip_create(request, **kwargs): """Create a vip for a specified pool. :param request: request context :param address: virtual IP address :param name: name for vip :param description: description for vip :param subnet_id: subnet_id for subnet of vip :param protocol_port: transport layer port number for vip :returns: Vip object """ body = { 'vip': { 'address': kwargs['address'], 'name': kwargs['name'], 'description': kwargs['description'], 'subnet_id': kwargs['subnet_id'], 'protocol_port': kwargs['protocol_port'], 'protocol': kwargs['protocol'], 'pool_id': kwargs['pool_id'], 'session_persistence': kwargs['session_persistence'], 'connection_limit': kwargs['connection_limit'], 'admin_state_up': kwargs['admin_state_up'] } } vip = quantumclient(request).create_vip(body).get('vip') return Vip(vip)
def member_create(request, **kwargs): """Create a load balance member :param request: request context :param pool_id: pool_id of pool for member :param address: IP address :param protocol_port: transport layer port number :param weight: weight for member :param admin_state_up: admin_state """ body = {'member': {'pool_id': kwargs['pool_id'], 'address': kwargs['address'], 'protocol_port': kwargs['protocol_port'], 'weight': kwargs['weight'], 'admin_state_up': kwargs['admin_state_up'] }} member = quantumclient(request).create_member(body).get('member') return Member(member)
def pool_create(request, **kwargs): """Create a pool for specified protocol :param request: request context :param name: name for pool :param description: description for pool :param subnet_id: subnet_id for subnet of pool :param protocol: load balanced protocol :param lb_method: load balancer method :param admin_state_up: admin state (default on) """ body = {'pool': {'name': kwargs['name'], 'description': kwargs['description'], 'subnet_id': kwargs['subnet_id'], 'protocol': kwargs['protocol'], 'lb_method': kwargs['lb_method'], 'admin_state_up': kwargs['admin_state_up'] }} pool = quantumclient(request).create_pool(body).get('pool') return Pool(pool)
def member_create(request, **kwargs): """Create a load balance member :param request: request context :param pool_id: pool_id of pool for member :param address: IP address :param protocol_port: transport layer port number :param weight: weight for member :param admin_state_up: admin_state """ body = { 'member': { 'pool_id': kwargs['pool_id'], 'address': kwargs['address'], 'protocol_port': kwargs['protocol_port'], 'weight': kwargs['weight'], 'admin_state_up': kwargs['admin_state_up'] } } member = quantumclient(request).create_member(body).get('member') return Member(member)
def pool_create(request, **kwargs): """Create a pool for specified protocol :param request: request context :param name: name for pool :param description: description for pool :param subnet_id: subnet_id for subnet of pool :param protocol: load balanced protocol :param lb_method: load balancer method :param admin_state_up: admin state (default on) """ body = { 'pool': { 'name': kwargs['name'], 'description': kwargs['description'], 'subnet_id': kwargs['subnet_id'], 'protocol': kwargs['protocol'], 'lb_method': kwargs['lb_method'], 'admin_state_up': kwargs['admin_state_up'] } } pool = quantumclient(request).create_pool(body).get('pool') return Pool(pool)
def vip_create(request, **kwargs): """Create a vip for a specified pool. :param request: request context :param address: virtual IP address :param name: name for vip :param description: description for vip :param subnet_id: subnet_id for subnet of vip :param protocol_port: transport layer port number for vip :returns: Vip object """ body = {'vip': {'address': kwargs['address'], 'name': kwargs['name'], 'description': kwargs['description'], 'subnet_id': kwargs['subnet_id'], 'protocol_port': kwargs['protocol_port'], 'protocol': kwargs['protocol'], 'pool_id': kwargs['pool_id'], 'session_persistence': kwargs['session_persistence'], 'connection_limit': kwargs['connection_limit'], 'admin_state_up': kwargs['admin_state_up'] }} vip = quantumclient(request).create_vip(body).get('vip') return Vip(vip)
def member_update(request, member_id, **kwargs): member = quantumclient(request).update_member(member_id, kwargs) return Member(member)
def pool_health_monitor_delete(request, mon_id): quantumclient(request).delete_health_monitor(mon_id)
def members_get(request, **kwargs): members = quantumclient(request).list_members().get('members') return [Member(m) for m in members]
def pool_stats(request, pool_id, **kwargs): stats = quantumclient(request).retrieve_pool_stats(pool_id, **kwargs) return PoolStats(stats)
def pool_health_monitors_get(request, **kwargs): monitors = quantumclient(request ).list_health_monitors().get('health_monitors') return [PoolMonitor(m) for m in monitors]
def pools_get(request, **kwargs): pools = quantumclient(request).list_pools().get('pools') return [Pool(p) for p in pools]
def pool_update(request, pool_id, **kwargs): pool = quantumclient(request).update_pool(pool_id, kwargs).get('pool') return Pool(pool)
def pools_get(request, **kwargs): pools = quantumclient(request).list_pools().get('pools') return [Pool(p) for p in pools]
def members_get(request, **kwargs): members = quantumclient(request).list_members().get('members') return [Member(m) for m in members]
def pool_health_monitor_get(request, monitor_id): monitor = quantumclient(request).show_health_monitor(monitor_id).get( 'health_monitor') return PoolMonitor(monitor)
def pool_health_monitor_delete(request, mon_id): quantumclient(request).delete_health_monitor(mon_id)
def pool_health_monitors_get(request, **kwargs): monitors = quantumclient(request).list_health_monitors().get( 'health_monitors') return [PoolMonitor(m) for m in monitors]
def pool_get(request, pool_id): pool = quantumclient(request).show_pool(pool_id).get('pool') return Pool(pool)
def pool_stats(request, pool_id, **kwargs): stats = quantumclient(request).retrieve_pool_stats(pool_id, **kwargs) return PoolStats(stats)
def pool_delete(request, pool): quantumclient(request).delete_pool(pool)
def member_get(request, member_id): member = quantumclient(request).show_member(member_id).get('member') return Member(member)
def vip_delete(request, vip_id): quantumclient(request).delete_vip(vip_id)
def member_update(request, member_id, **kwargs): member = quantumclient(request).update_member(member_id, kwargs) return Member(member)
def pool_get(request, pool_id): pool = quantumclient(request).show_pool(pool_id).get('pool') return Pool(pool)
def member_delete(request, mem_id): quantumclient(request).delete_member(mem_id)
def pool_delete(request, pool): quantumclient(request).delete_pool(pool)
def vips_get(request, **kwargs): vips = quantumclient(request).list_vips().get('vips') return [Vip(v) for v in vips]
def vip_update(request, vip_id, **kwargs): vip = quantumclient(request).update_vip(vip_id, kwargs).get('vip') return Vip(vip)
def vips_get(request, **kwargs): vips = quantumclient(request).list_vips().get('vips') return [Vip(v) for v in vips]
def pool_health_monitor_get(request, monitor_id): monitor = quantumclient(request ).show_health_monitor(monitor_id ).get('health_monitor') return PoolMonitor(monitor)
def vip_get(request, vip_id): vip = quantumclient(request).show_vip(vip_id).get('vip') return Vip(vip)
def vip_get(request, vip_id): vip = quantumclient(request).show_vip(vip_id).get('vip') return Vip(vip)
def vip_update(request, vip_id, **kwargs): vip = quantumclient(request).update_vip(vip_id, kwargs).get('vip') return Vip(vip)
def member_get(request, member_id): member = quantumclient(request).show_member(member_id).get('member') return Member(member)
def vip_delete(request, vip_id): quantumclient(request).delete_vip(vip_id)
def member_delete(request, mem_id): quantumclient(request).delete_member(mem_id)
def pool_update(request, pool_id, **kwargs): pool = quantumclient(request).update_pool(pool_id, kwargs).get('pool') return Pool(pool)