How to notify shared flow consumers if any breaking changes in Shared flow

when one of the shared flows is manipulated with a breaking change - requiring the proxy owners to update their APIs accordingly. Please suggest the idea and if any implementation tool.

0 6 173
6 REPLIES 6

Hi, any one having any suggestion ?

If your proxies are all under source control, you could create a quick script that looks in every proxy source directory, for an xml file under "policies" where the root element name = "SharedFlow" and containing an element "Name" whose content matches the shared flow.

Also, you'd need to check whether the shared flow is used as a flow hook, in which case you'd need to notify every proxy owner.

Two ways to check this:

- Manual (but quicker): Check using the UI

- Script: Invoke


GET /v1/organizations/{{org}}/environments/{{env}}/{{flowhook_type}}

for each of the following flowhook_types: ["PreProxyFlowHook", "PostProxyFlowHook", "PreTargetFlowHook", "PostTargetFlowHook"]]

If the response contains the shared flow name, then it's being used as a flow hook on that particular execution stage

Thanks @deboraelkin for your response. But I am not using any flow hook here. I created around 9 shared flows like request logging, response logging etc...these SFs are using our implementation team (around 15 teams)

When any shared flow is manipulated with a breaking change - , then may be we need to be versioning the SFs that means SF name will be change (assuming but not sure) , so its requiring the proxy owners to update their APIs accordingly with the new shared flow. I need the suggestion here ,how to verify and notify to the API owner as add the new shared flows need to be add in API proxy. Is there any tool or any way to check and notify.

Please check the first part of my response. You'd need to write a script to check the proxy configuration files

Thanks @deboraelkin . Still I am not able to understand. Could you please provide me an example ?

This is the pseudo code for the script I was alluding to.

It assumes it'll run from a directory that has the following structure:

7731-screen-shot-2018-11-21-at-100112.png

If you're not familiar with that structure, I'd recommend you have a look at https://docs.apigee.com/api-platform/reference/api-proxy-configuration-reference

I use XPath notation, if you're not familiar with it, search the web. There will surely be XPath libraries for your script language of choice

var sharedFlowName = ...  # Variable that stores the Shared Flow Name

# Iterate through all direct subdirectories in proxyRepo
for each proxyDir in proxyRepo   
  # Parse base configuration file, the only XML file 
  # directly in proxyDir/apiproxy, and assign it to an XML variable
  baseConfig = ....  
  proxyName = XPath(baseConfig/APIProxy/@name)
	
  # Iterate over all policy files in the policies directory
  for each curPolicyFile in proxyDir/apiproxy/policies
    # parse curPolicyFile and assign it to an XML variable 
    curPolicy = ... 
    # Check whether curPolicy is a FlowCallout policy 
    # that invokes sharedFlowName    
    usesTheSharedFlow = XPath(
	count(curPolicy/SharedFlow[./Step/Name == sharedFlowName] > 0)
       )  
    if usesTheSharedFlow then 
      print "Proxy [proxyName] invokes [SharedFlowName]"
      break # Stop the inner loop
    end if
  end for
end for