# marathon-node

> Node.js client library for Mesos Marathon's REST API

Latest version **1.1.1** (published 2020-11-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install marathon-node
pnpm add marathon-node
yarn add marathon-node
bun add marathon-node
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2020-11-17 |
| First published | 2015-11-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 52.2 KB |
| Known vulnerabilities | 0 (+6 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 8 |
| Author | elastic.io |
| Maintainers | drobiazko, vi6x, irisk, jhorbulyk, umkaline, arsenzhd, shkarupanick, gladikov.denis, olga.virolainen, garry_ua, kirill-levitskiy, zuker, kotenko.ant, vitaliy_kovalchuk, annekov |

## Links

- npm: https://www.npmjs.com/package/marathon-node
- Repository: https://github.com/elasticio/marathon-node
- Issues: https://github.com/elasticio/marathon-node/issues
- npm.io page: https://npm.io/package/marathon-node

## Dependencies (5)

- [lodash](https://npm.io/package/lodash.md) 4.17.20
- [request](https://npm.io/package/request.md) 2.87.0
- [bluebird](https://npm.io/package/bluebird.md) 3.7.2
- [eventsource](https://npm.io/package/eventsource.md) 1.0.7
- [request-promise](https://npm.io/package/request-promise.md) 3.0.0

## Recent versions

- 1.1.1 (latest) — 2020-11-17
- 1.1.0-dev.0 (dev) — 2017-06-23
- 1.1.0 — 2017-06-23
- 1.0.5 — 2017-01-13
- 1.0.4 — 2016-12-25
- 1.0.3 — 2016-11-21
- 1.0.2 — 2016-06-20
- 1.0.0 — 2016-05-29
- 0.0.3 — 2016-01-11
- 0.0.2 — 2016-01-11
- 0.0.1 — 2015-11-19

## README

# marathon-node [![CircleCI](https://circleci.com/gh/elasticio/marathon-node.svg?style=svg)](https://circleci.com/gh/elasticio/marathon-node)
Node.js client library for Mesos Marathon's REST API powered by Bluebird promises.

```javascript
const opts = {};
const marathon = require('marathon-node')(MARATHON_URL, opts);
marathon.app
  .getList()
  .then(console.log)
  .catch(console.error);
```

## Options
Options passed to [request](https://github.com/request/request) lib. Overview of all the options is [here](https://github.com/request/request#requestoptions-callback).

***HTTP Authentication example:***
```javascript
const opts = {
    auth: {
        user: 'foo',
        pass: 'baz'
    }
};
```

***Other options:***
- `logTime` - if `true`, logs requests time to console

## Marathon Event Bus

To manage event stream [EventSource](https://github.com/EventSource/eventsource) client is used.

***Example:***

```javascript
const marathon = require('marathon-node')(MARATHON_URL, opts);

const eventSourceOpts = {
    eventType: ['status_update_event'], // (string|array) Marathon will stream only this kind of events. (optional, Marathon >= 1.3.7)
    proxy: 'http://your.proxy.com' // (string) Proxy host (optional)
};
const es = marathon.events.createEventSource(eventSourceOpts);
es.addEventListener('status_update_event', event => console.log('status_update_event'));
es.on('open', () => console.log('opened'));
es.on('error', err => console.error(err));
```

You can find more info in the official documentation [Marathon Event Bus docs](https://mesosphere.github.io/marathon/docs/event-bus.html).

## Methods

#### Apps (marathon.apps.methodName)
- `getList(parameters)`
- `getOne(id)`
- `getVersions(id)`
- `getVersion(id, version)`
- `getTasks(id)`
- `create(body)`
- `update(id, body, force)`
- `restart(id, force)`
- `destroy(id)`
- `killTasks(id, parameters)`
- `killTask(id, task, scale)`

#### Groups (marathon.groups.methodName)
- `getList()`
- `create(body)`
- `getOne(id)`
- `update(id, body, force)`
- `destroy(id, force)`

#### Tasks (marathon.tasks.methodName)
- `getList()`
- `kill(body, scale, wipe)`

#### Deployments (marathon.deployments.methodName)
- `getList()`
- `destroy(id)`

#### Event Stream (marathon.events.methodName)
- `attach()` (deprecated)
- `createEventSource(opts)`

#### Event Subscriptions (marathon.subscriptions.methodName)
- `getList()`
- `create(callbackUrl)`

#### Queue (marathon.queue.methodName)
- `get()`
- `resetDelay(appId)`

#### Server Info (marathon.info.methodName)
- `get()`

#### Leader (marathon.leader.methodName)
- `get()`
- `abdicate()`

#### Miscellaneous (marathon.misc.methodName)
- `ping()`

---
_Source: https://npm.io/package/marathon-node · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
