Skip to content

Commit 02c0307

Browse files
Feature/add dynamic xml policy support (#13)
1 parent af99c4b commit 02c0307

File tree

5 files changed

+7
-72
lines changed

5 files changed

+7
-72
lines changed

samples/load-balancing/aca-backend-pool-prioritized.xml renamed to samples/load-balancing/aca-backend-pool-load-balancing.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<policies>
55
<inbound>
66
<base />
7-
<set-backend-service backend-id="aca-backend-pool-web-api-429-prioritized" />
7+
<set-backend-service backend-id="{backend_id}" />
88
</inbound>
99
<backend>
1010
<!--Apply load-balancing and retry mechanisms -->
1111
<!--Set count to one less than the number of backends in the pool to try all backends until the backend pool is temporarily unavailable.-->
12-
<retry count="1" interval="0" first-fast-retry="true" condition="@(context.Response.StatusCode == 429 || (context.Response.StatusCode == 503 && !context.Response.StatusReason.Contains("Backend pool") && !context.Response.StatusReason.Contains("is temporarily unavailable")))">
12+
<retry count="{retry_count}" interval="0" first-fast-retry="true" condition="@(context.Response.StatusCode == 429 || (context.Response.StatusCode == 503 && !context.Response.StatusReason.Contains("Backend pool") && !context.Response.StatusReason.Contains("is temporarily unavailable")))">
1313
<forward-request buffer-request-body="true" />
1414
</retry>
1515
</backend>

samples/load-balancing/aca-backend-pool-prioritized-and-weighted.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

samples/load-balancing/aca-backend-pool-weighted-50-50.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

samples/load-balancing/aca-backend-pool-weighted-80-20.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

samples/load-balancing/create.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@
7070
"# 3) Define the APIs and their operations and policies\n",
7171
"\n",
7272
"# Policies\n",
73-
"aca_backend_pool_prioritized_policy_xml = utils.read_policy_xml('./aca-backend-pool-prioritized.xml')\n",
74-
"aca_backend_pool_prioritized_and_weighted_policy_xml = utils.read_policy_xml('./aca-backend-pool-prioritized-and-weighted.xml')\n",
75-
"aca_backend_pool_weighted_equal_policy_xml = utils.read_policy_xml('./aca-backend-pool-weighted-50-50.xml')\n",
76-
"aca_backend_pool_weighted_unequal_policy_xml = utils.read_policy_xml('./aca-backend-pool-weighted-80-20.xml')\n",
73+
"base_policy = './aca-backend-pool-load-balancing.xml'\n",
74+
"aca_backend_pool_prioritized_policy_xml = utils.read_policy_xml(base_policy).format(retry_count = 1, backend_id = 'aca-backend-pool-web-api-429-prioritized')\n",
75+
"aca_backend_pool_prioritized_and_weighted_policy_xml = utils.read_policy_xml(base_policy).format(retry_count = 2, backend_id = 'aca-backend-pool-web-api-429-prioritized-and-weighted')\n",
76+
"aca_backend_pool_weighted_equal_policy_xml = utils.read_policy_xml(base_policy).format(retry_count = 1, backend_id = 'aca-backend-pool-web-api-429-weighted-50-50')\n",
77+
"aca_backend_pool_weighted_unequal_policy_xml = utils.read_policy_xml(base_policy).format(retry_count = 1, backend_id = 'aca-backend-pool-web-api-429-weighted-80-20')\n",
7778
"\n",
7879
"# Standard GET Operation\n",
7980
"get = GET_APIOperation('This is a standard GET')\n",

0 commit comments

Comments
 (0)