From 06bbf7fc238f7c568a7f9377a6628dc8160549ce Mon Sep 17 00:00:00 2001 From: Pallab Pain Date: Thu, 14 Dec 2023 15:48:30 +0900 Subject: [PATCH] feat(project): accepts subnets while enabling vpn (#245) --- riocli/project/features/vpn.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/riocli/project/features/vpn.py b/riocli/project/features/vpn.py index bf3fe261..a7ffb439 100644 --- a/riocli/project/features/vpn.py +++ b/riocli/project/features/vpn.py @@ -11,6 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from typing import List + import click from click_help_colors import HelpColorsCommand @@ -28,28 +30,40 @@ ) @click.argument('project-name', type=str) @click.argument('enable', type=bool) +@click.option('--subnets', type=click.STRING, multiple=True, default=(), + help='Subnet ranges for the project. For example: 10.81.0.0/16') @name_to_guid @with_spinner() def vpn( project_name: str, project_guid: str, enable: bool, + subnets: List[str], spinner=None, ) -> None: """ Enable or disable VPN on a project - Example: rio project features vpn "my-project" true + Example: + + rio project features vpn "my-project" true + + rio project features vpn "my-project" true --subnets 10.81.0.0/16 """ client = new_v2_client(with_project=False) + subnets = (subnets or []) if enable else [] + body = { "metadata": { "projectGUID": project_guid }, "spec": { "features": { - "vpn": enable + "vpn": { + "enabled": enable, + "subnets": subnets + } } } }