interface IComparablePrincipal
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.IAM.IComparablePrincipal |
Java | software.amazon.awscdk.services.iam.IComparablePrincipal |
Python | aws_cdk.aws_iam.IComparablePrincipal |
TypeScript (source) | @aws-cdk/aws-iam » IComparablePrincipal |
Implemented by
Account, Account, Any, Anyone, Arn, Canonical, Composite, Federated, Open, Organization, Principal, Saml, Saml, Service, Session, Star, Web, Via
Interface for principals that can be compared.
This only needs to be implemented for principals that could potentially be value-equal. Identity-equal principals will be handled correctly by default.
Properties
| Name | Type | Description |
|---|---|---|
| assume | string | When this Principal is used in an AssumeRole policy, the action to use. |
| grant | IPrincipal | The principal to grant permissions to. |
| policy | Principal | Return the policy fragment that identifies this principal in a Policy. |
| principal | string | The AWS account ID of this principal. |
assumeRoleAction
Type:
string
When this Principal is used in an AssumeRole policy, the action to use.
grantPrincipal
Type:
IPrincipal
The principal to grant permissions to.
policyFragment
Type:
Principal
Return the policy fragment that identifies this principal in a Policy.
principalAccount?
Type:
string
(optional)
The AWS account ID of this principal.
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.
Methods
| Name | Description |
|---|---|
| add | Add to the policy of this principal. |
| add | Add to the policy of this principal. |
| dedupe | Return a string format of this principal which should be identical if the two principals are the same. |
addToPolicy(statement)
public addToPolicy(statement: PolicyStatement): boolean
⚠️ Deprecated: Use addToPrincipalPolicy instead.
Parameters
- statement
PolicyStatement
Returns
boolean
Add to the policy of this principal.
addToPrincipalPolicy(statement)
public addToPrincipalPolicy(statement: PolicyStatement): AddToPrincipalPolicyResult
Parameters
- statement
PolicyStatement
Returns
Add to the policy of this principal.
dedupeString()
public dedupeString(): string
Returns
string
Return a string format of this principal which should be identical if the two principals are the same.

.NET
Java
Python
TypeScript (