Is it possible to set policies to multiple api proxies?

oyamatakuro
Participant IV

Hello,

Edge UI can set policies easily to API proxy.

But if I have many APIs, I would like to set/modify/delete API policies to selected multiple policies in bulk with commandline or management API because it would be time-consuming and inefficient to manage API policies to each API proxy one by one on Edge UI. Is it possible?

If there is any info or docs for samples to help this, it will be appreciated.

Solved Solved
1 3 404
1 ACCEPTED SOLUTION

Yes, there are multiple ways to do this.

First, It is possible for you to use the Edge management API to import API Proxy bundles. Proxy bundles are the things you can edit within the graphical Proxy editor in the Edge Administrative UI. To Import a proxy bundle you can use this API call.

Normally you would embed that API call into a script or program that runs as part of your CI/CD pipeline. You'll check out the proxy configuration as "source code" from the VCS that you use (git or whatever). Then bundle up the files (zip) and call the API.

There are multiple libraries available that wrap this API. We have examples in bash, JavaScript, Windows Powershell... and of course there is the Maven plugin that will do this step for you.

But let's suppose you would like to perform analysis of all the existing proxies. You want to check each proxy for policies of a certain type, to see if they conform to your established conventions. With the same mgmt API, you can query the proxies, the revisions of each proxy, and the policies in each revision. For a nodejs example of how this would work, see here. The URL for a particular policy is

/v1/0/ORGNAME/apis/PROXY/revisions/REV/policies/POLICY_NAME

Just perform a GET on that URL and you will get the policy definition. There is also a "write" option in the API so that you could update a policy within an API proxy via the same URL, with a POST.

And finally, rather than dealing with individual proxies, you have the option to use shared flows and flow hooks. This is a way to define reusable logic (Sets of policies) that can be called from any proxy. The flow hook feature also allows you to enforce execution of these shared flows, at specific points in proxy execution.

View solution in original post

3 REPLIES 3

Not applicable

Yes, there are multiple ways to do this.

First, It is possible for you to use the Edge management API to import API Proxy bundles. Proxy bundles are the things you can edit within the graphical Proxy editor in the Edge Administrative UI. To Import a proxy bundle you can use this API call.

Normally you would embed that API call into a script or program that runs as part of your CI/CD pipeline. You'll check out the proxy configuration as "source code" from the VCS that you use (git or whatever). Then bundle up the files (zip) and call the API.

There are multiple libraries available that wrap this API. We have examples in bash, JavaScript, Windows Powershell... and of course there is the Maven plugin that will do this step for you.

But let's suppose you would like to perform analysis of all the existing proxies. You want to check each proxy for policies of a certain type, to see if they conform to your established conventions. With the same mgmt API, you can query the proxies, the revisions of each proxy, and the policies in each revision. For a nodejs example of how this would work, see here. The URL for a particular policy is

/v1/0/ORGNAME/apis/PROXY/revisions/REV/policies/POLICY_NAME

Just perform a GET on that URL and you will get the policy definition. There is also a "write" option in the API so that you could update a policy within an API proxy via the same URL, with a POST.

And finally, rather than dealing with individual proxies, you have the option to use shared flows and flow hooks. This is a way to define reusable logic (Sets of policies) that can be called from any proxy. The flow hook feature also allows you to enforce execution of these shared flows, at specific points in proxy execution.

Thanks for the info!

I will test them.