Class: AWSCDK::BedrockAgentCore::ToolSchema

Inherits:
Jsii::Object
  • Object
show all
Defined in:
bedrock_agent_core/tool_schema.rb

Overview

**************************************************************************** TOOL SCHEMA CLASS ***************************************************************************.

Direct Known Subclasses

AssetToolSchema, InlineToolSchema, S3ToolSchema

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s3_file = nil, bucket_owner_account_id = nil, inline_schema = nil) ⇒ ToolSchema

Returns a new instance of ToolSchema.

Parameters:



11
12
13
14
15
16
17
18
# File 'bedrock_agent_core/tool_schema.rb', line 11

def initialize(s3_file = nil,  = nil, inline_schema = nil)
  s3_file = s3_file.is_a?(Hash) ? ::AWSCDK::S3::Location.new(**s3_file.transform_keys(&:to_sym)) : s3_file
  inline_schema = inline_schema.is_a?(Array) ? inline_schema.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::BedrockAgentCore::ToolDefinition.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : inline_schema
  Jsii::Type.check_type(s3_file, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuTG9jYXRpb24ifQ==")), "s3File") unless s3_file.nil?
  Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketOwnerAccountId") unless .nil?
  Jsii::Type.check_type(inline_schema, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrYWdlbnRjb3JlLlRvb2xEZWZpbml0aW9uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "inlineSchema") unless inline_schema.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(s3_file, , inline_schema)
end

Class Method Details

.from_inline(schema) ⇒ AWSCDK::BedrockAgentCore::InlineToolSchema

Creates a Tool Schema from an inline string.

Parameters:

Returns:



34
35
36
37
38
# File 'bedrock_agent_core/tool_schema.rb', line 34

def self.from_inline(schema)
  schema = schema.is_a?(Array) ? schema.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::BedrockAgentCore::ToolDefinition.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : schema
  Jsii::Type.check_type(schema, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrYWdlbnRjb3JlLlRvb2xEZWZpbml0aW9uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "schema")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_bedrockagentcore.ToolSchema", "fromInline", [schema])
end

.from_local_asset(path) ⇒ AWSCDK::BedrockAgentCore::ToolSchema

Creates a tool Schema from a local file.

Parameters:

  • path (String)
    • the path to the local file containing the function schema for the tool.

Returns:

  • (AWSCDK::BedrockAgentCore::ToolSchema)


44
45
46
47
# File 'bedrock_agent_core/tool_schema.rb', line 44

def self.from_local_asset(path)
  Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_bedrockagentcore.ToolSchema", "fromLocalAsset", [path])
end

.from_s3_file(bucket, object_key, bucket_owner_account_id = nil) ⇒ AWSCDK::BedrockAgentCore::S3ToolSchema

Creates a Tool Schema from an S3 File.

Parameters:

  • bucket (AWSCDK::S3::IBucket)
    • the bucket containing the local file containing the OpenAPI schema for the action group.
  • object_key (String)
    • object key in the bucket.
  • bucket_owner_account_id (String, nil) (defaults to: nil)
    • optional The account ID of the Amazon S3 bucket owner.

Returns:



55
56
57
58
59
60
# File 'bedrock_agent_core/tool_schema.rb', line 55

def self.from_s3_file(bucket, object_key,  = nil)
  Jsii::Type.check_type(bucket, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSUJ1Y2tldCJ9")), "bucket")
  Jsii::Type.check_type(object_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "objectKey")
  Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketOwnerAccountId") unless .nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_bedrockagentcore.ToolSchema", "fromS3File", [bucket, object_key, ])
end

.jsii_overridable_methodsObject



20
21
22
23
24
25
26
27
28
# File 'bedrock_agent_core/tool_schema.rb', line 20

def self.jsii_overridable_methods
  {
    :bucket_owner_account_id => { kind: :property, name: "bucketOwnerAccountId", is_optional: true },
    :inline_schema => { kind: :property, name: "inlineSchema", is_optional: true },
    :s3_file => { kind: :property, name: "s3File", is_optional: true },
    :bind => { kind: :method, name: "bind", is_optional: false },
    :grant_permissions_to_role => { kind: :method, name: "grantPermissionsToRole", is_optional: false },
  }
end

Instance Method Details

#bind(scope) ⇒ void

This method returns an undefined value.

Bind the schema to a construct.

Parameters:

  • scope (Constructs::Construct)


91
92
93
94
# File 'bedrock_agent_core/tool_schema.rb', line 91

def bind(scope)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  jsii_call_method("bind", [scope])
end

#bucket_owner_account_idString?

The account ID of the S3 bucket owner for cross-account access.

Returns:

  • (String, nil)


65
66
67
# File 'bedrock_agent_core/tool_schema.rb', line 65

def ()
  jsii_get_property("bucketOwnerAccountId")
end

#grant_permissions_to_role(role) ⇒ void

This method returns an undefined value.

Grant permissions to the role.

Parameters:



100
101
102
103
# File 'bedrock_agent_core/tool_schema.rb', line 100

def grant_permissions_to_role(role)
  Jsii::Type.check_type(role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role")
  jsii_call_method("grantPermissionsToRole", [role])
end

#inline_schemaArray<AWSCDK::BedrockAgentCore::ToolDefinition>?

The inline tool schema definition as a string, if using an inline schema.

Can be in JSON or YAML format.



74
75
76
# File 'bedrock_agent_core/tool_schema.rb', line 74

def inline_schema()
  jsii_get_property("inlineSchema")
end

#s3_fileAWSCDK::S3::Location?

The S3 location of the tool schema file, if using an S3-based schema.

Contains the bucket name and object key information.

Returns:



83
84
85
# File 'bedrock_agent_core/tool_schema.rb', line 83

def s3_file()
  jsii_get_property("s3File")
end