Module: AWSCDK::BedrockAgentCore::IBedrockAgentRuntime

Includes:
EC2::IConnectable, IAM::IGrantable, IResource, Interfaces::AWSBedrockagentcore::IRuntimeRef
Included in:
RuntimeBase
Defined in:
bedrock_agent_core/i_bedrock_agent_runtime.rb

Overview

Interface for Agent Runtime resources.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 325

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :grant_principal => { kind: :property, name: "grantPrincipal", is_optional: false },
    :connections => { kind: :property, name: "connections", is_optional: false },
    :runtime_ref => { kind: :property, name: "runtimeRef", is_optional: false },
    :agent_runtime_arn => { kind: :property, name: "agentRuntimeArn", is_optional: false },
    :agent_runtime_id => { kind: :property, name: "agentRuntimeId", is_optional: false },
    :agent_runtime_name => { kind: :property, name: "agentRuntimeName", is_optional: false },
    :application_log_group => { kind: :property, name: "applicationLogGroup", is_optional: false },
    :role => { kind: :property, name: "role", is_optional: false },
    :agent_runtime_version => { kind: :property, name: "agentRuntimeVersion", is_optional: true },
    :agent_status => { kind: :property, name: "agentStatus", is_optional: true },
    :created_at => { kind: :property, name: "createdAt", is_optional: true },
    :last_updated_at => { kind: :property, name: "lastUpdatedAt", is_optional: true },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :add_to_role_policy => { kind: :method, name: "addToRolePolicy", is_optional: false },
    :grant => { kind: :method, name: "grant", is_optional: false },
    :grant_invoke => { kind: :method, name: "grantInvoke", is_optional: false },
    :grant_invoke_runtime => { kind: :method, name: "grantInvokeRuntime", is_optional: false },
    :grant_invoke_runtime_for_user => { kind: :method, name: "grantInvokeRuntimeForUser", is_optional: false },
    :metric => { kind: :method, name: "metric", is_optional: false },
    :metric_invocations => { kind: :method, name: "metricInvocations", is_optional: false },
    :metric_invocations_aggregated => { kind: :method, name: "metricInvocationsAggregated", is_optional: false },
    :metric_latency => { kind: :method, name: "metricLatency", is_optional: false },
    :metric_session_count => { kind: :method, name: "metricSessionCount", is_optional: false },
    :metric_sessions_aggregated => { kind: :method, name: "metricSessionsAggregated", is_optional: false },
    :metric_system_errors => { kind: :method, name: "metricSystemErrors", is_optional: false },
    :metric_throttles => { kind: :method, name: "metricThrottles", is_optional: false },
    :metric_total_errors => { kind: :method, name: "metricTotalErrors", is_optional: false },
    :metric_user_errors => { kind: :method, name: "metricUserErrors", is_optional: false },
  }
end

Instance Method Details

#add_to_role_policy(statement) ⇒ AWSCDK::BedrockAgentCore::IBedrockAgentRuntime

Adds a policy statement to the runtime's execution role.

Parameters:

Returns:

  • (AWSCDK::BedrockAgentCore::IBedrockAgentRuntime)

    The runtime instance for chaining



180
181
182
183
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 180

def add_to_role_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("addToRolePolicy", [statement])
end

#agent_runtime_arnString

The ARN of the agent runtime resource - Format arn:${Partition}:bedrock-agentcore:${Region}:${Account}:runtime/${RuntimeId}.

Examples:

"arn:aws:bedrock-agentcore:us-west-2:123456789012:runtime/runtime-abc123"

Returns:

  • (String)


66
67
68
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 66

def agent_runtime_arn()
  jsii_get_property("agentRuntimeArn")
end

#agent_runtime_idString

The ID of the agent runtime.

Examples:

"runtime-abc123"

Returns:

  • (String)


75
76
77
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 75

def agent_runtime_id()
  jsii_get_property("agentRuntimeId")
end

#agent_runtime_nameString

The name of the agent runtime.

Returns:

  • (String)


82
83
84
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 82

def agent_runtime_name()
  jsii_get_property("agentRuntimeName")
end

#agent_runtime_versionString?

The version of the agent runtime.

Returns:

  • (String, nil)


116
117
118
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 116

def agent_runtime_version()
  jsii_get_property("agentRuntimeVersion")
end

#agent_statusString?

The current status of the agent runtime.

Returns:

  • (String, nil)


123
124
125
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 123

def agent_status()
  jsii_get_property("agentStatus")
end

#application_log_groupAWSCDK::Logs::ILogGroup

The CloudWatch Logs application log group for the default endpoint of this runtime, located at /aws/bedrock-agentcore/runtimes/{agentRuntimeId}-DEFAULT.

Use this property to attach metric filters, subscription filters, or alarms to the log group without hardcoding its name.

The log group is created by the AgentCore service on the runtime's first invocation, not by CDK. Constructs that require the log group to exist at deploy time (such as MetricFilter) may race the first invocation; in that case, ensure at least one invocation has occurred before deploying the dependent resources, or pre-create the log group with a LogRetention custom resource using the same name.

Examples:

"/aws/bedrock-agentcore/runtimes/runtime-abc123-DEFAULT"

Returns:



102
103
104
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 102

def application_log_group()
  jsii_get_property("applicationLogGroup")
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



171
172
173
174
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 171

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#connectionsAWSCDK::EC2::Connections

The network connections associated with this resource.



50
51
52
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 50

def connections()
  jsii_get_property("connections")
end

#created_atString?

The time at which the runtime was created.

Examples:

"2024-01-15T10:30:00Z"

Returns:

  • (String, nil)


132
133
134
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 132

def created_at()
  jsii_get_property("createdAt")
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



29
30
31
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 29

def env()
  jsii_get_property("env")
end

#grant(actions, resources) ⇒ AWSCDK::IAM::Grant

Grant the runtime specific actions on AWS resources.

Parameters:

  • actions (Array<String>)

    The actions to grant.

  • resources (Array<String>)

    The resource ARNs to grant access to.

Returns:



190
191
192
193
194
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 190

def grant(actions, resources)
  Jsii::Type.check_type(actions, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "actions")
  Jsii::Type.check_type(resources, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "resources")
  jsii_call_method("grant", [actions, resources])
end

#grant_invoke(grantee) ⇒ AWSCDK::IAM::Grant

Permits an IAM principal to invoke this runtime both directly and on behalf of users Grants both bedrock-agentcore:InvokeAgentRuntime and bedrock-agentcore:InvokeAgentRuntimeForUser permissions.

Parameters:

Returns:



200
201
202
203
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 200

def grant_invoke(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantInvoke", [grantee])
end

#grant_invoke_runtime(grantee) ⇒ AWSCDK::IAM::Grant

Permits an IAM principal to invoke this runtime Grants the bedrock-agentcore:InvokeAgentRuntime permission.

Parameters:

Returns:



209
210
211
212
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 209

def grant_invoke_runtime(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantInvokeRuntime", [grantee])
end

#grant_invoke_runtime_for_user(grantee) ⇒ AWSCDK::IAM::Grant

Permits an IAM principal to invoke this runtime on behalf of a user Grants the bedrock-agentcore:InvokeAgentRuntimeForUser permission Required when using the X-Amzn-Bedrock-AgentCore-Runtime-User-Id header.

Parameters:

Returns:



218
219
220
221
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 218

def grant_invoke_runtime_for_user(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantInvokeRuntimeForUser", [grantee])
end

#grant_principalAWSCDK::IAM::IPrincipal

The principal to grant permissions to.



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

def grant_principal()
  jsii_get_property("grantPrincipal")
end

#last_updated_atString?

The time at which the runtime was last updated.

Examples:

"2024-01-15T14:45:00Z"

Returns:

  • (String, nil)


141
142
143
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 141

def last_updated_at()
  jsii_get_property("lastUpdatedAt")
end

#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return the given named metric for this agent runtime.

Parameters:

Returns:



228
229
230
231
232
233
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 228

def metric(metric_name, props = nil)
  Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metric", [metric_name, props])
end

#metric_invocations(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return a metric containing the total number of invocations for this agent runtime.

Parameters:

Returns:



239
240
241
242
243
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 239

def metric_invocations(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricInvocations", [props])
end

#metric_invocations_aggregated(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return a metric containing the total number of invocations across all resources.

Parameters:

Returns:



249
250
251
252
253
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 249

def metric_invocations_aggregated(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricInvocationsAggregated", [props])
end

#metric_latency(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return a metric measuring the latency of requests for this agent runtime.

Parameters:

Returns:



259
260
261
262
263
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 259

def metric_latency(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricLatency", [props])
end

#metric_session_count(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return a metric containing the number of agent sessions for this agent runtime.

Parameters:

Returns:



269
270
271
272
273
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 269

def metric_session_count(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricSessionCount", [props])
end

#metric_sessions_aggregated(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return a metric containing the total number of sessions across all resources.

Parameters:

Returns:



279
280
281
282
283
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 279

def metric_sessions_aggregated(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricSessionsAggregated", [props])
end

#metric_system_errors(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return a metric containing the number of system errors for this agent runtime.

Parameters:

Returns:



289
290
291
292
293
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 289

def metric_system_errors(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricSystemErrors", [props])
end

#metric_throttles(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return a metric containing the number of throttled requests for this agent runtime.

Parameters:

Returns:



299
300
301
302
303
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 299

def metric_throttles(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricThrottles", [props])
end

#metric_total_errors(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return a metric containing the total number of errors (system + user) for this agent runtime.

Parameters:

Returns:



309
310
311
312
313
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 309

def metric_total_errors(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricTotalErrors", [props])
end

#metric_user_errors(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return a metric containing the number of user errors for this agent runtime.

Parameters:

Returns:



319
320
321
322
323
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 319

def metric_user_errors(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricUserErrors", [props])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


14
15
16
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 14

def node()
  jsii_get_property("node")
end

#roleAWSCDK::IAM::IRole

The IAM role that provides permissions for the agent runtime.

Returns:



109
110
111
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 109

def role()
  jsii_get_property("role")
end

#runtime_refAWSCDK::Interfaces::AWSBedrockagentcore::RuntimeReference

A reference to a Runtime resource.



57
58
59
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 57

def runtime_ref()
  jsii_get_property("runtimeRef")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



36
37
38
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 36

def stack()
  jsii_get_property("stack")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



152
153
154
155
156
157
# File 'bedrock_agent_core/i_bedrock_agent_runtime.rb', line 152

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end