Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(project): accepts subnets while enabling vpn #245

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading