How to automate addition of mandatory shared flow into the proxy bundle

Hi Team,

Please let us know if there's a way to automate by adding mandatory shared flow into the proxy bundle to deploy into APIGEE Edge. This is to save time and effort and also an effort to enable the beginners to build their Pass through proxies without much understanding on each and every policies and leverage the existing shared flows for ease.

Thanks,

Merin

0 10 731
10 REPLIES 10

There are several related concepts:

  • Shared Flow - a reusable sequence of policies. Think of this as a unit of re-usability for a series of steps. Like a function or subroutine in a 4th generation programming language. A good example is a check-and-fill of a cache. Eg: Load an item from cache; if the cache is empty, then load the item from the external resource and then store it in the cache. This series of steps might take 3 or 4 policies, but it can be considered as one "Step" and would be a good candidate for encapsulation into a shared flow.
  • Flow callout - a policy that allows an API proxy to explicitly call out to a shared flow - to invoke the sequence of its policies in order. BTW, a Shared Flow can include a Flow callout policy - one shared flow can call another.
  • Flow Hook - a mechanism to enforce IMPLICIT calls to shared flows at specific points during policy execution. FlowHooks are configured per environment.

All of these things are documented.

You are asking about "mandatory shared flow".

There are various ways that I can think of to enforce a "mandatory" shared flow, for varying degress of "enforcement".

  1. build your shared flow. configure a FlowHook at the desired point to invoke that shared flow. Now, every proxy deployed to the environment will execute that shared flow.
  2. Require your deployments to go through an automated CI/CD build process, and within that process, inject a FlowCallout policy into the API proxy at the desired point.
  3. Use an "code generation" or template mechanism (like mvn archetype generate), in which users start with a template of an API Proxy. In the template, insert the call to the desired shared flow. This is obviously something that a user could subvert or change, so it's not really "enforcement". More like "encouragement".

Hi Dino,

Thanks for the info. I m adding little more details to the requirement.

Some shared flows needs to be included in all the proxies both in request and response flows developed in the project. Suppose I have two shared flows namely InitialChecks and LoggingChecks to be included in the Proxy Preflow and Target PostFlow respectively. Now when I develop the proxybundle from openapi2apigee node.js module which creates proxy bundle from swagger file. Is there a way to by default add these shared flow in all the proxy bundles to be created? This will save time in adding all the basic shared flow without actually adding them from the UI.

Regards,

Merin

@Merin Mary Jose Hello, Did you figure out this requirement? Please let me know if you did, am now trying to achieve the same thing myself.

Have you looked at Flowhooks? What do you think of that feature?

I did look at FlowHooks. The feature is great! But our requirement is to add a group of shared flows to a proxy automatically using CI/CD pipeline. And in Flowhooks, we can add only one for a flowhook. Also, it gets executed for all the proxies in that org, but we want to control which group of shared flows are added to which proxy in the pipeline.

ok, so your requirements are completely different from Merin's.

Can you ask a distinct, new question please? So that an answer here that satisfies you, is not construed to satisfy Merin, and vice versa. Ask a new question.

Sure @Dino-at-Google. I'm posting it as a new question. Thanks

I think FlowHooks do that! They do what you want. You must have looked at FlowHooks. Does that feature not satisfy your requirement?

@Dino-at-Google you are right using FlowHook this requirement can be done,

@Merin Mary Jose can make the commonly used share flow, and then add that shared flow in Pre-proxy Flow Hook and Post-proxy Flow Hook.

The shared policy will get executed in both the request and response flow, I think which is the requirement.

Thanks @Dino-at-Google and @Mohsin Khan. We have a different requirement which can't be achieved with flowhooks unfortunately. Our requirement is to add a group of shared flows to a proxy automatically using CI/CD pipeline. And in Flowhooks, we can add only one for a flowhook. Also, it gets executed for all the proxies in that org, but we want to control which group of shared flows are added to a proxy in the pipeline.