Is there a way to create a proxy, with default proxies, using an Open Api File ?

I need to automate the proxy creation using an Open Api Documentation, but more than it, I need to add some default policies to this brand new proxy.
The 'openapi2apigee' node module creates the proxy fom the Open Api Doc, but I could not find a way to add the default policies after it. The 'openapi2apigee' module has the Apigee-127 extensions that creates policies and attaches to a proxy, but its not an option for me since the person who will build the Open API Documentation has no knowledge about policies.

Using the management API I would be able to GET the proxy that has been just created and use the response in a POST payload, just adding the new policies to JSON/XML. Is there any better option ?

Solved Solved
1 4 411
1 ACCEPTED SOLUTION

@Caio Kiyoshi Isikawa - I wrote this util a while back. This is a Yeoman generator that takes a bunch of inputs including the spec and generates an end to end project structure with all the policies baked into it. Take a look at this. Make sure you checkout the "cgsaas" branch as the main branch example is for Apigee X which is not what you want.

It's based on the template and the script that does some manipulation. Feel free to fork that repo and make changes that suits your requirement. Again this was a test side project and something that is not Google supported. Surely a good start though. Feel free to fork and extend.

View solution in original post

4 REPLIES 4

if you want to add policies (that are not included in 127), you will need to extend the development to include them. you can use shared flows almost anywhere so your developer actually just need to copy in to their openapi doc some sort of 'template' json\yaml to make this work.

from Management API you can get the .zip bundle, you can unzip it, modify the xml (scripts\devops\other), zip and redeploy again. for me it seems more work than actually try to enrich existing 127

if you need some development support, I can recommend some1 who done such jobs

Hey Denis, thank you for your answer.
Even using a Shared Flow, I'd like to don't depend on Developer to add 127-extensions. I'd like to automate all proxy creation, just using and original Open API Documentation.
Following your sugestion about using a Shared Flow I could make it the following way, but it doesnt smell good for me.
1 - GET https://api.enterprise.apigee.com/v1/organizations/{X}/apis/{Y}/revisions/{latest}/proxies/default/f...
2 - Manipulate the response, adding the Flow Callout Policy(Shared Flow);
3 - POST https://api.enterprise.apigee.com/v1/organizations/{X}/apis/{Y}/revisions/{latest}/proxies/default/f... with the payload built in Step 2.

Does it make sense ? Is there a better way to make it work ?

I thinks this is to complicated,

Think of this:

1. Developer creates regular swagger\open api

2. Then you modify it (ci\cd) or other tools or development\npm

2.1 You inject the relevant pieces of extentions you need

3. ...and then you generate the proxy bundle and upload it.

@Caio Kiyoshi Isikawa - I wrote this util a while back. This is a Yeoman generator that takes a bunch of inputs including the spec and generates an end to end project structure with all the policies baked into it. Take a look at this. Make sure you checkout the "cgsaas" branch as the main branch example is for Apigee X which is not what you want.

It's based on the template and the script that does some manipulation. Feel free to fork that repo and make changes that suits your requirement. Again this was a test side project and something that is not Google supported. Surely a good start though. Feel free to fork and extend.