Class: AWSCDK::BedrockAgentCore::APISchema

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

Overview

Represents the concept of an API Schema for a Gateway Target.

Direct Known Subclasses

AssetAPISchema, InlineAPISchema, S3APISchema

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of APISchema.

Parameters:

  • s3_file (AWSCDK::S3::Location, nil) (defaults to: nil)
  • bucket_owner_account_id (String, nil) (defaults to: nil)
  • inline_schema (String, nil) (defaults to: nil)


11
12
13
14
15
16
17
# File 'bedrock_agent_core/api_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
  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("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "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::InlineAPISchema

Creates an API Schema from an inline string.

Parameters:

  • schema (String)
    • the JSON or YAML payload defining the schema (OpenAPI or Smithy).

Returns:



33
34
35
36
# File 'bedrock_agent_core/api_schema.rb', line 33

def self.from_inline(schema)
  Jsii::Type.check_type(schema, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "schema")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_bedrockagentcore.ApiSchema", "fromInline", [schema])
end

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

Creates an API Schema from a local file.

Parameters:

  • path (String)
    • the path to the local file containing the OpenAPI schema for the action group.

Returns:



42
43
44
45
# File 'bedrock_agent_core/api_schema.rb', line 42

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.ApiSchema", "fromLocalAsset", [path])
end

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

Creates an API 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:



53
54
55
56
57
58
# File 'bedrock_agent_core/api_schema.rb', line 53

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.ApiSchema", "fromS3File", [bucket, object_key, ])
end

.jsii_overridable_methodsObject



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

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)


89
90
91
92
# File 'bedrock_agent_core/api_schema.rb', line 89

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)


63
64
65
# File 'bedrock_agent_core/api_schema.rb', line 63

def ()
  jsii_get_property("bucketOwnerAccountId")
end

#grant_permissions_to_role(role) ⇒ void

This method returns an undefined value.

Grant permissions to the role.

Parameters:



98
99
100
101
# File 'bedrock_agent_core/api_schema.rb', line 98

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_schemaString?

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

Can be in JSON or YAML format.

Returns:

  • (String, nil)


72
73
74
# File 'bedrock_agent_core/api_schema.rb', line 72

def inline_schema()
  jsii_get_property("inlineSchema")
end

#s3_fileAWSCDK::S3::Location?

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

Contains the bucket name and object key information.

Returns:



81
82
83
# File 'bedrock_agent_core/api_schema.rb', line 81

def s3_file()
  jsii_get_property("s3File")
end