File: vpn_password.py

package info (click to toggle)
python-softlayer 6.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,508 kB
  • sloc: python: 57,195; makefile: 133; xml: 97; sh: 59
file content (26 lines) | stat: -rw-r--r-- 812 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Set the user VPN password."""
# :license: MIT, see LICENSE for more details.

import click
import SoftLayer

from SoftLayer.CLI.command import SLCommand as SLCommand
from SoftLayer.CLI import environment
from SoftLayer.CLI import helpers


@click.command(cls=SLCommand, )
@click.argument('identifier')
@click.option('--password', required=True, help="Your new VPN password")
@environment.pass_env
def cli(env, identifier, password):
    """Set the user VPN password.

    Example: slcli user vpn-password 123456 --password=Mypassword1.
    """

    mgr = SoftLayer.UserManager(env.client)
    user_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'username')
    result = mgr.update_vpn_password(user_id, password)
    if result:
        click.secho("Successfully updated user VPN password.", fg='green')