All files / src App.ts

100% Statements 55/55
100% Branches 32/32
100% Functions 16/16
100% Lines 55/55

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125                                1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x     1x   1x 14x       1x 13x       1x 11x       1x 11x       1x 10x       1x 9x       1x 9x       1x 8x       1x 7x       1x 6x       1x 5x       1x 5x       1x 4x       1x 3x       1x 2x       1x 1x         1x  
/* 
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
  
  Licensed under the Apache License, Version 2.0 (the "License").
  You may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
 
import 'reflect-metadata';
import { Router } from 'src/common/Router';
import { MainHandler } from './common/MainHandler';
import { setupContainer } from './Container';
import { ListAuditsHandler } from './handlers/audits/ListAuditsHandler';
import { CreateObjectHandler } from './handlers/objects/CreateObjectHandler';
import { DeleteObjectHandler } from './handlers/objects/DeleteObjectHandler';
import { GetObjectHandler } from './handlers/objects/GetObjectHandler';
import { ListObjectsHandler } from './handlers/objects/ListObjectsHandler';
import { UpdateObjectHandler } from './handlers/objects/UpdateObjectHandler';
import { CreateRuleBundleHandler } from './handlers/rulebundles/CreateRuleBundleHandler';
import { DeleteRuleConfigHandler } from './handlers/rulebundles/DeleteRuleBundleHandler';
import { GetRuleConfigHandler } from './handlers/rulebundles/GetRuleBundleHandler';
import { ListRuleBundlesHandler } from './handlers/rulebundles/ListRuleBundlesHandler';
import { UpdateRuleBundleHandler } from './handlers/rulebundles/UpdateRuleBundleHandler';
import { CreateRuleHandler } from './handlers/rules/CreateRuleHandler';
import { DeleteRuleHandler } from './handlers/rules/DeleteRuleHandler';
import { GetRuleHandler } from './handlers/rules/GetRuleHandler';
import { ListRulesHandler } from './handlers/rules/ListRulesHandler';
import { UpdateRuleHandler } from './handlers/rules/UpdateRuleHandler';
 
setupContainer();
 
// setup route
const router = new Router();
 
router.addRoute(
    (e) => e.httpMethod === 'GET' && e.resource == '/rulebundles/{id}',
    GetRuleConfigHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'GET' && e.resource == '/rulebundles',
    ListRuleBundlesHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'POST' && e.resource == '/rulebundles',
    CreateRuleBundleHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'PUT' && e.resource == '/rulebundles/{id}',
    UpdateRuleBundleHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'DELETE' && e.resource == '/rulebundles/{id}',
    DeleteRuleConfigHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'POST' && e.resource == '/rulebundles/{id}/rules',
    CreateRuleHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'GET' && e.resource == '/rulebundles/{id}/rules',
    ListRulesHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'GET' && e.resource == '/rulebundles/{id}/rules/{ruleId}',
    GetRuleHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'DELETE' && e.resource == '/rulebundles/{id}/rules/{ruleId}',
    DeleteRuleHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'PUT' && e.resource == '/rulebundles/{id}/rules/{ruleId}',
    UpdateRuleHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'GET' && e.resource == '/objects',
    ListObjectsHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'POST' && e.resource == '/objects',
    CreateObjectHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'PUT' && e.resource == '/objects/{id}',
    UpdateObjectHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'DELETE' && e.resource == '/objects/{id}',
    DeleteObjectHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'GET' && e.resource == '/objects/{id}',
    GetObjectHandler
);
 
router.addRoute(
    (e) => e.httpMethod === 'GET' && e.resource == '/audits',
    ListAuditsHandler
);
 
// main lambda handler
export const lambdaHandler = new MainHandler(router).lambdaHandler;