Skip to content

Commit

Permalink
feat(project): accepts subnets while enabling vpn (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
pallabpain authored Dec 14, 2023
1 parent 6cea521 commit 06bbf7f
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions riocli/project/features/vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
}
}
}
}
Expand Down

0 comments on commit 06bbf7f

Please sign in to comment.