Skip to content
Snippets Groups Projects
Commit a45778dd authored by Juraj Paluba's avatar Juraj Paluba
Browse files

cloud_client: implement node details

Terraform resource attributes are backend specific. Because of that each
cloud client (AWS, OpenStack, ...) must implement this method.
parent 2051efb4
No related branches found
No related tags found
1 merge request!12cloud_client: implement node details
Pipeline #499763 passed
from .cloud_client_base import KypoCloudClientBase
from .cloud_client_elements import Image, Limits, QuotaSet, Quota, HardwareUsage
from .cloud_client_elements import Image, Limits, QuotaSet, Quota, HardwareUsage, NodeDetails
from .exceptions import KypoException, StackException, StackCreationFailed, \
InvalidTopologyDefinition, StackNotFound
from .topology_elements import MAN, SecurityGroups, Link, NodeToNodeLinkPair
......
from abc import ABC, abstractmethod
from typing import List
from kypo.cloud_commons.cloud_client_elements import Image, QuotaSet, HardwareUsage, Limits
from kypo.cloud_commons.cloud_client_elements import Image, NodeDetails, QuotaSet, HardwareUsage, Limits
from kypo.cloud_commons.topology_instance import TopologyInstance
......@@ -86,6 +86,17 @@ class KypoCloudClientBase(ABC):
"""
pass
@abstractmethod
def get_node_details(self, terraform_attrs: dict) -> NodeDetails:
"""
Get node details from the Terraform resource attributes.
Note, Terraform attributes are backend specific.
:param terraform_attrs: Terraform resource attributes of the node
:return: Node details
"""
pass
@abstractmethod
def get_console_url(self, node_id: str, console_type: str) -> str:
"""
......
......@@ -164,3 +164,14 @@ class HardwareUsage:
return self.vcpu == other.vcpu and self.ram == other.ram and\
self.instances == other.instances and self.network == other.network and\
self.subnet == other.subnet and self.port == other.port
class NodeDetails:
"""
Defines node (Terraform resource) detail
"""
def __init__(self, image_id: str, status: str, flavor: str) -> None:
self.image_id = image_id
self.status = status
self.flavor = flavor
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment