StevenMHernandez / capstone

VCU Capstone with Capital One
1 stars 0 forks source link

List available ASVs #2

Open StevenMHernandez opened 6 years ago

StevenMHernandez commented 6 years ago
StevenMHernandez commented 6 years ago

Step 1

We are already pulling in all the data with the functions like loadEC2, so let's just create a function that compiles all of these resources into an array of ASV Tags.

f(x) -> y

where x is something like the following:

{ Tags: 
   [ { Key: 'ASV',
       ResourceId: 'vol-0962f1d2bed5c11ba',
       ResourceType: 'volume',
       Value: 'PROD_SERVER' },
     { Key: 'ASV',
       ResourceId: 'i-062a2dacd66b38e05',
       ResourceType: 'instance',
       Value: 'STAGING_SERVER' },
     { Key: 'Name',
       ResourceId: 'vol-0ee6acfadaed219fb',
       ResourceType: 'volume',
       Value: 'personal' },
     { Key: 'ASV',
       ResourceId: 'i-01c5cababad8203a8',
       ResourceType: 'instance',
       Value: 'PROD_SERVER' },
]

and y is

[
  "PROD_SERVER",
  "STAGING_SERVER",
]
StevenMHernandez commented 6 years ago

Step 2

We need to turn this into some item that can be returned to the user.

~Do we want to return just a message with text or should we generate an image on the fly?~

We are going to just return a text based message. So, for step 2, we need to concatenate all of the string from step one with \r\n. So the above would be:

PROD_SERVER\r\n STAGING_SERVER

StevenMHernandez commented 6 years ago

Step 3 (Steven)

We need to setup the AWS Lambda to handle new incoming slack messages

StevenMHernandez commented 6 years ago

Setp 4 (Steven)

Hook up Slack "slash command" to run the AWS Lambda

StevenMHernandez commented 6 years ago

@vadrevua create a new file src/listAsv/index.js which contains a function that returns a string "Here is a list of available ASVs: 1,2,3 . . ."