@Generated(value="jsii-pacmak/1.63.2 (build a8a8833)", date="2022-08-09T19:16:32.845Z") public class Group extends Resource implements IGroup
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 |
Group.Builder
A fluent builder for
Group . |
IGroup.Jsii$Default, IGroup.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
Group(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Group(software.amazon.jsii.JsiiObjectRef objRef) |
|
Group(software.constructs.Construct scope,
java.lang.String id) |
|
Group(software.constructs.Construct scope,
java.lang.String id,
GroupProps props) |
Modifier and Type | Method and Description |
---|---|
void |
addManagedPolicy(IManagedPolicy policy)
Attaches a managed policy to this 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 |
addUser(IUser user)
Adds a user to this group.
|
void |
attachInlinePolicy(Policy policy)
Attaches a policy to this group.
|
static IGroup |
fromGroupArn(software.constructs.Construct scope,
java.lang.String id,
java.lang.String groupArn)
Import an external group by ARN.
|
static IGroup |
fromGroupName(software.constructs.Construct scope,
java.lang.String id,
java.lang.String groupName)
Import an existing group by given name (with path).
|
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.
|
java.lang.String |
getGroupArn()
Returns the IAM Group ARN.
|
java.lang.String |
getGroupName()
Returns the IAM Group Name.
|
PrincipalPolicyFragment |
getPolicyFragment()
Return the policy fragment that identifies this principal in a Policy.
|
java.lang.String |
getPrincipalAccount()
The AWS account ID of this principal.
|
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 Group(software.amazon.jsii.JsiiObjectRef objRef)
protected Group(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public Group(software.constructs.Construct scope, java.lang.String id, GroupProps props)
scope
- This parameter is required.id
- This parameter is required.props
- public Group(software.constructs.Construct scope, java.lang.String id)
scope
- This parameter is required.id
- This parameter is required.public static IGroup fromGroupArn(software.constructs.Construct scope, java.lang.String id, java.lang.String groupArn)
If the imported Group ARN is a Token (such as a
CfnParameter.valueAsString
or a Fn.importValue()
) and the referenced
group has a path
(like arn:...:group/AdminGroup/NetworkAdmin
), the
groupName
property will not resolve to the correct value. Instead it
will resolve to the first path component. We unfortunately cannot express
the correct calculation of the full path name as a CloudFormation
expression. In this scenario the Group ARN should be supplied without the
path
in order to resolve the correct group resource.
scope
- construct scope. This parameter is required.id
- construct id. This parameter is required.groupArn
- the ARN of the group to import (e.g. `arn:aws:iam::account-id:group/group-name`). This parameter is required.public static IGroup fromGroupName(software.constructs.Construct scope, java.lang.String id, java.lang.String groupName)
This method has same caveats of fromGroupArn
scope
- construct scope. This parameter is required.id
- construct id. This parameter is required.groupName
- the groupName (path included) of the existing group 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 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 addUser(IUser user)
user
- This parameter is required.public void attachInlinePolicy(Policy policy)
attachInlinePolicy
in interface IIdentity
policy
- The policy to attach. This parameter is required.public java.lang.String getAssumeRoleAction()
getAssumeRoleAction
in interface IPrincipal
public IPrincipal getGrantPrincipal()
getGrantPrincipal
in interface IGrantable
public java.lang.String getGroupArn()
getGroupArn
in interface IGroup
public java.lang.String getGroupName()
getGroupName
in interface IGroup
public PrincipalPolicyFragment getPolicyFragment()
getPolicyFragment
in interface IPrincipal
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