Giter Club home page Giter Club logo

pitchfork's Introduction

Build Status

Pitchfork

Rackspace Cloud API Interactive Application

Using a browser you can execute any Rackspace API command for any Cloud product without the need to get on a command line or use another CLI tool.

To use the application just login with your username and Cloud Account API key.

The application is divided up by the different cloud products that are available to all customers. Each call includes the following information:

  • Variables needed with descriptions, data types, and what is required
  • Endpoint and URI
  • Links to the API docs specific section for the call you are needing more information for.

For each API call you will be shown the following information in the browser.

  • Request URL
  • Request Headers
  • Request Object (If data object is used i.e. on Create and Update Statements)
  • Response Headers
  • Response Body

Warnings are on the calls that do things that could potentially impact an account (creates, updates, deletes, etc.).

Mocking is available to allow for the call to be built out using the parameters you have chosen so you can see all of the details. The only difference is the call will not actually be executed.

Note: You do not have to login to the application in order to use the Mock capability for any product

View the public version at https://pitchfork.cloudapi.co

Want to run it locally?

All you need is Python 2.7, Mongodb, and a web browser

Create a virtual environment

Note: The below example uses virtualenvwrapper

mkvirtualenv pitchfork
cd pitchfork
git clone https://github.com/oldarmyc/pitchfork.git
cd pitchfork
workon pitchfork
Use pip to install the requirements:
pip install -r requirements.txt
Setup the config file:
cp pitchfork/config/config.example.py pitchfork/config/config.py
vi pitchfork/config/config.py

Change the following for your setup:
MONGO_DATABASE : Database name to use
ADMIN : Cloud account username for first admin
ADMIN_NAME : Full name of admin for the account above SECRET_KEY : Used for sessions

Optional Additions:
MONGO_USER = 'Username for mongo database instance'
MONGO_PASS = 'Password for mongo database instance'

You can add to the KWARGS config item to add a replica set.
MONGO_KWARGS = {'tz_aware': True, 'replicaSet': 'my_replica_set'}

For more information on the options for Mongo see the hapPyMongo documentation.
https://github.com/sivel/happymongo

Running the Application:

After you have saved the config file and your mongo database is up and running, run the following command to start the application.

python runapp.py

Browse to http://localhost:5000 to view the application and login using your Cloud credentials

Upgrading

To upgrade an existing install to work with the recent changes do the following:

git pull origin master
pip install -r requirements

Log into mongodb. The command below assumes the database is named pitchfork.

use pitchfork
db.settings.remove()
db.api_settings.remove()
db.reporting.remove()

Browse to the home page and after it loads refresh the page. The refresh will force the app to repopulate the settings, reporting, and api_settings collections automatically to work with the new changes.

Adding API Calls

Pitchfork API Calls

The download above will provide all of the mongodb bson files for each of the Rackspace products. Once you download the files you can do the following to restore all of the product collections to the pitchfork database.

tar xzvf api_calls.tar.gz
mongorestore -d pitchfork --drop pitchfork/

Note: If you have added your own calls into the collections you can omit the --drop in the call above, and the calls will be added to the existing collection.

Testing

The application unit tests can be run with nose and selenium. To install the requirements to run test do the following in your virtual environment

pip install nose coverage selenium

Selenium was setup to use firefox when the tests are run. However you can update the following to use the driver of your choice.

Note: If you do not have Firefox the tests will be skipped

def setUpClass(cls):
    try:
        cls.client = webdriver.Firefox()
    except:
        pass

Documentation for selenium can be found here: http://selenium-python.readthedocs.org/en/latest/

Once you are ready to run the tests do the following. Run tests only

nosetests

Run tests with verbosity to see what tests are being run

nosetests -v

Run tests with coverage

nosetests --with-coverage --cover-erase --cover-package pitchfork

Note: Selenium tests uses port 5000 when running so ensure the application is not already running or some tests will fail.

pitchfork's People

Contributors

maxlinc avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.