# UnknownPrincipal

A principal for use in resources that need to have a role but it's unknown.

Some resources have roles associated with them which they assume, such as
Lambda Functions, CodeBuild projects, StepFunctions machines, etc.

When those resources are imported, their actual roles are not always
imported with them. When that happens, we use an instance of this class
instead, which will add user warnings when statements are attempted to be
added to it.

Extends: UnknownPrincipal
Implements: IGrantable, IPrincipal

- Source: [`aws-iam/lib/unknown-principal.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-iam/lib/unknown-principal.ts#L29)

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_iam as iam } from 'aws-cdk-lib';
import * as constructs from 'constructs';

declare const construct: constructs.Construct;
const unknownPrincipal = new iam.UnknownPrincipal({
  resource: construct,
});
```

## Initializer

```ts
new UnknownPrincipal(props: UnknownPrincipalProps)
```

## Properties

- `assumeRoleAction`: string — When this Principal is used in an AssumeRole policy, the action to use.

- `grantPrincipal`: [IPrincipal](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IPrincipal.html) — The principal to grant permissions to.

- `policyFragment`: [PrincipalPolicyFragment](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PrincipalPolicyFragment.html) — Return the policy fragment that identifies this principal in a Policy.

## Methods

- `addToPolicy(statement: PolicyStatement): boolean` — Add to the policy of this principal.

- `addToPrincipalPolicy(statement: PolicyStatement): AddToPrincipalPolicyResult` — Add to the policy of this principal.
