Skip to content

Instantly share code, notes, and snippets.

@ApigeeSamples
ApigeeSamples / quota_sample7.xml
Created June 1, 2012 09:45
2000 requests per month based on message weight reference
<Quota name="QuotaPolicy">
<Interval>1</Interval>
<TimeUnit>month</TimeUnit>
<Allow count="2000" />
<MessageWeight ref="request.header.weight" />
</Quota>
@ApigeeSamples
ApigeeSamples / quota_sample6.xml
Created June 1, 2012 09:44
2000 requests per month based on client identifier (using service class identifier)
<Quota name="QuotaPolicy">
<Interval>1</Interval>
<TimeUnit>month</TimeUnit>
<Allow count="2000">
<Class ref="request.header.clientId">
<Allow class="X" count="100"/>
<Allow class="Y" count="75" />
<Allow class="_default" count="50" />
</Class>
</Allow>
@ApigeeSamples
ApigeeSamples / quota_sample5.xml
Created June 1, 2012 09:43
2000 requests per month based on client identifier
<Quota name="QuotaPolicy">
<Interval>1</Interval>
<TimeUnit>month</TimeUnit>
<Identifier ref="request.header.clientId" /> <!-- Add a separate counter per unique identifier -->
<Allow count="200" />
</Quota>
@ApigeeSamples
ApigeeSamples / quota_sample4.xml
Created June 1, 2012 09:41
2000 requests per month (On exceeding the limit (1000 requests), send an alert to syslog)
<Quota name="QuotaPolicy">
<Interval>1</Interval>
<TimeUnit>month</TimeUnit>
<Allow count="2000" />
<Alert count="1000" >
<NotificationIntervalInSec>5</NotificationIntervalInSec>
<Syslog>
<Message>Quota has exceeded. Allowed quota={ratelimit.allowed.count}, Used quota={ratelimit.used.count}, Quota expires at {ratelimt.expiry.time}</Message>
<Host>IP-Address</Host>
<Port>514</Port>
@ApigeeSamples
ApigeeSamples / quota_sample3.xml
Created June 1, 2012 09:40
2000 requests per month (On exceeding the limit (1000 requests), send an alert to local disk.)
<Quota name="QuotaPolicy">
<Interval>1</Interval>
<TimeUnit>month</TimeUnit>
<Allow count="2000" />
<Alert count="1000" >
<NotificationIntervalInSec>5</NotificationIntervalInSec>
<File>
<Message>Quota has exceeded. Allowed quota={ratelimit.allowed.count}, Used quota={ratelimit.used.count}, Quota expires at {ratelimt.expiry.time}</Message>
<FileName>quota_exceeded.log</FileName>
<FileRotationOptions rotateFileOnStartup="true">
@ApigeeSamples
ApigeeSamples / quota_sample2.xml
Created June 1, 2012 09:38
2000 requests per month (using flow variables)
<Quota name="QuotaPolicy">
<Interval ref="request.header.quota_count"/>
<TimeUnit ref="request.header.quota_timeunit" />
<Allow count="2000" countRef="request.header.allowed_quota"/>
</Quota>
@ApigeeSamples
ApigeeSamples / quota_sample1.xml
Created June 1, 2012 09:31
2000 requests per month (simple case)
<Quota name="QuotaPolicy">
<Interval>1</Interval>
<TimeUnit>month</TimeUnit>
<Allow count="2000" />
</Quota>
@ApigeeSamples
ApigeeSamples / StatisticsCollector.xml
Created May 29, 2012 11:04
Statistics Collector policy
<StatisticsCollector name="publishPurchaseDetails">
<Statistics>
<Statistic name="productID" ref="product.id" type="string">{defaultval}</Statistic>
<Statistic name="price" ref="product.price" type="string">{defaultval}</Statistic>
</Statistics>
</StatisticsCollector>
{
"action" : "post",
"application" : "4353136f-e978-11e0-8264-005056c00008",
"params" : {
},
"path" : "/users",
"uri" : "http://api.usergrid.com/4353136f-e978-11e0-8264-005056c00008/users",
"entities" : [ {
"uuid" : "7d1aa429-e978-11e0-8264-005056c00008",
"type" : "user",
<RaiseAlert name="RaiseAlert">
<Syslog>
<Message>This is a test message. id = {request.header.id}</Message>
<Host>IP</Host>
<Port>514</Port>
</Syslog>
</RaiseAlert>