@utils.arg('secgroup', metavar='<secgroup>', help=_('ID or name of security group.'))
@utils.arg('ip_proto', metavar='<ip-proto>', help=_('IP protocol (icmp, tcp, udp).'))
@utils.arg('from_port', metavar='<from-port>', help=_('Port at start of range.'))
@utils.arg('to_port', metavar='<to-port>', help=_('Port at end of range.'))
@utils.arg('cidr', metavar='<cidr>', help=_('CIDR for address range.'))
@deprecated_network
def do_secgroup_delete_rule(cs, args):
 secgroup = _get_secgroup(cs, args.secgroup)
 for rule in secgroup.rules:
  if (rule['ip_protocol'] and (rule['ip_protocol'].upper() == args.ip_proto.upper()) and (rule['from_port'] == int(args.from_port)) and (rule['to_port'] == int(args.to_port)) and (rule['ip_range']['cidr'] == args.cidr)):
   _print_secgroup_rules([rule])
   return cs.security_group_rules.delete(rule['id'])
 raise exceptions.CommandError(_('Rule not found'))

@ utils . arg ( 'secgroup' , metavar = '<secgroup>' , help = _ ( 'ID or name of security group.' ) ) @ utils . arg ( 'ip_proto' , metavar = '<ip-proto>' , help = _ ( 'IP protocol (icmp, tcp, udp).' ) ) @ utils . arg ( 'from_port' , metavar = '<from-port>' , help = _ ( 'Port at start of range.' ) ) @ utils . arg ( 'to_port' , metavar = '<to-port>' , help = _ ( 'Port at end of range.' ) ) @ utils . arg ( 'cidr' , metavar = '<cidr>' , help = _ ( 'CIDR for address range.' ) ) @ deprecated_network def do_secgroup_delete_rule ( cs , args ) : secgroup = _get_secgroup ( cs , args . secgroup ) for rule in secgroup . rules : if ( rule [ 'ip_protocol' ] and ( rule [ 'ip_protocol' ] . upper ( ) == args . ip_proto . upper ( ) ) and ( rule [ 'from_port' ] == int ( args . from_port ) ) and ( rule [ 'to_port' ] == int ( args . to_port ) ) and ( rule [ 'ip_range' ] [ 'cidr' ] == args . cidr ) ) : _print_secgroup_rules ( [ rule ] ) return cs . security_group_rules . delete ( rule [ 'id' ] ) raise exceptions . CommandError ( _ ( 'Rule not found' ) )
delete a rule from a security group .