-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IOPAE-1711] Api rate limit 250 for io novità e aggiornamenti service #1390
Merged
StefanoDoc
merged 3 commits into
main
from
iopae-1711-RateLimit-for-IO-Novita-e-aggiornamenti
Jan 29, 2025
Merged
[IOPAE-1711] Api rate limit 250 for io novità e aggiornamenti service #1390
StefanoDoc
merged 3 commits into
main
from
iopae-1711-RateLimit-for-IO-Novita-e-aggiornamenti
Jan 29, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rodoviti
approved these changes
Jan 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@pagopa/engineering-team-cloud-eng i need a review by today thanks |
Krusty93
reviewed
Jan 29, 2025
Co-authored-by: Andrea Grillo <[email protected]>
Quality Gate passedIssues Measures |
📖 Terraform Plan ('src/legacy-apim/prod') - successTerraform PlanTerraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# module.apim_itn_product_services.azurerm_api_management_product_policy.this[0] will be updated in-place
~ resource "azurerm_api_management_product_policy" "this" {
id = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-itn-common-rg-01/providers/Microsoft.ApiManagement/service/io-p-itn-apim-01/products/io-services-api"
~ xml_content = <<-EOT
- <policies>
- <inbound>
- <base />
- <choose>
- <when condition="@(context.User.Groups.Select(g => g.Name).Contains("ApiNoRateLimit"))">
- <!-- ApiNoRateLimit for internal/special users -->
- </when>
- <when condition="@(context.User.Groups.Select(g => g.Name).Contains("ApiRateLimit250"))">
- <!-- ApiRateLimit 250 requests/5seconds for fast premium users -->
- <rate-limit-by-key calls="250" renewal-period="5" counter-key="@(context.User.Id)" retry-after-header-name="x-rate-limit-retry-after" remaining-calls-header-name="x-rate-limit-remaining" />
- </when>
- <otherwise>
- <!-- ApiRateLimit 150 requests/5seconds for fast standard users -->
- <rate-limit-by-key calls="150" renewal-period="5" counter-key="@(context.User.Id)" retry-after-header-name="x-rate-limit-retry-after" remaining-calls-header-name="x-rate-limit-remaining" />
- </otherwise>
- </choose>
- </inbound>
- <backend>
- <base />
- </backend>
- <outbound>
- <base />
- </outbound>
- <on-error>
- <base />
- </on-error>
+ <policies>
+ <inbound>
+ <base />
+ <choose>
+ <when condition="@(context.Subscription.Id.Equals("azure-deployc49a"))">
+ <!-- ApiRateLimit 250 for IO Novita e aggiornamenti service -->
+ <rate-limit-by-key calls="250" renewal-period="5" counter-key="@(context.Subscription.Id + "-" + context.User.Id)" retry-after-header-name="x-rate-limit-retry-after" remaining-calls-header-name="x-rate-limit-remaining" />
+ </when>
+ <when condition="@(context.User.Groups.Select(g => g.Name).Contains("ApiNoRateLimit"))">
+ <!-- ApiNoRateLimit for internal/special users -->
+ </when>
+ <when condition="@(context.User.Groups.Select(g => g.Name).Contains("ApiRateLimit250"))">
+ <!-- ApiRateLimit 250 requests/5seconds for fast premium users -->
+ <rate-limit-by-key calls="250" renewal-period="5" counter-key="@(context.User.Id)" retry-after-header-name="x-rate-limit-retry-after" remaining-calls-header-name="x-rate-limit-remaining" />
+ </when>
+ <otherwise>
+ <!-- ApiRateLimit 150 requests/5seconds for fast standard users -->
+ <rate-limit-by-key calls="150" renewal-period="5" counter-key="@(context.User.Id)" retry-after-header-name="x-rate-limit-retry-after" remaining-calls-header-name="x-rate-limit-remaining" />
+ </otherwise>
+ </choose>
+ </inbound>
+ <backend>
+ <base />
+ </backend>
+ <outbound>
+ <base />
+ </outbound>
+ <on-error>
+ <base />
+ </on-error>
</policies>
EOT
# (3 unchanged attributes hidden)
}
# module.apim_v2_product_services.azurerm_api_management_product_policy.this[0] will be updated in-place
~ resource "azurerm_api_management_product_policy" "this" {
id = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-rg-internal/providers/Microsoft.ApiManagement/service/io-p-apim-v2-api/products/io-services-api"
~ xml_content = <<-EOT
- <policies>
- <inbound>
- <base />
- <choose>
- <when condition="@(context.User.Groups.Select(g => g.Name).Contains("ApiNoRateLimit"))">
- <!-- ApiNoRateLimit for internal/special users -->
- </when>
- <when condition="@(context.User.Groups.Select(g => g.Name).Contains("ApiRateLimit250"))">
- <!-- ApiRateLimit 250 requests/5seconds for fast premium users -->
- <rate-limit-by-key calls="250" renewal-period="5" counter-key="@(context.User.Id)" retry-after-header-name="x-rate-limit-retry-after" remaining-calls-header-name="x-rate-limit-remaining" />
- </when>
- <otherwise>
- <!-- ApiRateLimit 150 requests/5seconds for fast standard users -->
- <rate-limit-by-key calls="150" renewal-period="5" counter-key="@(context.User.Id)" retry-after-header-name="x-rate-limit-retry-after" remaining-calls-header-name="x-rate-limit-remaining" />
- </otherwise>
- </choose>
- </inbound>
- <backend>
- <base />
- </backend>
- <outbound>
- <base />
- </outbound>
- <on-error>
- <base />
- </on-error>
+ <policies>
+ <inbound>
+ <base />
+ <choose>
+ <when condition="@(context.Subscription.Id.Equals("azure-deployc49a"))">
+ <!-- ApiRateLimit 250 for IO Novita e aggiornamenti service -->
+ <rate-limit-by-key calls="250" renewal-period="5" counter-key="@(context.Subscription.Id + "-" + context.User.Id)" retry-after-header-name="x-rate-limit-retry-after" remaining-calls-header-name="x-rate-limit-remaining" />
+ </when>
+ <when condition="@(context.User.Groups.Select(g => g.Name).Contains("ApiNoRateLimit"))">
+ <!-- ApiNoRateLimit for internal/special users -->
+ </when>
+ <when condition="@(context.User.Groups.Select(g => g.Name).Contains("ApiRateLimit250"))">
+ <!-- ApiRateLimit 250 requests/5seconds for fast premium users -->
+ <rate-limit-by-key calls="250" renewal-period="5" counter-key="@(context.User.Id)" retry-after-header-name="x-rate-limit-retry-after" remaining-calls-header-name="x-rate-limit-remaining" />
+ </when>
+ <otherwise>
+ <!-- ApiRateLimit 150 requests/5seconds for fast standard users -->
+ <rate-limit-by-key calls="150" renewal-period="5" counter-key="@(context.User.Id)" retry-after-header-name="x-rate-limit-retry-after" remaining-calls-header-name="x-rate-limit-remaining" />
+ </otherwise>
+ </choose>
+ </inbound>
+ <backend>
+ <base />
+ </backend>
+ <outbound>
+ <base />
+ </outbound>
+ <on-error>
+ <base />
+ </on-error>
</policies>
EOT
# (3 unchanged attributes hidden)
}
Plan: 0 to add, 2 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────
Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now. |
Krusty93
approved these changes
Jan 29, 2025
StefanoDoc
deleted the
iopae-1711-RateLimit-for-IO-Novita-e-aggiornamenti
branch
January 29, 2025 13:22
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Api rate limit 250 for io novità e aggiornamenti service
Major Changes
in short the azure-deployc49a service will have to send 20,000,000 messages and a request has arrived to apply a ratelimit250 only for that service temporarily, the solution that seemed simplest and quick was to apply a policy on the IO-SERVICE-API product, we did some tests using another service via the portal and it worked
Dependencies
Testing
Documentation
Other Considerations