public final class Policy extends com.google.protobuf.GeneratedMessageV3 implements PolicyOrBuilder
# Overview
The `Policy` defines an access control policy language. It is used to
define policies that are attached to resources like files, folders, VMs,
etc.
# Policy structure
A `Policy` consists of a list of bindings. A `Binding` binds a set of members
to a role, where the members include user accounts, user groups, user
domains, and service accounts. A 'role' is a named set of permissions,
defined by IAM. The definition of a role is outside the policy.
A permission check first determines the roles that include the specified
permission, and then determines if the principal specified is a
member of a binding to at least one of these roles. The membership check is
recursive when a group is bound to a role.
Policy examples:
```
{
"bindings": [
{
"role": "roles/owner",
"members": [
"user:mike@example.com",
"group:admins@example.com",
"domain:google.com",
"serviceAccount:frontend@example.iam.gserviceaccounts.com"]
},
{
"role": "roles/viewer",
"members": ["user:sean@example.com"]
}
]
}
```
Protobuf type google.iam.v1.Policy| Modifier and Type | Class and Description |
|---|---|
static class |
Policy.Builder
# Overview
The `Policy` defines an access control policy language.
|
com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage,BuilderType extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable| Modifier and Type | Field and Description |
|---|---|
static int |
BINDINGS_FIELD_NUMBER |
static int |
ETAG_FIELD_NUMBER |
static int |
VERSION_FIELD_NUMBER |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
Binding |
getBindings(int index)
It is an error to specify multiple bindings for the same role.
|
int |
getBindingsCount()
It is an error to specify multiple bindings for the same role.
|
java.util.List<Binding> |
getBindingsList()
It is an error to specify multiple bindings for the same role.
|
BindingOrBuilder |
getBindingsOrBuilder(int index)
It is an error to specify multiple bindings for the same role.
|
java.util.List<? extends BindingOrBuilder> |
getBindingsOrBuilderList()
It is an error to specify multiple bindings for the same role.
|
static Policy |
getDefaultInstance() |
Policy |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
com.google.protobuf.ByteString |
getEtag()
Can be used to perform a read-modify-write.
|
com.google.protobuf.Parser<Policy> |
getParserForType() |
int |
getSerializedSize() |
com.google.protobuf.UnknownFieldSet |
getUnknownFields() |
int |
getVersion()
The policy language version.
|
int |
hashCode() |
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
static Policy.Builder |
newBuilder() |
static Policy.Builder |
newBuilder(Policy prototype) |
Policy.Builder |
newBuilderForType() |
protected Policy.Builder |
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) |
static Policy |
parseDelimitedFrom(java.io.InputStream input) |
static Policy |
parseDelimitedFrom(java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Policy |
parseFrom(byte[] data) |
static Policy |
parseFrom(byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Policy |
parseFrom(com.google.protobuf.ByteString data) |
static Policy |
parseFrom(com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Policy |
parseFrom(com.google.protobuf.CodedInputStream input) |
static Policy |
parseFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Policy |
parseFrom(java.io.InputStream input) |
static Policy |
parseFrom(java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static com.google.protobuf.Parser<Policy> |
parser() |
Policy.Builder |
toBuilder() |
void |
writeTo(com.google.protobuf.CodedOutputStream output) |
computeStringSize, computeStringSizeNoTag, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, makeExtensionsImmutable, newBuilderForType, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, writeReplace, writeString, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final int VERSION_FIELD_NUMBER
public static final int BINDINGS_FIELD_NUMBER
public static final int ETAG_FIELD_NUMBER
public final com.google.protobuf.UnknownFieldSet getUnknownFields()
getUnknownFields in interface com.google.protobuf.MessageOrBuildergetUnknownFields in class com.google.protobuf.GeneratedMessageV3public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3public int getVersion()
The policy language version. The version of the policy is represented by the etag. The default version is 0.
optional int32 version = 1;getVersion in interface PolicyOrBuilderpublic java.util.List<Binding> getBindingsList()
It is an error to specify multiple bindings for the same role. It is an error to specify a binding with no members.
repeated .google.iam.v1.Binding bindings = 4;getBindingsList in interface PolicyOrBuilderpublic java.util.List<? extends BindingOrBuilder> getBindingsOrBuilderList()
It is an error to specify multiple bindings for the same role. It is an error to specify a binding with no members.
repeated .google.iam.v1.Binding bindings = 4;getBindingsOrBuilderList in interface PolicyOrBuilderpublic int getBindingsCount()
It is an error to specify multiple bindings for the same role. It is an error to specify a binding with no members.
repeated .google.iam.v1.Binding bindings = 4;getBindingsCount in interface PolicyOrBuilderpublic Binding getBindings(int index)
It is an error to specify multiple bindings for the same role. It is an error to specify a binding with no members.
repeated .google.iam.v1.Binding bindings = 4;getBindings in interface PolicyOrBuilderpublic BindingOrBuilder getBindingsOrBuilder(int index)
It is an error to specify multiple bindings for the same role. It is an error to specify a binding with no members.
repeated .google.iam.v1.Binding bindings = 4;getBindingsOrBuilder in interface PolicyOrBuilderpublic com.google.protobuf.ByteString getEtag()
Can be used to perform a read-modify-write.
optional bytes etag = 3;getEtag in interface PolicyOrBuilderpublic final boolean isInitialized()
isInitialized in interface com.google.protobuf.MessageLiteOrBuilderisInitialized in class com.google.protobuf.GeneratedMessageV3public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException
writeTo in interface com.google.protobuf.MessageLitewriteTo in class com.google.protobuf.GeneratedMessageV3java.io.IOExceptionpublic int getSerializedSize()
getSerializedSize in interface com.google.protobuf.MessageLitegetSerializedSize in class com.google.protobuf.GeneratedMessageV3public boolean equals(java.lang.Object obj)
equals in interface com.google.protobuf.Messageequals in class com.google.protobuf.AbstractMessagepublic int hashCode()
hashCode in interface com.google.protobuf.MessagehashCode in class com.google.protobuf.AbstractMessagepublic static Policy parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Policy parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Policy parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Policy parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Policy parseFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Policy parseFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static Policy parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Policy parseDelimitedFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic static Policy parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException
java.io.IOExceptionpublic static Policy parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException
java.io.IOExceptionpublic Policy.Builder newBuilderForType()
newBuilderForType in interface com.google.protobuf.MessagenewBuilderForType in interface com.google.protobuf.MessageLitepublic static Policy.Builder newBuilder()
public static Policy.Builder newBuilder(Policy prototype)
public Policy.Builder toBuilder()
toBuilder in interface com.google.protobuf.MessagetoBuilder in interface com.google.protobuf.MessageLiteprotected Policy.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
newBuilderForType in class com.google.protobuf.GeneratedMessageV3public static Policy getDefaultInstance()
public static com.google.protobuf.Parser<Policy> parser()
public com.google.protobuf.Parser<Policy> getParserForType()
getParserForType in interface com.google.protobuf.MessagegetParserForType in interface com.google.protobuf.MessageLitegetParserForType in class com.google.protobuf.GeneratedMessageV3public Policy getDefaultInstanceForType()
getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder