-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from kmcgrath/master
[src] add MrScalerAwsService
- Loading branch information
Showing
8 changed files
with
2,526 additions
and
1,410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); |
Oops, something went wrong.