|
22 | 22 | import pytest |
23 | 23 | from ibm_code_engine_sdk.code_engine_v2 import * |
24 | 24 |
|
25 | | -version = '2024-09-27' |
| 25 | +version = '2024-11-18' |
26 | 26 |
|
27 | 27 | # |
28 | 28 | # This file provides an example of how to use the Code Engine service. |
@@ -146,6 +146,112 @@ def test_get_project_example(self): |
146 | 146 | except ApiException as e: |
147 | 147 | pytest.fail(str(e)) |
148 | 148 |
|
| 149 | + @needscredentials |
| 150 | + def test_list_allowed_outbound_destination_example(self): |
| 151 | + """ |
| 152 | + list_allowed_outbound_destination request example |
| 153 | + """ |
| 154 | + try: |
| 155 | + print('\nlist_allowed_outbound_destination() result:') |
| 156 | + |
| 157 | + # begin-list_allowed_outbound_destination |
| 158 | + |
| 159 | + all_results = [] |
| 160 | + pager = AllowedOutboundDestinationPager( |
| 161 | + client=code_engine_service, |
| 162 | + project_id='15314cc3-85b4-4338-903f-c28cdee6d005', |
| 163 | + limit=100, |
| 164 | + ) |
| 165 | + while pager.has_next(): |
| 166 | + next_page = pager.get_next() |
| 167 | + assert next_page is not None |
| 168 | + all_results.extend(next_page) |
| 169 | + |
| 170 | + print(json.dumps(all_results, indent=2)) |
| 171 | + |
| 172 | + # end-list_allowed_outbound_destination |
| 173 | + except ApiException as e: |
| 174 | + pytest.fail(str(e)) |
| 175 | + |
| 176 | + @needscredentials |
| 177 | + def test_create_allowed_outbound_destination_example(self): |
| 178 | + """ |
| 179 | + create_allowed_outbound_destination request example |
| 180 | + """ |
| 181 | + try: |
| 182 | + print('\ncreate_allowed_outbound_destination() result:') |
| 183 | + |
| 184 | + # begin-create_allowed_outbound_destination |
| 185 | + |
| 186 | + allowed_outbound_destination_prototype_model = { |
| 187 | + 'type': 'cidr_block', |
| 188 | + 'cidr_block': 'testString', |
| 189 | + 'name': 'testString', |
| 190 | + } |
| 191 | + |
| 192 | + response = code_engine_service.create_allowed_outbound_destination( |
| 193 | + project_id='15314cc3-85b4-4338-903f-c28cdee6d005', |
| 194 | + allowed_outbound_destination=allowed_outbound_destination_prototype_model, |
| 195 | + ) |
| 196 | + allowed_outbound_destination = response.get_result() |
| 197 | + |
| 198 | + print(json.dumps(allowed_outbound_destination, indent=2)) |
| 199 | + |
| 200 | + # end-create_allowed_outbound_destination |
| 201 | + |
| 202 | + except ApiException as e: |
| 203 | + pytest.fail(str(e)) |
| 204 | + |
| 205 | + @needscredentials |
| 206 | + def test_get_allowed_outbound_destination_example(self): |
| 207 | + """ |
| 208 | + get_allowed_outbound_destination request example |
| 209 | + """ |
| 210 | + try: |
| 211 | + print('\nget_allowed_outbound_destination() result:') |
| 212 | + |
| 213 | + # begin-get_allowed_outbound_destination |
| 214 | + |
| 215 | + response = code_engine_service.get_allowed_outbound_destination( |
| 216 | + project_id='15314cc3-85b4-4338-903f-c28cdee6d005', |
| 217 | + name='my-allowed-outbound-destination', |
| 218 | + ) |
| 219 | + allowed_outbound_destination = response.get_result() |
| 220 | + |
| 221 | + print(json.dumps(allowed_outbound_destination, indent=2)) |
| 222 | + |
| 223 | + # end-get_allowed_outbound_destination |
| 224 | + |
| 225 | + except ApiException as e: |
| 226 | + pytest.fail(str(e)) |
| 227 | + |
| 228 | + @needscredentials |
| 229 | + def test_update_allowed_outbound_destination_example(self): |
| 230 | + """ |
| 231 | + update_allowed_outbound_destination request example |
| 232 | + """ |
| 233 | + try: |
| 234 | + print('\nupdate_allowed_outbound_destination() result:') |
| 235 | + |
| 236 | + # begin-update_allowed_outbound_destination |
| 237 | + |
| 238 | + allowed_outbound_destination_patch_model = {} |
| 239 | + |
| 240 | + response = code_engine_service.update_allowed_outbound_destination( |
| 241 | + project_id='15314cc3-85b4-4338-903f-c28cdee6d005', |
| 242 | + name='my-allowed-outbound-destination', |
| 243 | + if_match='testString', |
| 244 | + allowed_outbound_destination=allowed_outbound_destination_patch_model, |
| 245 | + ) |
| 246 | + allowed_outbound_destination = response.get_result() |
| 247 | + |
| 248 | + print(json.dumps(allowed_outbound_destination, indent=2)) |
| 249 | + |
| 250 | + # end-update_allowed_outbound_destination |
| 251 | + |
| 252 | + except ApiException as e: |
| 253 | + pytest.fail(str(e)) |
| 254 | + |
149 | 255 | @needscredentials |
150 | 256 | def test_get_project_egress_ips_example(self): |
151 | 257 | """ |
@@ -1244,6 +1350,25 @@ def test_delete_project_example(self): |
1244 | 1350 | except ApiException as e: |
1245 | 1351 | pytest.fail(str(e)) |
1246 | 1352 |
|
| 1353 | + @needscredentials |
| 1354 | + def test_delete_allowed_outbound_destination_example(self): |
| 1355 | + """ |
| 1356 | + delete_allowed_outbound_destination request example |
| 1357 | + """ |
| 1358 | + try: |
| 1359 | + # begin-delete_allowed_outbound_destination |
| 1360 | + |
| 1361 | + response = code_engine_service.delete_allowed_outbound_destination( |
| 1362 | + project_id='15314cc3-85b4-4338-903f-c28cdee6d005', |
| 1363 | + name='my-allowed-outbound-destination', |
| 1364 | + ) |
| 1365 | + |
| 1366 | + # end-delete_allowed_outbound_destination |
| 1367 | + print('\ndelete_allowed_outbound_destination() response status code: ', response.get_status_code()) |
| 1368 | + |
| 1369 | + except ApiException as e: |
| 1370 | + pytest.fail(str(e)) |
| 1371 | + |
1247 | 1372 | @needscredentials |
1248 | 1373 | def test_delete_app_example(self): |
1249 | 1374 | """ |
|
0 commit comments