2018-08-29 23:42:22 +03:00
# platform-chaos-api
2018-09-04 20:51:13 +03:00
[![Build Status ](https://travis-ci.org/Azure/platform-chaos-api.svg?branch=master )](https://travis-ci.org/Azure/platform-chaos-api)
2018-09-14 19:14:17 +03:00
[![Deploy to Azure ](https://azuredeploy.net/deploybutton.png )](https://azuredeploy.net/)
2018-08-29 23:42:22 +03:00
2018-09-04 20:51:13 +03:00
An API that surfaces the functionality of the [CLI ](https://github.com/Azure/platform-chaos-cli ) for [Platform Chaos ](https://github.com/Azure/platform-chaos ). :cloud:
![hero image ](.github/hero.png )
2018-08-29 23:42:22 +03:00
This simply surfaces the `chaos` functionality via authenticated API.
By default, this runs on port `3000` - but that can be configured with the `PORT` environment variable.
To configure this authentication layer, use the following environment variables:
+ `AUTH_CLIENT_ID` - an AzureAD application client id
+ `AUTH_ISSUER` - the AzureAD issuer
+ `AUTH_AUDIENCE` - the AzureAD audience
See [passport-azure-ad ](https://github.com/AzureAD/passport-azure-ad#5212-options ) for more details.
2018-09-14 19:14:17 +03:00
To configure a deployment of this repo, refer to the [wiki page ](https://github.com/Azure/platform-chaos-api/wiki/Walkthrough:-Deploy-and-Authenticate ) which contains detailed instructions.
2018-08-29 23:42:22 +03:00
## API
> All endpoints require `Authentication: Bearer <token>` header authentication values for the configured AzureAD application.
### GET /extensions
Returns all registered extensions, as an array:
```
[
{
"name": "test",
"desc": "test desc",
"uri": "https://test.com"
}
]
```
### POST /extensions
Creates a new extension. Takes `name, uri, desc` as parts of a json payload.
### GET /extensions/:extId
Gets a particular extension. Takes `extId` (the name of the extension) as part of the path.
```
{
"name": "test",
"desc": "test desc",
"uri": "https://test.com"
}
```
### POST /extensions/:extId/start
Starts an extension. Takes `extId` (the name of the extension) as part of the path.
Optionally takes `?code=<value>` as a query parameter, where `code` is passed along
to the extension. Takes `accessToken` and `resources` as parts of a json payload.
### POST /extensions/:extId/stop
Stops an extension. Takes `extId` (the name of the extension) as part of the path.
Optionally takes `?code=<value>` as a query parameter, where `code` is passed along
to the extension. Takes `accessToken` and `resources` as parts of a json payload.
### DELETE /extensions/:extId
Deletes an extension. Takes `extId` (the name of the extension) as part of the path.
2018-09-04 20:51:13 +03:00
## Related Projects
2018-08-29 23:42:22 +03:00
2018-09-04 20:51:13 +03:00
* [platform-chaos ](https://github.com/Azure/platform-chaos ) - A Node.js SDK for building services capable of injecting chaos into PaaS offerings.
* [platform-chaos-cli ](https://github.com/Azure/platform-chaos-cli ) - A tool for introducing chaos into Azure PaaS offerings using configurable extensions.
2018-08-29 23:42:22 +03:00
# Contributing
2018-09-04 20:51:13 +03:00
This project welcomes contributions and suggestions! Here's what you need to know to get started.
### Feedback and Feature Requests
> When you're ready, you can open issues [here](https://github.com/Azure/platform-chaos-api/issues)!
To submit feedback or request features please do a quick search for similar issues,
then open a new issue. If you're requesting a new feature, please briefly explain in the issue what scenario you're planning to use the feature for.
### Development Requirements
To get started developing, you'll need to first ensure you have these tools installed:
* [Git ](https://git-scm.com )
* [NodeJS ](https://nodejs.org )
Once you've installed those, clone this repository and install dependencies:
```
git clone https://github.com/Azure/platform-chaos.git
cd platform-chaos
npm install
```
Now you're ready to begin contributing!
2018-09-07 00:27:57 +03:00
### Testing and Linting
To run the tests for this project, use npm to run the linter and the tests locally.
```
npm test
```
Note this command is meant to be run from the project directory (the folder you cloned the project into). It will run the linter and then if the linter pass is successful, then the tests will run. To run the linter separately from the tests, run:
```
npm run lint
```
2018-09-04 20:51:13 +03:00
### Legal
Most contributions require you to agree to a
2018-08-29 23:42:22 +03:00
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
2018-09-04 20:51:13 +03:00
### Code of Conduct
2018-08-29 23:42:22 +03:00
This project has adopted the [Microsoft Open Source Code of Conduct ](https://opensource.microsoft.com/codeofconduct/ ).
For more information see the [Code of Conduct FAQ ](https://opensource.microsoft.com/codeofconduct/faq/ ) or
contact [opencode@microsoft.com ](mailto:opencode@microsoft.com ) with any additional questions or comments.