# AttributeAccessor

Accessor for building type-safe attribute comparisons.

Provides methods for common comparison operators with proper type checking.

Returned by: [ConditionBuilder.contextAttribute](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.ConditionBuilder.html#contextattribute), ConditionBuilder.principalAttribute, ConditionBuilder.resourceAttribute

- Source: [`lib/policy/policy-statement.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-bedrock-agentcore-alpha/lib/policy/policy-statement.ts#L417)
- Type last changed: v2.278.0-alpha.0 · 21 Nov 2026

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';

declare const conditionBuilder: bedrock_agentcore_alpha.ConditionBuilder;
const attributeAccessor = new bedrock_agentcore_alpha.AttributeAccessor('path', conditionBuilder);
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_bedrock_agentcore_alpha as bedrock_agentcore_alpha

# condition_builder: bedrock_agentcore_alpha.ConditionBuilder

attribute_accessor = bedrock_agentcore_alpha.AttributeAccessor("path", condition_builder)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.agentcore.alpha.*;

ConditionBuilder conditionBuilder;

AttributeAccessor attributeAccessor = new AttributeAccessor("path", conditionBuilder);
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Bedrock.Agentcore.Alpha;

ConditionBuilder conditionBuilder;

var attributeAccessor = new AttributeAccessor("path", conditionBuilder);
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_agentcore_alpha "github.com/aws/aws-cdk-go/awsbedrockagentcorealpha"

var conditionBuilder ConditionBuilder

attributeAccessor := bedrock_agentcore_alpha.NewAttributeAccessor(jsii.String("path"), conditionBuilder)
```

## Initializer

TypeScript:

```ts
new AttributeAccessor(path: string, parent: ConditionBuilder)
```

Python:

```python
AttributeAccessor(path: str, parent: ConditionBuilder)
```

Java:

```java
new AttributeAccessor(String path, ConditionBuilder parent)
```

C# / .NET:

```csharp
new AttributeAccessor(string path, ConditionBuilder parent)
```

Golang:

```go
NewAttributeAccessor(Path *string, Parent ConditionBuilder)
```

## Methods

- `contains(value: string): ConditionBuilder` — String contains check.

- `equalTo(value: string | number | boolean): ConditionBuilder` — Equality comparison (==).

- `greaterThan(value: number): ConditionBuilder` — Greater than comparison (>).

- `greaterThanOrEqualTo(value: number): ConditionBuilder` — Greater than or equals comparison (>=).

- `isIn(values: string | number[]): ConditionBuilder` — Check if attribute is in a set/list.

- `isInRange(ipRange: string): ConditionBuilder` — IP range check - tests if IP address is in CIDR range.

  **Parameters**

  - `ipRange` — - CIDR notation (e.g., '192.168.1.0/24').

- `lessThan(value: number): ConditionBuilder` — Less than comparison (<).

- `lessThanOrEqualTo(value: number): ConditionBuilder` — Less than or equals comparison (<=).

- `notEqualTo(value: string | number | boolean): ConditionBuilder` — Inequality comparison (!=).
