Is it possible to create a policiy and inherit in every proxy I create?

Not applicable

Lets suppouse that I need to create a Javascript policy named DoSomethingPolicy.js, and this policy will do something using javascript.

Later, I will create N number of proxies but I would like to attach this policy automatically to every proxy created. I'd lke to have this policy available to use in any step of the proxy flow or the target flow.

I have seen how to create shared flows documentation but I don't think this is what I need, because I don't want to force this policy to be used in a flow, just its availability to use un any flow of every proxy.

6449-policy.png

Is it possible?

I have installed the Private Edge version.

Solved Solved
0 2 127
1 ACCEPTED SOLUTION

Not sure if the current features satisfy your desires. Let's review.

You say you are aware of Shared Flows. Shared flows allow you to configure a sequence of one or more policies that can be re-used by any number of proxies.

There is a related entity called "Flow Hooks" which allows you to enforce the execution of a specific Shared Flow at four specific points during execution: prior to proxy execution, prior to target, post target, or post proxy.

But as you say: this gets executed for every proxy; it's not conditional.

Today it IS possible to attach a JavaScript, or XSL, or Java JAR, as an organization-wide resource, or as an environment-wide resource. This capability is not exposed in the Apigee Administrative UI, but is is possible, and it is supported. A Good example of a use case for this: suppose you have a standard JavaScript that computes some kind of hash, maybe an HMAC or something. And you don't want to require every proxy to reproduce (or copy/paste) that JS code. Attaching the JS code as a resource to the org (or env) means you can have a JavaScript POLICY that references the JavaScript code.

But today it is not possible to have a JavaScript POLICY attached as a re-usable org-wide resource, or environment-wide resource. Nor is it possible to attach any sort of policy in this way.

The Shared Flow seems to be the right vehicle for that purpose. And each proxy can optionally call out to the SharedFlow.

You wrote:

I would like to attach this policy automatically to every proxy created. I'd lke to have this policy available to use in any step of the proxy flow or the target flow. ... I don't want to force this policy to be used in a flow, just its availability to use un any flow of every proxy

The Shared Flow is available for use by any Proxy within any flow. The Flow Hook enforces the use of a Shared Flow, at specific points in the flow.

View solution in original post

2 REPLIES 2

Not sure if the current features satisfy your desires. Let's review.

You say you are aware of Shared Flows. Shared flows allow you to configure a sequence of one or more policies that can be re-used by any number of proxies.

There is a related entity called "Flow Hooks" which allows you to enforce the execution of a specific Shared Flow at four specific points during execution: prior to proxy execution, prior to target, post target, or post proxy.

But as you say: this gets executed for every proxy; it's not conditional.

Today it IS possible to attach a JavaScript, or XSL, or Java JAR, as an organization-wide resource, or as an environment-wide resource. This capability is not exposed in the Apigee Administrative UI, but is is possible, and it is supported. A Good example of a use case for this: suppose you have a standard JavaScript that computes some kind of hash, maybe an HMAC or something. And you don't want to require every proxy to reproduce (or copy/paste) that JS code. Attaching the JS code as a resource to the org (or env) means you can have a JavaScript POLICY that references the JavaScript code.

But today it is not possible to have a JavaScript POLICY attached as a re-usable org-wide resource, or environment-wide resource. Nor is it possible to attach any sort of policy in this way.

The Shared Flow seems to be the right vehicle for that purpose. And each proxy can optionally call out to the SharedFlow.

You wrote:

I would like to attach this policy automatically to every proxy created. I'd lke to have this policy available to use in any step of the proxy flow or the target flow. ... I don't want to force this policy to be used in a flow, just its availability to use un any flow of every proxy

The Shared Flow is available for use by any Proxy within any flow. The Flow Hook enforces the use of a Shared Flow, at specific points in the flow.

Wow, great explanation. As always, giving great answers, thanks.