Skip to content

Commit

Permalink
Merge pull request #6 from kmcgrath/master
Browse files Browse the repository at this point in the history
[src] add MrScalerAwsService
  • Loading branch information
kmcgrath authored May 5, 2019
2 parents 964a196 + 6357819 commit e0e7194
Show file tree
Hide file tree
Showing 8 changed files with 2,526 additions and 1,410 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [1.0.32] - 2019-05-04
### Added
- config.setAccount - add accountId to SDK requests
- ENV option to set SPOTINST_ACCOUNT and SPOTINST_TOKEN
- MrScalerAwsService - to list, create and remove MrScaler EMR clusters



82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { Client, config } from 'spotinst-sdk-nodejs';
// Instantiate new client.
const clientOpts = [
config.setToken('foo'),
config.setAccount('act-XXXXXX')
];
const client = new Client(...clientOpts);
```
Expand Down Expand Up @@ -87,6 +88,87 @@ client.AwsGroupService.read({id: 'sig-bar'}, (err, groups) => {
});
```

## Available Servies

Services and actions are formatted as `client.SERVICE.ACTION()`

**Example:**
```
client.AwsGroupService.list()
.then((groups) => {
console.log(groups);
// do something with groups
})
.catch((err) => {
console.error(err);
// do something with err
});
```

### AwsGroupService
Manage Spotinst Elastigroups

**Actions:**
* create
* read
* list
* update
* delete
* status

### AwsGroupRollService
Manage Elastigroups with AWS EMR integration

**Actions:**
* start
* stop
* list
* read

### AwsInstanceService
Manage a single instance within an Elastigroup

**Actions:**
* read
* detach
* signal

### AwsSpotService
Describes a specific Spot Instance Request

**Actions:**
* read

### SubscriptionService
Manage Spotinst Subscriptions

**Actions:**
* create
* read
* list
* update
* delete

### SpectrumService.Event
Manage Spectrum Events

**Actions:**
* create
* read
* list
* update
* delete

### MrScalerAwsService
Manage Elastigroups with AWS EMR integration

**Actions:**
* create
* read
* list
* update
* delete

## Documentation

For a comprehensive list of examples, check out the [API documentation](https://api.spotinst.com/).
Expand Down
102 changes: 102 additions & 0 deletions examples/mrscaler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
var spotinst = require('spotinst-sdk-nodejs');

const clientOpts = [
];

// Instantiate new client.
var client = new spotinst.Client(...clientOpts);


let emrJson = {
"mrScaler": {
"name": "kevin-emr-test",
"description": "Kevin EMR test for nodejs sdk",
"region": "us-west-2",
"strategy": {
"new": {
"releaseLabel": "emr-5.20.0"
}
},
"compute": {
"availabilityZones": [
{
"name": "us-west-2a",
"subnetId": "subnet-02297335338642"
},
{
"name": "us-west-2b",
"subnetId": "subnet-0cb5a07e1df98b"
}
],
"instanceGroups": {
"masterGroup": {
"instanceTypes": [
"m4.large"
],
"target": 1,
"lifeCycle": "ON_DEMAND"
},
"coreGroup": {
"instanceTypes": [
"m4.large"
],
"capacity": {
"target": 1,
"minimum": 1,
"maximum": 1,
"unit": "instance"
},
"lifeCycle": "SPOT"
},
"taskGroup": {
"instanceTypes": [
"m4.large"
],
"capacity": {
"target": 1,
"minimum": 1,
"maximum": 1,
"unit": "instance"
},
"lifeCycle": "SPOT"
}
},
"ec2KeyName": "kevin",
"emrManagedMasterSecurityGroup": "sg-8cfb4654",
"emrManagedSlaveSecurityGroup": "sg-f2f94987"
},
"scheduling": {},
"scaling": {},
"coreScaling": {}
}
}

client.MrScalerAwsService.create(emrJson)
.then((mrscalers) => {
console.log(mrscalers);
// do something with groups
})
.catch((err) => {
console.error(err);
// do something with err
});

client.MrScalerAwsService.list()
.then((mrscalers) => {
console.log(mrscalers);
// do something with groups
})
.catch((err) => {
console.error(err);
// do something with err
});

client.MrScalerAwsService.delete({id: "simrs-d4b3b432"})
.then((mrscalers) => {
console.log(mrscalers);
// do something with groups
})
.catch((err) => {
console.error(err);
// do something with err
});
Loading

0 comments on commit e0e7194

Please sign in to comment.