File: set_notify_status.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 (25 lines) | stat: -rw-r--r-- 931 bytes parent folder | download | duplicates (2)
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
"""Disable/Enable snapshots space usage threshold warning for a specific volume"""
# :license: MIT, see LICENSE for more details.

import click
import SoftLayer
from SoftLayer.CLI import environment


@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('volume_id')
@click.option(
    '--enable/--disable',
    default=True,
    help='Enable/Disable snapshot notification. Use `slcli file snapshot-set-notification volumeId --enable` to enable',
    required=True)
@environment.pass_env
def cli(env, volume_id, enable):
    """Enables/Disables snapshot space usage threshold warning for a given volume"""
    file_manager = SoftLayer.FileStorageManager(env.client)

    status = file_manager.set_volume_snapshot_notification(volume_id, enable)
    if status:
        click.echo(
            'Snapshots space usage threshold warning notification has bee set to %s for volume %s'
            % (enable, volume_id))