Class: AWSCDK::BedrockAgentCore::ToolSchema
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::BedrockAgentCore::ToolSchema
- Defined in:
- bedrock_agent_core/tool_schema.rb
Overview
**************************************************************************** TOOL SCHEMA CLASS ***************************************************************************.
Direct Known Subclasses
Class Method Summary collapse
-
.from_inline(schema) ⇒ AWSCDK::BedrockAgentCore::InlineToolSchema
Creates a Tool Schema from an inline string.
-
.from_local_asset(path) ⇒ AWSCDK::BedrockAgentCore::ToolSchema
Creates a tool Schema from a local file.
-
.from_s3_file(bucket, object_key, bucket_owner_account_id = nil) ⇒ AWSCDK::BedrockAgentCore::S3ToolSchema
Creates a Tool Schema from an S3 File.
- .jsii_overridable_methods ⇒ Object
Instance Method Summary collapse
-
#bind(scope) ⇒ void
Bind the schema to a construct.
-
#bucket_owner_account_id ⇒ String?
The account ID of the S3 bucket owner for cross-account access.
-
#grant_permissions_to_role(role) ⇒ void
Grant permissions to the role.
-
#initialize(s3_file = nil, bucket_owner_account_id = nil, inline_schema = nil) ⇒ ToolSchema
constructor
A new instance of ToolSchema.
-
#inline_schema ⇒ Array<AWSCDK::BedrockAgentCore::ToolDefinition>?
The inline tool schema definition as a string, if using an inline schema.
-
#s3_file ⇒ AWSCDK::S3::Location?
The S3 location of the tool schema file, if using an S3-based schema.
Constructor Details
#initialize(s3_file = nil, bucket_owner_account_id = nil, inline_schema = nil) ⇒ ToolSchema
Returns a new instance of ToolSchema.
11 12 13 14 15 16 17 18 |
# File 'bedrock_agent_core/tool_schema.rb', line 11 def initialize(s3_file = nil, bucket_owner_account_id = 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(bucket_owner_account_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketOwnerAccountId") unless bucket_owner_account_id.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, bucket_owner_account_id, inline_schema) end |
Class Method Details
.from_inline(schema) ⇒ AWSCDK::BedrockAgentCore::InlineToolSchema
Creates a Tool Schema from an inline string.
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.
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.
55 56 57 58 59 60 |
# File 'bedrock_agent_core/tool_schema.rb', line 55 def self.from_s3_file(bucket, object_key, bucket_owner_account_id = 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(bucket_owner_account_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "bucketOwnerAccountId") unless bucket_owner_account_id.nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_bedrockagentcore.ToolSchema", "fromS3File", [bucket, object_key, bucket_owner_account_id]) end |
.jsii_overridable_methods ⇒ Object
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.
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_id ⇒ String?
The account ID of the S3 bucket owner for cross-account access.
65 66 67 |
# File 'bedrock_agent_core/tool_schema.rb', line 65 def bucket_owner_account_id() jsii_get_property("bucketOwnerAccountId") end |
#grant_permissions_to_role(role) ⇒ void
This method returns an undefined value.
Grant permissions to the role.
100 101 102 103 |
# File 'bedrock_agent_core/tool_schema.rb', line 100 def (role) Jsii::Type.check_type(role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") jsii_call_method("grantPermissionsToRole", [role]) end |
#inline_schema ⇒ Array<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_file ⇒ AWSCDK::S3::Location?
The S3 location of the tool schema file, if using an S3-based schema.
Contains the bucket name and object key information.
83 84 85 |
# File 'bedrock_agent_core/tool_schema.rb', line 83 def s3_file() jsii_get_property("s3File") end |