Axway-API-Management-Plus / apim-cli

Axway API-Management CLI - Manage your platform from the command line or with your CI/CD pipeline
Apache License 2.0
45 stars 17 forks source link

Quota replacement for method: * #514

Open mattir81 opened 5 days ago

mattir81 commented 5 days ago

APIM-CLI version

*

API-Management version

7.7.20240228

Bug description

I'm trying to export an API, update the quota definition for application/system and re-importing it. If method is configured with * (all methods) no quota is kept in consideration and the merged quota remains as the current one. If the configuration specify a method in particular method: then the quota definition is overridden properly.

Steps to reproduce

  1. define default quota for an api (all methods)
  2. export the api
  3. modify quota config
  4. import again the api

Relevant log output

2024-10-28 15:14:05,165 [APIQuotaManager] INFO : Updating System default quota for API: Hbfree
2024-10-28 15:14:05,165 [APIQuotaManager] DEBUG: System default-Restrictions: Desired: [QuotaRestriction [api=*, method=*, type=throttle, config={period=second, per=35, messages=5}]], Actual: [QuotaRestriction [api=a451eaf0-8adb-44f7-9b1b-c9675f35e9a3, method=*, type=throttle, config={period=second, per=30, messages=4}]]
2024-10-28 15:14:05,165 [APIQuotaManager] DEBUG: Current Default Quota : APIQuota [id=00000000-0000-0000-0000-000000000000, type=API, restrictions=[QuotaRestriction [api=5e370bc6-53a1-4f69-9ea4-d246ab472e6e, method=*, type=throttle, config={period=second, per=30, messages=4}], QuotaRestriction [api=a451eaf0-8adb-44f7-9b1b-c9675f35e9a3, method=*, type=throttle, config={period=second, per=30, messages=4}]]]
2024-10-28 15:14:05,165 [APIQuotaManager] DEBUG: Merged  Quota : [QuotaRestriction [api=a451eaf0-8adb-44f7-9b1b-c9675f35e9a3, method=*, type=throttle, config={period=second, per=30, messages=4}]]      
2024-10-28 15:14:05,165 [RestAPICall] DEBUG: Http verb:PUT and URI:
https://api-env.demo.axway.com:8075/api/portal/v1.4/quotas/00000000-0000-0000-0000-000000000000
2024-10-28 15:14:05,361 [APIQuotaManager] INFO : Updating Application default quota for API: Hbfree
2024-10-28 15:14:05,361 [APIQuotaManager] DEBUG: Application default-Restrictions: Desired: [QuotaRestriction [api=*, method=*, type=throttle, config={period=second, per=35, messages=5}]], Actual: [Quo2024-10-28 15:14:05,361 [APIQuotaManager] DEBUG: Application default-Restrictions: Desired: [QuotaRestriction [api=*, method=*, type=throttle, config={period=second, per=35, messages=5}]], Actual: [QuotaRestriction [api=a451eaf0-8adb-44f7-9b1b-c9675f35e9a3, method=*, type=throttle, config={period=second, per=30, messages=4}]]
2024-10-28 15:14:05,361 [APIQuotaManager] DEBUG: Current Default Quota : APIQuota [id=00000000-0000-0000-0000-000000000001, type=APPLICATION, restrictions=[QuotaRestriction [api=5e370bc6-53a1-4f69-9ea4-d246ab472e6e, method=*, type=throttle, config={period=second, per=30, messages=4}], QuotaRestriction [api=a451eaf0-8adb-44f7-9b1b-c9675f35e9a3, method=*, type=throttle, config={period=second, per=30, 2024-10-28 15:14:05,361 [APIQuotaManager] DEBUG: Current Default Quota : APIQuota [id=00000000-0000-0000-0000-000000000001, type=APPLICATION, restrictions=[QuotaRestriction [api=5e370bc6-53a1-4f69-9ea4-d246ab472e6e, method=*, type=throttle, config={period=second, per=30, messages=4}], QuotaRestriction [api=a451eaf0-8adb-44f7-9b1b-c9675f35e9a3, method=*, type=throttle, config={period=second, per=30, -d246ab472e6e, method=*, type=throttle, config={period=second, per=30, messages=4}], QuotaRestriction [api=a451eaf0-8adb-44f7-9b1b-c9675f35e9a3, method=*, type=throttle, config={period=second, per=30, messages=4}]]]
messages=4}]]]
2024-10-28 15:14:05,361 [APIQuotaManager] DEBUG: Merged  Quota : [QuotaRestriction [api=a451eaf0-8adb-44f7-9b1b-c9675f35e9a3, method=*, type=throttle, config={period=second, per=30, messages=4}]]      
2024-10-28 15:14:05,361 [RestAPICall] DEBUG: Http verb:PUT and URI:
https://api-env.demo.axway.com:8075/api/portal/v1.4/quotas/00000000-0000-0000-0000-000000000001
2024-10-28 15:14:05,547 [ManageClientOrganization] INFO : reCreation : false
rathnapandi commented 5 days ago

Hi @mattir81,

The Quota replacement works fine on version 1.14.7. hence closing the defect.

Thanks Rathna