|
45 | 45 | "# 3) Define the APIs and their operations and policies\n", |
46 | 46 | "\n", |
47 | 47 | "# Policies\n", |
48 | | - "default_policy_xml = utils.policy_xml_replacement(DEFAULT_XML_POLICY_PATH)\n", |
49 | 48 | "hello_world_policy_xml = utils.policy_xml_replacement(HELLO_WORLD_XML_POLICY_PATH)\n", |
50 | 49 | "\n", |
51 | 50 | "# Hello World (Root)\n", |
52 | 51 | "api_hwroot_get = GET_APIOperation('This is a GET for API 1', hello_world_policy_xml)\n", |
53 | | - "api_hwroot = API('hello-world', 'Hello World', '', 'This is the root API for Hello World', default_policy_xml, [api_hwroot_get])\n", |
| 52 | + "api_hwroot = API('hello-world', 'Hello World', '', 'This is the root API for Hello World', operations = [api_hwroot_get])\n", |
54 | 53 | "\n", |
55 | 54 | "apis: List[API] = [api_hwroot]\n", |
56 | 55 | "\n", |
|
63 | 62 | " aca_backend_pool_policy_xml = utils.policy_xml_replacement(ACA_BACKEND_POOL_XML_POLICY_PATH)\n", |
64 | 63 | "\n", |
65 | 64 | " # Hello World (ACA Backend 1)\n", |
66 | | - " api_hwaca_1_get = GET_APIOperation('This is a GET for Hello World on ACA Backend 1', default_policy_xml)\n", |
67 | | - " api_hwaca_1 = API('hello-world-aca-1', 'Hello World (ACA 1)', '/aca-1', 'This is the ACA API for Backend 1', aca_backend_1_policy_xml, [api_hwaca_1_get])\n", |
| 65 | + " 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", |
68 | 67 | "\n", |
69 | 68 | " # Hello World (ACA Backend 2)\n", |
70 | | - " api_hwaca_2_get = GET_APIOperation('This is a GET for Hello World on ACA Backend 2', default_policy_xml)\n", |
71 | | - " api_hwaca_2 = API('hello-world-aca-2', 'Hello World (ACA 2)', '/aca-2', 'This is the ACA API for Backend 2', aca_backend_2_policy_xml, [api_hwaca_2_get])\n", |
| 69 | + " 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", |
72 | 71 | "\n", |
73 | 72 | " # Hello World (ACA Backend Pool)\n", |
74 | | - " api_hwaca_pool_get = GET_APIOperation('This is a GET for Hello World on ACA Backend Pool', default_policy_xml)\n", |
75 | | - " api_hwaca_pool = API('hello-world-aca-pool', 'Hello World (ACA Pool)', '/aca-pool', 'This is the ACA API for Backend Pool', aca_backend_pool_policy_xml, [api_hwaca_pool_get])\n", |
| 73 | + " 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", |
76 | 75 | "\n", |
77 | 76 | " # Add ACA APIs to the existing apis array\n", |
78 | 77 | " apis += [api_hwaca_1, api_hwaca_2, api_hwaca_pool]\n", |
|
111 | 110 | "\n", |
112 | 111 | "# 3) Print a deployment summary, if successful; otherwise, exit with an error\n", |
113 | 112 | "if not output.success:\n", |
114 | | - " exit('Deployment failed')\n", |
| 113 | + " raise SystemExit('Deployment failed')\n", |
115 | 114 | "\n", |
116 | 115 | "if output.success and output.json_data:\n", |
117 | 116 | " apim_service_id = output.get('apimServiceId', 'APIM Service Id')\n", |
|
219 | 218 | "\n", |
220 | 219 | "# 3) Print a single, clear deployment summary if successful\n", |
221 | 220 | "if not output.success:\n", |
222 | | - " exit('Deployment failed')\n", |
| 221 | + " raise SystemExit('Deployment failed')\n", |
223 | 222 | " \n", |
224 | 223 | "if output.success and output.json_data:\n", |
225 | 224 | " apim_gateway_url = output.get('apimResourceGatewayURL', 'APIM API Gateway URL')\n", |
|
0 commit comments