# PolicyResource

The resource a policy statement applies to.

AgentCore rejects a policy whose resource is an unconstrained wildcard, so a
statement must name either a resource type or a specific resource.

Obtainable from: PolicyResource.anyOfType, PolicyResource.instance

- Source: [`aws-bedrockagentcore/lib/policy/policy-statement.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/policy/policy-statement.ts#L569)
- Type last changed: v2.269.0 · 10 Sep 2026

## Example

TypeScript:

```ts
import { PolicyResource } from 'aws-cdk-lib/aws-bedrockagentcore';
declare const gatewayArn: string;

PolicyResource.anyOfType('AgentCore::Gateway'); // resource is AgentCore::Gateway
PolicyResource.instance('AgentCore::Gateway', gatewayArn); // resource == AgentCore::Gateway::"<arn>"
```

Python:

```python
from aws_cdk.aws_bedrockagentcore import PolicyResource
# gateway_arn: str

PolicyResource.any_of_type("AgentCore::Gateway") # resource is AgentCore::Gateway
PolicyResource.instance("AgentCore::Gateway", gateway_arn)
```

Java:

```java
import software.amazon.awscdk.services.bedrockagentcore.PolicyResource;
String gatewayArn;

PolicyResource.anyOfType("AgentCore::Gateway"); // resource is AgentCore::Gateway
PolicyResource.instance("AgentCore::Gateway", gatewayArn);
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.BedrockAgentCore;
string gatewayArn;

PolicyResource.AnyOfType("AgentCore::Gateway"); // resource is AgentCore::Gateway
PolicyResource.Instance("AgentCore::Gateway", gatewayArn);
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"
var gatewayArn string

awscdk.PolicyResource_AnyOfType(jsii.String("AgentCore::Gateway")) // resource is AgentCore::Gateway
awscdk.PolicyResource_Instance(jsii.String("AgentCore::Gateway"), gatewayArn)
```

## Methods

- `anyOfType(entityType: string): PolicyResource // chainable` (static) — Any resource of the given entity type.

  **Parameters**

  - `entityType` — - The entity type, for example 'AgentCore::Gateway'.

- `instance(entityType: string, entityArn: string): PolicyResource // chainable` (static) — One specific resource.

  AgentCore requires a specific resource when the statement names specific
  actions rather than any action.

  **Parameters**

  - `entityType` — - The entity type, for example 'AgentCore::Gateway'.
  - `entityArn` — - The resource ARN or identifier.
