Skip to content

Commit 2b264b7

Browse files
committed
feat: LLMO-204 Provisioning API for cdn logs S3 bucket
1 parent a47d43b commit 2b264b7

File tree

7 files changed

+738
-0
lines changed

7 files changed

+738
-0
lines changed

docs/openapi/api.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ tags:
4949
description: APIs for scraping web pages
5050
- name: llmo
5151
description: LLMO (Large Language Model Optimizer) operations
52+
- name: cdn-logs
53+
description: APIs for CDN logs infrastructure
5254

5355
paths:
5456
/audits/latest/{auditType}:
@@ -229,6 +231,8 @@ paths:
229231
$ref: './llmo-api.yaml#/llmo-customer-intent'
230232
/sites/{siteId}/llmo/customer-intent/{intentKey}:
231233
$ref: './llmo-api.yaml#/llmo-customer-intent-item'
234+
/tools/cdn-logs/bucket:
235+
$ref: './tools-api.yaml#/tools-cdn-logs-bucket'
232236

233237
components:
234238
securitySchemes:

docs/openapi/schemas.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3490,3 +3490,42 @@ LlmoConfig:
34903490
description: The customer intent configuration containing key-value pairs
34913491
$ref: '#/LlmoCustomerIntent'
34923492
additionalProperties: false
3493+
3494+
# CDN Logs Schemas
3495+
CdnLogsBucketRequest:
3496+
type: object
3497+
required:
3498+
- org_id
3499+
properties:
3500+
org_id:
3501+
type: string
3502+
description: Organization identifier (alphanumeric, often ending with @AdobeOrg)
3503+
example: "123ABCDEF4567890XYZ@AdobeOrg"
3504+
org_name:
3505+
type: string
3506+
description: Organization name (optional)
3507+
example: "Adobe"
3508+
3509+
CdnLogsBucketResponse:
3510+
type: object
3511+
properties:
3512+
message:
3513+
type: string
3514+
description: Success message describing what was created/retrieved
3515+
example: "Bucket 'cdn-logs-adobe123' created successfully with new credentials"
3516+
bucketName:
3517+
type: string
3518+
description: The S3 bucket name
3519+
example: "cdn-logs-adobe"
3520+
accessKey:
3521+
type: string
3522+
description: AWS access key for the bucket
3523+
example: "AKIAIOSFODNN7EXAMPLE"
3524+
secretKey:
3525+
type: string
3526+
description: AWS secret key for the bucket
3527+
example: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
3528+
region:
3529+
type: string
3530+
description: AWS region where the bucket was created
3531+
example: "us-east-1"

docs/openapi/tools-api.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,51 @@ file-download:
362362
$ref: './responses.yaml#/500'
363363
security:
364364
- scoped_api_key: [ ]
365+
366+
cdn-logs-bucket:
367+
put:
368+
tags:
369+
- cdn-logs
370+
- tools
371+
summary: Provision CDN logs S3 bucket
372+
description: |
373+
Provisions an S3 bucket for CDN logs with associated IAM credentials.
374+
This endpoint requires admin access and follows an idempotent pattern:
375+
376+
If the bucket does NOT exist: Creates a new S3 bucket with proper encryption, access controls,
377+
IAM policy, IAM user, and stores credentials in AWS Secrets Manager.
378+
379+
If the bucket already exists: Retrieves the existing bucket and credentials without creating duplicates.
380+
381+
This ensures that calling the endpoint multiple times with the same organization ID will not create
382+
duplicate resources, making it safe for automated provisioning workflows.
383+
384+
AWS resources created include:
385+
- S3 bucket with proper encryption and access controls
386+
- IAM policy for bucket access
387+
- IAM user with access keys
388+
- Stored credentials in AWS Secrets Manager
389+
operationId: provisionCdnLogsBucket
390+
requestBody:
391+
required: true
392+
content:
393+
application/json:
394+
schema:
395+
$ref: './schemas.yaml#/CdnLogsBucketRequest'
396+
responses:
397+
'200':
398+
description: Bucket and credentials created/retrieved successfully
399+
content:
400+
application/json:
401+
schema:
402+
$ref: './schemas.yaml#/CdnLogsBucketResponse'
403+
'400':
404+
$ref: './responses.yaml#/400'
405+
'401':
406+
$ref: './responses.yaml#/401'
407+
'403':
408+
$ref: './responses.yaml#/403'
409+
'500':
410+
$ref: './responses.yaml#/500'
411+
security:
412+
- admin_key: []

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
"@adobe/spacecat-shared-utils": "1.45.0",
8484
"@aws-sdk/client-s3": "3.864.0",
8585
"@aws-sdk/client-sfn": "3.864.0",
86+
"@aws-sdk/client-ssm": "^3.x.x",
87+
"@aws-sdk/client-iam": "^3.x.x",
88+
"@aws-sdk/client-secrets-manager": "^3.x.x",
8689
"@aws-sdk/client-sqs": "3.864.0",
8790
"@aws-sdk/s3-request-presigner": "3.864.0",
8891
"@langchain/core": "0.3.68",

0 commit comments

Comments
 (0)