L2 Construct: update_documents
s3 awsDescription
UpdateDocuments uploads new documents to S3 while skipping any that already exist. It takes a list of documents, bucket name, folder path, and allowed file types as input. Returns the count of newly uploaded documents.
L2 Data
- Provider: aws
- Module: s3
- Action: update_documents
Example Step
{
"name": "insert-your-step-name",
"type": "l2",
"l2_data": {
"provider": "aws",
"module": "s3",
"action": "update_documents",
"metadata": {}
}
}
Input
Example
{
"documents": [
{
"id": "",
"title": "example-doc",
"content": "This is example content",
"description": "",
"url": "https://example.com/doc"
}
],
"bucket": "my-bucket",
"folder": "documents",
"allowed_file_types": ["txt", "pdf"]
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/aws/s3/update-documents-input",
"$ref": "#/$defs/UpdateDocumentsInput",
"$defs": {
"Document": {
"properties": {
"id": {
"type": "string"
},
"title": {
"type": "string"
},
"content": {
"type": "string"
},
"description": {
"type": "string"
},
"url": {
"type": "string"
},
"tags": {
"items": {
"type": "string"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["id", "title", "content", "description", "url"]
},
"UpdateDocumentsInput": {
"properties": {
"documents": {
"items": {
"$ref": "#/$defs/Document"
},
"type": "array"
},
"bucket": {
"type": "string"
},
"folder": {
"type": "string"
},
"allowed_file_types": {
"items": {
"type": "string"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["documents", "bucket", "folder", "allowed_file_types"]
}
}
}
Output
Example
{
"uploaded_count": 1
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/aws/s3/update-documents-output",
"$ref": "#/$defs/UpdateDocumentsOutput",
"$defs": {
"UpdateDocumentsOutput": {
"properties": {
"uploaded_count": {
"type": "integer"
}
},
"additionalProperties": false,
"type": "object",
"required": ["uploaded_count"]
}
}
}