From 74a7c1d9d6efc545676cec1d9efeb2a86c5bc548 Mon Sep 17 00:00:00 2001 From: pedro Date: Mon, 23 Mar 2020 15:15:59 -0300 Subject: Add description field to portforwarding NAT rules Add the `description` field to Floating IP Port Forwardings Depends-On: https://review.opendev.org/#/c/705038/ Change-Id: I6477368e32570c96cacddba4f86455262e533277 Implements: blueprint portforwarding-description Closes-Bug: #1850818 --- .../network/v2/floating_ip_port_forwarding.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'openstackclient/network') diff --git a/openstackclient/network/v2/floating_ip_port_forwarding.py b/openstackclient/network/v2/floating_ip_port_forwarding.py index f94bcc06..06b3df8b 100644 --- a/openstackclient/network/v2/floating_ip_port_forwarding.py +++ b/openstackclient/network/v2/floating_ip_port_forwarding.py @@ -75,6 +75,12 @@ class CreateFloatingIPPortForwarding(command.ShowOne): required=True, help=_("The protocol used in the floating IP " "port forwarding, for instance: TCP, UDP") + ), + parser.add_argument( + '--description', + metavar='', + help=_("A text to describe/contextualize the use of the " + "port forwarding configuration") ) parser.add_argument( 'floating_ip', @@ -113,6 +119,9 @@ class CreateFloatingIPPortForwarding(command.ShowOne): attrs['internal_ip_address'] = parsed_args.internal_ip_address attrs['protocol'] = parsed_args.protocol + if parsed_args.description is not None: + attrs['description'] = parsed_args.description + obj = client.create_floating_ip_port_forwarding( floating_ip.id, **attrs @@ -212,6 +221,7 @@ class ListFloatingIPPortForwarding(command.Lister): 'internal_port', 'external_port', 'protocol', + 'description', ) headers = ( 'ID', @@ -220,6 +230,7 @@ class ListFloatingIPPortForwarding(command.Lister): 'Internal Port', 'External Port', 'Protocol', + 'Description', ) query = {} @@ -296,6 +307,12 @@ class SetFloatingIPPortForwarding(command.Command): metavar='', choices=['tcp', 'udp'], help=_("The IP protocol used in the floating IP port forwarding") + ), + parser.add_argument( + '--description', + metavar='', + help=_("A text to describe/contextualize the use of " + "the port forwarding configuration") ) return parser @@ -332,6 +349,9 @@ class SetFloatingIPPortForwarding(command.Command): if parsed_args.protocol: attrs['protocol'] = parsed_args.protocol + if parsed_args.description is not None: + attrs['description'] = parsed_args.description + client.update_floating_ip_port_forwarding( floating_ip.id, parsed_args.port_forwarding_id, **attrs) -- cgit v1.2.1