|
1 | 1 | import string |
2 | 2 | import sys |
3 | | -from dataclasses import dataclass |
| 3 | +from dataclasses import dataclass, field |
4 | 4 | from datetime import datetime |
5 | 5 | from enum import Enum |
6 | 6 | from os import urandom |
@@ -653,6 +653,66 @@ class MigrationType: |
653 | 653 | WARM = "warm" |
654 | 654 |
|
655 | 655 |
|
| 656 | +@dataclass |
| 657 | +class LinodeInterfaceDefaultRoute(JSONObject): |
| 658 | + ipv4: bool = False |
| 659 | + |
| 660 | + |
| 661 | +@dataclass |
| 662 | +class LinodeInterfaceVPCIPv4Address(JSONObject): |
| 663 | + address: str = "" |
| 664 | + primary: bool = False |
| 665 | + |
| 666 | + |
| 667 | +@dataclass |
| 668 | +class LinodeInterfaceVPCIPv4Range(JSONObject): |
| 669 | + range: str = "" |
| 670 | + |
| 671 | + |
| 672 | +@dataclass |
| 673 | +class LinodeInterfaceVPCIPv4(JSONObject): |
| 674 | + addresses: List[LinodeInterfaceVPCIPv4Address] = field(default_factory=list) |
| 675 | + ranges: List[LinodeInterfaceVPCIPv4Range] = field(default_factory=list) |
| 676 | + |
| 677 | + |
| 678 | +@dataclass |
| 679 | +class LinodeInterfaceVPC(JSONObject): |
| 680 | + vpc_id: int = 0 |
| 681 | + vpc_subnet: int = 0 |
| 682 | + |
| 683 | + ipv4: Optional[LinodeInterfaceVPCIPv4] = None |
| 684 | + |
| 685 | + |
| 686 | +@dataclass |
| 687 | +class LinodeInterfacePublic(JSONObject): |
| 688 | + vpc_id: int = 0 |
| 689 | + vpc_subnet: int = 0 |
| 690 | + |
| 691 | + ipv4: Optional[LinodeInterfaceVPCIPv4] = None |
| 692 | + |
| 693 | + |
| 694 | +class LinodeInterface(Base): |
| 695 | + """ |
| 696 | + A Linode's network interface. |
| 697 | +
|
| 698 | + API Documentation: Not yet available. |
| 699 | + """ |
| 700 | + |
| 701 | + api_endpoint = "/linode/instances/{linode_id}/interfaces/{id}" |
| 702 | + derived_url_path = "interfaces" |
| 703 | + parent_id_name = "linode_id" |
| 704 | + |
| 705 | + properties = { |
| 706 | + "id": Property(identifier=True), |
| 707 | + "mac_address": Property(), |
| 708 | + "created": Property(is_datetime=True), |
| 709 | + "updated": Property(is_datetime=True), |
| 710 | + "version": Property(), |
| 711 | + "default_route": Property(json_object=LinodeInterfaceDefaultRoute), |
| 712 | + "vpc": Property(json_object=LinodeInterfaceVPC), |
| 713 | + } |
| 714 | + |
| 715 | + |
656 | 716 | class Instance(Base): |
657 | 717 | """ |
658 | 718 | A Linode Instance. |
|
0 commit comments