Add a new option '--redirect-http-code' into L7Policy CLI

This patch add a new option '--redirect-http-code' into L7Policy for
redirection url and prefix action.

Change-Id: I30b1a7555e1d910e07379bc69e739225a35a1a0c
Story: 2003609
Depends-On: https://review.openstack.org/#/c/625007
This commit is contained in:
ZhaoBo 2018-12-13 21:37:01 +08:00 committed by Michael Johnson
parent 985835a909
commit 2d1c4f8a85
3 changed files with 20 additions and 1 deletions

View File

@ -159,7 +159,8 @@ L7POLICY_ROWS = (
'position',
'id',
'operating_status',
'name')
'name',
'redirect_http_code')
L7POLICY_COLUMNS = (
'id',

View File

@ -24,6 +24,7 @@ from octaviaclient.osc.v2 import validate
ACTION_CHOICES = ['REDIRECT_TO_URL', 'REDIRECT_TO_POOL',
'REDIRECT_PREFIX', 'REJECT']
REDIRECT_CODE_CHOICES = [301, 302, 303, 307, 308]
class CreateL7Policy(command.ShowOne):
@ -74,6 +75,14 @@ class CreateL7Policy(command.ShowOne):
help="Set the URL Prefix to redirect requests to."
)
parser.add_argument(
'--redirect-http-code',
metavar='<redirect_http_code>',
choices=REDIRECT_CODE_CHOICES,
type=int,
help="Set the HTTP response code for REDIRECT_URL or"
"REDIRECT_PREFIX action."
)
parser.add_argument(
'--position',
metavar='<position>',
@ -231,6 +240,14 @@ class SetL7Policy(command.Command):
metavar='<url>',
help="Set the URL Prefix to redirect requests to."
)
parser.add_argument(
'--redirect-http-code',
metavar='<redirect_http_code>',
choices=REDIRECT_CODE_CHOICES,
type=int,
help="Set the HTTP response code for REDIRECT_URL or"
"REDIRECT_PREFIX action."
)
parser.add_argument(
'--position',
metavar='<position>',

View File

@ -316,6 +316,7 @@ def get_l7policy_attrs(client_manager, parsed_args):
'name': ('name', str),
'description': ('description', str),
'redirect_url': ('redirect_url', str),
'redirect_http_code': ('redirect_http_code', int),
'redirect_prefix': ('redirect_prefix', str),
'l7policy': (
'l7policy_id',