1"""Set note for an existing File storage volume."""
2# :license: MIT, see LICENSE for more details.
3
4import click
5import SoftLayer
6from SoftLayer.CLI import environment
7from SoftLayer.CLI import helpers
8
9
10@click.command()
11@click.argument('volume-id')
12@click.option('--note', '-n',
13              type=str,
14              required=True,
15              help='Public notes related to a Storage volume')
16@environment.pass_env
17def cli(env, volume_id, note):
18    """Set note for an existing file storage volume."""
19    file_manager = SoftLayer.FileStorageManager(env.client)
20    file_volume_id = helpers.resolve_id(file_manager.resolve_ids, volume_id, 'File Storage')
21
22    result = file_manager.volume_set_note(file_volume_id, note)
23
24    if result:
25        click.echo("Set note successfully!")
26
27    else:
28        click.echo("Note could not be set! Please verify your options and try again.")
29