Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mfriesen committed May 20, 2023
1 parent 47a5585 commit 5e0ee25
Show file tree
Hide file tree
Showing 4 changed files with 203 additions and 9 deletions.
96 changes: 94 additions & 2 deletions docs/openapi/openapi-iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
operationId: GetVersion
description: Return the version of FormKiQ
tags:
- Miscellaneous
- System Management
responses:
"200":
description: 200 OK
Expand All @@ -47,7 +47,7 @@
operationId: GetSites
description: Returns the list of sites that the user has access to
tags:
- Miscellaneous
- System Management
responses:
"200":
description: 200 OK
Expand All @@ -69,6 +69,70 @@
- sigv4: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
/configs:
get:
operationId: GetConfigs
description: Returns the list of sites that the user has access to
tags:
- System Management
parameters:
- $ref: '#/components/parameters/siteIdParam'
responses:
"200":
description: 200 OK
headers:
Access-Control-Allow-Origin:
schema:
type: string
Access-Control-Allow-Methods:
schema:
type: string
Access-Control-Allow-Headers:
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/GetConfigsRequest'
security:
- sigv4: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
patch:
operationId: UpdateConfig
description: Update the System Management configuration
tags:
- System Management
parameters:
- $ref: '#/components/parameters/siteIdParam'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SetConfigRequest'
examples:
Config:
value:
chatGptApiKey: ABC
responses:
"200":
description: 200 OK
headers:
Access-Control-Allow-Origin:
$ref: '#/components/headers/AccessControlAllowOrigin'
Access-Control-Allow-Methods:
$ref: '#/components/headers/AccessControlAllowMethods'
Access-Control-Allow-Headers:
$ref: '#/components/headers/AccessControlAllowHeaders'
content:
application/json:
schema:
$ref: '#/components/schemas/SetConfigResponse'
security:
- sigv4: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
/tagSchemas:
get:
operationId: GetTagSchemas
Expand Down Expand Up @@ -3215,6 +3279,34 @@
description: List of installed modules
items:
type: string
SetConfigRequest:
type: object
properties:
chatGptApiKey:
type: string
description: ChatGPT Api Key
SetConfigResponse:
type: object
properties:
message:
type: string
description: Result message
GetConfigsRequest:
type: object
properties:
sites:
$ref: '#/components/schemas/Configs'
Configs:
type: array
description: List of configs
items:
$ref: '#/components/schemas/Config'
Config:
type: object
properties:
chatGptApiKey:
type: string
description: ChatGPT API Key
GetSitesRequest:
type: object
properties:
Expand Down
96 changes: 94 additions & 2 deletions docs/openapi/openapi-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
operationId: GetVersion
description: Return the version of FormKiQ
tags:
- Miscellaneous
- System Management
responses:
"200":
description: 200 OK
Expand All @@ -47,7 +47,7 @@
operationId: GetSites
description: Returns the list of sites that the user has access to
tags:
- Miscellaneous
- System Management
responses:
"200":
description: 200 OK
Expand All @@ -69,6 +69,70 @@
- AuthorizationCognito: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
/configs:
get:
operationId: GetConfigs
description: Returns the list of sites that the user has access to
tags:
- System Management
parameters:
- $ref: '#/components/parameters/siteIdParam'
responses:
"200":
description: 200 OK
headers:
Access-Control-Allow-Origin:
schema:
type: string
Access-Control-Allow-Methods:
schema:
type: string
Access-Control-Allow-Headers:
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/GetConfigsRequest'
security:
- AuthorizationCognito: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
patch:
operationId: UpdateConfig
description: Update the System Management configuration
tags:
- System Management
parameters:
- $ref: '#/components/parameters/siteIdParam'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SetConfigRequest'
examples:
Config:
value:
chatGptApiKey: ABC
responses:
"200":
description: 200 OK
headers:
Access-Control-Allow-Origin:
$ref: '#/components/headers/AccessControlAllowOrigin'
Access-Control-Allow-Methods:
$ref: '#/components/headers/AccessControlAllowMethods'
Access-Control-Allow-Headers:
$ref: '#/components/headers/AccessControlAllowHeaders'
content:
application/json:
schema:
$ref: '#/components/schemas/SetConfigResponse'
security:
- AuthorizationCognito: []
x-amazon-apigateway-integration:
$ref: '#/components/x-amazon-apigateway-integrations/lambdaApi200'
/tagSchemas:
get:
operationId: GetTagSchemas
Expand Down Expand Up @@ -3215,6 +3279,34 @@
description: List of installed modules
items:
type: string
SetConfigRequest:
type: object
properties:
chatGptApiKey:
type: string
description: ChatGPT Api Key
SetConfigResponse:
type: object
properties:
message:
type: string
description: Result message
GetConfigsRequest:
type: object
properties:
sites:
$ref: '#/components/schemas/Configs'
Configs:
type: array
description: List of configs
items:
$ref: '#/components/schemas/Config'
Config:
type: object
properties:
chatGptApiKey:
type: string
description: ChatGPT API Key
GetSitesRequest:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.List;
import org.junit.Test;
import com.formkiq.stacks.client.FormKiqClientV1;
import com.formkiq.stacks.client.models.Configs;
import com.formkiq.stacks.client.models.Config;
import software.amazon.awssdk.services.cognitoidentityprovider.model.AuthenticationResultType;

/**
Expand Down Expand Up @@ -55,7 +55,7 @@ public void testConfigs01() throws Exception {
FormKiqClientV1 client = clients.get(0);

// when
Configs c = client.getConfigs();
Config c = client.getConfigs();

// then
assertEquals("", c.chatGptApiKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,10 @@ protected DocumentActionsProcessor(final Map<String, String> map, final Region a
ssmService.getParameterValue("/formkiq/" + appEnvironment + "/s3/DocumentsS3Bucket");
String ocrBucket = ssmService.getParameterValue("/formkiq/" + appEnvironment + "/s3/OcrBucket");

map.put("DOCUMENTS_S3_BUCKET", ocrBucket);
map.put("OCR_S3_BUCKET", this.documentsBucket);
this.serviceCache.environment(map);
Map<String, String> newmap = new HashMap<>(map);
newmap.put("DOCUMENTS_S3_BUCKET", ocrBucket);
newmap.put("OCR_S3_BUCKET", this.documentsBucket);
this.serviceCache.environment(newmap);

this.fkqConnection = new FormKiqClientConnection(this.documentsIamUrl).region(awsRegion);

Expand Down Expand Up @@ -527,6 +528,15 @@ private void processRecords(final LambdaLogger logger, final List<Map<String, Ob
if (map.containsKey("Message")) {
DocumentEvent event =
this.gson.fromJson(map.get("Message").toString(), DocumentEvent.class);

String s = String.format(
"{\"siteId\": \"%s\",\"documentId\": \"%s\",\"s3key\": \"%s\",\"s3bucket\": \"%s\","
+ "\"type\": \"%s\",\"userId\": %s,"
+ "\"contentType\": \"%s\",\"path\":\"%s\",\"content\":%s}",
event.siteId(), event.documentId(), event.s3key(), event.s3bucket(), event.type(),
event.userId(), event.contentType(), event.path(), event.content());

logger.log(s);
processEvent(logger, event);
}
}
Expand Down

0 comments on commit 5e0ee25

Please sign in to comment.