let addMethod = function()

in source/aws-connect-vm-serverless/src/lib/auth/auth-policy.js [128:160]


    let addMethod = function(effect, verb, resource, conditions) {
        if (verb !== "*" && !AuthPolicy.HttpVerb.hasOwnProperty(verb)) {
            throw new Error("Invalid HTTP verb " + verb + ". Allowed verbs in AuthPolicy.HttpVerb");
        }

        if (!this.pathRegex.test(resource)) {
            throw new Error("Invalid resource path: " + resource + ". Path should match " + this.pathRegex);
        }

        let cleanedResource = resource;
        if (resource.substring(0, 1) === "/") {
            cleanedResource = resource.substring(1, resource.length);
        }
        let resourceArn = "arn:aws:execute-api:" +
            this.region + ":" +
            this.awsAccountId + ":" +
            this.restApiId + "/" +
            this.stage + "/" +
            verb + "/" +
            cleanedResource;

        if (effect.toLowerCase() === "allow") {
            this.allowMethods.push({
                resourceArn: resourceArn,
                conditions: conditions
            });
        } else if (effect.toLowerCase() === "deny") {
            this.denyMethods.push({
                resourceArn: resourceArn,
                conditions: conditions
            });
        }
    };