Find all the proxies using a particular shared flow (Non NodeJS)

Dear All,

Is there a way other than NodeJs script to find all proxies names along with deployment environment and revision information based on particular shared flow name?

(Note : We have on-premise setup)

Thanks in advance!

0 9 705
9 REPLIES 9

Well sure, you can do it. You'd need to write a script. Any language.

You said no nodejs; so that rules out the apigee-edge-js library which wraps the Apigee Admin API.

But there's a powershell module that can help you; it does the same thing but for powershell.

or the golang library, which is a bit less mature.

And the PHP client wrapper.

If you don't like any of those you could just write a script in python, or something else. (I don't know of a python wrapper for the Apigee Admin API.)

Regardless of the language you choose to use to implement this, the logic would be:

  • query all the API proxies
  • for each proxy, query all the revisions
  • for each revision, look for FlowCallout policies
  • For each of those, look for the match for your particular shared flow
  • if match, then determine if the proxy is deployed, and if so, which environment.

It's unfortunate you don't want to use nodejs, because a script already exists. Maybe you could use it as a pattern.

Edit

Here's an example using the PowerShell module. LINK. Note: you need to use the develop branch in order to get the new Get-EdgeApiPolicy function.

Thank you Dino for quick and perfect response. It's useful. Will explore.

@Dino-at-Google : We are planning to use your PowerShell module. Does entity type : apis list down proxies details if we pass 'sharedflow' name in 'query'?

I believe so, but let me test it to be sure. If not, I'll update the module to make sure it works the way you need it to work. I use nodejs primarily, so I generally make improvements and enhancements in apigee-edge-js first; the Powershell module is a fast follower.

I'll get back to you in a bit.

Yes I’ve updated the powershell module with a new cmdlet and example. Check it out via github.

Hi @Dino-at-Google : We are having the same query.
Also are getting below Exception after importing PSApigeeEdge

getType: System.Management.Automation.ErrorRecord
The remote server returned an error: (407) Proxy Authentication Required.
stacktrace: at Get-EdgeNewAdminToken<Process>, C:\Users\<userid>\Powershell\Edge-Powershell-Admin-develop\PSApigeeEdge\Public\Get-EdgeNewAdminToken.ps1: line 131
at Set-EdgeConnection<Process>, C:\Users\<userid>\Powershell\Edge-Powershell-Admin-develop\PSApigeeEdge\Public\Set-EdgeConnection.ps1: line 224
at <ScriptBlock>, <No file>: line 1

while trying to establish connection by using Set-EdgeConnection -Org <ourorgname>
-User <userid> -MgmtUri <our_edge_mgmturl>
command

Could you please help us ?

Thanks in Advance !

"Proxy Authentication Required" sounds like an error that is coming from your network.

It's possible the PS-Apigee-Edge library is trying tocall to a management server located at api.enterprise.apigee.com . This is the right endpoint if you use Apigee SaaS. If you use OPDK, you need to specify a different management server endpoint. Consult the docs for the powershell module for how to do that.

Can we find all the proxies list using a particular shared flow in ApigeeX?

Yes, using apigee-scanner.

Example:

node ./scanProxies.js --token $TOKEN --apigeex --org $ORG--latestrevision --sharedflowuse MY-SHARED-FLOW-NAME