Skip to content

Instantly share code, notes, and snippets.

@ApigeeSamples
ApigeeSamples / RegularExpressionProtection.xml
Created May 8, 2012 10:08
Regular Expression Protection
<RegularExpressionProtection name="mypolicy">
<Source>response</Source>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<URIPath>
<Pattern>[tT]rue</Pattern>
<Pattern>.*true.*</Pattern>
</URIPath>
<QueryParam name="greeting">
<Pattern>[tT]rue</Pattern>
<Pattern>.*true.*</Pattern>
@ApigeeSamples
ApigeeSamples / KeyValueMapOperations.xml
Last active October 4, 2015 12:17
Key Value Map Operations
<KeyValueMapOperations name="abc">
<Scope>organization/environment/apiproxy/policy</Scope>
<ExpiryTimeInSecs>60</ExpiryTimeInSecs>
<InitialEntries>
<Entry>
<Key>
<Parameter>k1</Parameter>
</Key>
<Value>v1</Value>
<Value>v2</Value>
<ExtractVariables name="mypolicy">
<Source>sc.response</Source>
<VariablePrefix>apigee</VariablePrefix>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<URIPath>
<Pattern>/**/hello/{user}</Pattern>
<Pattern>/**/hi/{user}</Pattern>
</URIPath>
<QueryParam name="greeting">
<Pattern>hello {user}</Pattern>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Script name="MyPythonScriptPolicy">
<ResourceURL>py://MyPythonScript</ResourceURL>
<IncludeURL>py://MyPythonScript</IncludeURL>
</Script>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Javascript timeLimit="200" enabled="true" continueOnError="false" async="false" name="MyJSPolicy">
<ResourceURL>jsc://MyJavaScript</ResourceURL>
<IncludeURL>jsc://MyJavaScript</IncludeURL>
</Javascript>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JavaCallout name="MyJavaCalloutPolicy">
<ResourceURL>java://MyJavaCallout.jar</ResourceURL>
<ClassName>com.apigee.mypolicy.Javacallout.MyJavaCallout</ClassName>
</JavaCallout>
@ApigeeSamples
ApigeeSamples / Servicecallout.xml
Last active October 4, 2015 11:27
Service Callout
<ServiceCallout name="myPolicy">
<Request clearPayload="false" variable="myRequest"/>
<Response>myResponse</Response>
<HTTPTargetConnection>
<Properties/>
<URL>http://example.com</URL>
</HTTPTargetConnection>
</ServiceCallout>
<MessageValidation name="myPolicy">
<Source>mymessage</Source>
<ResourceURL>xsd://sample</ResourceURL>
<SOAPMessage version="1.1/1.2"/>
<Element namespace="http://finance.com/1999"> PurchaseOrder</Element>
<Element namespace="http://finance.com/2000">PurchaseOrder</Element>
</MessageValidation>
<RaiseFault name="abc">
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<FaultResponse>
<Copy source="sc.response"> <!-- source is optional.. default is message -->
<Headers />
</Copy>
<Remove>
<Headers>
<Header name="h1"/>
</Headers>
@ApigeeSamples
ApigeeSamples / xsl.xml
Created May 7, 2012 13:18
XSL transformation
<XSL name="xslPolicy">
<Source>...</Source>
<OutputVariable>...</OutputVariable>
<ResourceURL>xsl://sample</ResourceURL>
<Parameters ignoreUnresolvedVariables="true/[false]">
<Parameter name="p1" value="value1"/>
<Parameter name="p2" ref="request.header.greeting"/>
</Parameters>
</XSL>