This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: newrelicservice | |
frameworkVersion: '2' | |
useDotenv: true | |
plugins: | |
- serverless-offline | |
- serverless-dotenv-plugin | |
- serverless-newrelic-lambda-layers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-undef */ | |
"use strict"; | |
const {unDeleteDashboard} = require("./newrelic/dashboard"); | |
const {response} = require("./slack/format"); | |
const {recoverModal} = require("./slack/payloads"); | |
/** | |
* Bolt App Initialization | |
*/ | |
const {App, ExpressReceiver} = require("@slack/bolt"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
recoverModal: () => { | |
return { | |
view: JSON.stringify({ | |
title: { | |
type: "plain_text", | |
text: "Recover Dashboard" | |
}, | |
submit: { | |
type: "plain_text", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
response: (color, msg, extra) => { | |
return { | |
attachments: [ | |
{ | |
fallback: "Fallback triggered", | |
color: `${color}`, | |
blocks: [ | |
{ | |
type: "section", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const AWS = require("aws-sdk"); | |
const moment = require("moment"); | |
const ErrorResponse = require("../common/error"); | |
const s3 = new AWS.S3(); | |
const {fetchAllDashboards, fetchDashboardDetails} = require("../newrelic/dashboard"); | |
require("dotenv").config(); | |
/** | |
* getErrorMessage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const axios = require("axios"); | |
const config = require("../common/config"); | |
const ErrorResponse = require("../common/error"); | |
const {account, getDashboardInfo, unDelete} = require("./queries"); | |
const MyAccount = require("../common/constant"); | |
let myAccount = MyAccount(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
class ErrorResponse extends Error { | |
constructor(message, statusCode) { | |
super(message); | |
this.statusCode = statusCode; | |
} | |
} | |
module.exports = ErrorResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-undef */ | |
"use strict"; | |
require("dotenv").config(); | |
module.exports = () => { | |
const Account = { | |
// make sure to properly set your acccount and account id | |
accountName: process.env.NODE_ENV === "dev" ? "DEV-ACCOUNT" : "PROD-ACCOUNT", | |
accountID: process.env.NODE_ENV === "dev" ? 11111111 : 1000000 | |
}; | |
return Account; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-undef */ | |
"use strict"; | |
module.exports = (options) => { | |
var config = { | |
method: "post", | |
url: `${process.env.URL}`, | |
headers: { | |
"Content-Type": "application/json", | |
"API-Key": `${process.env.NODE_ENV === "dev" ? process.env.API_KEY : process.env.API_KEY_PROD}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
/** | |
* account Uses tagName to get account specific info | |
* @param {*} tagName | |
* @returns JSON with error or success | |
*/ | |
const account = (tagName) => { | |
return JSON.stringify({ | |
query: `{ | |
actor { |
NewerOlder