lib/yao/resources/floating_ip.rb in yao-0.17.0 vs lib/yao/resources/floating_ip.rb in yao-0.18.0

- old
+ new

@@ -16,7 +16,34 @@ # @return [Yao::Resources::Router] def router @router ||= Yao::Router.get(router_id) end + + # @param [Yao::Resources::Port] + # @return [Yao::Resources::FloatingIP] + def associate_port(port) + self.class.associate_port(id, port.id) + end + + # @return [Yao::Resources::FloatingIP] + def disassociate_port + self.class.disassociate_port(id) + end + + class << self + + # @param id [String] ID of floating_ip + # @param port_id [String] ID of port + # @return [Yao::Resources::FloatingIP] + def associate_port(id, port_id) + update(id, port_id: port_id) + end + + # @param id [String] ID of floating_ip + # @return [Yao::Resources::FloatingIP] + def disassociate_port(id) + update(id, port_id: nil) + end + end end end