The Auto Cleanup API is a serverless Lambda-based API built to facilitate the website. The architecture diagram below illustrates the various services and their relationships with one another.
-
Ensure the APP module has been deployed and invoked at least once prior to deploying this module
-
Change directory
cd aws-auto-cleanup/api/
-
Install dependencies
npm install
-
Deploy
npm run deploy -- [--region] [--aws-profile]
-
After the deployment has completed, annotate the api key as it's the x-api-key needed to call the API and to use in the web app.
-
Change directory
cd aws-auto-cleanup/api/
-
Remove
npm run remove -- [--region] [--aws-profile]
Inserts a new whitelist entry into DynamoDB.
URL: /whitelist/entry
Method: POST
Auth required: x-api-key
Permissions required: None
{
"resource_id": "string",
"owner": "string",
"comment": "string",
"permanent": "bool"
}
-
(dict)
-
resource_id (string) -- [REQUIRED] Unique resource ID in format
service:resource:id
. For a list of acceptable values, see this table. -
owner (string) -- The email address belonging to the owner of the whitelist entry.
-
comment (string) -- Comment associated with the whitelist entry.
-
permanent (bool) -- If the whitelist entry should be created as a permanent.
-
dict
{
"message": "string",
"request": {
"resource_id": "string",
"owner": "string",
"comment": "string"
},
"response": {
"resource_id": "string",
"expiration": "epoch",
"owner": "string",
"comment": "string"
}
}
-
(dict)
-
message (string) -- If the operation was successful, the value will denote the action taken. Otherwise, the value will contain an error message.
-
request (dict) -- Request payload.
-
response (dict) -- Response payload.
-
resource_id (string) -- Whitelist entry resource ID.
-
expiration (epoch) -- Epoch timestamp when the whitelist entry will expire.
-
owner (string) -- The name or email address belonging to the owner of the whitelist entry.
-
comment (string) -- Comment associated with the whitelist entry.
-
-
-
AWS service (e.g.
s3
) and resource (e.g.bucket
) will be evaluated against the Settings table to ensure they are valid. -
The
expiration
field is computed at insert time. Current time plusttl
from the Settings table are used to compute the value.
Returns the entire whitelist table.
URL: /whitelist
Method: GET
Auth required: x-api-key
Permissions required: None
N/A
N/A
dict
{
"message": "string",
"request": null,
"response": {
"whitelist": [
{
"resource_id": "string",
"expiration": "epoch",
"owner": "string",
"comment": "string"
}
]
}
}
-
(dict)
-
message (string) -- If the operational was successful, the value will denote the action taken. Otherwise, the value will contain an error message.
-
request (dict) -- Request payload.
-
response (dict) -- Response payload.
-
whitelist (list) -- List of all whitelist entries.
-
(dict)
-
resource_id (string) -- Whitelist entry resource ID.
-
expiration (epoch) -- Epoch timestamp when the whitelist entry will expire.
-
owner (string) -- The name or email address belonging to the owner of the whitelist entry.
-
comment (string) -- Comment associated with the whitelist entry.
-
-
-
-
Updates an existing whitelist entry into DynamoDB. This is not meant to be used to update the owner
or comment
fields, but rather to extend the expiration
date to ensure the resources are kept alive for longer.
URL: /whitelist/entry
Method: PUT
Auth required: x-api-key
Permissions required: None
{
"resource_id": "string",
"expiration": "epoch",
"owner": "string",
"comment": "string"
}
-
(dict)
-
resource_id (string) -- [REQUIRED] Unique resource ID in format
service:resource:id
. For a list of acceptable values, see this table. -
expiration (epoch) -- [REQUIRED] Epoch timestamp of the existing whitelist entry.
-
owner (string) -- The name or email address belonging to the owner of the whitelist entry.
-
comment (string) -- Comment associated with the whitelist entry.
-
dict
{
"message": "string",
"request": {
"resource_id": "string",
"expiration": "epoch",
"owner": "string",
"comment": "string"
},
"response": {
"resource_id": "string",
"expiration": "epoch",
"owner": "string",
"comment": "string"
}
}
-
(dict)
-
message (string) -- If the operational was successful, the value will denote the action taken. Otherwise, the value will contain an error message.
-
request (dict) -- Request payload.
-
response (dict) -- Response payload.
-
resource_id (string) -- Whitelist entry resource ID.
-
expiration (epoch) -- Extended Epoch timestamp when the whitelist entry will expire.
-
owner (string) -- The name or email address belonging to the owner of the whitelist entry.
-
comment (string) -- Comment associated with the whitelist entry.
-
-
-
AWS service (e.g.
s3
) and resource (e.g.bucket
) will be evaluated against the Settings table to ensure they are valid. -
The new
expiration
field value is computed by using the value from the payload and adding to it thettl
value from the Settings table.
Deletes a new whitelist entry into DynamoDB.
URL: /whitelist/entry
Method: DELETE
Auth required: x-api-key
Permissions required: None
{
"resource_id": "string"
}
-
(dict)
- resource_id (string) -- [REQUIRED] Unique resource ID in format
service:resource:id
. For a list of acceptable values, see this table.
- resource_id (string) -- [REQUIRED] Unique resource ID in format
dict
{
"message": "string",
"request": {
"resource_id": "string"
},
"response": {
"resource_id": "string"
}
}
-
(dict)
-
message (string) -- If the operational was successful, the value will denote the action taken. Otherwise, the value will contain an error message.
-
request (dict) -- Request payload.
-
response (dict) -- Response payload.
- resource_id (string) -- Whitelist entry resource ID that was deleted.
-
Returns a list of all Auto Cleanup App executions in descending order
URL: /execution
Method: GET
Auth required: x-api-key
Permissions required: None
N/A
N/A
dict
{
"message": "string",
"request": null,
"response": { "logs": [{ "key": "string", "date": "string" }] }
}
-
(dict)
-
message (string) -- If the operational was successful, the value will denote the action taken. Otherwise, the value will contain an error message.
-
request (dict) -- Request payload.
-
response (list) -- Response payload.
-
logs (list) -- List of all execution logs.
-
(dict)
-
key (string) -- S3 key.
-
date (string) -- Locale’s appropriate date and time representation.
-
-
-
-
Returns executions logs for a particular Auto Cleanup execution log S3 key.
URL: /execution/{key}
Method: GET
Auth required: x-api-key
Permissions required: None
{key}
- key -- [REQUIRED] S3 key, URL encoded.
dict
{
"message": "string",
"request": { "key": "string" },
"response": { "header": ["string"], "body": [["string"]] }
}
-
(dict)
-
message (string) -- If the operational was successful, the value will denote the action taken. Otherwise, the value will contain an error message.
-
request (dict) -- Request payload.
-
response (list) -- Response payload.
-
(dict)
-
header (list) -- List of column headers.
- string
-
body (list) -- List of execution log records.
-
(list)
- string
-
-
-
-
Returns a list AWS services that are supported by Auto Cleanup.
URL: /settings/service
Method: GET
Auth required: x-api-key
Permissions required: None
N/A
N/A
dict
{
"message": "string",
"request": null,
"response": {
"string": { "string": { "clean": bool, "ttl": 123, "id": "string" } }
}
}
-
(dict)
-
message (string) -- If the operational was successful, the value will denote the action taken. Otherwise, the value will contain an error message.
-
request (dict) -- Request payload.
-
response (dict) -- Response payload.
-
service (dict)
-
resource (dict)
-
clean (boo) -- Indicator if the AWS service resource will be cleaned
-
ttl (123) -- Default time-to-live for the AWS service resource
-
id (string) -- Type of resource ID required for whitelisting
-
-
-
-