@InterfaceAudience.LimitedPrivate(value="Tests") @InterfaceStability.Unstable public class RoleModel extends Object
Modifier and Type | Class and Description |
---|---|
static class |
RoleModel.Effects
Effect options.
|
static class |
RoleModel.Policy
A policy is one or more statements.
|
static class |
RoleModel.RoleElt
Any element in a role.
|
static class |
RoleModel.Statement
A single statement.
|
Modifier and Type | Field and Description |
---|---|
static String |
BUCKET_RESOURCE_F |
static String |
VERSION |
Constructor and Description |
---|
RoleModel() |
Modifier and Type | Method and Description |
---|---|
static String[] |
directory(org.apache.hadoop.fs.Path path)
Given a directory path, return the S3 resource to it.
|
static RoleModel.Effects |
effect(boolean allowed)
Map a bool to an effect.
|
static String |
newSid()
Statement ID factory.
|
static String |
pathToKey(org.apache.hadoop.fs.Path path)
Variant of
S3AFileSystem.pathToKey(Path) which doesn't care
about working directories, so can be static and stateless. |
static RoleModel.Policy |
policy(List<RoleModel.Statement> statements)
From a set of statements, create a policy.
|
static RoleModel.Policy |
policy(RoleModel.Statement... statements)
From a set of statements, create a policy.
|
static String |
resource(org.apache.hadoop.fs.Path path,
boolean isDirectory,
boolean addWildcard)
Given a path, return the S3 resource to it.
|
static String |
resource(String bucket,
String key,
boolean addWildcard)
Create a resource.
|
static RoleModel.Statement |
statement(boolean allow,
org.apache.hadoop.fs.Path path,
boolean isDirectory,
boolean wildcards,
Collection<String> actions)
Create a statement.
|
static RoleModel.Statement |
statement(boolean allow,
org.apache.hadoop.fs.Path path,
boolean isDirectory,
boolean wildcards,
String... actions)
Create a statement.
|
static RoleModel.Statement |
statement(boolean allow,
String scope,
Collection<String> actions)
Create a statement.
|
static RoleModel.Statement |
statement(boolean allow,
String scope,
String... actions)
Create a statement.
|
String |
toJson(RoleModel.Policy policy) |
public static final String VERSION
public static final String BUCKET_RESOURCE_F
public String toJson(RoleModel.Policy policy) throws com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonProcessingException
public static String newSid()
public static RoleModel.Effects effect(boolean allowed)
allowed
- is the statement to allow actions?public static String resource(String bucket, String key, boolean addWildcard)
bucket
- bucketkey
- keyaddWildcard
- add a * to the tail of the key?public static String resource(org.apache.hadoop.fs.Path path, boolean isDirectory, boolean addWildcard)
isDirectory
is 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.path
- a pathisDirectory
- is this a directory?addWildcard
- add a * to the tail of the key?public static String[] directory(org.apache.hadoop.fs.Path path)
path
- a pathpublic static String pathToKey(org.apache.hadoop.fs.Path path)
S3AFileSystem.pathToKey(Path)
which doesn't care
about working directories, so can be static and stateless.path
- path to mappublic static RoleModel.Statement statement(boolean allow, String scope, String... actions)
allow
- allow or denyscope
- scopeactions
- actionspublic static RoleModel.Statement statement(boolean allow, String scope, Collection<String> actions)
allow
- allow or denyscope
- scopeactions
- actionspublic static RoleModel.Statement statement(boolean allow, org.apache.hadoop.fs.Path path, boolean isDirectory, boolean wildcards, String... actions)
isDirectory
is 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.allow
- allow or denypath
- pathisDirectory
- is this a directory?wildcards
- add a * to the tail of the key?actions
- actionpublic static RoleModel.Statement statement(boolean allow, org.apache.hadoop.fs.Path path, boolean isDirectory, boolean wildcards, Collection<String> actions)
isDirectory
is 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.allow
- allow or denypath
- pathisDirectory
- is this a directory?wildcards
- add a * to the tail of the key?actions
- actionpublic static RoleModel.Policy policy(RoleModel.Statement... statements)
statements
- statementspublic static RoleModel.Policy policy(List<RoleModel.Statement> statements)
statements
- statementsCopyright © 2008–2024 Apache Software Foundation. All rights reserved.