api.yaml 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275
  1. AWSTemplateFormatVersion: "2010-09-09"
  2. Transform: AWS::Serverless-2016-10-31
  3. Description: Amazon S3 Find and Forget API
  4. Globals:
  5. Function:
  6. Runtime: python3.9
  7. Timeout: 180
  8. Layers: !Ref CommonLayers
  9. Environment:
  10. Variables:
  11. AllowOrigin: !If
  12. - DefaultAccessControlOrigin
  13. - !Ref WebUIOrigin
  14. - !Ref AccessControlAllowOriginOverride
  15. ConfigParam: !Ref ConfigParameter
  16. DeletionQueueTable: !Ref DeletionQueueTableName
  17. DataMapperTable: !Ref DataMapperTableName
  18. GSIBucketCount: "1"
  19. JobTable: !Ref JobTableName
  20. JobTableDateGSI: !Ref JobTableDateGSI
  21. LogLevel: !Ref LogLevel
  22. Metadata:
  23. cfn-lint:
  24. config:
  25. ignore_checks:
  26. - W8001 # Bug in cfn-lint not detecting that the Condition is actually in use.
  27. Parameters:
  28. AccessControlAllowOriginOverride:
  29. Type: String
  30. ConfigParameter:
  31. Type: String
  32. CognitoUserPoolArn:
  33. Type: String
  34. CommonLayers:
  35. Type: CommaDelimitedList
  36. Description: Common layers supplied to all functions
  37. DataMapperTableName:
  38. Description: Table name for DataMapper Table
  39. Type: String
  40. DeletionQueueTableName:
  41. Description: Table name for Deletion Queue Table
  42. Type: String
  43. EnableAccessLogging:
  44. Description: Whether to enable access logs
  45. Type: String
  46. JobTableDateGSI:
  47. Description: Date ordered GSI for Jobs Table
  48. Type: String
  49. JobTableName:
  50. Description: Table name for Jobs Table
  51. Type: String
  52. LogLevel:
  53. Type: String
  54. Default: INFO
  55. AllowedValues:
  56. - CRITICAL
  57. - FATAL
  58. - ERROR
  59. - WARNING
  60. - INFO
  61. - DEBUG
  62. - NOTSET
  63. WebUIOrigin:
  64. Type: String
  65. DeployCognito:
  66. Type: String
  67. Conditions:
  68. EnableAccessLogging: !Equals [!Ref EnableAccessLogging, "true"]
  69. DefaultAccessControlOrigin: !Equals [!Ref AccessControlAllowOriginOverride, "false"]
  70. ShouldDeployCognito: !Equals [!Ref DeployCognito, "true"]
  71. Resources:
  72. Api:
  73. Type: AWS::Serverless::Api
  74. Properties:
  75. OpenApiVersion: '3.0.1'
  76. StageName: Prod
  77. MethodSettings:
  78. !If
  79. - EnableAccessLogging
  80. - - LoggingLevel: INFO
  81. DataTraceEnabled: false
  82. ResourcePath: '/*'
  83. HttpMethod: '*'
  84. - !Ref AWS::NoValue
  85. DefinitionBody:
  86. openapi: "3.0.1"
  87. info:
  88. title: "Amazon S3 Find And Forget API"
  89. version: "1.0"
  90. servers:
  91. - url: "https://your-apigw-id.execute-api.region.amazonaws.com/{basePath}"
  92. variables:
  93. basePath:
  94. default: "Prod"
  95. tags:
  96. - name: DataMapper
  97. description: Operations related to data mappers
  98. - name: DeletionQueue
  99. description: Operations related to the deletion queue
  100. - name: Jobs
  101. description: Operations related to jobs
  102. - name: Settings
  103. description: Operations related to solution settings
  104. paths:
  105. /v1/queue:
  106. get:
  107. summary: Lists deletion queue items
  108. tags:
  109. - DeletionQueue
  110. operationId: "listDeletionQueueMatches"
  111. security:
  112. - Authorizer: []
  113. parameters:
  114. - '$ref': '#/components/parameters/StartAtQS'
  115. - '$ref': '#/components/parameters/PageSizeQS'
  116. responses:
  117. '200':
  118. description: OK
  119. content:
  120. application/json:
  121. schema:
  122. type: "object"
  123. title: "DeletionQueue"
  124. properties:
  125. MatchIds:
  126. type: "array"
  127. description: "The list of Match IDs currently in the queue"
  128. items:
  129. $ref: '#/components/schemas/DeletionQueueItem'
  130. NextStart:
  131. type: "string"
  132. nullable: true
  133. default: ""
  134. description: "The watermark to use when requesting the next page of results"
  135. x-amazon-apigateway-integration:
  136. uri:
  137. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetDeletionQueue.Arn}/invocations"
  138. passthroughBehavior: "when_no_match"
  139. httpMethod: "POST"
  140. type: "aws_proxy"
  141. delete:
  142. summary: Starts a job for the items in the deletion queue
  143. tags:
  144. - DeletionQueue
  145. operationId: "startDeletionJob"
  146. security:
  147. - Authorizer: []
  148. responses:
  149. '202':
  150. description: "Job Started"
  151. content:
  152. application/json:
  153. schema:
  154. $ref: '#/components/schemas/Job'
  155. '422':
  156. $ref: '#/components/responses/InvalidRequest'
  157. x-amazon-apigateway-integration:
  158. uri:
  159. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ProcessQueue.Arn}/invocations"
  160. passthroughBehavior: "when_no_match"
  161. httpMethod: "POST"
  162. type: "aws_proxy"
  163. patch:
  164. summary: "Adds an item to the deletion queue (Deprecated: use PATCH /v1/queue/matches)"
  165. deprecated: true
  166. tags:
  167. - DeletionQueue
  168. operationId: "addItemToDeletionQueue"
  169. security:
  170. - Authorizer: []
  171. responses:
  172. '201':
  173. description: "Created"
  174. content:
  175. application/json:
  176. schema:
  177. $ref: '#/components/schemas/DeletionQueueItem'
  178. '422':
  179. $ref: '#/components/responses/InvalidRequest'
  180. requestBody:
  181. description: "Request body containing details of the Match to add to the Deletion Queue"
  182. content:
  183. application/json:
  184. schema:
  185. $ref: '#/components/schemas/CreateDeletionQueueItem'
  186. required: true
  187. x-amazon-apigateway-integration:
  188. uri:
  189. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${EnqueueDeletion.Arn}/invocations"
  190. passthroughBehavior: "when_no_match"
  191. httpMethod: "POST"
  192. type: "aws_proxy"
  193. /v1/queue/matches:
  194. delete:
  195. summary: Removes one or more items from the deletion queue
  196. tags:
  197. - DeletionQueue
  198. operationId: "deleteMatches"
  199. security:
  200. - Authorizer: []
  201. responses:
  202. '204':
  203. description: OK
  204. requestBody:
  205. description: "Request body containing a list of Matches to be deleted"
  206. content:
  207. application/json:
  208. schema:
  209. title: "ListOfMatchDeletions"
  210. required:
  211. - "Matches"
  212. type: "object"
  213. properties:
  214. Matches:
  215. type: "array"
  216. description: "The list of Match IDs to remove from the deletion queue"
  217. items:
  218. title: "MatchDeletion"
  219. required:
  220. - "DeletionQueueItemId"
  221. type: "object"
  222. properties:
  223. DeletionQueueItemId:
  224. type: "string"
  225. description: "The Deletion Queue Item ID to remove from the deletion queue"
  226. required: true
  227. x-amazon-apigateway-integration:
  228. uri:
  229. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${CancelDeletion.Arn}/invocations"
  230. passthroughBehavior: "when_no_match"
  231. httpMethod: "POST"
  232. type: "aws_proxy"
  233. patch:
  234. summary: Adds one or more items to the deletion queue
  235. tags:
  236. - DeletionQueue
  237. operationId: "addItemsToDeletionQueue"
  238. security:
  239. - Authorizer: []
  240. responses:
  241. '201':
  242. description: "Created"
  243. content:
  244. application/json:
  245. schema:
  246. title: "ListOfDeletionQueueItem"
  247. required:
  248. - "Matches"
  249. type: "object"
  250. properties:
  251. Matches:
  252. type: "array"
  253. description: "List of Deletion Queue Item objects"
  254. items:
  255. $ref: '#/components/schemas/DeletionQueueItem'
  256. '422':
  257. $ref: '#/components/responses/InvalidRequest'
  258. requestBody:
  259. description: "Request body containing details of the Matches to add to the Deletion Queue"
  260. content:
  261. application/json:
  262. schema:
  263. title: "ListOfCreateDeletionQueueItems"
  264. required:
  265. - "Matches"
  266. type: "object"
  267. properties:
  268. Matches:
  269. type: "array"
  270. description: "List of Deletion Queue Items"
  271. items:
  272. $ref: '#/components/schemas/CreateDeletionQueueItem'
  273. required: true
  274. x-amazon-apigateway-integration:
  275. uri:
  276. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${EnqueueDeletions.Arn}/invocations"
  277. passthroughBehavior: "when_no_match"
  278. httpMethod: "POST"
  279. type: "aws_proxy"
  280. /v1/jobs:
  281. get:
  282. summary: Lists all jobs
  283. tags:
  284. - Job
  285. operationId: "listJobs"
  286. security:
  287. - Authorizer: []
  288. parameters:
  289. - '$ref': '#/components/parameters/StartAtQS'
  290. - '$ref': '#/components/parameters/PageSizeQS'
  291. responses:
  292. '200':
  293. description: "OK"
  294. content:
  295. application/json:
  296. schema:
  297. title: "ListOfJobs"
  298. type: "object"
  299. properties:
  300. Jobs:
  301. type: "array"
  302. description: "The list of jobs"
  303. items:
  304. $ref: '#/components/schemas/JobSummary'
  305. NextStart:
  306. type: "integer"
  307. nullable: true
  308. default: 0
  309. description: "The watermark to use when requesting the next page of results"
  310. x-amazon-apigateway-integration:
  311. uri:
  312. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ListJobs.Arn}/invocations"
  313. passthroughBehavior: "when_no_match"
  314. httpMethod: "POST"
  315. type: "aws_proxy"
  316. /v1/jobs/{job_id}:
  317. parameters:
  318. - '$ref': '#/components/parameters/JobId'
  319. get:
  320. summary: Returns the details of a job
  321. tags:
  322. - Job
  323. operationId: "getJob"
  324. security:
  325. - Authorizer: []
  326. responses:
  327. '200':
  328. description: "OK"
  329. content:
  330. application/json:
  331. schema:
  332. $ref: '#/components/schemas/Job'
  333. x-amazon-apigateway-integration:
  334. uri:
  335. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetJob.Arn}/invocations"
  336. passthroughBehavior: "when_no_match"
  337. httpMethod: "POST"
  338. type: "aws_proxy"
  339. /v1/jobs/{job_id}/events:
  340. parameters:
  341. - '$ref': '#/components/parameters/JobId'
  342. get:
  343. summary: Lists all events for a job
  344. tags:
  345. - Job
  346. operationId: "getJobEvents"
  347. security:
  348. - Authorizer: []
  349. parameters:
  350. - '$ref': '#/components/parameters/StartAtQS'
  351. - '$ref': '#/components/parameters/PageSizeQS'
  352. - in: "query"
  353. name: "filter"
  354. required: "false"
  355. schema:
  356. oneOf:
  357. - type: "string"
  358. - type: "array"
  359. items:
  360. type: "string"
  361. pattern: "^(EventName)([=])([a-zA-Z0-9]+)$"
  362. pattern: "^(EventName)([=])([a-zA-Z0-9]+)$"
  363. description: >
  364. Filters to apply in the format [key][operator][value]. If multiple
  365. filters are supplied, they will applied on an **AND** basis.
  366. Supported keys: EventName. Supported Operators: =
  367. responses:
  368. '200':
  369. description: "OK"
  370. content:
  371. application/json:
  372. schema:
  373. title: "ListOfJobEvents"
  374. type: "object"
  375. properties:
  376. JobEvents:
  377. type: "array"
  378. description: "The list of job events"
  379. items:
  380. $ref: '#/components/schemas/JobEvent'
  381. NextStart:
  382. type: "integer"
  383. nullable: true
  384. default: 0
  385. description: "The watermark to use when requesting the next page of results"
  386. x-amazon-apigateway-integration:
  387. uri:
  388. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ListJobEvents.Arn}/invocations"
  389. passthroughBehavior: "when_no_match"
  390. httpMethod: "POST"
  391. type: "aws_proxy"
  392. /v1/data_mappers:
  393. get:
  394. summary: Lists data mappers
  395. tags:
  396. - DataMapper
  397. operationId: "listDataMappers"
  398. security:
  399. - Authorizer: []
  400. parameters:
  401. - '$ref': '#/components/parameters/StartAtQS'
  402. - '$ref': '#/components/parameters/PageSizeQS'
  403. responses:
  404. '200':
  405. description: OK
  406. content:
  407. application/json:
  408. schema:
  409. title: "ListOfDataMappers"
  410. type: "object"
  411. properties:
  412. DataMappers:
  413. type: "array"
  414. description: "The list of data mappers"
  415. items:
  416. $ref: '#/components/schemas/DataMapper'
  417. NextStart:
  418. type: "string"
  419. nullable: true
  420. default: ""
  421. description: "The watermark to use when requesting the next page of results"
  422. x-amazon-apigateway-integration:
  423. uri:
  424. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetDataMappers.Arn}/invocations"
  425. passthroughBehavior: "when_no_match"
  426. httpMethod: "POST"
  427. type: "aws_proxy"
  428. /v1/data_mappers/{data_mapper_id}:
  429. parameters:
  430. - '$ref': '#/components/parameters/DataMapperId'
  431. get:
  432. summary: Returns the details of a data mapper
  433. tags:
  434. - DataMapper
  435. operationId: "getDataMapper"
  436. security:
  437. - Authorizer: []
  438. responses:
  439. '200':
  440. description: "OK"
  441. content:
  442. application/json:
  443. schema:
  444. $ref: '#/components/schemas/DataMapper'
  445. x-amazon-apigateway-integration:
  446. uri:
  447. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetDataMapper.Arn}/invocations"
  448. passthroughBehavior: "when_no_match"
  449. httpMethod: "POST"
  450. type: "aws_proxy"
  451. put:
  452. summary: Creates or modifies a data mapper
  453. tags:
  454. - DataMapper
  455. operationId: "putDataMapper"
  456. security:
  457. - Authorizer: []
  458. responses:
  459. '201':
  460. description: "OK"
  461. content:
  462. application/json:
  463. schema:
  464. $ref: '#/components/schemas/DataMapper'
  465. requestBody:
  466. description: "Request body containing details of the Data Mapper to create or modify"
  467. content:
  468. application/json:
  469. schema:
  470. $ref: '#/components/schemas/DataMapper'
  471. required: true
  472. x-amazon-apigateway-integration:
  473. uri:
  474. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${PutDataMapper.Arn}/invocations"
  475. passthroughBehavior: "when_no_match"
  476. httpMethod: "POST"
  477. type: "aws_proxy"
  478. delete:
  479. summary: Removes a data mapper
  480. tags:
  481. - DataMapper
  482. operationId: "deleteDataMapper"
  483. security:
  484. - Authorizer: []
  485. responses:
  486. '204':
  487. description: OK
  488. x-amazon-apigateway-integration:
  489. uri:
  490. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${DeleteDataMapper.Arn}/invocations"
  491. passthroughBehavior: "when_no_match"
  492. httpMethod: "POST"
  493. type: "aws_proxy"
  494. /v1/settings:
  495. get:
  496. summary: Gets the solution settings
  497. tags:
  498. - Settings
  499. operationId: "getSettings"
  500. security:
  501. - Authorizer: []
  502. responses:
  503. '200':
  504. description: "OK"
  505. content:
  506. application/json:
  507. schema:
  508. $ref: '#/components/schemas/Settings'
  509. x-amazon-apigateway-integration:
  510. uri:
  511. Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ListSettings.Arn}/invocations"
  512. passthroughBehavior: "when_no_match"
  513. httpMethod: "POST"
  514. type: "aws_proxy"
  515. components:
  516. parameters:
  517. DataMapperId:
  518. in: "path"
  519. name: "data_mapper_id"
  520. required: "true"
  521. schema:
  522. type: "string"
  523. description: "Data Mapper ID path parameter"
  524. JobId:
  525. in: "path"
  526. name: "job_id"
  527. required: "true"
  528. schema:
  529. type: "string"
  530. description: "Job ID path parameter"
  531. PageSizeQS:
  532. in: "query"
  533. name: "page_size"
  534. required: "false"
  535. schema:
  536. type: "integer"
  537. minimum: 1
  538. maximum: 1000
  539. description: "Page size query string parameter. Min: 1. Max: 1000"
  540. StartAtQS:
  541. in: "query"
  542. name: "start_at"
  543. required: "false"
  544. schema:
  545. type: "string"
  546. default: 0
  547. description: "Start at watermark query string parameter"
  548. schemas:
  549. DataMapper:
  550. description: "A Data Mapper object"
  551. required:
  552. - "Columns"
  553. - "QueryExecutor"
  554. - "QueryExecutorParameters"
  555. - "RoleArn"
  556. type: "object"
  557. properties:
  558. DataMapperId:
  559. type: "string"
  560. description: "The ID of the data mapper"
  561. Format:
  562. type: "string"
  563. description: "The format of the dataset"
  564. enum:
  565. - "json"
  566. - "parquet"
  567. default: "parquet"
  568. QueryExecutor:
  569. type: "string"
  570. description: "The query executor used to query your dataset"
  571. enum:
  572. - "athena"
  573. Columns:
  574. minItems: 1
  575. type: "array"
  576. description: "Columns to query for MatchIds the dataset"
  577. items:
  578. type: "string"
  579. QueryExecutorParameters:
  580. type: "object"
  581. description: "Details of the query executor parameters to use when the QueryExecutor is set to 'athena'"
  582. properties:
  583. DataCatalogProvider:
  584. description: "The data catalog provider which contains the database table with metadata about your S3 data lake"
  585. enum:
  586. - "glue"
  587. type: "string"
  588. Database:
  589. description: "The database in the data catalog which contains the metatadata table"
  590. type: "string"
  591. Table:
  592. description: "The table in the data catalog database containing the metatadata for your data lake"
  593. type: "string"
  594. PartitionKeys:
  595. description: "The partition keys to use on each query. This allows to control the number and the size of the queries. When omitted, all the table partitions are used."
  596. type: "array"
  597. items:
  598. type: "string"
  599. required:
  600. - "Database"
  601. - "Table"
  602. RoleArn:
  603. type: "string"
  604. description: "Role ARN to assume when performing operations in S3 for this data mapper. The role must have the exact name 'S3F2DataAccessRole'."
  605. pattern: '^arn:(aws[a-zA-Z-]*)?:iam::\d{12}:role\/S3F2DataAccessRole$'
  606. DeleteOldVersions:
  607. type: "boolean"
  608. description: "Toggles deleting all non-latest versions of an object after a new redacted version is created"
  609. default: "true"
  610. IgnoreObjectNotFoundExceptions:
  611. type: "boolean"
  612. description: "Toggles ignoring Object Not Found errors during deletion"
  613. default: "false"
  614. DeletionQueueItem:
  615. description: "A Deletion Queue Item object"
  616. type: "object"
  617. required:
  618. - "DeletionQueueItemId"
  619. - "Type"
  620. - "MatchId"
  621. - "CreatedAt"
  622. - "DataMappers"
  623. properties:
  624. DeletionQueueItemId:
  625. type: "string"
  626. description: "The Deletion Queue Item unique identifier"
  627. Type:
  628. type: "string"
  629. description: "MatchId Type"
  630. default: "Simple"
  631. enum:
  632. - "Simple"
  633. - "Composite"
  634. MatchId:
  635. oneOf:
  636. - type: "string"
  637. - type: "array"
  638. items:
  639. type: "object"
  640. required:
  641. - "Column"
  642. - "Value"
  643. properties:
  644. Column:
  645. type: "string"
  646. description: "Column Identifier"
  647. Value:
  648. type: "string"
  649. description: "Value for the given column"
  650. description: "The Match ID to remove from the deletion queue"
  651. CreatedAt:
  652. type: "integer"
  653. description: "Deletion queue item creation date as Epoch timestamp"
  654. DataMappers:
  655. type: "array"
  656. description: "The list of data mappers to apply to this Match ID"
  657. items:
  658. type: "string"
  659. CreateDeletionQueueItem:
  660. description: "A request to create a Deletion Queue Item"
  661. required:
  662. - "MatchId"
  663. type: "object"
  664. properties:
  665. Type:
  666. type: "string"
  667. description: "MatchId Type"
  668. enum:
  669. - "Simple"
  670. - "Composite"
  671. default: "Simple"
  672. MatchId:
  673. oneOf:
  674. - type: "string"
  675. - type: "array"
  676. items:
  677. type: "object"
  678. required:
  679. - "Column"
  680. - "Value"
  681. properties:
  682. Column:
  683. type: "string"
  684. description: "Column Identifier"
  685. Value:
  686. type: "string"
  687. description: "Value for the given column"
  688. description: "The Match ID to remove from the deletion queue"
  689. DataMappers:
  690. type: "array"
  691. description: "The list of data mappers to apply to this Match ID"
  692. default: ["*"]
  693. items:
  694. type: "string"
  695. JobSummary:
  696. description: "A Job summary object"
  697. type: "object"
  698. required:
  699. - "Id"
  700. - "JobStatus"
  701. - "CreatedAt"
  702. properties:
  703. Id:
  704. type: "string"
  705. description: "The Job ID"
  706. JobStatus:
  707. type: "string"
  708. description: "The Job status. When a job is first created, it will remain in queued till the workflow starts"
  709. default: "QUEUED"
  710. enum:
  711. - "QUEUED"
  712. - "RUNNING"
  713. - "FORGET_COMPLETED_CLEANUP_IN_PROGRESS"
  714. - "COMPLETED"
  715. - "COMPLETED_CLEANUP_FAILED"
  716. - "FAILED"
  717. - "FIND_FAILED"
  718. - "FORGET_FAILED"
  719. - "FORGET_PARTIALLY_FAILED"
  720. CreatedAt:
  721. type: "integer"
  722. description: "Job creation date as Epoch timestamp"
  723. default: <the current time>
  724. JobStartTime:
  725. type: "integer"
  726. description: "Job start date as Epoch timestamp"
  727. JobFinishTime:
  728. type: "integer"
  729. description: "Job finish date as Epoch timestamp"
  730. TotalObjectUpdatedCount:
  731. type: "integer"
  732. description: "Total number of successfully updated objects"
  733. default: 0
  734. TotalObjectUpdateSkippedCount:
  735. type: "integer"
  736. description: "Total number of skipped objects"
  737. default: 0
  738. TotalObjectUpdateFailedCount:
  739. type: "integer"
  740. description: "Total number of objects which could not be successfully updated"
  741. default: 0
  742. TotalObjectRollbackFailedCount:
  743. type: "integer"
  744. description: "Total number of objects which could not be successfully rolled back after detecting an integrity conflict"
  745. default: 0
  746. TotalQueryCount:
  747. type: "integer"
  748. description: "Total number of queries executed during the find phase"
  749. default: 0
  750. TotalQueryFailedCount:
  751. type: "integer"
  752. description: "Total number of unsuccessfully executed queries during the find phase"
  753. default: 0
  754. TotalQueryScannedInBytes:
  755. type: "integer"
  756. description: "Total amount of data scanned during the find phase"
  757. default: 0
  758. TotalQuerySucceededCount:
  759. type: "integer"
  760. description: "Total number of successfully executed queries during the find phase"
  761. default: 0
  762. TotalQueryTimeInMillis:
  763. type: "integer"
  764. description: "Total time spent by the query executor for this job"
  765. default: 0
  766. Job:
  767. description: "A Job object"
  768. type: "object"
  769. required:
  770. - "Id"
  771. - "JobStatus"
  772. - "CreatedAt"
  773. - "AthenaConcurrencyLimit"
  774. - "AthenaQueryMaxRetries"
  775. - "DeletionTasksMaxNumber"
  776. - "ForgetQueueWaitSeconds"
  777. - "QueryExecutionWaitSeconds"
  778. - "QueryQueueWaitSeconds"
  779. - "Sk"
  780. - "Type"
  781. - "GSIBucket"
  782. properties:
  783. Id:
  784. type: "string"
  785. description: "The Job ID"
  786. JobStatus:
  787. type: "string"
  788. description: "The Job status. When a job is first created, it will remain in queued till the workflow starts"
  789. default: "QUEUED"
  790. enum:
  791. - "QUEUED"
  792. - "RUNNING"
  793. - "FORGET_COMPLETED_CLEANUP_IN_PROGRESS"
  794. - "COMPLETED"
  795. - "COMPLETED_CLEANUP_FAILED"
  796. - "FAILED"
  797. - "FIND_FAILED"
  798. - "FORGET_FAILED"
  799. - "FORGET_PARTIALLY_FAILED"
  800. CreatedAt:
  801. type: "integer"
  802. description: "Job creation date as Epoch timestamp"
  803. default: <the current time>
  804. JobStartTime:
  805. type: "integer"
  806. description: "Job start date as Epoch timestamp"
  807. JobFinishTime:
  808. type: "integer"
  809. description: "Job finish date as Epoch timestamp"
  810. AthenaConcurrencyLimit:
  811. type: "integer"
  812. description: "Athena concurrency setting for this job"
  813. AthenaQueryMaxRetries:
  814. type: "integer"
  815. description: "Max number of retries to each Athena query after a failure"
  816. DeletionTasksMaxNumber:
  817. type: "integer"
  818. description: "Max Fargate tasks setting for this job"
  819. ForgetQueueWaitSeconds:
  820. type: "integer"
  821. description: "Forget queue wait setting for this job"
  822. QueryExecutionWaitSeconds:
  823. type: "integer"
  824. description: "Query execution wait setting for this job"
  825. QueryQueueWaitSeconds:
  826. type: "integer"
  827. description: "Query queue worker wait setting for this job"
  828. TotalObjectUpdatedCount:
  829. type: "integer"
  830. description: "Total number of successfully updated objects"
  831. default: 0
  832. TotalObjectUpdateSkippedCount:
  833. type: "integer"
  834. description: "Total number of skipped objects"
  835. default: 0
  836. TotalObjectUpdateFailedCount:
  837. type: "integer"
  838. description: "Total number of objects which could not be successfully updated"
  839. default: 0
  840. TotalObjectRollbackFailedCount:
  841. type: "integer"
  842. description: "Total number of objects which could not be successfully rolled back after detecting an integrity conflict"
  843. default: 0
  844. TotalQueryCount:
  845. type: "integer"
  846. description: "Total number of queries executed during the find phase"
  847. default: 0
  848. TotalQueryFailedCount:
  849. type: "integer"
  850. description: "Total number of unsuccessfully executed queries during the find phase"
  851. default: 0
  852. TotalQueryScannedInBytes:
  853. type: "integer"
  854. description: "Total amount of data scanned during the find phase"
  855. default: 0
  856. TotalQuerySucceededCount:
  857. type: "integer"
  858. description: "Total number of successfully executed queries during the find phase"
  859. default: 0
  860. TotalQueryTimeInMillis:
  861. type: "integer"
  862. description: "Total time spent by the query executor for this job"
  863. default: 0
  864. Expires:
  865. type: "integer"
  866. description: "Expiry date when the item will be deleted as Epoch time"
  867. Sk:
  868. type: "string"
  869. description: "Internal field used as part of DynamoDB single table design"
  870. Type:
  871. type: "string"
  872. enum:
  873. - "Job"
  874. description: "Internal field used as part of DynamoDB single table design"
  875. GSIBucket:
  876. type: "string"
  877. description: "Internal field used as part of DynamoDB single table design"
  878. JobEvent:
  879. description: "A Job Event object"
  880. type: "object"
  881. properties:
  882. Id:
  883. type: "string"
  884. description: "The Job ID"
  885. CreatedAt:
  886. type: "integer"
  887. description: "Job creation date as Epoch timestamp"
  888. default: <the current time>
  889. EventName:
  890. type: "string"
  891. description: "The Job Event name"
  892. EventData:
  893. type: "object"
  894. description: "Free form field containing data about the event. Structure varies based on the event"
  895. EmitterId:
  896. type: "string"
  897. description: "The identifier for the service or service instance which emitted the event"
  898. example: "StepFunctions"
  899. Expires:
  900. type: "integer"
  901. description: "Expiry date when the item will be deleted as Epoch time"
  902. Sk:
  903. type: "string"
  904. description: "Internal field used as part of DynamoDB single table design"
  905. Type:
  906. type: "string"
  907. enum:
  908. - "Job"
  909. description: "Internal field used as part of DynamoDB single table design"
  910. Settings:
  911. description: "A Settings object"
  912. type: "object"
  913. properties:
  914. AthenaConcurrencyLimit:
  915. type: "integer"
  916. description: "Athena concurrency setting for this job"
  917. AthenaQueryMaxRetries:
  918. type: "integer"
  919. description: "Max number of retries to each Athena query after a failure"
  920. DeletionTasksMaxNumber:
  921. type: "integer"
  922. description: "Max Fargate tasks setting for this job"
  923. ForgetQueueWaitSeconds:
  924. type: "integer"
  925. description: "Forget queue wait setting for this job"
  926. QueryExecutionWaitSeconds:
  927. type: "integer"
  928. description: "Query execution wait setting for this job"
  929. QueryQueueWaitSeconds:
  930. type: "integer"
  931. description: "Query queue worker wait setting for this job"
  932. required:
  933. - "AthenaConcurrencyLimit"
  934. - "AthenaQueryMaxRetries"
  935. - "DeletionTasksMaxNumber"
  936. - "ForgetQueueWaitSeconds"
  937. - "QueryExecutionWaitSeconds"
  938. - "QueryQueueWaitSeconds"
  939. Error:
  940. description: "A standard error object"
  941. type: "object"
  942. properties:
  943. Message:
  944. description: "Error message"
  945. type: "string"
  946. required:
  947. - "Message"
  948. responses:
  949. InvalidRequest:
  950. description: "Error response for invalid requests"
  951. content:
  952. application/json:
  953. schema:
  954. $ref: '#/components/schemas/Error'
  955. securitySchemes:
  956. Authorizer:
  957. type: "apiKey"
  958. name: "Authorization"
  959. in: "header"
  960. x-amazon-apigateway-authtype: !If [ShouldDeployCognito, "cognito_user_pools", "awsSigv4"]
  961. x-amazon-apigateway-authorizer: !If
  962. - ShouldDeployCognito
  963. - providerARNs:
  964. - Ref: CognitoUserPoolArn
  965. type: "cognito_user_pools"
  966. - !Ref AWS::NoValue
  967. x-amazon-apigateway-request-validator: All
  968. x-amazon-apigateway-request-validators:
  969. All:
  970. validateRequestParameters: true
  971. validateRequestBody: true
  972. EndpointConfiguration: REGIONAL
  973. Cors:
  974. AllowMethods: "'*'"
  975. AllowHeaders: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
  976. AllowOrigin: !If
  977. - DefaultAccessControlOrigin
  978. - !Sub "'${WebUIOrigin}'"
  979. - !Sub "'${AccessControlAllowOriginOverride}'"
  980. GatewayResponses:
  981. DEFAULT_4XX:
  982. ResponseTemplates:
  983. "application/json": '{ "Message": $context.error.messageString }'
  984. ResponseParameters:
  985. Headers:
  986. Access-Control-Allow-Methods: "'*'"
  987. Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
  988. Access-Control-Allow-Origin: !If
  989. - DefaultAccessControlOrigin
  990. - !Sub "'${WebUIOrigin}'"
  991. - !Sub "'${AccessControlAllowOriginOverride}'"
  992. BAD_REQUEST_BODY:
  993. StatusCode: 422
  994. ResponseTemplates:
  995. "application/json": '{ "Message": $context.error.messageString }'
  996. ResponseParameters:
  997. Headers:
  998. Access-Control-Allow-Methods: "'*'"
  999. Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
  1000. Access-Control-Allow-Origin: !If
  1001. - DefaultAccessControlOrigin
  1002. - !Sub "'${WebUIOrigin}'"
  1003. - !Sub "'${AccessControlAllowOriginOverride}'"
  1004. BAD_REQUEST_PARAMETERS:
  1005. StatusCode: 422
  1006. ResponseTemplates:
  1007. "application/json": '{ "Message": $context.error.messageString }'
  1008. ResponseParameters:
  1009. Headers:
  1010. Access-Control-Allow-Methods: "'*'"
  1011. Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
  1012. Access-Control-Allow-Origin: !If
  1013. - DefaultAccessControlOrigin
  1014. - !Sub "'${WebUIOrigin}'"
  1015. - !Sub "'${AccessControlAllowOriginOverride}'"
  1016. DEFAULT_5XX:
  1017. ResponseTemplates:
  1018. "application/json": '{ "Message": $context.error.messageString }'
  1019. ResponseParameters:
  1020. Headers:
  1021. Access-Control-Allow-Methods: "'*'"
  1022. Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
  1023. Access-Control-Allow-Origin: !If
  1024. - DefaultAccessControlOrigin
  1025. - !Sub "'${WebUIOrigin}'"
  1026. - !Sub "'${AccessControlAllowOriginOverride}'"
  1027. ## Queue
  1028. EnqueueDeletion:
  1029. Type: AWS::Serverless::Function
  1030. Properties:
  1031. Handler: handlers.enqueue_handler
  1032. CodeUri: ../backend/lambdas/queue/
  1033. Events:
  1034. Get:
  1035. Type: Api
  1036. Properties:
  1037. Path: /v1/queue
  1038. Method: PATCH
  1039. RestApiId: !Ref Api
  1040. Policies:
  1041. - DynamoDBCrudPolicy:
  1042. TableName: !Ref DeletionQueueTableName
  1043. EnqueueDeletions:
  1044. Type: AWS::Serverless::Function
  1045. Properties:
  1046. Handler: handlers.enqueue_batch_handler
  1047. CodeUri: ../backend/lambdas/queue/
  1048. Events:
  1049. Get:
  1050. Type: Api
  1051. Properties:
  1052. Path: /v1/queue/matches
  1053. Method: PATCH
  1054. RestApiId: !Ref Api
  1055. Policies:
  1056. - DynamoDBCrudPolicy:
  1057. TableName: !Ref DeletionQueueTableName
  1058. GetDeletionQueue:
  1059. Type: AWS::Serverless::Function
  1060. Properties:
  1061. Handler: handlers.get_handler
  1062. CodeUri: ../backend/lambdas/queue/
  1063. Events:
  1064. Get:
  1065. Type: Api
  1066. Properties:
  1067. Path: /v1/queue
  1068. Method: GET
  1069. RestApiId: !Ref Api
  1070. Policies:
  1071. - DynamoDBCrudPolicy:
  1072. TableName: !Ref DeletionQueueTableName
  1073. CancelDeletion:
  1074. Type: AWS::Serverless::Function
  1075. Properties:
  1076. Handler: handlers.cancel_handler
  1077. CodeUri: ../backend/lambdas/queue/
  1078. Events:
  1079. Get:
  1080. Type: Api
  1081. Properties:
  1082. Path: /v1/queue/matches
  1083. Method: DELETE
  1084. RestApiId: !Ref Api
  1085. Policies:
  1086. - DynamoDBReadPolicy:
  1087. TableName: !Ref JobTableName
  1088. - DynamoDBCrudPolicy:
  1089. TableName: !Ref DeletionQueueTableName
  1090. ProcessQueue:
  1091. Type: AWS::Serverless::Function
  1092. Properties:
  1093. Handler: handlers.process_handler
  1094. CodeUri: ../backend/lambdas/queue/
  1095. MemorySize: 512
  1096. Events:
  1097. Get:
  1098. Type: Api
  1099. Properties:
  1100. Path: /v1/queue
  1101. Method: DELETE
  1102. RestApiId: !Ref Api
  1103. Policies:
  1104. - DynamoDBCrudPolicy:
  1105. TableName: !Ref DeletionQueueTableName
  1106. - DynamoDBCrudPolicy:
  1107. TableName: !Ref JobTableName
  1108. - Statement:
  1109. - Action: "ssm:GetParameter"
  1110. Effect: "Allow"
  1111. Resource: !Sub "arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:parameter${ConfigParameter}"
  1112. # DataMappers
  1113. PutDataMapper:
  1114. Type: AWS::Serverless::Function
  1115. Properties:
  1116. Handler: handlers.put_data_mapper_handler
  1117. CodeUri: ../backend/lambdas/data_mappers/
  1118. Events:
  1119. Put:
  1120. Type: Api
  1121. Properties:
  1122. Path: /v1/data_mappers/{data_mapper_id}
  1123. Method: PUT
  1124. RestApiId: !Ref Api
  1125. Policies:
  1126. - Statement:
  1127. - Action:
  1128. - "glue:BatchGetPartition"
  1129. - "glue:GetDatabase*"
  1130. - "glue:GetPartition*"
  1131. - "glue:GetTable*"
  1132. Effect: "Allow"
  1133. Resource:
  1134. - !Sub "arn:${AWS::Partition}:glue:*:*:catalog*"
  1135. - !Sub "arn:${AWS::Partition}:glue:*:*:database*"
  1136. - !Sub "arn:${AWS::Partition}:glue:*:*:table*"
  1137. - !Sub "arn:${AWS::Partition}:glue:*:*:partition*"
  1138. - DynamoDBCrudPolicy:
  1139. TableName: !Ref DataMapperTableName
  1140. GetDataMapper:
  1141. Type: AWS::Serverless::Function
  1142. Properties:
  1143. Handler: handlers.get_data_mapper_handler
  1144. CodeUri: ../backend/lambdas/data_mappers/
  1145. Events:
  1146. Get:
  1147. Type: Api
  1148. Properties:
  1149. Path: /v1/data_mappers/{data_mapper_id}
  1150. Method: GET
  1151. RestApiId: !Ref Api
  1152. Policies:
  1153. - DynamoDBReadPolicy:
  1154. TableName: !Ref DataMapperTableName
  1155. GetDataMappers:
  1156. Type: AWS::Serverless::Function
  1157. Properties:
  1158. Handler: handlers.get_data_mappers_handler
  1159. CodeUri: ../backend/lambdas/data_mappers/
  1160. Events:
  1161. Get:
  1162. Type: Api
  1163. Properties:
  1164. Path: /v1/data_mappers
  1165. Method: GET
  1166. RestApiId: !Ref Api
  1167. Policies:
  1168. - DynamoDBCrudPolicy:
  1169. TableName: !Ref DataMapperTableName
  1170. DeleteDataMapper:
  1171. Type: AWS::Serverless::Function
  1172. Properties:
  1173. Handler: handlers.delete_data_mapper_handler
  1174. CodeUri: ../backend/lambdas/data_mappers/
  1175. Events:
  1176. Get:
  1177. Type: Api
  1178. Properties:
  1179. Path: /v1/data_mappers/{data_mapper_id}
  1180. Method: DELETE
  1181. RestApiId: !Ref Api
  1182. Policies:
  1183. - DynamoDBReadPolicy:
  1184. TableName: !Ref JobTableName
  1185. - DynamoDBCrudPolicy:
  1186. TableName: !Ref DataMapperTableName
  1187. # Jobs
  1188. GetJob:
  1189. Type: AWS::Serverless::Function
  1190. Properties:
  1191. Handler: handlers.get_job_handler
  1192. CodeUri: ../backend/lambdas/jobs/
  1193. Events:
  1194. Get:
  1195. Type: Api
  1196. Properties:
  1197. Path: /v1/jobs/{job_id}
  1198. Method: GET
  1199. RestApiId: !Ref Api
  1200. Policies:
  1201. - DynamoDBReadPolicy:
  1202. TableName: !Ref JobTableName
  1203. ListJobs:
  1204. Type: AWS::Serverless::Function
  1205. Properties:
  1206. Handler: handlers.list_jobs_handler
  1207. CodeUri: ../backend/lambdas/jobs/
  1208. Events:
  1209. List:
  1210. Type: Api
  1211. Properties:
  1212. Path: /v1/jobs
  1213. Method: GET
  1214. RestApiId: !Ref Api
  1215. Policies:
  1216. - DynamoDBReadPolicy:
  1217. TableName: !Ref JobTableName
  1218. ListJobEvents:
  1219. Type: AWS::Serverless::Function
  1220. Properties:
  1221. Handler: handlers.list_job_events_handler
  1222. CodeUri: ../backend/lambdas/jobs/
  1223. Events:
  1224. List:
  1225. Type: Api
  1226. Properties:
  1227. Path: /v1/jobs/{job_id}/events
  1228. Method: GET
  1229. RestApiId: !Ref Api
  1230. Policies:
  1231. - DynamoDBReadPolicy:
  1232. TableName: !Ref JobTableName
  1233. # Settings
  1234. ListSettings:
  1235. Type: AWS::Serverless::Function
  1236. Properties:
  1237. Handler: handlers.list_settings_handler
  1238. CodeUri: ../backend/lambdas/settings/
  1239. Events:
  1240. List:
  1241. Type: Api
  1242. Properties:
  1243. Path: /v1/settings
  1244. Method: GET
  1245. RestApiId: !Ref Api
  1246. Policies:
  1247. - Statement:
  1248. - Action: "ssm:GetParameter"
  1249. Effect: "Allow"
  1250. Resource: !Sub "arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:parameter${ConfigParameter}"
  1251. Outputs:
  1252. AccessControlAllowOriginHeader:
  1253. Description: Access-Control-Allow-Origin header sent from API endpoints
  1254. Value: !If
  1255. - DefaultAccessControlOrigin
  1256. - !Ref WebUIOrigin
  1257. - !Ref AccessControlAllowOriginOverride
  1258. ApiArn:
  1259. Value: !Sub arn:${AWS::Partition}:execute-api:${AWS::Region}:${AWS::AccountId}:${Api}/${Api.Stage}/*/*
  1260. ApiUrl:
  1261. Description: API endpoint URL for Prod environment
  1262. Value: !Sub https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/${Api.Stage}/
  1263. PutDataMapperRole:
  1264. Description: Role used by the PutDataMapper API
  1265. Value: !Ref PutDataMapperRole