Package org.apache.hadoop.fs.s3a.auth
Class RoleModel
java.lang.Object
org.apache.hadoop.fs.s3a.auth.RoleModel
Jackson Role Model for Role Properties, for API clients and tests.
Doesn't have complete coverage of the entire AWS IAM policy model;
don't expect to be able to parse everything.
It can generate simple models.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEffect options.static classA policy is one or more statements.static classAny element in a role.static classA single statement. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]directory(org.apache.hadoop.fs.Path path) Given a directory path, return the S3 resource to it.static RoleModel.Effectseffect(boolean allowed) Map a bool to an effect.static StringnewSid()Statement ID factory.static StringpathToKey(org.apache.hadoop.fs.Path path) Variant ofS3AFileSystem.pathToKey(Path)which doesn't care about working directories, so can be static and stateless.static RoleModel.Policypolicy(List<RoleModel.Statement> statements) From a set of statements, create a policy.static RoleModel.Policypolicy(RoleModel.Statement... statements) From a set of statements, create a policy.static StringCreate a resource.static Stringresource(org.apache.hadoop.fs.Path path, boolean isDirectory, boolean addWildcard) Given a path, return the S3 resource to it.static RoleModel.StatementCreate a statement.static RoleModel.Statementstatement(boolean allow, String scope, Collection<String> actions) Create a statement.static RoleModel.Statementstatement(boolean allow, org.apache.hadoop.fs.Path path, boolean isDirectory, boolean wildcards, String... actions) Create a statement.static RoleModel.Statementstatement(boolean allow, org.apache.hadoop.fs.Path path, boolean isDirectory, boolean wildcards, Collection<String> actions) Create a statement.toJson(RoleModel.Policy policy)
-
Field Details
-
VERSION
- See Also:
-
BUCKET_RESOURCE_F
- See Also:
-
-
Constructor Details
-
RoleModel
public RoleModel()
-
-
Method Details
-
toJson
public String toJson(RoleModel.Policy policy) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
newSid
Statement ID factory.- Returns:
- a statement ID unique for this JVM's life.
-
effect
Map a bool to an effect.- Parameters:
allowed- is the statement to allow actions?- Returns:
- the appropriate effect.
-
resource
Create a resource.- Parameters:
bucket- bucketkey- keyaddWildcard- add a * to the tail of the key?- Returns:
- a resource for a statement.
-
resource
public static String resource(org.apache.hadoop.fs.Path path, boolean isDirectory, boolean addWildcard) Given a path, return the S3 resource to it. IfisDirectoryis true, a "/" is added to the path. This is critical when adding wildcard permissions under a directory, and also needed when locking down dir-as-file and dir-as-directory-marker access.- Parameters:
path- a pathisDirectory- is this a directory?addWildcard- add a * to the tail of the key?- Returns:
- a resource for a statement.
-
directory
Given a directory path, return the S3 resource to it.- Parameters:
path- a path- Returns:
- a resource for a statement.
-
pathToKey
Variant ofS3AFileSystem.pathToKey(Path)which doesn't care about working directories, so can be static and stateless.- Parameters:
path- path to map- Returns:
- key or ""
-
statement
Create a statement.- Parameters:
allow- allow or denyscope- scopeactions- actions- Returns:
- the formatted json statement
-
statement
public static RoleModel.Statement statement(boolean allow, String scope, Collection<String> actions) Create a statement.- Parameters:
allow- allow or denyscope- scopeactions- actions- Returns:
- the formatted json statement
-
statement
public static RoleModel.Statement statement(boolean allow, org.apache.hadoop.fs.Path path, boolean isDirectory, boolean wildcards, String... actions) Create a statement. IfisDirectoryis true, a "/" is added to the path. This is critical when adding wildcard permissions under a directory, and also needed when locking down dir-as-file and dir-as-directory-marker access.- Parameters:
allow- allow or denypath- pathisDirectory- is this a directory?wildcards- add a * to the tail of the key?actions- action- Returns:
- the formatted json statement
-
statement
public static RoleModel.Statement statement(boolean allow, org.apache.hadoop.fs.Path path, boolean isDirectory, boolean wildcards, Collection<String> actions) Create a statement. IfisDirectoryis true, a "/" is added to the path. This is critical when adding wildcard permissions under a directory, and also needed when locking down dir-as-file and dir-as-directory-marker access.- Parameters:
allow- allow or denypath- pathisDirectory- is this a directory?wildcards- add a * to the tail of the key?actions- action- Returns:
- the formatted json statement
-
policy
From a set of statements, create a policy.- Parameters:
statements- statements- Returns:
- the policy
-
policy
From a set of statements, create a policy.- Parameters:
statements- statements- Returns:
- the policy
-