|
38 | 38 | " PolicyFragment('AuthZ-Match-All', utils.read_policy_xml(utils.determine_shared_policy_path('pf-authz-match-all.xml')), 'Authorizes if all of the specified roles match the JWT role claims.'),\n", |
39 | 39 | " PolicyFragment('AuthZ-Match-Any', utils.read_policy_xml(utils.determine_shared_policy_path('pf-authz-match-any.xml')), 'Authorizes if any of the specified roles match the JWT role claims.'),\n", |
40 | 40 | " PolicyFragment('Http-Response-200', utils.read_policy_xml(utils.determine_shared_policy_path('pf-http-response-200.xml')), 'Returns a 200 OK response for the current HTTP method.'),\n", |
| 41 | + " PolicyFragment('Product-Match-Any', utils.read_policy_xml(utils.determine_shared_policy_path('pf-product-match-any.xml')), 'Proceeds if any of the specified products match the context product name.'),\n", |
41 | 42 | " PolicyFragment('Remove-Request-Headers', utils.read_policy_xml(utils.determine_shared_policy_path('pf-remove-request-headers.xml')), 'Removes request headers from the incoming request.')\n", |
42 | 43 | "]\n", |
43 | 44 | "\n", |
44 | 45 | "# 4) Define the APIs and their operations and policies\n", |
45 | 46 | "\n", |
46 | 47 | "# Policies\n", |
47 | | - "hello_world_policy_xml = utils.read_policy_xml(HELLO_WORLD_XML_POLICY_PATH)\n", |
| 48 | + "pol_hello_world = utils.read_policy_xml(HELLO_WORLD_XML_POLICY_PATH)\n", |
48 | 49 | "\n", |
49 | 50 | "# Hello World (Root)\n", |
50 | | - "api_hwroot_get = GET_APIOperation('This is a GET for API 1', hello_world_policy_xml)\n", |
| 51 | + "api_hwroot_get = GET_APIOperation('This is a GET for API 1', pol_hello_world)\n", |
51 | 52 | "api_hwroot = API('hello-world', 'Hello World', '', 'This is the root API for Hello World', operations = [api_hwroot_get])\n", |
52 | 53 | "\n", |
53 | 54 | "apis: List[API] = [api_hwroot]\n", |
|
56 | 57 | "if use_ACA:\n", |
57 | 58 | " utils.print_info('ACA APIs will be created.')\n", |
58 | 59 | "\n", |
59 | | - " backend_policy_xml = utils.read_policy_xml(BACKEND_XML_POLICY_PATH)\n", |
60 | | - " aca_backend_1_policy_xml = backend_policy_xml.format(backend_id = 'aca-backend-1')\n", |
61 | | - " aca_backend_2_policy_xml = backend_policy_xml.format(backend_id = 'aca-backend-2')\n", |
62 | | - " aca_backend_pool_policy_xml = backend_policy_xml.format(backend_id = 'aca-backend-pool')\n", |
| 60 | + " pol_backend = utils.read_policy_xml(BACKEND_XML_POLICY_PATH)\n", |
| 61 | + " pol_aca_backend_1 = pol_backend.format(backend_id = 'aca-backend-1')\n", |
| 62 | + " pol_aca_backend_2 = pol_backend.format(backend_id = 'aca-backend-2')\n", |
| 63 | + " pol_aca_backend_pool = pol_backend.format(backend_id = 'aca-backend-pool')\n", |
63 | 64 | "\n", |
64 | 65 | " # Hello World (ACA Backend 1)\n", |
65 | 66 | " api_hwaca_1_get = GET_APIOperation('This is a GET for Hello World on ACA Backend 1')\n", |
66 | | - " api_hwaca_1 = API('hello-world-aca-1', 'Hello World (ACA 1)', '/aca-1', 'This is the ACA API for Backend 1', policyXml = aca_backend_1_policy_xml, operations = [api_hwaca_1_get])\n", |
| 67 | + " api_hwaca_1 = API('hello-world-aca-1', 'Hello World (ACA 1)', '/aca-1', 'This is the ACA API for Backend 1', policyXml = pol_aca_backend_1, operations = [api_hwaca_1_get])\n", |
67 | 68 | "\n", |
68 | 69 | " # Hello World (ACA Backend 2)\n", |
69 | 70 | " api_hwaca_2_get = GET_APIOperation('This is a GET for Hello World on ACA Backend 2')\n", |
70 | | - " api_hwaca_2 = API('hello-world-aca-2', 'Hello World (ACA 2)', '/aca-2', 'This is the ACA API for Backend 2', policyXml = aca_backend_2_policy_xml, operations = [api_hwaca_2_get])\n", |
| 71 | + " api_hwaca_2 = API('hello-world-aca-2', 'Hello World (ACA 2)', '/aca-2', 'This is the ACA API for Backend 2', policyXml = pol_aca_backend_2, operations = [api_hwaca_2_get])\n", |
71 | 72 | "\n", |
72 | 73 | " # Hello World (ACA Backend Pool)\n", |
73 | 74 | " api_hwaca_pool_get = GET_APIOperation('This is a GET for Hello World on ACA Backend Pool')\n", |
74 | | - " api_hwaca_pool = API('hello-world-aca-pool', 'Hello World (ACA Pool)', '/aca-pool', 'This is the ACA API for Backend Pool', policyXml = aca_backend_pool_policy_xml, operations = [api_hwaca_pool_get])\n", |
| 75 | + " api_hwaca_pool = API('hello-world-aca-pool', 'Hello World (ACA Pool)', '/aca-pool', 'This is the ACA API for Backend Pool', policyXml = pol_aca_backend_pool, operations = [api_hwaca_pool_get])\n", |
75 | 76 | "\n", |
76 | 77 | " # Add ACA APIs to the existing apis array\n", |
77 | 78 | " apis += [api_hwaca_1, api_hwaca_2, api_hwaca_pool]\n", |
|
0 commit comments