Id

object Id

Constructs and deconstructs Id values.

An Id is composed of two parts: a scheme and an id. There exists only a finite set of ''schemes'' recognized by ZooKeeper, which are noted below. The acceptable form of ''id'' depends on the chosen scheme.

'''Schemes'''

world -- ''id'' must be "anyone".

auth -- ''id'' must be "" (empty string).

digest -- ''id'' must be of the form "''username'':''password''".

host -- ''id'' should be an Internet domain name.

ip -- ''id'' must be a valid IPv4 or IPv6 address with an optional network prefix, variations of which follow:

  • "''addr''" where prefix is assumed to be 32 and 128 for IPv4 and IPv6, respectively.
  • "''addr''/''prefix''" where prefix is in the range [0,32] and [0,128] for IPv4 and IPv6, respectively.
See also:
Companion:
class
class Object
trait Matchable
class Any
Id.type

Value members

Concrete methods

def apply(scheme: String, id: String): Id

Constructs a new identity.

Constructs a new identity.

Value parameters:
id

a string representing the id

scheme

a string representing the scheme

Returns:

an identity with the given scheme and id

Throws:
IllegalArgumentException

if a valid identity cannot be constructed from scheme and id

See also:
def apply(s: String): Id

Constructs a new identity from the input string s.

Constructs a new identity from the input string s.

Value parameters:
s

a string representing the identity

Returns:

the identity in s if it conforms to the proper syntax

Throws:
IllegalArgumentException

if s does not conform to the proper syntax

See also:
def parse(s: String): Try[Id]

Parses the identity in the input string s.

Parses the identity in the input string s.

The syntax of s is "''scheme'':''id''", where the : delimiter may be omitted if ''id'' is not required for the given ''scheme''.

Value parameters:
s

a string representing the identity

Returns:

a Success containing the identity in s if it conforms to the proper syntax, otherwise a Failure containing the offending exception

def unapply(id: Id): Option[(String, String)]

Used in pattern matching to deconstruct an identity.

Used in pattern matching to deconstruct an identity.

Value parameters:
id

selector value

Returns:

a Some containing scheme and id if the selector value is not null, otherwise None

Concrete fields

val Anyone: Id

An identity whose scheme is "world" and id is "anyone".

An identity whose scheme is "world" and id is "anyone".

Equivalent to WorldId.

val Creator: Id

An identity whose scheme is "auth" and id is "".

An identity whose scheme is "auth" and id is "".

This is a special identity, usable only while setting ACLs, that is substituted with the identities used during client authentication.

Equivalent to AuthId.

Implicits

Implicits

implicit def tupleToIdentity(id: (String, String)): Id