@ThreadSafe public interface IamPolicy extends ToCopyableBuilder<IamPolicy.Builder,IamPolicy>
By default, all requests to use your resource coming from anyone but you are denied. Access control polices can override that by allowing different types of access to your resources, or by explicitly denying different types of access.
Each statement in an AWS access control policy takes the form: "A has permission to do B to C where D applies".
For more information, see The IAM User Guide
Download the policy uploaded in the previous example and create a new policy with "read" access added to it.
IamPolicyReader,
IamPolicyWriter,
IamStatement,
IAM User Guide| Modifier and Type | Interface and Description |
|---|---|
static interface |
IamPolicy.Builder |
| Modifier and Type | Method and Description |
|---|---|
static IamPolicy.Builder |
builder()
Create a
IamPolicy.Builder for an IamPolicy. |
static IamPolicy |
create(Collection<IamStatement> statements)
Create an
IamPolicy containing the provided statements. |
static IamPolicy |
fromJson(String json)
Create an
IamPolicy from an IAM policy in JSON form. |
String |
id()
Retrieve the value set by
IamPolicy.Builder.id(String). |
List<IamStatement> |
statements()
Retrieve the value set by
IamPolicy.Builder.statements(Collection). |
String |
toJson()
Convert this policy to the JSON format that is accepted by AWS services.
|
String |
toJson(IamPolicyWriter writer)
Convert this policy to the JSON format that is accepted by AWS services, using the provided writer.
|
String |
version()
Retrieve the value set by
IamPolicy.Builder.version(String). |
copy, toBuilderstatic IamPolicy fromJson(String json)
IamPolicy from an IAM policy in JSON form.
This will raise an exception if the provided JSON is invalid or does not appear to represent a valid policy document.
This is equivalent to IamPolicyReader.create().read(json).
static IamPolicy create(Collection<IamStatement> statements)
IamPolicy containing the provided statements.
At least one statement is required.
This is equivalent to IamPolicy.builder().statements(statements).build()
static IamPolicy.Builder builder()
IamPolicy.Builder for an IamPolicy.String id()
IamPolicy.Builder.id(String).String version()
IamPolicy.Builder.version(String).List<IamStatement> statements()
IamPolicy.Builder.statements(Collection).String toJson()
This is equivalent to IamPolicyWriter.create().writeToString(policy)
String toJson(IamPolicyWriter writer)
This is equivalent to writer.writeToString(policy)
Copyright © 2023. All rights reserved.