@@ -67,15 +67,35 @@ def rule_list(env, securitygroup_id, sortby):
6767@click .option ('--ethertype' , '-e' ,
6868 help = 'The ethertype (IPv4 or IPv6) to enforce' )
6969@click .option ('--port-max' , '-M' , type = click .INT ,
70- help = 'The upper port bound to enforce' )
70+ help = ('The upper port bound to enforce. When the protocol is ICMP, '
71+ 'this specifies the ICMP code to permit' ))
7172@click .option ('--port-min' , '-m' , type = click .INT ,
72- help = 'The lower port bound to enforce' )
73+ help = ('The lower port bound to enforce. When the protocol is ICMP, '
74+ 'this specifies the ICMP type to permit' ))
7375@click .option ('--protocol' , '-p' ,
7476 help = 'The protocol (icmp, tcp, udp) to enforce' )
7577@environment .pass_env
7678def add (env , securitygroup_id , remote_ip , remote_group ,
7779 direction , ethertype , port_max , port_min , protocol ):
78- """Add a security group rule to a security group."""
80+ """Add a security group rule to a security group.
81+
82+ \b
83+ Examples:
84+ # Add an SSH rule (TCP port 22) to a security group
85+ slcli sg rule-add 384727 \\
86+ --direction ingress \\
87+ --protocol tcp \\
88+ --port-min 22 \\
89+ --port-max 22
90+
91+ \b
92+ # Add a ping rule (ICMP type 8 code 0) to a security group
93+ slcli sg rule-add 384727 \\
94+ --direction ingress \\
95+ --protocol icmp \\
96+ --port-min 8 \\
97+ --port-max 0
98+ """
7999 mgr = SoftLayer .NetworkManager (env .client )
80100
81101 ret = mgr .add_securitygroup_rule (securitygroup_id , remote_ip , remote_group ,
0 commit comments