forked from apigee/apigeetool-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented Issue apigee#159 - Flow Hooks
- Loading branch information
1 parent
4b45e36
commit a010f42
Showing
9 changed files
with
370 additions
and
13 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,52 @@ | ||
/* jshint node: true */ | ||
'use strict'; | ||
|
||
var util = require('util'); | ||
var _ = require('underscore'); | ||
|
||
var defaults = require('../defaults'); | ||
var options = require('../options'); | ||
var command_utils = require('./command-utils') | ||
|
||
var descriptor = defaults.defaultDescriptor({ | ||
environment: { | ||
name: 'Environment', | ||
shortOption: 'e', | ||
required: true, | ||
prompt: true | ||
}, | ||
flowHookName: { | ||
name: 'One of: PreProxyFlowHook\n PreTargetFlowHook\n PostTargetFlowHook\n PostProxyFlowHook', | ||
required: true, | ||
prompt: true | ||
}, | ||
sharedFlowName: { | ||
name: 'Shared Flow name', | ||
required: true, | ||
prompt: true | ||
} | ||
}); | ||
|
||
module.exports.descriptor = descriptor; | ||
|
||
module.exports.run = function(opts, cb) { | ||
if (opts.debug) { | ||
console.log('attachFlowHook: %j', opts); | ||
} | ||
var payload = { | ||
"continueOnError" : true, | ||
"sharedFlow" : opts.sharedFlowName | ||
} | ||
if(opts.targetSSL){ | ||
payload.sSLInfo = {enabled: true} | ||
} | ||
|
||
var uri = util.format('%s/v1/o/%s/e/%s/flowhooks/%s', opts.baseuri, opts.organization, opts.environment, opts.flowHookName); | ||
var requestOpts = { | ||
uri: uri, | ||
method:'POST', | ||
body: payload, | ||
json:true | ||
} | ||
command_utils.run('attachFlowHook',opts, requestOpts, cb) | ||
}; |
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,42 @@ | ||
/* jshint node: true */ | ||
'use strict'; | ||
|
||
var util = require('util'); | ||
var _ = require('underscore'); | ||
|
||
var defaults = require('../defaults'); | ||
var options = require('../options'); | ||
var command_utils = require('./command-utils') | ||
|
||
var descriptor = defaults.defaultDescriptor({ | ||
environment: { | ||
name: 'Environment', | ||
shortOption: 'e', | ||
required: true, | ||
prompt: true | ||
}, | ||
flowHookName: { | ||
name: 'One of: PreProxyFlowHook\n PreTargetFlowHook\n PostTargetFlowHook\n PostProxyFlowHook', | ||
required: true, | ||
prompt: true | ||
} | ||
}); | ||
|
||
module.exports.descriptor = descriptor; | ||
|
||
module.exports.run = function(opts, cb) { | ||
if (opts.debug) { | ||
console.log('detachFlowHook: %j', opts); | ||
} | ||
if(opts.targetSSL){ | ||
payload.sSLInfo = {enabled: true} | ||
} | ||
|
||
var uri = util.format('%s/v1/o/%s/e/%s/flowhooks/%s', opts.baseuri, opts.organization, opts.environment, opts.flowHookName); | ||
var requestOpts = { | ||
uri: uri, | ||
method:'DELETE', | ||
json:true | ||
} | ||
command_utils.run('detachFlowHook',opts, requestOpts, cb) | ||
}; |
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,42 @@ | ||
/* jshint node: true */ | ||
'use strict'; | ||
|
||
var util = require('util'); | ||
var _ = require('underscore'); | ||
|
||
var defaults = require('../defaults'); | ||
var options = require('../options'); | ||
var command_utils = require('./command-utils') | ||
|
||
var descriptor = defaults.defaultDescriptor({ | ||
environment: { | ||
name: 'Environment', | ||
shortOption: 'e', | ||
required: true, | ||
prompt: true | ||
}, | ||
flowHookName: { | ||
name: 'One of: PreProxyFlowHook\n PreTargetFlowHook\n PostTargetFlowHook\n PostProxyFlowHook', | ||
required: true, | ||
prompt: true | ||
} | ||
}); | ||
|
||
module.exports.descriptor = descriptor; | ||
|
||
module.exports.run = function(opts, cb) { | ||
if (opts.debug) { | ||
console.log('getFlowHook: %j', opts); | ||
} | ||
if(opts.targetSSL){ | ||
payload.sSLInfo = {enabled: true} | ||
} | ||
|
||
var uri = util.format('%s/v1/o/%s/e/%s/flowhooks/%s', opts.baseuri, opts.organization, opts.environment, opts.flowHookName); | ||
var requestOpts = { | ||
uri: uri, | ||
method:'GET', | ||
json:true | ||
} | ||
command_utils.run('getFlowHook',opts, requestOpts, cb) | ||
}; |
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
Oops, something went wrong.