Package org.apache.nifi.authorization
Class AccessPolicy.Builder
java.lang.Object
org.apache.nifi.authorization.AccessPolicy.Builder
- Enclosing class:
AccessPolicy
Builder for Access Policies.
-
Field Summary
Modifier and TypeFieldDescriptionprivate RequestAction
private final boolean
private String
private String
-
Constructor Summary
ConstructorDescriptionBuilder()
Default constructor for building a new AccessPolicy.Builder
(AccessPolicy other) Initializes the builder with the state of the provided policy. -
Method Summary
Modifier and TypeMethodDescriptionaction
(RequestAction action) Sets the action for this builder.Adds the given group to the builder's set of groups.Adds all the groups from the provided set to the builder's set of groups.Adds the given user to the builder's set of users.Adds all the users from the provided set to the builder's set of users.build()
Clears the builder's set of groups so that it is non-null and size == 0.Clears the builder's set of users so that it is non-null and size == 0.identifier
(String identifier) Sets the identifier of the builder.Sets the identifier of the builder with a UUID generated from the specified seed string.Sets the identifier of the builder to a random UUID.removeGroup
(String group) Removes the provided groups from the builder's set of groups.removeGroups
(Set<String> groups) Removes all groups in the provided set from the builder's set of groups.removeUser
(String user) Removes the provided user from the builder's set of users.removeUsers
(Set<String> users) Removes all users in the provided set from the builder's set of users.Sets the resource of the builder.
-
Field Details
-
identifier
-
resource
-
action
-
users
-
groups
-
fromPolicy
private final boolean fromPolicy
-
-
Constructor Details
-
Builder
public Builder()Default constructor for building a new AccessPolicy. -
Builder
Initializes the builder with the state of the provided policy. When using this constructor the identifier field of the builder can not be changed and will result in an IllegalStateException if attempting to do so.- Parameters:
other
- the existing access policy to initialize from
-
-
Method Details
-
identifier
Sets the identifier of the builder.- Parameters:
identifier
- the identifier to set- Returns:
- the builder
- Throws:
IllegalStateException
- if this method is called when this builder was constructed from an existing Policy
-
identifierGenerateRandom
Sets the identifier of the builder to a random UUID.- Returns:
- the builder
- Throws:
IllegalStateException
- if this method is called when this builder was constructed from an existing Policy
-
identifierGenerateFromSeed
Sets the identifier of the builder with a UUID generated from the specified seed string.- Returns:
- the builder
- Throws:
IllegalStateException
- if this method is called when this builder was constructed from an existing Policy
-
resource
Sets the resource of the builder.- Parameters:
resource
- the resource to set- Returns:
- the builder
-
addUsers
Adds all the users from the provided set to the builder's set of users.- Parameters:
users
- the users to add- Returns:
- the builder
-
addUser
Adds the given user to the builder's set of users.- Parameters:
user
- the user to add- Returns:
- the builder
-
removeUsers
Removes all users in the provided set from the builder's set of users.- Parameters:
users
- the users to remove- Returns:
- the builder
-
removeUser
Removes the provided user from the builder's set of users.- Parameters:
user
- the user to remove- Returns:
- the builder
-
clearUsers
Clears the builder's set of users so that it is non-null and size == 0.- Returns:
- the builder
-
addGroups
Adds all the groups from the provided set to the builder's set of groups.- Parameters:
groups
- the groups to add- Returns:
- the builder
-
addGroup
Adds the given group to the builder's set of groups.- Parameters:
group
- the group to add- Returns:
- the builder
-
removeGroups
Removes all groups in the provided set from the builder's set of groups.- Parameters:
groups
- the groups to remove- Returns:
- the builder
-
removeGroup
Removes the provided groups from the builder's set of groups.- Parameters:
group
- the group to remove- Returns:
- the builder
-
clearGroups
Clears the builder's set of groups so that it is non-null and size == 0.- Returns:
- the builder
-
action
Sets the action for this builder.- Parameters:
action
- the action to set- Returns:
- the builder
-
build
- Returns:
- a new AccessPolicy constructed from the state of the builder
-