1"""Edit ip note"""
2# :license: MIT, see LICENSE for more details.
3
4import click
5
6import SoftLayer
7from SoftLayer.CLI import environment
8
9
10@click.command()
11@click.argument('identifier')
12@click.option('--note', help="set ip address note of subnet")
13@environment.pass_env
14def cli(env, identifier, note):
15    """Set the note of the ipAddress"""
16
17    data = {
18        'note': note
19    }
20    mgr = SoftLayer.NetworkManager(env.client)
21    ip_id = None
22    if str.isdigit(identifier):
23        ip_id = identifier
24    else:
25        ip_object = mgr.get_ip_by_address(identifier)
26        ip_id = ip_object.get('id')
27    mgr.set_subnet_ipddress_note(ip_id, data)
28