Interface IPrincipal
Represents a logical IAM principal.
Inherited Members
Namespace: Amazon.CDK.AWS.IAM
Assembly: Amazon.CDK.AWS.IAM.dll
Syntax (csharp)
public interface IPrincipal : IGrantable
Syntax (vb)
Public Interface IPrincipal
Inherits IGrantable
Remarks
An IPrincipal describes a logical entity that can perform AWS API calls against sets of resources, optionally under certain conditions.
Examples of simple principals are IAM objects that you create, such as Users or Roles.
An example of a more complex principals is a ServicePrincipal
(such as
new ServicePrincipal("sns.amazonaws.com")
, which represents the Simple
Notifications Service).
A single logical Principal may also map to a set of physical principals.
For example, new OrganizationPrincipal('o-1234')
represents all
identities that are part of the given AWS Organization.
Synopsis
Properties
AssumeRoleAction | When this Principal is used in an AssumeRole policy, the action to use. |
PolicyFragment | Return the policy fragment that identifies this principal in a Policy. |
PrincipalAccount | The AWS account ID of this principal. |
Methods
AddToPolicy(PolicyStatement) | (deprecated) Add to the policy of this principal. |
AddToPrincipalPolicy(PolicyStatement) | Add to the policy of this principal. |
Properties
AssumeRoleAction
When this Principal is used in an AssumeRole policy, the action to use.
string AssumeRoleAction { get; }
Property Value
System.String
PolicyFragment
Return the policy fragment that identifies this principal in a Policy.
PrincipalPolicyFragment PolicyFragment { get; }
Property Value
PrincipalAccount
The AWS account ID of this principal.
virtual string PrincipalAccount { get; }
Property Value
System.String
Remarks
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
AddToPolicy(PolicyStatement)
(deprecated) Add to the policy of this principal.
bool AddToPolicy(PolicyStatement statement)
Parameters
- statement PolicyStatement
Returns
System.Boolean
true if the statement was added, false if the principal in question does not have a policy document to add the statement to.
Remarks
Stability: Deprecated
AddToPrincipalPolicy(PolicyStatement)
Add to the policy of this principal.
IAddToPrincipalPolicyResult AddToPrincipalPolicy(PolicyStatement statement)
Parameters
- statement PolicyStatement
Returns