Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4b0942d
Supporting ExistingCognitoUserPoolId
majdarbash Aug 9, 2024
10837e5
fix
majdarbash Aug 9, 2024
255b9d1
Merge branch 'aws-solutions:main' into main
majdarbash Aug 26, 2024
5384f3b
Merge branch 'aws-solutions:main' into main
majdarbash Sep 23, 2024
0ce3b04
ui-deployment: api related changes
maarbash-aws Sep 23, 2024
080b52d
more updates
maarbash-aws Sep 23, 2024
e89ff08
ui-deployment: reorganized files and added user pool client
maarbash-aws Sep 23, 2024
9222393
ui-deplyoment: disable AuthenticationParams on edit
maarbash-aws Sep 24, 2024
b903afb
lambda: api changes to support the AuthenticationParams
maarbash-aws Sep 24, 2024
c2ebd8c
lambda: api changes to support the AuthenticationParams
maarbash-aws Sep 24, 2024
82bea47
resolving the cognito domain prefix dynamically
maarbash-aws Sep 24, 2024
deffaaf
fixes
maarbash-aws Sep 24, 2024
b19eb6b
reset layer packages
maarbash-aws Sep 24, 2024
cfb22e9
deps fixes
maarbash-aws Sep 24, 2024
8fc4cdc
fix
maarbash-aws Sep 24, 2024
810f54f
ui-deployment: fix
maarbash-aws Sep 26, 2024
9a03945
lambda: fix
maarbash-aws Sep 26, 2024
f3351c1
lambda: allow to describe user pools
maarbash-aws Sep 26, 2024
5185286
lambda: fix
maarbash-aws Sep 26, 2024
b2baef6
lambda: retain authentication parameters on update
maarbash-aws Sep 27, 2024
f7408b9
ui-deployment: fix
maarbash-aws Sep 27, 2024
ff359e7
lambda: pr fixes
maarbash-aws Sep 30, 2024
04a3b78
lambda: pr fixes
maarbash-aws Sep 30, 2024
e2efdba
ui-deployment: warning for locked user pool settings
maarbash-aws Sep 30, 2024
a106314
api: schema update
maarbash-aws Sep 30, 2024
9d569a2
api: schema tests
maarbash-aws Oct 1, 2024
2dc12dc
api: schema tests
maarbash-aws Oct 2, 2024
53bf9fc
lambda: add tests for AuthenticationParams
maarbash-aws Oct 3, 2024
1399718
ui-deployment: updated test
maarbash-aws Oct 3, 2024
15fd462
Merge branch 'aws-solutions:main' into main
majdarbash Oct 3, 2024
72f2489
ui-deployment: fix
maarbash-aws Oct 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This software includes third party software subject to the following copyrights:
@aws-lambda-powertools/logger MIT
@aws-lambda-powertools/metrics MIT
@aws-lambda-powertools/tracer MIT
@aws-sdk/client-cognito-identity-provider Apache-2.0
@aws-sdk/client-cloudformation Apache-2.0
@aws-sdk/client-dynamodb Apache-2.0
@aws-sdk/client-kendra Apache-2.0
Expand Down
85 changes: 67 additions & 18 deletions source/infrastructure/lib/api/model-schema/deploy-usecase-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import { JsonSchema, JsonSchemaType, JsonSchemaVersion } from 'aws-cdk-lib/aws-apigateway';
import {
AUTHENTICATION_PROVIDERS,
CHAT_PROVIDERS,
DEFAULT_CONVERSATION_MEMORY_TYPE,
DEFAULT_ENABLE_RBAC,
Expand All @@ -31,6 +32,7 @@ import {
MIN_KENDRA_NUMBER_OF_DOCS,
MIN_SCORE_THRESHOLD,
MODEL_PARAM_TYPES,
SUPPORTED_AUTHENTICATION_PROVIDERS,
SUPPORTED_CHAT_PROVIDERS,
SUPPORTED_CONVERSATION_MEMORY_TYPES,
SUPPORTED_KNOWLEDGE_BASE_TYPES
Expand Down Expand Up @@ -358,6 +360,39 @@ export const deployUseCaseBodySchema: JsonSchema = {
required: ['KnowledgeBaseType'],
additionalProperties: false
},

AuthenticationParams: {
type: JsonSchemaType.OBJECT,
description: 'Parameters related to the Authentication.',
properties: {
AuthenticationProvider: {
type: JsonSchemaType.STRING,
description: 'Supported authentication provider.',
enum: SUPPORTED_AUTHENTICATION_PROVIDERS
},
CognitoParams: {
type: JsonSchemaType.OBJECT,
description: 'Cognito user pool related parameters.',
properties: {
ExistingUserPoolId: {
type: JsonSchemaType.STRING,
description: 'Existing Cognito User Pool Id.',
pattern: '^[\\w-]+_[0-9a-zA-Z]+$',
minLength: 1,
maxLength: 55
},
ExistingUserPoolClientId: {
type: JsonSchemaType.STRING,
description: 'Existing Cognito User Pool Client Id.',
pattern: '^[\\w+]+$',
minLength: 1,
maxLength: 128
}
},
required: ['ExistingUserPoolId']
},
},
},
LlmParams: {
type: JsonSchemaType.OBJECT,
description: 'Parameters related to the LLM performing inferences.',
Expand Down Expand Up @@ -552,35 +587,49 @@ export const deployUseCaseBodySchema: JsonSchema = {
}
},
// If RAG is enabled, ensure we provide the KnowledgeBaseParams
oneOf: [
allOf: [
{
properties: {
LlmParams: {
oneOf: [
{
properties: {
RAGEnabled: {
type: JsonSchemaType.BOOLEAN,
enum: [false]
LlmParams: {
properties: {
RAGEnabled: {
type: JsonSchemaType.BOOLEAN,
enum: [false]
}
}
},
KnowledgeBaseParams: {
'not': {}
}
}
},
KnowledgeBaseParams: {
'not': {}
}
}
{
properties: {
LlmParams: {
properties: {
RAGEnabled: {
type: JsonSchemaType.BOOLEAN,
enum: [true]
}
}
}
},
required: ['KnowledgeBaseParams']
},
],
},
{
properties: {
LlmParams: {
AuthenticationParams: {
properties: {
RAGEnabled: {
type: JsonSchemaType.BOOLEAN,
enum: [true]
}
}
AuthenticationProvider: { enum: [AUTHENTICATION_PROVIDERS.COGNITO] }
},
required: ['CognitoParams']
}
},
required: ['KnowledgeBaseParams']
}
},
],
required: ['UseCaseName', 'LlmParams'],
additionalProperties: false
Expand Down
46 changes: 46 additions & 0 deletions source/infrastructure/lib/api/model-schema/update-usecase-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import { JsonSchema, JsonSchemaType, JsonSchemaVersion } from 'aws-cdk-lib/aws-apigateway';
import {
AUTHENTICATION_PROVIDERS,
CHAT_PROVIDERS,
DEFAULT_CONVERSATION_MEMORY_TYPE,
DEFAULT_ENABLE_RBAC,
Expand All @@ -25,6 +26,7 @@ import {
MIN_KENDRA_NUMBER_OF_DOCS,
MIN_SCORE_THRESHOLD,
MODEL_PARAM_TYPES,
SUPPORTED_AUTHENTICATION_PROVIDERS,
SUPPORTED_CHAT_PROVIDERS,
SUPPORTED_CONVERSATION_MEMORY_TYPES,
SUPPORTED_KNOWLEDGE_BASE_TYPES
Expand Down Expand Up @@ -225,6 +227,47 @@ export const updateUseCaseBodySchema: JsonSchema = {
],
additionalProperties: false
},
AuthenticationParams: {
type: JsonSchemaType.OBJECT,
description: 'Parameters related to the Authentication.',
properties: {
AuthenticationProvider: {
type: JsonSchemaType.STRING,
description: 'Supported authentication provider.',
enum: SUPPORTED_AUTHENTICATION_PROVIDERS
},
CognitoParams: {
type: JsonSchemaType.OBJECT,
description: 'Cognito user pool related parameters.',
properties: {
ExistingUserPoolId: {
type: JsonSchemaType.STRING,
description: 'Existing Cognito User Pool Id.',
pattern: '^[\\w-]+_[0-9a-zA-Z]+$',
minLength: 1,
maxLength: 55
},
ExistingUserPoolClientId: {
type: JsonSchemaType.STRING,
description: 'Existing Cognito User Pool Client Id.',
pattern: '^[\\w+]+$',
minLength: 1,
maxLength: 128
}
},
required: ['ExistingUserPoolId']
},
},
anyOf: [
{
properties: {
AuthenticationProvider: { enum: [AUTHENTICATION_PROVIDERS.COGNITO] }
},
required: ['CognitoParams']
},
],
required: ['AuthenticationProvider']
},
LlmParams: {
type: JsonSchemaType.OBJECT,
properties: {
Expand Down Expand Up @@ -434,6 +477,9 @@ export const updateUseCaseBodySchema: JsonSchema = {
},
{
required: ['LlmParams']
},
{
required: ['AuthenticationParams']
}
],
additionalProperties: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,13 @@ const buildCfnDeployRole = (scope: Construct, lambdaRole: iam.Role): iam.Role =>
...awsCalledViaCondition
}
}),
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: [
'cognito-idp:DescribeUserPool'
],
resources: [`arn:${cdk.Aws.PARTITION}:cognito-idp:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:userpool/*`],
}),
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: [
Expand Down
6 changes: 6 additions & 0 deletions source/infrastructure/lib/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@ export const enum CHAT_PROVIDERS {
BEDROCK = 'Bedrock',
SAGEMAKER = 'SageMaker'
}

export const enum AUTHENTICATION_PROVIDERS {
COGNITO = 'Cognito'
}

export const SUPPORTED_CHAT_PROVIDERS = [CHAT_PROVIDERS.BEDROCK, CHAT_PROVIDERS.SAGEMAKER];
export const SUPPORTED_AUTHENTICATION_PROVIDERS = [AUTHENTICATION_PROVIDERS.COGNITO];

export const KENDRA_EDITIONS = ['DEVELOPER_EDITION', 'ENTERPRISE_EDITION'];
export const DEFAULT_KENDRA_EDITION = 'DEVELOPER_EDITION';
Expand Down
Loading