#NEWLINE# @ cli . command ( ) #NEWLINE# @ click . option ( '-a' , '--attributes' , metavar = 'ATTRS' , help = 'A key/value pair attached to this Interface (format: key=value).' , multiple = True , callback = callbacks . transform_attributes ) #NEWLINE# @ click . option ( '-c' , '--addresses' , metavar = 'ADDRS' , help = 'An IPv4/IPv6 address in CIDR format.' , multiple = True ) #NEWLINE# @ click . option ( '-D' , '--device' , metavar = 'DEVICE' , help = 'Unique ID of the Device to which this Interface is attached.  [required]' ) #NEWLINE# @ click . option ( '-e' , '--description' , metavar = 'DESCRIPTION' , type = str , help = 'The description for this Interface.' ) #NEWLINE# @ click . option ( '-m' , '--mac-address' , metavar = 'MAC' , type = str , help = 'The MAC address of the Interface.' ) #NEWLINE# @ click . option ( '-n' , '--name' , metavar = 'NAME' , type = str , help = 'The name of the Interface.  [required]' ) #NEWLINE# @ click . option ( '-p' , '--parent-id' , metavar = 'PARENT_ID' , type = int , help = 'Unique ID of the parent interface.' ) #NEWLINE# @ click . option ( '-S' , '--speed' , metavar = 'SPEED' , type = int , help = 'The Interface speed in Mbps (e.g. 20000 for 20Gps).' ) #NEWLINE# @ click . option ( '-s' , '--site-id' , metavar = 'SITE_ID' , type = int , help = 'Unique ID of the Site this Interface is under.  [required]' , callback = callbacks . process_site_id ) #NEWLINE# @ click . option ( '-t' , '--type' , metavar = 'TYPE' , type = int , help = 'The Interface type ID (e.g. 6 for ethernet).' ) #NEWLINE# @ click . pass_context #NEWLINE# def add( ctx , attributes , addresses , device , description , mac_address , name , parent_id , speed , site_id , type ) : #NEWLINE# #INDENT# '\n    Add a new Interface.\n\n    You must provide a Device ID using the -D/--device option.\n\n    When adding a new Interface, you must provide a value for the -n/--name\n    option.\n\n    If you wish to add attributes, you may specify the -a/--attributes\n    option once for each key/value pair.\n\n    If you wish to assign addresses, you may specify the -c/--addresses\n    option once for each IP address.\n    ' #NEWLINE# data = ctx . params #NEWLINE# if ( name is None ) : #NEWLINE# #INDENT# raise click . UsageError ( 'Missing option "-n" / "--name"' ) #NEWLINE# #UNINDENT# if ( speed is None ) : #NEWLINE# #INDENT# data . pop ( 'speed' ) #NEWLINE# #UNINDENT# if ( type is None ) : #NEWLINE# #INDENT# data . pop ( 'type' ) #NEWLINE# #UNINDENT# if ( description is None ) : #NEWLINE# #INDENT# data . pop ( 'description' ) #NEWLINE# #UNINDENT# ctx . obj . add ( data )