Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for Google Compute Engine
- Loading branch information
Benjamin Coe
committed
Jun 3, 2016
1 parent
91efc03
commit 925ca10
Showing
5 changed files
with
53 additions
and
0 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
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,18 @@ | ||
const assign = require('lodash.assign') | ||
const GCEIP = require('gce-ips') | ||
|
||
function GCE (opts) { | ||
assign(this, { | ||
name: 'gce' | ||
}, opts) | ||
} | ||
|
||
GCE.prototype.list = function (cb) { | ||
GCEIP().lookup(function (err, ips) { | ||
return cb(err, ips) | ||
}) | ||
} | ||
|
||
module.exports = function (opts) { | ||
return new GCE(opts) | ||
} |
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,16 @@ | ||
/* global describe, it */ | ||
|
||
require('chai').should() | ||
|
||
const GCE = require('../lib/gce') | ||
|
||
describe('GCE', function () { | ||
it('returns a list of IP ranges for GCE', function (done) { | ||
const gce = GCE() | ||
gce.list(function (err, ranges) { | ||
if (err) return done(err) | ||
ranges.should.include('8.34.208.0/20') | ||
return done() | ||
}) | ||
}) | ||
}) |
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