public final class Identity extends Object implements Serializable
Policy
. The following types of identities are permitted in IAM policies:
There are also two special identities that represent all users and all Google-authenticated accounts.
Modifier and Type | Class and Description |
---|---|
static class |
Identity.Type
The types of IAM identities.
|
Modifier and Type | Method and Description |
---|---|
static Identity |
allAuthenticatedUsers()
Returns a new identity representing anyone who is authenticated with a Google account or a
service account.
|
static Identity |
allUsers()
Returns a new identity representing anyone who is on the internet; with or without a Google
account.
|
static Identity |
domain(String domain)
Returns a new domain identity.
|
boolean |
equals(Object obj) |
Identity.Type |
getType() |
String |
getValue()
Returns the string identifier for this identity.
|
static Identity |
group(String email)
Returns a new group identity.
|
int |
hashCode() |
static Identity |
projectEditor(String projectId)
Returns a new project editor identity.
|
static Identity |
projectOwner(String projectId)
Returns a new project owner identity.
|
static Identity |
projectViewer(String projectId)
Returns a new project viewer identity.
|
static Identity |
serviceAccount(String email)
Returns a new service account identity.
|
String |
strValue()
Returns the string value associated with the identity.
|
String |
toString() |
static Identity |
user(String email)
Returns a new user identity.
|
static Identity |
valueOf(String identityStr)
Converts a string to an
Identity . |
public Identity.Type getType()
public String getValue()
USER
, SERVICE_ACCOUNT
, and GROUP
)
DOMAIN
)
null
(for identities of type ALL_USERS
and ALL_AUTHENTICATED_USERS
)
public static Identity allUsers()
public static Identity allAuthenticatedUsers()
public static Identity user(String email)
email
- An email address that represents a specific Google account. For example,
alice@gmail.com or joe@example.com.public static Identity serviceAccount(String email)
email
- An email address that represents a service account. For example,
my-other-app@appspot.gserviceaccount.com.public static Identity group(String email)
email
- An email address that represents a Google group. For example,
admins@example.com.public static Identity domain(String domain)
domain
- A Google Apps domain name that represents all the users of that domain. For
example, google.com or example.com.public static Identity projectOwner(String projectId)
projectId
- A Google Cloud Platform project ID. For example, my-sample-project.public static Identity projectEditor(String projectId)
projectId
- A Google Cloud Platform project ID. For example, my-sample-project.public static Identity projectViewer(String projectId)
projectId
- A Google Cloud Platform project ID. For example, my-sample-project.public String strValue()
Identity
objects to strings for protobuf-generated policies.Copyright © 2019 Google LLC. All rights reserved.