consul.api.acl.auth_method module

class consul.api.acl.auth_method.AclAuthMethod[source]

Bases: TypedDict

Name: str
Type: str
DisplayName: str
Description: str
Config: dict[str, Any]
MaxTokenTTL: str
TokenLocality: str
TokenNameFormat: str
CreateIndex: int
ModifyIndex: int
class consul.api.acl.auth_method.AuthMethod(agent)[source]

Bases: object

list(token=None)[source]

Lists all the ACL auth methods. Note the response omits each method’s config; use read() for the full definition. Requires a token with acl:read capability. :param token: token with acl:read capability :return: the list of auth methods (without their Config)

Parameters:

token (str | None)

Return type:

list[AclAuthMethod]

read(name, token=None)[source]

Returns the auth method information for name. Requires a token with acl:read capability. :param name: The name of the auth method to read :param token: token with acl:read capability :return: selected auth method information

Parameters:
  • name (str)

  • token (str | None)

Return type:

AclAuthMethod

delete(name, token=None)[source]

Deletes the auth method name. This also deletes any binding rules and outstanding tokens created from it. Requires a token with acl:write capability. :param name: The name of the auth method to delete :param token: token with acl:write capability :return: True if the auth method was deleted

Parameters:
  • name (str)

  • token (str | None)

Return type:

bool

create(name, method_type, token=None, display_name='', description='', config=None, max_token_ttl=None, token_locality=None, token_name_format=None)[source]

Create an auth method. Requires a token with acl:write capability. :param name: Specifies a name for the auth method. Immutable once created. :param method_type: The type of auth method this is, e.g. “kubernetes”, “jwt”, “oidc”. Immutable once created. :param token: token with acl:write capability :param display_name: Optional display name for use in UIs. :param description: Free form human-readable description of the auth method. :param config: The type-specific configuration for this auth method. :param max_token_ttl: Optional duration (e.g. “10m”) after which created tokens expire. :param token_locality: Optional, either “local” or “global”. Defaults to “local”. :param token_name_format: Optional HIL template controlling generated token names. :return: The created auth method information

Parameters:
  • name (str)

  • method_type (str)

  • token (str | None)

  • display_name (str)

  • description (str)

  • config (dict[str, Any] | None)

  • max_token_ttl (str | None)

  • token_locality (str | None)

  • token_name_format (str | None)

Return type:

AclAuthMethod

update(name, method_type, token=None, display_name='', description='', config=None, max_token_ttl=None, token_locality=None, token_name_format=None)[source]

Update the auth method name. method_type must match the type the auth method was created with, as it is immutable. Requires a token with acl:write capability. :param name: The name of the auth method to update :param method_type: The (unchanged) type of the auth method :param token: token with acl:write capability :param display_name: Optional display name for use in UIs. :param description: Free form human-readable description of the auth method. :param config: The type-specific configuration for this auth method. :param max_token_ttl: Optional duration (e.g. “10m”) after which created tokens expire. :param token_locality: Optional, either “local” or “global”. :param token_name_format: Optional HIL template controlling generated token names. :return: The updated auth method information

Parameters:
  • name (str)

  • method_type (str)

  • token (str | None)

  • display_name (str)

  • description (str)

  • config (dict[str, Any] | None)

  • max_token_ttl (str | None)

  • token_locality (str | None)

  • token_name_format (str | None)

Return type:

AclAuthMethod