# S3ToolSchema

Class to define a Tool Schema from an S3 object.

Extends: [ToolSchema](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.ToolSchema.html) › S3ToolSchema
Obtainable from: [ToolSchema.fromS3File](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.ToolSchema.html#froms3file)

- Source: [`lib/gateway/targets/schema/tool-schema.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-bedrock-agentcore-alpha/lib/gateway/targets/schema/tool-schema.ts#L297)

## 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';
const s3ToolSchema = new bedrock_agentcore_alpha.S3ToolSchema({
  bucketName: 'bucketName',
  objectKey: 'objectKey',

  // the properties below are optional
  objectVersion: 'objectVersion',
}, /* all optional props */ 'bucketOwnerAccountId');
```

Python:

```python
from aws_cdk.aws_s3 import Location
# 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

s3_tool_schema = bedrock_agentcore_alpha.S3ToolSchema(Location(
    bucket_name="bucketName",
    object_key="objectKey",

    # the properties below are optional
    object_version="objectVersion"
), "bucketOwnerAccountId")
```

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.*;

S3ToolSchema s3ToolSchema = new S3ToolSchema(Location.builder()
        .bucketName("bucketName")
        .objectKey("objectKey")

        // the properties below are optional
        .objectVersion("objectVersion")
        .build(), "bucketOwnerAccountId");
```

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;

var s3ToolSchema = new S3ToolSchema(new Location {
    BucketName = "bucketName",
    ObjectKey = "objectKey",

    // the properties below are optional
    ObjectVersion = "objectVersion"
}, "bucketOwnerAccountId");
```

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"

s3ToolSchema := bedrock_agentcore_alpha.NewS3ToolSchema(&Location{
	BucketName: jsii.String("bucketName"),
	ObjectKey: jsii.String("objectKey"),

	// the properties below are optional
	ObjectVersion: jsii.String("objectVersion"),
}, jsii.String("bucketOwnerAccountId"))
```

## Initializer

TypeScript:

```ts
new S3ToolSchema(location: Location, bucketOwnerAccountId?: string)
```

Python:

```python
S3ToolSchema(location: Location, bucket_owner_account_id: typing.Optional[str] = None)
```

Java:

```java
new S3ToolSchema(Location location, String bucketOwnerAccountId)
```

C# / .NET:

```csharp
new S3ToolSchema(Location location, string? bucketOwnerAccountId = null)
```

Golang:

```go
NewS3ToolSchema(Location Location, BucketOwnerAccountId *string)
```

## Properties

- `bucketOwnerAccountId`: string — The account ID of the S3 bucket owner for cross-account access.

- `inlineSchema`: [ToolDefinition](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.ToolDefinition.html)[] — The inline tool schema definition as a string, if using an inline schema.

  Can be in JSON or YAML format.

- `s3File`: [Location](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Location.html) — The S3 location of the tool schema file, if using an S3-based schema.

  Contains the bucket name and object key information.

## Methods

- `bind(scope: Construct): void` — Bind the schema to a construct.

- `fromInline(schema: ToolDefinition[]): InlineToolSchema` (static) — Creates a Tool Schema from an inline string.

  **Parameters**

  - `schema` — - the JSON or YAML payload defining the OpenAPI schema for the action group.

- `fromLocalAsset(path: string): ToolSchema` (static) — Creates a tool Schema from a local file.

  **Parameters**

  - `path` — - the path to the local file containing the function schema for the tool.

- `fromS3File(bucket: IBucket, objectKey: string, bucketOwnerAccountId?: string): S3ToolSchema // chainable` (static) — Creates a Tool Schema from an S3 File.

  **Parameters**

  - `bucket` — - the bucket containing the local file containing the OpenAPI schema for the action group.
  - `objectKey` — - object key in the bucket.
  - `bucketOwnerAccountId` — - optional The account ID of the Amazon S3 bucket owner.

- `grantPermissionsToRole(role: IRole): void` — Grant permissions to the role.
