Пример #1
0
    def delete(self, policy_name):
        """
This endpoint deletes the named ACL policy. This request is always forwarded to the authoritative region.

        :param: policy_name (string: <required>) - Specifies the policy name to delete.

        :return: boolean
        """
        return self.agent.http.delete(
            CB.bool(), '/v1/acl/policy/%s' % policy_name)
Пример #2
0
    def delete(self, accessor_id):
        """
        This endpoint deletes the ACL token by accessor. This request is forwarded to the authoritative region for global tokens.

        :param: accessor_id (string: <required>) - Specifies the ACL token accessor ID.

        :return: json
        """
        return self.agent.http.delete(
            CB.bool(), '/v1/acl/token/%s' % accessor_id)
Пример #3
0
    def replace_servers(self, address):
        """This endpoint updates the list of known servers to the provided list. This replaces all previous server addresses with the new list.

        :param: address (string|list of strings: <required>) - Specifies the list of addresses in the format ip:port.

        :return Boolean
"""
        if isinstance(address, list):
            address = [('address', a) for a in address]
        else:
            address = [('address', address)]
        return self.agent.http.post(CB.bool(),
                                    '/v1/agent/servers',
                                    params=address)
Пример #4
0
    def set(self, policy_name, rules, description=None):
        """
This endpoint creates or updates an ACL Policy. This request is always forwarded to the authoritative region.

        :param: name (string: <required>) - Specifies the name of the policy. Creates the policy if the name does not exist, otherwise updates the existing policy.
        :param: rules (string: <required>) - Specifies the Policy rules in HCL or JSON format.
        :param: Description (string: <optional>) - Specifies a human readable description.

        :return: json
        """
        data = {'Name': policy_name, 'Rules': rules}
        if description is not None:
            data['Description'] = description
        data = dumps(data)
        return self.agent.http.post(
            CB.bool(), '/v1/acl/policy/%s' % policy_name, data=data)