consul.api.acl.token module

class consul.api.acl.token.Token(agent)[source]

Bases: object

list(token=None)[source]

Lists all the active ACL tokens. This is a privileged endpoint, and requires a management token. token will override this client’s default token. Requires a token with acl:read capability. ACLPermissionDenied raised otherwise

Parameters:

token (str | None)

read(accessor_id, token=None)[source]

Returns the token information for accessor_id. Requires a token with acl:read capability. :param accessor_id: The accessor ID of the token to read :param token: token with acl:read capability :return: selected token information

Parameters:
  • accessor_id (str)

  • token (str | None)

delete(accessor_id, token=None)[source]

Deletes the token with accessor_id. This is a privileged endpoint, and requires a token with acl:write. :param accessor_id: The accessor ID of the token to delete :param token: token with acl:write capability :return: True if the token was deleted

Parameters:
  • accessor_id (str)

  • token (str | None)

clone(accessor_id, token=None, description='')[source]

Clones the token identified by accessor_id. This is a privileged endpoint, and requires a token with acl:write. :param accessor_id: The accessor ID of the token to clone :param token: token with acl:write capability :param description: Optional new token description :return: The cloned token information

Parameters:
  • accessor_id (str)

  • token (str | None)

  • description (str)

create(token=None, accessor_id=None, secret_id=None, policies_id=None, description='', policies_name=None, roles_id=None, roles_name=None, templated_policies=None)[source]

Create a token (optionally identified by secret_id and accessor_id). This is a privileged endpoint, and requires a token with acl:write. :param token: token with acl:write capability :param accessor_id: The accessor ID of the token to create :param secret_id: The secret ID of the token to create :param description: Optional new token description :param policies_id: Optional list of policies id :param roles_id: Optional list of roles id :param roles_name: Optional list of roles name :param templated_policies: Optional list of templated policies, :return: The cloned token information

Parameters:
  • token (str | None)

  • accessor_id (str | None)

  • secret_id (str | None)

  • policies_id (builtins.list[str] | None)

  • description (str)

  • policies_name (builtins.list[str] | None)

  • roles_id (builtins.list[str] | None)

  • roles_name (builtins.list[str] | None)

  • templated_policies (builtins.list[builtins.dict[str, builtins.dict[str, str]]] | None)

update(accessor_id, token=None, secret_id=None, description='', policies_id=None, policies_name=None, roles_id=None, roles_name=None, templated_policies=None)[source]

Update a token (optionally identified by secret_id and accessor_id). This is a privileged endpoint, and requires a token with acl:write. :param accessor_id: The accessor ID of the token to update :param token: token with acl:write capability :param secret_id: Optional secret ID of the token to update :param description: Optional new token description :param policies_id: Optional list of policies id :param roles_id: Optional list of roles id :param roles_name: Optional list of roles name :param templated_policies: Optional list of templated policies :return: The updated token information

Parameters:
  • accessor_id (str)

  • token (str | None)

  • secret_id (str | None)

  • description (str)

  • policies_id (builtins.list[str] | None)

  • policies_name (builtins.list[str] | None)

  • roles_id (builtins.list[str] | None)

  • roles_name (builtins.list[str] | None)

  • templated_policies (builtins.list[builtins.dict[str, builtins.dict[str, str]]] | None)