# Path: libcloudforensics/providers/kubernetes/base.py
# class K8sClient(metaclass=abc.ABCMeta):
# class K8sResource(K8sClient, metaclass=abc.ABCMeta):
# class K8sNamespacedResource(K8sResource, metaclass=abc.ABCMeta):
# class K8sNode(K8sResource):
# class K8sWorkload(K8sNamespacedResource):
# class K8sPod(K8sWorkload):
#   T = TypeVar('T')
#   def __init__(self, api_client: client.ApiClient) -> None:
#   def _Api(self, api_class: Callable[[client.ApiClient], T]) -> T:
#   def __init__(self, api_client: client.ApiClient, name: str) -> None:
#   def Read(self) -> object:
#   def __init__(
#       self, api_client: client.ApiClient, name: str, namespace: str) -> None:
#   def Delete(self, cascade: bool = True) -> None:
#   def Read(self) -> client.V1Node:
#   def Cordon(self) -> None:
#   def Drain(self, pod_filter: Callable[['K8sPod'], bool]) -> None:
#   def ListPods(self, namespace: Optional[str] = None) -> List['K8sPod']:
#   def ExternalIps(self) -> List[str]:
#   def InternalIps(self) -> List[str]:
#   def GetCoveredPods(self) -> List['K8sPod']:
#   def GetCoveredNodes(self) -> List[K8sNode]:
#   def IsCoveringPod(self, pod: 'K8sPod') -> bool:
#   def gcp_protopayload_methodname(self) -> str:
#   def GcpClusterLogsQuerySupplement(self) -> str:
#   def GcpContainerLogsQuerySupplement(self) -> str:
#   def OrphanPods(self) -> None:
#   def gcp_protopayload_methodname(self) -> str:
#   def GcpContainerLogsQuerySupplement(self) -> str:
#   def OrphanPods(self) -> None:
#   def GetCoveredPods(self) -> List['K8sPod']:
#   def IsCoveringPod(self, pod: 'K8sPod') -> bool:
#   def Read(self) -> client.V1Pod:
#   def GetNode(self) -> K8sNode:
#   def ListContainers(self) -> List[container.K8sContainer]:
#   def ListVolumes(self) -> List[volume.K8sVolume]:
#   def GetLabels(self) -> Dict[str, str]:
#   def Delete(self, cascade: bool = True) -> None:
#   def AddLabels(self, labels: Dict[str, str]) -> None:
# 
# Path: libcloudforensics/providers/kubernetes/selector.py
# class K8sSelector:
#   class Component(abc.ABC):
#   class LabelComponent(Component, metaclass=abc.ABCMeta):
#   class FieldComponent(Component, metaclass=abc.ABCMeta):
#   class Name(FieldComponent):
#   class Node(FieldComponent):
#   class Running(FieldComponent):
#   class Label(LabelComponent):
#     def ToString(self) -> str:
#     def keyword(self) -> str:
#     def keyword(self) -> str:
#     def keyword(self) -> str:
#     def __init__(self, name: str) -> None:
#     def ToString(self) -> str:
#     def __init__(self, node: str) -> None:
#     def ToString(self) -> str:
#     def ToString(self) -> str:
#     def __init__(self, key: str, value: str) -> None:
#     def ToString(self) -> str:
#   def __init__(self, *selectors: Component) -> None:
#   def ToKeywords(self) -> Dict[str, str]:
#   def FromLabelsDict(cls, labels: Dict[str, str]) -> 'K8sSelector':


from typing import Dict, List, Optional
from kubernetes import client
from libcloudforensics.providers.kubernetes import base
from libcloudforensics.providers.kubernetes import selector
class K8sService(base.K8sNamespacedResource):
  """Class representing a Kubernetes service."""

  def Delete(self, cascade: bool = True) -> None:
    """Override of abstract method."""
    api = self._Api(client.CoreV1Api)
    api.delete_namespaced_service(self.name, self.namespace)

  def Read(self) -> client.V1Service:
    """Override of abstract method."""
    api = self._Api(client.CoreV1Api)
    return api.read_namespaced_service(self.name, self.namespace)

  def Type(self) -> str:
    """Returns the type of this service.

    Returns:
      str: The type of this service.
    """
    return str(self.Read().spec.type)

  def Labels(self) -> Dict[str, str]:
    """Returns the selector labels for this service.

    Returns:
      Dict[str, str]: The selector labels for this service.
    """
    labels = self.Read().spec.selector  # type: Dict[str, str]
    return labels


# Path: libcloudforensics/providers/kubernetes/base.py
# class K8sClient(metaclass=abc.ABCMeta):
# class K8sResource(K8sClient, metaclass=abc.ABCMeta):
# class K8sNamespacedResource(K8sResource, metaclass=abc.ABCMeta):
# class K8sNode(K8sResource):
# class K8sWorkload(K8sNamespacedResource):
# class K8sPod(K8sWorkload):
#   T = TypeVar('T')
#   def __init__(self, api_client: client.ApiClient) -> None:
#   def _Api(self, api_class: Callable[[client.ApiClient], T]) -> T:
#   def __init__(self, api_client: client.ApiClient, name: str) -> None:
#   def Read(self) -> object:
#   def __init__(
#       self, api_client: client.ApiClient, name: str, namespace: str) -> None:
#   def Delete(self, cascade: bool = True) -> None:
#   def Read(self) -> client.V1Node:
#   def Cordon(self) -> None:
#   def Drain(self, pod_filter: Callable[['K8sPod'], bool]) -> None:
#   def ListPods(self, namespace: Optional[str] = None) -> List['K8sPod']:
#   def ExternalIps(self) -> List[str]:
#   def InternalIps(self) -> List[str]:
#   def GetCoveredPods(self) -> List['K8sPod']:
#   def GetCoveredNodes(self) -> List[K8sNode]:
#   def IsCoveringPod(self, pod: 'K8sPod') -> bool:
#   def gcp_protopayload_methodname(self) -> str:
#   def GcpClusterLogsQuerySupplement(self) -> str:
#   def GcpContainerLogsQuerySupplement(self) -> str:
#   def OrphanPods(self) -> None:
#   def gcp_protopayload_methodname(self) -> str:
#   def GcpContainerLogsQuerySupplement(self) -> str:
#   def OrphanPods(self) -> None:
#   def GetCoveredPods(self) -> List['K8sPod']:
#   def IsCoveringPod(self, pod: 'K8sPod') -> bool:
#   def Read(self) -> client.V1Pod:
#   def GetNode(self) -> K8sNode:
#   def ListContainers(self) -> List[container.K8sContainer]:
#   def ListVolumes(self) -> List[volume.K8sVolume]:
#   def GetLabels(self) -> Dict[str, str]:
#   def Delete(self, cascade: bool = True) -> None:
#   def AddLabels(self, labels: Dict[str, str]) -> None:
# 
# Path: libcloudforensics/providers/kubernetes/selector.py
# class K8sSelector:
#   class Component(abc.ABC):
#   class LabelComponent(Component, metaclass=abc.ABCMeta):
#   class FieldComponent(Component, metaclass=abc.ABCMeta):
#   class Name(FieldComponent):
#   class Node(FieldComponent):
#   class Running(FieldComponent):
#   class Label(LabelComponent):
#     def ToString(self) -> str:
#     def keyword(self) -> str:
#     def keyword(self) -> str:
#     def keyword(self) -> str:
#     def __init__(self, name: str) -> None:
#     def ToString(self) -> str:
#     def __init__(self, node: str) -> None:
#     def ToString(self) -> str:
#     def ToString(self) -> str:
#     def __init__(self, key: str, value: str) -> None:
#     def ToString(self) -> str:
#   def __init__(self, *selectors: Component) -> None:
#   def ToKeywords(self) -> Dict[str, str]:
#   def FromLabelsDict(cls, labels: Dict[str, str]) -> 'K8sSelector':


# Path: libcloudforensics/providers/kubernetes/services.py
from typing import Dict, List, Optional
from kubernetes import client
from libcloudforensics.providers.kubernetes import base
from libcloudforensics.providers.kubernetes import selector

class K8sService(base.K8sNamespacedResource):
  """Class representing a Kubernetes service."""

  def Delete(self, cascade: bool = True) -> None:
    """Override of abstract method."""
    api = self._Api(client.CoreV1Api)
    api.delete_namespaced_service(self.name, self.namespace)

  def Read(self) -> client.V1Service:
    """Override of abstract method."""
    api = self._Api(client.CoreV1Api)
    return api.read_namespaced_service(self.name, self.namespace)

  def Type(self) -> str:
    """Returns the type of this service.

    Returns:
      str: The type of this service.
    """
    return str(self.Read().spec.type)

  def Labels(self) -> Dict[str, str]:
    """Returns the selector labels for this service.

    Returns:
      Dict[str, str]: The selector labels for this service.
    """
    labels = self.Read().spec.selector  # type: Dict[str, str]
    return labels


  def GetCoveredPods(self) -> List[base.K8sPod]: