mixcoatl/network/firewall_rule.py
def create(self, **kwargs):
        """Create a new firewall rule

            .. warning::

                Does not currently support adding ICMP rules

        :param reason: Reason for the new rule
        :type reason: str.
        :returns: `bool`
        :raises: :class:`FirewallRuleException`
        """

        if 'reason' not in kwargs:
            reason = 'Added by mixcoatl'
        else:
            reason = kwargs['reason']

        payload = {'add_rule': [{
            'firewall_id': self.firewall['firewall_id'],
            'source': self.source,
            'source_type': self.source_type,
            'destination': self.destination,
            'destination_type': self.destination_type,
            'direction': self.direction,
            'permission': self.permission,
            'protocol': self.protocol,
            'reason': reason}]}

        if self.firewall_rule_id is not None:
            raise FirewallRuleException('Cannot modify existing firewall rule')

        self.post(self.PATH, data=json.dumps(camel_keys(payload)))

        if self.last_error is None:
            return True
        else:
            if self.last_request.status_code == 418:
                return True
            else:
                raise FirewallRuleException(self.last_error)
Create a new firewall rule

            .. warning::

                Does not currently support adding ICMP rules

        :param reason: Reason for the new rule
        :type reason: str.
        :returns: `bool`
        :raises: :class:`FirewallRuleException`
        
Create a new firewall rule
warning:.

Does not currently support adding ICMP rules
Create a new firewall rule warning : . Does not currently support adding ICMP rules
def create(self, **kwargs):
        if 'reason' not in kwargs:
            reason = 'Added by mixcoatl'
        else:
            reason = kwargs['reason']
        payload = {'add_rule': [{
            'firewall_id': self.firewall['firewall_id'],
            'source': self.source,
            'source_type': self.source_type,
            'destination': self.destination,
            'destination_type': self.destination_type,
            'direction': self.direction,
            'permission': self.permission,
            'protocol': self.protocol,
            'reason': reason}]}
        if self.firewall_rule_id is not None:
            raise FirewallRuleException('Cannot modify existing firewall rule')
        self.post(self.PATH, data=json.dumps(camel_keys(payload)))
        if self.last_error is None:
            return True
        else:
            if self.last_request.status_code == 418:
                return True
            else:
                raise FirewallRuleException(self.last_error)
def create ( self , ** kwargs ) : if 'reason' not in kwargs : reason = 'Added by mixcoatl' else : reason = kwargs [ 'reason' ] payload = { 'add_rule' : [ { 'firewall_id' : self . firewall [ 'firewall_id' ] , 'source' : self . source , 'source_type' : self . source_type , 'destination' : self . destination , 'destination_type' : self . destination_type , 'direction' : self . direction , 'permission' : self . permission , 'protocol' : self . protocol , 'reason' : reason } ] } if self . firewall_rule_id is not None : raise FirewallRuleException ( 'Cannot modify existing firewall rule' ) self . post ( self . PATH , data = json . dumps ( camel_keys ( payload ) ) ) if self . last_error is None : return True else : if self . last_request . status_code == 418 : return True else : raise FirewallRuleException ( self . last_error )
Create a new firewall rule
.. warning::
Create a new firewall rule .. warning ::
"""Create a new firewall rule

            .. warning::

                Does not currently support adding ICMP rules

        :param reason: Reason for the new rule
        :type reason: str.
        :returns: `bool`
        :raises: :class:`FirewallRuleException`
        """
None
None
self
reason
Reason for the new rule
Reason for the new rule