|
22 | 22 | ListIPsRequestOrderBy, |
23 | 23 | ListPatRulesRequestOrderBy, |
24 | 24 | PatRuleProtocol, |
| 25 | + AddBastionAllowedIPsRequest, |
| 26 | + AddBastionAllowedIPsResponse, |
25 | 27 | CreateGatewayNetworkRequest, |
26 | 28 | CreateGatewayRequest, |
27 | 29 | CreateIPRequest, |
|
35 | 37 | ListIPsResponse, |
36 | 38 | ListPatRulesResponse, |
37 | 39 | PatRule, |
| 40 | + SetBastionAllowedIPsRequest, |
| 41 | + SetBastionAllowedIPsResponse, |
38 | 42 | SetPatRulesRequest, |
39 | 43 | SetPatRulesRequestRule, |
40 | 44 | SetPatRulesResponse, |
|
53 | 57 | unmarshal_IP, |
54 | 58 | unmarshal_Gateway, |
55 | 59 | unmarshal_PatRule, |
| 60 | + unmarshal_AddBastionAllowedIPsResponse, |
56 | 61 | unmarshal_ListGatewayNetworksResponse, |
57 | 62 | unmarshal_ListGatewayTypesResponse, |
58 | 63 | unmarshal_ListGatewaysResponse, |
59 | 64 | unmarshal_ListIPsResponse, |
60 | 65 | unmarshal_ListPatRulesResponse, |
| 66 | + unmarshal_SetBastionAllowedIPsResponse, |
61 | 67 | unmarshal_SetPatRulesResponse, |
| 68 | + marshal_AddBastionAllowedIPsRequest, |
62 | 69 | marshal_CreateGatewayNetworkRequest, |
63 | 70 | marshal_CreateGatewayRequest, |
64 | 71 | marshal_CreateIPRequest, |
65 | 72 | marshal_CreatePatRuleRequest, |
| 73 | + marshal_SetBastionAllowedIPsRequest, |
66 | 74 | marshal_SetPatRulesRequest, |
67 | 75 | marshal_UpdateGatewayNetworkRequest, |
68 | 76 | marshal_UpdateGatewayRequest, |
@@ -1383,3 +1391,122 @@ async def refresh_ssh_keys( |
1383 | 1391 |
|
1384 | 1392 | self._throw_on_error(res) |
1385 | 1393 | return unmarshal_Gateway(res.json()) |
| 1394 | + |
| 1395 | + async def add_bastion_allowed_i_ps( |
| 1396 | + self, |
| 1397 | + *, |
| 1398 | + gateway_id: str, |
| 1399 | + ip_range: str, |
| 1400 | + zone: Optional[Zone] = None, |
| 1401 | + ) -> AddBastionAllowedIPsResponse: |
| 1402 | + """ |
| 1403 | + Add allowed IP range to SSH bastion. |
| 1404 | + Add an IP range (in CIDR notation) to be allowed to connect to the SSH bastion. |
| 1405 | + :param gateway_id: ID of the gateway to add the allowed IP range to. |
| 1406 | + :param ip_range: IP range allowed to connect to the SSH bastion. |
| 1407 | + :param zone: Zone to target. If none is passed will use default zone from the config. |
| 1408 | + :return: :class:`AddBastionAllowedIPsResponse <AddBastionAllowedIPsResponse>` |
| 1409 | +
|
| 1410 | + Usage: |
| 1411 | + :: |
| 1412 | +
|
| 1413 | + result = await api.add_bastion_allowed_i_ps( |
| 1414 | + gateway_id="example", |
| 1415 | + ip_range="example", |
| 1416 | + ) |
| 1417 | + """ |
| 1418 | + |
| 1419 | + param_zone = validate_path_param("zone", zone or self.client.default_zone) |
| 1420 | + param_gateway_id = validate_path_param("gateway_id", gateway_id) |
| 1421 | + |
| 1422 | + res = self._request( |
| 1423 | + "POST", |
| 1424 | + f"/vpc-gw/v2/zones/{param_zone}/gateways/{param_gateway_id}/bastion-allowed-ips", |
| 1425 | + body=marshal_AddBastionAllowedIPsRequest( |
| 1426 | + AddBastionAllowedIPsRequest( |
| 1427 | + gateway_id=gateway_id, |
| 1428 | + ip_range=ip_range, |
| 1429 | + zone=zone, |
| 1430 | + ), |
| 1431 | + self.client, |
| 1432 | + ), |
| 1433 | + ) |
| 1434 | + |
| 1435 | + self._throw_on_error(res) |
| 1436 | + return unmarshal_AddBastionAllowedIPsResponse(res.json()) |
| 1437 | + |
| 1438 | + async def set_bastion_allowed_i_ps( |
| 1439 | + self, |
| 1440 | + *, |
| 1441 | + gateway_id: str, |
| 1442 | + zone: Optional[Zone] = None, |
| 1443 | + ip_ranges: Optional[List[str]] = None, |
| 1444 | + ) -> SetBastionAllowedIPsResponse: |
| 1445 | + """ |
| 1446 | + Set all IP ranges allowed for SSH bastion. |
| 1447 | + Set a definitive list of IP ranges (in CIDR notation) allowed to connect to the SSH bastion. |
| 1448 | + :param gateway_id: ID of the gateway on which to set the allowed IP range. |
| 1449 | + :param zone: Zone to target. If none is passed will use default zone from the config. |
| 1450 | + :param ip_ranges: New list of IP ranges (each range in CIDR notation) allowed to connect to the SSH bastion. |
| 1451 | + :return: :class:`SetBastionAllowedIPsResponse <SetBastionAllowedIPsResponse>` |
| 1452 | +
|
| 1453 | + Usage: |
| 1454 | + :: |
| 1455 | +
|
| 1456 | + result = await api.set_bastion_allowed_i_ps( |
| 1457 | + gateway_id="example", |
| 1458 | + ) |
| 1459 | + """ |
| 1460 | + |
| 1461 | + param_zone = validate_path_param("zone", zone or self.client.default_zone) |
| 1462 | + param_gateway_id = validate_path_param("gateway_id", gateway_id) |
| 1463 | + |
| 1464 | + res = self._request( |
| 1465 | + "PUT", |
| 1466 | + f"/vpc-gw/v2/zones/{param_zone}/gateways/{param_gateway_id}/bastion-allowed-ips", |
| 1467 | + body=marshal_SetBastionAllowedIPsRequest( |
| 1468 | + SetBastionAllowedIPsRequest( |
| 1469 | + gateway_id=gateway_id, |
| 1470 | + zone=zone, |
| 1471 | + ip_ranges=ip_ranges, |
| 1472 | + ), |
| 1473 | + self.client, |
| 1474 | + ), |
| 1475 | + ) |
| 1476 | + |
| 1477 | + self._throw_on_error(res) |
| 1478 | + return unmarshal_SetBastionAllowedIPsResponse(res.json()) |
| 1479 | + |
| 1480 | + async def delete_bastion_allowed_i_ps( |
| 1481 | + self, |
| 1482 | + *, |
| 1483 | + gateway_id: str, |
| 1484 | + ip_range: str, |
| 1485 | + zone: Optional[Zone] = None, |
| 1486 | + ) -> None: |
| 1487 | + """ |
| 1488 | + Delete allowed IP range from SSH bastion. |
| 1489 | + Delete an IP range (defined in CIDR notation) from SSH bastion, so that it is no longer allowed to connect. |
| 1490 | + :param gateway_id: ID of the gateway on which to delete the allowed IP range. |
| 1491 | + :param ip_range: IP range to delete from SSH bastion's list of allowed IPs. |
| 1492 | + :param zone: Zone to target. If none is passed will use default zone from the config. |
| 1493 | +
|
| 1494 | + Usage: |
| 1495 | + :: |
| 1496 | +
|
| 1497 | + result = await api.delete_bastion_allowed_i_ps( |
| 1498 | + gateway_id="example", |
| 1499 | + ip_range="example", |
| 1500 | + ) |
| 1501 | + """ |
| 1502 | + |
| 1503 | + param_zone = validate_path_param("zone", zone or self.client.default_zone) |
| 1504 | + param_gateway_id = validate_path_param("gateway_id", gateway_id) |
| 1505 | + param_ip_range = validate_path_param("ip_range", ip_range) |
| 1506 | + |
| 1507 | + res = self._request( |
| 1508 | + "DELETE", |
| 1509 | + f"/vpc-gw/v2/zones/{param_zone}/gateways/{param_gateway_id}/bastion-allowed-ips/{param_ip_range}", |
| 1510 | + ) |
| 1511 | + |
| 1512 | + self._throw_on_error(res) |
0 commit comments