@Generated(value="jsii-pacmak/1.63.2 (build a8a8833)", date="2022-08-09T19:16:32.904Z") public class User extends Resource implements IIdentity, IUser
Example:
User user = new User(this, "MyUser"); // or User.fromUserName(stack, 'User', 'johnsmith'); Group group = new Group(this, "MyGroup"); // or Group.fromGroupArn(stack, 'Group', 'arn:aws:iam::account-id:group/group-name'); user.addToGroup(group); // or group.addUser(user);
Modifier and Type | Class and Description |
---|---|
static class |
User.Builder
A fluent builder for
User . |
IUser.Jsii$Default, IUser.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
User(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
User(software.amazon.jsii.JsiiObjectRef objRef) |
|
User(software.constructs.Construct scope,
java.lang.String id) |
|
User(software.constructs.Construct scope,
java.lang.String id,
UserProps props) |
Modifier and Type | Method and Description |
---|---|
void |
addManagedPolicy(IManagedPolicy policy)
Attaches a managed policy to the user.
|
void |
addToGroup(IGroup group)
Adds this user to a group.
|
java.lang.Boolean |
addToPolicy(PolicyStatement statement)
Add to the policy of this principal.
|
AddToPrincipalPolicyResult |
addToPrincipalPolicy(PolicyStatement statement)
Adds an IAM statement to the default policy.
|
void |
attachInlinePolicy(Policy policy)
Attaches a policy to this user.
|
static IUser |
fromUserArn(software.constructs.Construct scope,
java.lang.String id,
java.lang.String userArn)
Import an existing user given a user ARN.
|
static IUser |
fromUserAttributes(software.constructs.Construct scope,
java.lang.String id,
UserAttributes attrs)
Import an existing user given user attributes.
|
static IUser |
fromUserName(software.constructs.Construct scope,
java.lang.String id,
java.lang.String userName)
Import an existing user given a username.
|
java.lang.String |
getAssumeRoleAction()
When this Principal is used in an AssumeRole policy, the action to use.
|
IPrincipal |
getGrantPrincipal()
The principal to grant permissions to.
|
IManagedPolicy |
getPermissionsBoundary()
Returns the permissions boundary attached to this user.
|
PrincipalPolicyFragment |
getPolicyFragment()
Return the policy fragment that identifies this principal in a Policy.
|
java.lang.String |
getPrincipalAccount()
The AWS account ID of this principal.
|
java.lang.String |
getUserArn()
An attribute that represents the user's ARN.
|
java.lang.String |
getUserName()
An attribute that represents the user name.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyRemovalPolicy, getEnv, getStack
getNode
protected User(software.amazon.jsii.JsiiObjectRef objRef)
protected User(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public User(software.constructs.Construct scope, java.lang.String id, UserProps props)
scope
- This parameter is required.id
- This parameter is required.props
- public User(software.constructs.Construct scope, java.lang.String id)
scope
- This parameter is required.id
- This parameter is required.public static IUser fromUserArn(software.constructs.Construct scope, java.lang.String id, java.lang.String userArn)
If the ARN comes from a Token, the User cannot have a path; if so, any attempt to reference its username will fail.
scope
- construct scope. This parameter is required.id
- construct id. This parameter is required.userArn
- the ARN of an existing user to import. This parameter is required.public static IUser fromUserAttributes(software.constructs.Construct scope, java.lang.String id, UserAttributes attrs)
If the ARN comes from a Token, the User cannot have a path; if so, any attempt to reference its username will fail.
scope
- construct scope. This parameter is required.id
- construct id. This parameter is required.attrs
- the attributes of the user to import. This parameter is required.public static IUser fromUserName(software.constructs.Construct scope, java.lang.String id, java.lang.String userName)
scope
- construct scope. This parameter is required.id
- construct id. This parameter is required.userName
- the username of the existing user to import. This parameter is required.public void addManagedPolicy(IManagedPolicy policy)
addManagedPolicy
in interface IIdentity
policy
- The managed policy to attach. This parameter is required.public void addToGroup(IGroup group)
addToGroup
in interface IUser
group
- This parameter is required.public java.lang.Boolean addToPolicy(PolicyStatement statement)
addToPolicy
in interface IPrincipal
statement
- This parameter is required.public AddToPrincipalPolicyResult addToPrincipalPolicy(PolicyStatement statement)
addToPrincipalPolicy
in interface IPrincipal
statement
- This parameter is required.public void attachInlinePolicy(Policy policy)
attachInlinePolicy
in interface IIdentity
policy
- This parameter is required.public java.lang.String getAssumeRoleAction()
getAssumeRoleAction
in interface IPrincipal
public IPrincipal getGrantPrincipal()
getGrantPrincipal
in interface IGrantable
public PrincipalPolicyFragment getPolicyFragment()
getPolicyFragment
in interface IPrincipal
public java.lang.String getUserArn()
getUserArn
in interface IUser
public java.lang.String getUserName()
getUserName
in interface IUser
public IManagedPolicy getPermissionsBoundary()
public java.lang.String getPrincipalAccount()
Can be undefined when the account is not known (for example, for service principals). Can be a Token - in that case, it's assumed to be AWS::AccountId.
getPrincipalAccount
in interface IPrincipal