Partitioned policy when field not set in key

I don’t think this is answering my query.

  • First of all please let me know the actual usage of “per_api” field. From what I understood from observations and the word meaning(“per api”) it is for setting different rate, quota etc separately for different APIs which are accessible in a given policy(those APIs listed in the “access_rights” section of policy).
    For example, if policy P has two APIs A, B inside “access_rights” section, we can set rate limiting individually for APIs rather than the global rate limit for policy P

    So I didn’t understand how it will satisfy my requirement.

    On setting “per_api” to true and setting the “limits” section for API inside “access_rights” for rate limits it takes rate defined in “limits” section of policy.

  • As I have already mentioned before, I want to use partitioned policy to set the rate limits in key. And suppose there wasn’t any rate set in the key(which was supposed to be there in the key) then I have to use the rate limits defined in the policy instead of no rate limit at all. With “per_api” and “limits” set it always takes from policy and not from key at all.

  • From my observations I see when “acl”, “rate” fields inside “partitions” section is set to false(I tried it with and without “per_api” set to true) it always took rate from policy. And for “per_api” to be set true we need to set “acl”, “rate”, “quota” inside “partitions” section to be set as false as you mentioned earlier.(The point to note is “acl” and “rate” is false so it could have took rates from policy)

  • Adding or removing the “access_rights” section from key or policy (with or without “per_api”: true) do not make any difference.

  • FYI I don’t want to combine global rate limits in policy and rate limits for individual APIs(set using “limit” section inside “access_rights”) to do anything complex. I mentioned it since you told about setting “per_api” to true. So I added rate limits inside the “limit” section of “access_rights”. Otherwise I don’t need to deal with it. I just want the global rate limits set in policy and key as in:

{
    "last_check": n,
    "allowance": n,
    "rate": n,
    "per": m,
    "throttle_interval": n,
    "throttle_retry_limit": n,
    .....
}

I believe my requirement is clear to you?

  • So are you saying my requirement cannot be achieved?

I am iterating my requirement again:

Policy must be paritioned to take value from key.

If there is a rate set in key → use it.

If the fields to set rate(“rate”, “per” fields) are not present in key → Use the rate from policy associated with the key(In policy I have set a rate limit I just want it to be used. It should not allow as many requests to pass through as it happens now)

I have already told an example here.