コード例 #1
0
def protocol_to_type(protocol):
    try:
        protocols = ProtocolsType()
        setattr(protocols, protocol, True)
        return protocols
    except AttributeError:
        raise VcaError("The value in protocol is not valid")
コード例 #2
0
 def _create_protocols_type(self, protocol):
     all_protocols = {"Tcp": None, "Udp": None, "Icmp": None, "Any": None}
     all_protocols[protocol] = True
     return ProtocolsType(**all_protocols)