Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added target-server flag to generateApi options and target endpoint generation #21

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/openapi2apigee
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ program
.option('-t, --token <token>', 'Apigee Edge Auth Token to Deploy')
.option('-U, --backendurl <backendurl>','Specify the target backend url')
.option('-O, --oauth <oauth>','Apigee enable oauth')
.option('-T, --target-server <targetserver>', 'Apigee existing target server')

.description('Generates Apigee API Bundle')
.action(function(apiProxy, options) {
Expand Down
10 changes: 9 additions & 1 deletion lib/commands/generateApi/generateTargetEndPoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ module.exports = function generateTargetEndPoint (apiProxy, options, api, cb) {

if (options.backendurl) {
httpTargetConn.ele('URL', {}, options.backendurl)
} else {
}
else if (options.targetServer) {
httpTargetConn.ele('LoadBalancer')
.ele('Server', {'name': options.targetServer})
if (options.basepath) {
httpTargetConn.ele('Path', {}, options.basepath)
}
}
else {
if (api.openapi) {
httpTargetConn.ele('URL', {}, api.servers[0].url)
} else {
Expand Down