consul.api.acl.role module¶
- class consul.api.acl.role.AclRole[source]¶
Bases:
TypedDict- Policies: builtins.list[AclPolicyLink]¶
- ServiceIdentities: builtins.list[AclServiceIdentity]¶
- NodeIdentities: builtins.list[AclNodeIdentity]¶
- TemplatedPolicies: builtins.list[AclTemplatedPolicy]¶
- class consul.api.acl.role.Role(agent)[source]¶
Bases:
object- list(policy=None, token=None)[source]¶
Lists all the ACL roles. Requires a token with acl:read capability. :param policy: Optional policy ID to filter the results by. :param token: token with acl:read capability :return: the list of roles
- read(role_id, token=None)[source]¶
Returns the role information for role_id. Requires a token with acl:read capability. :param role_id: The ID of the role to read :param token: token with acl:read capability :return: selected role information
- read_by_name(name, token=None)[source]¶
Returns the role information for the role named name. Requires a token with acl:read capability. :param name: The name of the role to read :param token: token with acl:read capability :return: selected role information
- delete(role_id, token=None)[source]¶
Deletes the role with role_id. Requires a token with acl:write capability. :param role_id: The ID of the role to delete :param token: token with acl:write capability :return: True if the role was deleted
- create(name, token=None, description='', policies_id=None, policies_name=None, service_identities=None, node_identities=None, templated_policies=None)[source]¶
Create a role. Requires a token with acl:write capability. :param name: Specifies a name for the ACL role. :param token: token with acl:write capability :param description: Free form human-readable description of the role. :param policies_id: Optional list of policy IDs to link. :param policies_name: Optional list of policy names to link. :param service_identities: Optional list of service identities, e.g. [{“ServiceName”: “web”}] :param node_identities: Optional list of node identities, e.g. [{“NodeName”: “node1”, “Datacenter”: “dc1”}] :param templated_policies: Optional list of templated policies :return: The created role information
- Parameters:
name (str)
token (str | None)
description (str)
policies_id (builtins.list[str] | None)
policies_name (builtins.list[str] | None)
service_identities (builtins.list[AclServiceIdentity] | None)
node_identities (builtins.list[AclNodeIdentity] | None)
templated_policies (builtins.list[builtins.dict[str, builtins.dict[str, str]]] | None)
- Return type:
- update(role_id, name, token=None, description='', policies_id=None, policies_name=None, service_identities=None, node_identities=None, templated_policies=None)[source]¶
Update the role identified by role_id. Requires a token with acl:write capability. :param role_id: The ID of the role to update :param name: Specifies a name for the ACL role. :param token: token with acl:write capability :param description: Free form human-readable description of the role. :param policies_id: Optional list of policy IDs to link. :param policies_name: Optional list of policy names to link. :param service_identities: Optional list of service identities. :param node_identities: Optional list of node identities. :param templated_policies: Optional list of templated policies :return: The updated role information
- Parameters:
role_id (str)
name (str)
token (str | None)
description (str)
policies_id (builtins.list[str] | None)
policies_name (builtins.list[str] | None)
service_identities (builtins.list[AclServiceIdentity] | None)
node_identities (builtins.list[AclNodeIdentity] | None)
templated_policies (builtins.list[builtins.dict[str, builtins.dict[str, str]]] | None)
- Return type: