1.0.1 • Published 6 years ago

cf-helpers v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

Cloud Formation Helpers

This library is untested and is a set of wrappers around the standard AWS NodeJS SDK functions which are much more capable. Use this library at your own risk.

Importing the library

let cfh = require('cf-helpers')({region: 'ap-southeast-2'});

Structure of CFHelpers class

// Structure of class returned from require('cf-helpers')
class CFHelpers{
    constructor({region}) => new CFHelpers()

    getRegion() => string

    stackExists({name}) => Promise, resolves(exists: boolean), rejects(err: Error)

    listStacks() => Promise, resolves(stacks: object[]), rejects(err: Error)

    createStack({template}) => Promise, resolves(created?: boolean), rejects(err: Error)

    updateStack({template}) => Promise, resolves(exists: boolean), rejects(err: Error)

    getExports({name}) => Promise, resolves(exports: object[]), rejects(err: Error)

    stackStatus({name}) => Promise, resolves(status: string), rejects(err: Error)
}

Checking if a stack exists

let cf = require('cf-helpers');

// returns a Promise
cf.stackExists('stack name')
    .then((exists: boolean) => { 
        // Do some work
    })
    .catch((err: Error) => {
        // Handle error case
    });

Listing all stacks and their current status

let cf = require('cf-helpers');

// returns a Promise
cf.listStacks('stack name')
    .then((stacks: object[]) => { 
        // Do some work

        stacks = [
            {
                StackName : "name of stack",
                StackStatus : "CREATE_IN_PROGRESS" | "CREATE_COMPLETE" | "ROLLBACK_IN_PROGRESS" | "ROLLBACK_FAILED" | "ROLLBACK_COMPLETE" | "DELETE_IN_PROGRESS" | "DELETE_FAILED" | "UPDATE_IN_PROGRESS" | "UPDATE_COMPLETE_CLEANUP_IN_PROGRESS" | "UPDATE_COMPLETE" | "UPDATE_ROLLBACK_IN_PROGRESS" | "UPDATE_ROLLBACK_FAILED" | "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS" | "UPDATE_ROLLBACK_COMPLETE"
                // Other useful properties exist
            }
        ]
    })
    .catch((err: Error) => {
        // Handle error case
    });
1.0.1

6 years ago

1.0.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago