Send feedback
Class Policy.Builder (2.26.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version 2.26.0 keyboard_arrow_down
public static class Policy.Builder
A builder for Policy
objects.
Constructors
Builder()
Builder(Policy policy)
protected Builder(Policy policy)
Parameter Name Description policy
Policy
Methods
addIdentity(Role role, Identity first, Identity[] others)
public final Policy.Builder addIdentity(Role role, Identity first, Identity[] others)
Adds one or more identities to the policy under the role specified.
build()
public final Policy build()
removeIdentity(Role role, Identity first, Identity[] others)
public final Policy.Builder removeIdentity(Role role, Identity first, Identity[] others)
Removes one or more identities from an existing binding. Does nothing if the binding
associated with the provided role doesn't exist.
removeRole(Role role)
public final Policy.Builder removeRole(Role role)
Removes the role (and all identities associated with that role) from the policy.
Parameter Name Description role
Role
setBindings(List<Binding> bindings)
public final Policy.Builder setBindings(List<Binding> bindings)
Replaces the builder's List of bindings with the given List of Bindings.
setBindings(Map<Role,Set<Identity>> bindings)
public final Policy.Builder setBindings(Map<Role,Set<Identity>> bindings)
Replaces the builder's map of bindings with the given map of bindings.
setEtag(String etag)
public final Policy.Builder setEtag(String etag)
Sets the policy's etag.
Etags are 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.
Parameter Name Description etag
String
setVersion(int version)
public final Policy.Builder setVersion(int version)
Sets the version of the policy.
Parameter Name Description version
int
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-21 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{
"lastModified": "Last updated 2024-08-21 UTC.",
"confidential": False
}