@miguelmendoza @ssvaidyanathan - I am exploring this tool and watched your latest demo in mad_in_apis. Using the version 1.0.0
When trying to render a proxy based on the template, i am running into below issues,
- VirtualHost - I am not able to set this element in apiproxy.yml - as its complaining with error
$ apigee-go-gen render apiproxy --template ./proxy-template/apiproxy.yml --output ./pxy_auto
Error: unknown node "VirtualHost" found at "Root.ProxyEndpoints.0.ProxyEndpoint(name: default).HTTPProxyConnection"
- policies - When we add policies in UI, there is a folder which gets created with all the policies and only the names will be represented in the test.xml, but using this tool the policy itself is getting substituted. Do I have to make the template structure different to achieve this ?
Command
apigee-go-gen render apiproxy --template ./proxy-template/apiproxy.yml --output ./pxy_auto --set PXY_NAME=test --set PXY_PATH=/test
apiproxy.yml
APIProxy:
.revision: 1
.name: {{ $.Values.PXY_NAME }}
Basepaths: {{ $.Values.PXY_PATH }}
Description: 'Proxy bundle for "{{ $.Values.PXY_NAME }}"'
DisplayName: {{ $.Values.PXY_NAME }}
Policies: {{ include "./policies.yml" . | nindent 2 }}
ProxyEndpoints:
ProxyEndpoint: default
Resources: {}
Spec: {}
TargetEndpoints:
TargetEndpoint: default
ProxyEndpoints:
- ProxyEndpoint:
.name: default
Description: {}
FaultRules: {}
PreFlow:
.name: PreFlow
Request: {}
Response: {}
PostFlow:
.name: PostFlow
Request: {}
Response: {}
Flows: {}
HTTPProxyConnection:
BasePath: {{ $.Values.PXY_PATH }}
Properties: {}
RouteRule:
.name: default
TargetEndpoint: default
TargetEndpoints:
- TargetEndpoint:
.name: default
Description: {}
FaultRules: {}
PreFlow:
.name: PreFlow
Request:
Step:
Name: AM-RemoveHeaders
Response: {}
PostFlow:
.name: PostFlow
Request: {}
Response: {}
Flows: {}
HTTPTargetConnection:
Properties: {}
URL: {{ $.Values.PXY_URL }}
Resources: []
policies.yml
- AssignMessage:
.async: false
.continueOnError: false
.enabled: true
.name: AM-RemoveHeaders
DisplayName: AM-RemoveHeaders
Remove:
Headers:
- Header:
.name: Authorization
IgnoreUnresolvedVariables: true
AssignTo:
.createNew: false
.transport: http
.type: request
Output
File Structure
pxy_auto
apiproxy
proxies
default.xml
targets
default.xml
test.xml
<?xml version="1.0" encoding="UTF-8"?>
<APIProxy revision="1" name="test">
<DisplayName>test</DisplayName>
<Description>Proxy bundle for "test"</Description>
<Spec/>
<Basepaths>/test</Basepaths>
<Policies>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-RemoveHeaders">
<DisplayName>AM-RemoveHeaders</DisplayName>
<Remove>
<Headers>
<Header name="Authorization"/>
</Headers>
</Remove>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
</Policies>
<Resources/>
<ProxyEndpoints>
<ProxyEndpoint>default</ProxyEndpoint>
</ProxyEndpoints>
<TargetEndpoints>
<TargetEndpoint>default</TargetEndpoint>
</TargetEndpoints>
</APIProxy>