public final class Policy extends com.google.protobuf.GeneratedMessageV3 implements PolicyOrBuilder
Defines an Identity and Access Management (IAM) policy. It is used to
specify access control policies for Cloud Platform resources.
A `Policy` consists of a list of `bindings`. A `Binding` binds a list of
`members` to a `role`, where the members can be user accounts, Google groups,
Google domains, and service accounts. A `role` is a named list of permissions
defined by IAM.
**Example**
{
"bindings": [
{
"role": "roles/owner",
"members": [
"user:mike@example.com",
"group:admins@example.com",
"domain:google.com",
"serviceAccount:my-other-app@appspot.gserviceaccount.com",
]
},
{
"role": "roles/viewer",
"members": ["user:sean@example.com"]
}
]
}
For a description of IAM and its features, see the
[IAM developer's guide](https://cloud.google.com/iam).
Protobuf type google.iam.v1.Policy| Modifier and Type | Class and Description |
|---|---|
static class |
Policy.Builder
Defines an Identity and Access Management (IAM) policy.
|
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)
Associates a list of `members` to a `role`.
|
int |
getBindingsCount()
Associates a list of `members` to a `role`.
|
java.util.List<Binding> |
getBindingsList()
Associates a list of `members` to a `role`.
|
BindingOrBuilder |
getBindingsOrBuilder(int index)
Associates a list of `members` to a `role`.
|
java.util.List<? extends BindingOrBuilder> |
getBindingsOrBuilderList()
Associates a list of `members` to a `role`.
|
static Policy |
getDefaultInstance() |
Policy |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
com.google.protobuf.ByteString |
getEtag()
`etag` is used for optimistic concurrency control as a way to help
prevent simultaneous updates of a policy from overwriting each other.
|
com.google.protobuf.Parser<Policy> |
getParserForType() |
int |
getSerializedSize() |
com.google.protobuf.UnknownFieldSet |
getUnknownFields() |
int |
getVersion()
Version of the `Policy`.
|
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, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, 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()
Version of the `Policy`. The default version is 0.
int32 version = 1;getVersion in interface PolicyOrBuilderpublic java.util.List<Binding> getBindingsList()
Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.
repeated .google.iam.v1.Binding bindings = 4;getBindingsList in interface PolicyOrBuilderpublic java.util.List<? extends BindingOrBuilder> getBindingsOrBuilderList()
Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.
repeated .google.iam.v1.Binding bindings = 4;getBindingsOrBuilderList in interface PolicyOrBuilderpublic int getBindingsCount()
Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.
repeated .google.iam.v1.Binding bindings = 4;getBindingsCount in interface PolicyOrBuilderpublic Binding getBindings(int index)
Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.
repeated .google.iam.v1.Binding bindings = 4;getBindings in interface PolicyOrBuilderpublic BindingOrBuilder getBindingsOrBuilder(int index)
Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.
repeated .google.iam.v1.Binding bindings = 4;getBindingsOrBuilder in interface PolicyOrBuilderpublic com.google.protobuf.ByteString getEtag()
`etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. If no `etag` is provided in the call to `setIamPolicy`, then the existing policy is overwritten blindly.
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