@aws-cdk/aws-bedrock-agentcore-alpha 2.250.0-alpha.0 → 2.252.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +11883 -7285
- package/.jsii.tabl.json.gz +0 -0
- package/.warnings.jsii.js +4 -0
- package/README.md +405 -0
- package/lib/gateway/gateway-base.js +1 -1
- package/lib/gateway/gateway.d.ts +58 -0
- package/lib/gateway/gateway.js +46 -3
- package/lib/gateway/inbound-auth/authorizer.d.ts +27 -1
- package/lib/gateway/inbound-auth/authorizer.js +37 -5
- package/lib/gateway/inbound-auth/custom-claim.js +1 -1
- package/lib/gateway/interceptor.js +1 -1
- package/lib/gateway/outbound-auth/api-key.js +1 -1
- package/lib/gateway/outbound-auth/credential-provider.js +1 -1
- package/lib/gateway/protocol.js +2 -2
- package/lib/gateway/targets/schema/api-schema.js +4 -4
- package/lib/gateway/targets/schema/tool-schema.js +4 -4
- package/lib/gateway/targets/target-base.js +1 -1
- package/lib/gateway/targets/target-configuration.js +6 -6
- package/lib/gateway/targets/target.js +1 -1
- package/lib/index.d.ts +8 -0
- package/lib/index.js +13 -1
- package/lib/memory/memory-strategy.js +1 -1
- package/lib/memory/memory.js +2 -2
- package/lib/memory/strategies/managed-strategy.js +1 -1
- package/lib/memory/strategies/self-managed-strategy.js +1 -1
- package/lib/network/network-configuration.js +4 -4
- package/lib/policy/perms.d.ts +50 -0
- package/lib/policy/perms.js +62 -0
- package/lib/policy/policy-base.d.ts +194 -0
- package/lib/policy/policy-base.js +120 -0
- package/lib/policy/policy-engine-base.d.ts +260 -0
- package/lib/policy/policy-engine-base.js +193 -0
- package/lib/policy/policy-engine.d.ts +150 -0
- package/lib/policy/policy-engine.js +290 -0
- package/lib/policy/policy-statement.d.ts +518 -0
- package/lib/policy/policy-statement.js +927 -0
- package/lib/policy/policy-types.d.ts +66 -0
- package/lib/policy/policy-types.js +30 -0
- package/lib/policy/policy.d.ts +127 -0
- package/lib/policy/policy.js +225 -0
- package/lib/policy/validation-helpers.d.ts +139 -0
- package/lib/policy/validation-helpers.js +276 -0
- package/lib/runtime/inbound-auth/custom-claim.js +1 -1
- package/lib/runtime/inbound-auth/runtime-authorizer-configuration.js +1 -1
- package/lib/runtime/observability.d.ts +105 -0
- package/lib/runtime/observability.js +317 -0
- package/lib/runtime/runtime-artifact.js +1 -1
- package/lib/runtime/runtime-base.js +1 -1
- package/lib/runtime/runtime-endpoint-base.js +1 -1
- package/lib/runtime/runtime-endpoint.js +1 -1
- package/lib/runtime/runtime.d.ts +17 -0
- package/lib/runtime/runtime.js +10 -2
- package/lib/tools/browser.js +2 -2
- package/lib/tools/code-interpreter.js +2 -2
- package/package.json +9 -9
- package/rosetta/default.ts-fixture +2 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
5
|
+
* with the License. A copy of the License is located at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
10
|
+
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
11
|
+
* and limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
import type { IResource, ResourceProps } from 'aws-cdk-lib';
|
|
14
|
+
import { Resource } from 'aws-cdk-lib';
|
|
15
|
+
import type { IPolicyRef, PolicyReference } from 'aws-cdk-lib/aws-bedrockagentcore';
|
|
16
|
+
import type { DimensionsMap, MetricOptions } from 'aws-cdk-lib/aws-cloudwatch';
|
|
17
|
+
import { Metric } from 'aws-cdk-lib/aws-cloudwatch';
|
|
18
|
+
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
19
|
+
import type { Construct } from 'constructs';
|
|
20
|
+
import type { IPolicyEngine } from './policy-engine-base';
|
|
21
|
+
import type { PolicyValidationMode } from './policy-types';
|
|
22
|
+
/******************************************************************************
|
|
23
|
+
* Interface
|
|
24
|
+
*****************************************************************************/
|
|
25
|
+
/**
|
|
26
|
+
* Minimal reference interface for Policy resources.
|
|
27
|
+
* Used for resource identification and ARN construction.
|
|
28
|
+
*/
|
|
29
|
+
export interface IPolicy extends IResource, IPolicyRef, iam.IGrantable {
|
|
30
|
+
/**
|
|
31
|
+
* The ARN of the policy resource
|
|
32
|
+
* @attribute
|
|
33
|
+
*/
|
|
34
|
+
readonly policyArn: string;
|
|
35
|
+
/**
|
|
36
|
+
* The ID of the policy
|
|
37
|
+
* @attribute
|
|
38
|
+
*/
|
|
39
|
+
readonly policyId: string;
|
|
40
|
+
/**
|
|
41
|
+
* The name of the policy
|
|
42
|
+
* @attribute
|
|
43
|
+
*/
|
|
44
|
+
readonly policyName: string;
|
|
45
|
+
/**
|
|
46
|
+
* The policy engine this policy belongs to
|
|
47
|
+
* @attribute
|
|
48
|
+
*/
|
|
49
|
+
readonly policyEngine: IPolicyEngine;
|
|
50
|
+
/**
|
|
51
|
+
* The description of the policy
|
|
52
|
+
*/
|
|
53
|
+
readonly description?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The validation mode for the policy
|
|
56
|
+
*/
|
|
57
|
+
readonly validationMode?: PolicyValidationMode;
|
|
58
|
+
/**
|
|
59
|
+
* Grants IAM actions to the IAM Principal
|
|
60
|
+
*
|
|
61
|
+
* @param grantee - The IAM principal to grant permissions to
|
|
62
|
+
* @param actions - The actions to grant
|
|
63
|
+
*/
|
|
64
|
+
grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
|
|
65
|
+
/**
|
|
66
|
+
* Grants read permissions on the Policy (data plane).
|
|
67
|
+
*
|
|
68
|
+
* This grants runtime read access to policy configuration. Use this for monitoring,
|
|
69
|
+
* audit, or read-only administrative roles that need to inspect policy definitions.
|
|
70
|
+
*
|
|
71
|
+
* @param grantee - The IAM principal to grant read permissions to
|
|
72
|
+
*/
|
|
73
|
+
grantRead(grantee: iam.IGrantable): iam.Grant;
|
|
74
|
+
/**
|
|
75
|
+
* Return the given named metric for this policy.
|
|
76
|
+
*
|
|
77
|
+
* @param metricName The name of the metric
|
|
78
|
+
* @param dimensions Additional dimensions for the metric
|
|
79
|
+
* @param props Optional metric configuration
|
|
80
|
+
*/
|
|
81
|
+
metric(metricName: string, dimensions: DimensionsMap, props?: MetricOptions): Metric;
|
|
82
|
+
/**
|
|
83
|
+
* Return a metric containing the total number of evaluations for this policy.
|
|
84
|
+
*
|
|
85
|
+
* This metric tracks how many times this policy has been evaluated.
|
|
86
|
+
*
|
|
87
|
+
* @param props Optional metric configuration
|
|
88
|
+
*/
|
|
89
|
+
metricEvaluations(props?: MetricOptions): Metric;
|
|
90
|
+
/**
|
|
91
|
+
* Return a metric measuring the evaluation latency for this policy.
|
|
92
|
+
*
|
|
93
|
+
* This metric represents the time taken to evaluate this specific policy.
|
|
94
|
+
*
|
|
95
|
+
* @param props Optional metric configuration
|
|
96
|
+
*/
|
|
97
|
+
metricEvaluationLatency(props?: MetricOptions): Metric;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Attributes for importing an existing Policy
|
|
101
|
+
*/
|
|
102
|
+
export interface PolicyAttributes {
|
|
103
|
+
/**
|
|
104
|
+
* The ARN of the policy
|
|
105
|
+
*/
|
|
106
|
+
readonly policyArn: string;
|
|
107
|
+
/**
|
|
108
|
+
* The policy engine this policy belongs to
|
|
109
|
+
* [disable-awslint:prefer-ref-interface]
|
|
110
|
+
*/
|
|
111
|
+
readonly policyEngine: IPolicyEngine;
|
|
112
|
+
}
|
|
113
|
+
/******************************************************************************
|
|
114
|
+
* ABSTRACT BASE CLASS
|
|
115
|
+
*****************************************************************************/
|
|
116
|
+
/**
|
|
117
|
+
* Abstract base class for a Policy.
|
|
118
|
+
* Contains methods and attributes valid for Policies either created with CDK or imported.
|
|
119
|
+
*/
|
|
120
|
+
export declare abstract class PolicyBase extends Resource implements IPolicy {
|
|
121
|
+
abstract readonly policyArn: string;
|
|
122
|
+
abstract readonly policyId: string;
|
|
123
|
+
abstract readonly policyName: string;
|
|
124
|
+
abstract readonly policyEngine: IPolicyEngine;
|
|
125
|
+
abstract readonly description?: string;
|
|
126
|
+
abstract readonly validationMode?: PolicyValidationMode;
|
|
127
|
+
/**
|
|
128
|
+
* The principal to grant permissions to
|
|
129
|
+
*/
|
|
130
|
+
abstract readonly grantPrincipal: iam.IPrincipal;
|
|
131
|
+
/**
|
|
132
|
+
* A reference to this Policy resource.
|
|
133
|
+
*/
|
|
134
|
+
get policyRef(): PolicyReference;
|
|
135
|
+
constructor(scope: Construct, id: string, props?: ResourceProps);
|
|
136
|
+
/**
|
|
137
|
+
* Grants IAM actions to the IAM Principal
|
|
138
|
+
*
|
|
139
|
+
* [disable-awslint:no-grants]
|
|
140
|
+
*
|
|
141
|
+
* @param grantee - The IAM principal to grant permissions to
|
|
142
|
+
* @param actions - The actions to grant
|
|
143
|
+
* @returns An IAM Grant object representing the granted permissions
|
|
144
|
+
*/
|
|
145
|
+
grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
|
|
146
|
+
/**
|
|
147
|
+
* Grants read permissions on the Policy (data plane).
|
|
148
|
+
*
|
|
149
|
+
* This grants runtime read access to policy configuration. Use this for monitoring,
|
|
150
|
+
* audit, or read-only administrative roles that need to inspect policy definitions
|
|
151
|
+
* and Cedar statements at runtime.
|
|
152
|
+
*
|
|
153
|
+
* IMPORTANT: This does NOT grant permissions to create/update/delete the Policy
|
|
154
|
+
* resource itself. Those are control plane operations performed by CloudFormation
|
|
155
|
+
* during `cdk deploy`, not by your application at runtime.
|
|
156
|
+
*
|
|
157
|
+
* [disable-awslint:no-grants]
|
|
158
|
+
*
|
|
159
|
+
* @param grantee - The IAM principal to grant read permissions to
|
|
160
|
+
* @returns An IAM Grant object representing the granted permissions
|
|
161
|
+
*/
|
|
162
|
+
grantRead(grantee: iam.IGrantable): iam.Grant;
|
|
163
|
+
/**
|
|
164
|
+
* Return the given named metric for this policy.
|
|
165
|
+
*
|
|
166
|
+
* By default, the metric will be calculated as a sum over a period of 5 minutes.
|
|
167
|
+
* You can customize this by using the `statistic` and `period` properties.
|
|
168
|
+
*
|
|
169
|
+
* @param metricName The name of the metric
|
|
170
|
+
* @param dimensions Additional dimensions for the metric
|
|
171
|
+
* @param props Optional metric configuration
|
|
172
|
+
*/
|
|
173
|
+
metric(metricName: string, dimensions: DimensionsMap, props?: MetricOptions): Metric;
|
|
174
|
+
/**
|
|
175
|
+
* Return a metric containing the total number of evaluations for this policy.
|
|
176
|
+
*
|
|
177
|
+
* This metric tracks how many times this policy has been evaluated.
|
|
178
|
+
*
|
|
179
|
+
* @param props Optional metric configuration
|
|
180
|
+
*/
|
|
181
|
+
metricEvaluations(props?: MetricOptions): Metric;
|
|
182
|
+
/**
|
|
183
|
+
* Return a metric measuring the evaluation latency for this policy.
|
|
184
|
+
*
|
|
185
|
+
* This metric represents the time taken to evaluate this specific policy.
|
|
186
|
+
*
|
|
187
|
+
* @param props Optional metric configuration
|
|
188
|
+
*/
|
|
189
|
+
metricEvaluationLatency(props?: MetricOptions): Metric;
|
|
190
|
+
/**
|
|
191
|
+
* Internal method to create a metric.
|
|
192
|
+
*/
|
|
193
|
+
private configureMetric;
|
|
194
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolicyBase = void 0;
|
|
4
|
+
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
5
|
+
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
6
|
+
const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch");
|
|
7
|
+
const iam = require("aws-cdk-lib/aws-iam");
|
|
8
|
+
// Internal imports
|
|
9
|
+
const perms_1 = require("./perms");
|
|
10
|
+
/******************************************************************************
|
|
11
|
+
* ABSTRACT BASE CLASS
|
|
12
|
+
*****************************************************************************/
|
|
13
|
+
/**
|
|
14
|
+
* Abstract base class for a Policy.
|
|
15
|
+
* Contains methods and attributes valid for Policies either created with CDK or imported.
|
|
16
|
+
*/
|
|
17
|
+
class PolicyBase extends aws_cdk_lib_1.Resource {
|
|
18
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/aws-bedrock-agentcore-alpha.PolicyBase", version: "2.252.0-alpha.0" };
|
|
19
|
+
/**
|
|
20
|
+
* A reference to this Policy resource.
|
|
21
|
+
*/
|
|
22
|
+
get policyRef() {
|
|
23
|
+
return {
|
|
24
|
+
policyArn: this.policyArn,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
constructor(scope, id, props = {}) {
|
|
28
|
+
super(scope, id, props);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Grants IAM actions to the IAM Principal
|
|
32
|
+
*
|
|
33
|
+
* [disable-awslint:no-grants]
|
|
34
|
+
*
|
|
35
|
+
* @param grantee - The IAM principal to grant permissions to
|
|
36
|
+
* @param actions - The actions to grant
|
|
37
|
+
* @returns An IAM Grant object representing the granted permissions
|
|
38
|
+
*/
|
|
39
|
+
grant(grantee, ...actions) {
|
|
40
|
+
return iam.Grant.addToPrincipal({
|
|
41
|
+
grantee,
|
|
42
|
+
actions,
|
|
43
|
+
resourceArns: [this.policyArn],
|
|
44
|
+
scope: this,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Grants read permissions on the Policy (data plane).
|
|
49
|
+
*
|
|
50
|
+
* This grants runtime read access to policy configuration. Use this for monitoring,
|
|
51
|
+
* audit, or read-only administrative roles that need to inspect policy definitions
|
|
52
|
+
* and Cedar statements at runtime.
|
|
53
|
+
*
|
|
54
|
+
* IMPORTANT: This does NOT grant permissions to create/update/delete the Policy
|
|
55
|
+
* resource itself. Those are control plane operations performed by CloudFormation
|
|
56
|
+
* during `cdk deploy`, not by your application at runtime.
|
|
57
|
+
*
|
|
58
|
+
* [disable-awslint:no-grants]
|
|
59
|
+
*
|
|
60
|
+
* @param grantee - The IAM principal to grant read permissions to
|
|
61
|
+
* @returns An IAM Grant object representing the granted permissions
|
|
62
|
+
*/
|
|
63
|
+
grantRead(grantee) {
|
|
64
|
+
return this.grant(grantee, ...perms_1.POLICY_READ_PERMS);
|
|
65
|
+
}
|
|
66
|
+
// ------------------------------------------------------
|
|
67
|
+
// Metrics
|
|
68
|
+
// ------------------------------------------------------
|
|
69
|
+
/**
|
|
70
|
+
* Return the given named metric for this policy.
|
|
71
|
+
*
|
|
72
|
+
* By default, the metric will be calculated as a sum over a period of 5 minutes.
|
|
73
|
+
* You can customize this by using the `statistic` and `period` properties.
|
|
74
|
+
*
|
|
75
|
+
* @param metricName The name of the metric
|
|
76
|
+
* @param dimensions Additional dimensions for the metric
|
|
77
|
+
* @param props Optional metric configuration
|
|
78
|
+
*/
|
|
79
|
+
metric(metricName, dimensions, props) {
|
|
80
|
+
const metricProps = {
|
|
81
|
+
namespace: 'AWS/Bedrock-AgentCore',
|
|
82
|
+
metricName,
|
|
83
|
+
dimensionsMap: { ...dimensions, Resource: this.policyArn },
|
|
84
|
+
...props,
|
|
85
|
+
};
|
|
86
|
+
return this.configureMetric(metricProps);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Return a metric containing the total number of evaluations for this policy.
|
|
90
|
+
*
|
|
91
|
+
* This metric tracks how many times this policy has been evaluated.
|
|
92
|
+
*
|
|
93
|
+
* @param props Optional metric configuration
|
|
94
|
+
*/
|
|
95
|
+
metricEvaluations(props) {
|
|
96
|
+
return this.metric('PolicyEvaluations', {}, { statistic: aws_cloudwatch_1.Stats.SUM, ...props });
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Return a metric measuring the evaluation latency for this policy.
|
|
100
|
+
*
|
|
101
|
+
* This metric represents the time taken to evaluate this specific policy.
|
|
102
|
+
*
|
|
103
|
+
* @param props Optional metric configuration
|
|
104
|
+
*/
|
|
105
|
+
metricEvaluationLatency(props) {
|
|
106
|
+
return this.metric('PolicyEvaluationLatency', {}, { statistic: aws_cloudwatch_1.Stats.AVERAGE, ...props });
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Internal method to create a metric.
|
|
110
|
+
*/
|
|
111
|
+
configureMetric(props) {
|
|
112
|
+
return new aws_cloudwatch_1.Metric({
|
|
113
|
+
...props,
|
|
114
|
+
region: props?.region ?? this.stack.region,
|
|
115
|
+
account: props?.account ?? this.stack.account,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.PolicyBase = PolicyBase;
|
|
120
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9saWN5LWJhc2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJwb2xpY3ktYmFzZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBY0EsNkNBQXVDO0FBR3ZDLCtEQUEyRDtBQUMzRCwyQ0FBMkM7QUFFM0MsbUJBQW1CO0FBQ25CLG1DQUE0QztBQWlINUM7OytFQUUrRTtBQUUvRTs7O0dBR0c7QUFDSCxNQUFzQixVQUFXLFNBQVEsc0JBQVE7O0lBYS9DOztPQUVHO0lBQ0gsSUFBVyxTQUFTO1FBQ2xCLE9BQU87WUFDTCxTQUFTLEVBQUUsSUFBSSxDQUFDLFNBQVM7U0FDMUIsQ0FBQztLQUNIO0lBRUQsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxRQUF1QixFQUFFO1FBQ2pFLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO0tBQ3pCO0lBRUQ7Ozs7Ozs7O09BUUc7SUFDSSxLQUFLLENBQUMsT0FBdUIsRUFBRSxHQUFHLE9BQWlCO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qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSW50ZXJmYWNlXG4gKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovXG5cbi8qKlxuICogTWluaW1hbCByZWZlcmVuY2UgaW50ZXJmYWNlIGZvciBQb2xpY3kgcmVzb3VyY2VzLlxuICogVXNlZCBmb3IgcmVzb3VyY2UgaWRlbnRpZmljYXRpb24gYW5kIEFSTiBjb25zdHJ1Y3Rpb24uXG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgSVBvbGljeSBleHRlbmRzIElSZXNvdXJjZSwgSVBvbGljeVJlZiwgaWFtLklHcmFudGFibGUge1xuICAvKipcbiAgICogVGhlIEFSTiBvZiB0aGUgcG9saWN5IHJlc291cmNlXG4gICAqIEBhdHRyaWJ1dGVcbiAgICovXG4gIHJlYWRvbmx5IHBvbGljeUFybjogc3RyaW5nO1xuXG4gIC8qKlxuICAgKiBUaGUgSUQgb2YgdGhlIHBvbGljeVxuICAgKiBAYXR0cmlidXRlXG4gICAqL1xuICByZWFkb25seSBwb2xpY3lJZDogc3RyaW5nO1xuXG4gIC8qKlxuICAgKiBUaGUgbmFtZSBvZiB0aGUgcG9saWN5XG4gICAqIEBhdHRyaWJ1dGVcbiAgICovXG4gIHJlYWRvbmx5IHBvbGljeU5hbWU6IHN0cmluZztcblxuICAvKipcbiAgICogVGhlIHBvbGljeSBlbmdpbmUgdGhpcyBwb2xpY3kgYmVsb25ncyB0b1xuICAgKiBAYXR0cmlidXRlXG4gICAqL1xuICByZWFkb25seSBwb2xpY3lFbmdpbmU6IElQb2xpY3lFbmdpbmU7XG5cbiAgLyoqXG4gICAqIFRoZSBkZXNjcmlwdGlvbiBvZiB0aGUgcG9saWN5XG4gICAqL1xuICByZWFkb25seSBkZXNjcmlwd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
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
|
|
5
|
+
* with the License. A copy of the License is located at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES
|
|
10
|
+
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
|
|
11
|
+
* and limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
import type { IResource, ResourceProps } from 'aws-cdk-lib';
|
|
14
|
+
import { Resource } from 'aws-cdk-lib';
|
|
15
|
+
import type { IPolicyEngineRef, PolicyEngineReference } from 'aws-cdk-lib/aws-bedrockagentcore';
|
|
16
|
+
import type { DimensionsMap, MetricOptions } from 'aws-cdk-lib/aws-cloudwatch';
|
|
17
|
+
import { Metric } from 'aws-cdk-lib/aws-cloudwatch';
|
|
18
|
+
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
19
|
+
import type * as kms from 'aws-cdk-lib/aws-kms';
|
|
20
|
+
import type { Construct } from 'constructs';
|
|
21
|
+
import type { IGateway } from '../gateway/gateway-base';
|
|
22
|
+
/******************************************************************************
|
|
23
|
+
* Interface
|
|
24
|
+
*****************************************************************************/
|
|
25
|
+
/**
|
|
26
|
+
* Contains all properties and methods for both created and imported policy engines.
|
|
27
|
+
*/
|
|
28
|
+
export interface IPolicyEngine extends IResource, IPolicyEngineRef, iam.IGrantable {
|
|
29
|
+
/**
|
|
30
|
+
* The ARN of the policy engine resource
|
|
31
|
+
* @attribute
|
|
32
|
+
*/
|
|
33
|
+
readonly policyEngineArn: string;
|
|
34
|
+
/**
|
|
35
|
+
* The ID of the policy engine
|
|
36
|
+
* @attribute
|
|
37
|
+
*/
|
|
38
|
+
readonly policyEngineId: string;
|
|
39
|
+
/**
|
|
40
|
+
* The name of the policy engine
|
|
41
|
+
* @attribute
|
|
42
|
+
*/
|
|
43
|
+
readonly policyEngineName: string;
|
|
44
|
+
/**
|
|
45
|
+
* The description of the policy engine
|
|
46
|
+
*/
|
|
47
|
+
readonly description?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The KMS key used for encryption
|
|
50
|
+
*/
|
|
51
|
+
readonly kmsKey?: kms.IKey;
|
|
52
|
+
/**
|
|
53
|
+
* Grants IAM actions to the IAM Principal
|
|
54
|
+
*
|
|
55
|
+
* @param grantee - The IAM principal to grant permissions to
|
|
56
|
+
* @param actions - The actions to grant
|
|
57
|
+
*/
|
|
58
|
+
grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
|
|
59
|
+
/**
|
|
60
|
+
* Grants read permissions on the PolicyEngine.
|
|
61
|
+
*
|
|
62
|
+
* This grants runtime read access to policy engine configuration. Use this for
|
|
63
|
+
* monitoring, observability, or read-only administrative roles.
|
|
64
|
+
*
|
|
65
|
+
* @param grantee - The IAM principal to grant read permissions to
|
|
66
|
+
*/
|
|
67
|
+
grantRead(grantee: iam.IGrantable): iam.Grant;
|
|
68
|
+
/**
|
|
69
|
+
* Grants permissions to evaluate policies at runtime .
|
|
70
|
+
*
|
|
71
|
+
* This is the primary permission needed by Gateway execution roles to evaluate
|
|
72
|
+
* authorization decisions during agent requests. Grant this to roles that need
|
|
73
|
+
* to call AuthorizeAction or PartiallyAuthorizeActions.
|
|
74
|
+
*
|
|
75
|
+
* @param grantee - The IAM principal to grant evaluation permissions to
|
|
76
|
+
*/
|
|
77
|
+
grantEvaluate(grantee: iam.IGrantable): iam.Grant;
|
|
78
|
+
/**
|
|
79
|
+
* Grants the full set of permissions required for a gateway execution role to use
|
|
80
|
+
* this policy engine, correctly scoped to both the policy engine and gateway ARNs.
|
|
81
|
+
*
|
|
82
|
+
* Per the AWS docs, `AuthorizeAction` and `PartiallyAuthorizeActions` require
|
|
83
|
+
* both the policy engine ARN and the gateway ARN as resources, while
|
|
84
|
+
* `GetPolicyEngine` only needs the policy engine ARN.
|
|
85
|
+
*
|
|
86
|
+
* This follows the same pattern as Lambda's `grantInvokeVersion(grantee, version)`.
|
|
87
|
+
*
|
|
88
|
+
* @param grantee - The IAM principal (gateway execution role) to grant permissions to
|
|
89
|
+
* @param gateway - The gateway that will use this policy engine [disable-awslint:prefer-ref-interface]
|
|
90
|
+
*/
|
|
91
|
+
grantEvaluateForGateway(grantee: iam.IGrantable, gateway: IGateway): iam.Grant;
|
|
92
|
+
/**
|
|
93
|
+
* Return the given named metric for this policy engine.
|
|
94
|
+
*
|
|
95
|
+
* @param metricName The name of the metric
|
|
96
|
+
* @param dimensions Additional dimensions for the metric
|
|
97
|
+
* @param props Optional metric configuration
|
|
98
|
+
*/
|
|
99
|
+
metric(metricName: string, dimensions: DimensionsMap, props?: MetricOptions): Metric;
|
|
100
|
+
/**
|
|
101
|
+
* Return a metric measuring the authorization latency for this policy engine.
|
|
102
|
+
*
|
|
103
|
+
* This metric represents the time taken to evaluate authorization policies.
|
|
104
|
+
*
|
|
105
|
+
* @param props Optional metric configuration
|
|
106
|
+
*/
|
|
107
|
+
metricAuthorizationLatency(props?: MetricOptions): Metric;
|
|
108
|
+
/**
|
|
109
|
+
* Return a metric containing the number of denied authorization requests for this policy engine.
|
|
110
|
+
*
|
|
111
|
+
* This metric tracks authorization requests that were explicitly denied by policies.
|
|
112
|
+
*
|
|
113
|
+
* @param props Optional metric configuration
|
|
114
|
+
*/
|
|
115
|
+
metricDeniedRequests(props?: MetricOptions): Metric;
|
|
116
|
+
/**
|
|
117
|
+
* Return a metric containing the number of errors during authorization for this policy engine.
|
|
118
|
+
*
|
|
119
|
+
* This metric tracks errors encountered during policy evaluation.
|
|
120
|
+
*
|
|
121
|
+
* @param props Optional metric configuration
|
|
122
|
+
*/
|
|
123
|
+
metricErrors(props?: MetricOptions): Metric;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Attributes for importing an existing PolicyEngine
|
|
127
|
+
*/
|
|
128
|
+
export interface PolicyEngineAttributes {
|
|
129
|
+
/**
|
|
130
|
+
* The ARN of the policy engine
|
|
131
|
+
*/
|
|
132
|
+
readonly policyEngineArn: string;
|
|
133
|
+
/**
|
|
134
|
+
* The KMS key ARN used for encryption (optional)
|
|
135
|
+
*
|
|
136
|
+
* @default - No KMS key
|
|
137
|
+
*/
|
|
138
|
+
readonly kmsKeyArn?: string;
|
|
139
|
+
}
|
|
140
|
+
/******************************************************************************
|
|
141
|
+
* ABSTRACT BASE CLASS
|
|
142
|
+
*****************************************************************************/
|
|
143
|
+
/**
|
|
144
|
+
* Abstract base class for a PolicyEngine.
|
|
145
|
+
* Contains methods and attributes valid for PolicyEngines either created with CDK or imported.
|
|
146
|
+
*/
|
|
147
|
+
export declare abstract class PolicyEngineBase extends Resource implements IPolicyEngine {
|
|
148
|
+
abstract readonly policyEngineArn: string;
|
|
149
|
+
abstract readonly policyEngineId: string;
|
|
150
|
+
abstract readonly policyEngineName: string;
|
|
151
|
+
abstract readonly description?: string;
|
|
152
|
+
abstract readonly kmsKey?: kms.IKey;
|
|
153
|
+
/**
|
|
154
|
+
* The principal to grant permissions to
|
|
155
|
+
*/
|
|
156
|
+
abstract readonly grantPrincipal: iam.IPrincipal;
|
|
157
|
+
/**
|
|
158
|
+
* A reference to this PolicyEngine resource.
|
|
159
|
+
*/
|
|
160
|
+
get policyEngineRef(): PolicyEngineReference;
|
|
161
|
+
constructor(scope: Construct, id: string, props?: ResourceProps);
|
|
162
|
+
/**
|
|
163
|
+
* Grants IAM actions to the IAM Principal
|
|
164
|
+
*
|
|
165
|
+
* [disable-awslint:no-grants]
|
|
166
|
+
*
|
|
167
|
+
* @param grantee - The IAM principal to grant permissions to
|
|
168
|
+
* @param actions - The actions to grant
|
|
169
|
+
* @returns An IAM Grant object representing the granted permissions
|
|
170
|
+
*/
|
|
171
|
+
grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
|
|
172
|
+
/**
|
|
173
|
+
* Grants read permissions on the PolicyEngine (data plane).
|
|
174
|
+
*
|
|
175
|
+
* This grants runtime read access to policy engine configuration. Use this for
|
|
176
|
+
* monitoring, observability, or read-only administrative roles that need to inspect
|
|
177
|
+
* policy engine settings at runtime.
|
|
178
|
+
*
|
|
179
|
+
* [disable-awslint:no-grants]
|
|
180
|
+
*
|
|
181
|
+
* @param grantee - The IAM principal to grant read permissions to
|
|
182
|
+
* @returns An IAM Grant object representing the granted permissions
|
|
183
|
+
*/
|
|
184
|
+
grantRead(grantee: iam.IGrantable): iam.Grant;
|
|
185
|
+
/**
|
|
186
|
+
* Grants permissions to evaluate policies at runtime (data plane operations).
|
|
187
|
+
*
|
|
188
|
+
* This is the primary permission needed by Gateway execution roles to evaluate
|
|
189
|
+
* authorization decisions during agent requests. Grant this to roles that need
|
|
190
|
+
* to call AuthorizeAction or PartiallyAuthorizeActions at runtime.
|
|
191
|
+
*
|
|
192
|
+
* [disable-awslint:no-grants]
|
|
193
|
+
*
|
|
194
|
+
* @param grantee - The IAM principal to grant evaluation permissions to
|
|
195
|
+
* @returns An IAM Grant object representing the granted permissions
|
|
196
|
+
*/
|
|
197
|
+
grantEvaluate(grantee: iam.IGrantable): iam.Grant;
|
|
198
|
+
/**
|
|
199
|
+
* Grants the full set of permissions required for a gateway execution role to use
|
|
200
|
+
* this policy engine, correctly scoped to both the policy engine and gateway ARNs.
|
|
201
|
+
*
|
|
202
|
+
* Per the AWS docs:
|
|
203
|
+
* - `GetPolicyEngine` → policy engine ARN only
|
|
204
|
+
* - `AuthorizeAction` + `PartiallyAuthorizeActions` → policy engine ARN **and** gateway ARN
|
|
205
|
+
*
|
|
206
|
+
* [disable-awslint:no-grants]
|
|
207
|
+
*
|
|
208
|
+
* @param grantee - The IAM principal (gateway execution role) to grant permissions to
|
|
209
|
+
* @param gateway - The gateway that will use this policy engine [disable-awslint:prefer-ref-interface]
|
|
210
|
+
* @returns A combined IAM Grant representing all granted permissions
|
|
211
|
+
*/
|
|
212
|
+
grantEvaluateForGateway(grantee: iam.IGrantable, gateway: IGateway): iam.Grant;
|
|
213
|
+
/**
|
|
214
|
+
* Return the given named metric for this policy engine.
|
|
215
|
+
*
|
|
216
|
+
* By default, the metric will be calculated as a sum over a period of 5 minutes.
|
|
217
|
+
* You can customize this by using the `statistic` and `period` properties.
|
|
218
|
+
*
|
|
219
|
+
* @param metricName The name of the metric
|
|
220
|
+
* @param dimensions Additional dimensions for the metric
|
|
221
|
+
* @param props Optional metric configuration
|
|
222
|
+
*/
|
|
223
|
+
metric(metricName: string, dimensions: DimensionsMap, props?: MetricOptions): Metric;
|
|
224
|
+
/**
|
|
225
|
+
* Return a metric containing the total number of authorizations for this policy engine.
|
|
226
|
+
*
|
|
227
|
+
* This metric tracks all authorization requests processed by the policy engine.
|
|
228
|
+
*
|
|
229
|
+
* @param props Optional metric configuration
|
|
230
|
+
*/
|
|
231
|
+
metricAuthorizations(props?: MetricOptions): Metric;
|
|
232
|
+
/**
|
|
233
|
+
* Return a metric measuring the authorization latency for this policy engine.
|
|
234
|
+
*
|
|
235
|
+
* This metric represents the time taken to evaluate authorization policies.
|
|
236
|
+
*
|
|
237
|
+
* @param props Optional metric configuration
|
|
238
|
+
*/
|
|
239
|
+
metricAuthorizationLatency(props?: MetricOptions): Metric;
|
|
240
|
+
/**
|
|
241
|
+
* Return a metric containing the number of denied authorization requests for this policy engine.
|
|
242
|
+
*
|
|
243
|
+
* This metric tracks authorization requests that were explicitly denied by policies.
|
|
244
|
+
*
|
|
245
|
+
* @param props Optional metric configuration
|
|
246
|
+
*/
|
|
247
|
+
metricDeniedRequests(props?: MetricOptions): Metric;
|
|
248
|
+
/**
|
|
249
|
+
* Return a metric containing the number of errors during authorization for this policy engine.
|
|
250
|
+
*
|
|
251
|
+
* This metric tracks errors encountered during policy evaluation.
|
|
252
|
+
*
|
|
253
|
+
* @param props Optional metric configuration
|
|
254
|
+
*/
|
|
255
|
+
metricErrors(props?: MetricOptions): Metric;
|
|
256
|
+
/**
|
|
257
|
+
* Internal method to create a metric.
|
|
258
|
+
*/
|
|
259
|
+
private configureMetric;
|
|
260
|
+
}
|