# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: pod.proto
# plugin: python-betterproto
# This file has been @generated

from dataclasses import dataclass
from typing import (
    TYPE_CHECKING,
    Dict,
    List,
    Optional,
)

import betterproto
import grpc
from betterproto.grpcstub.grpcio_client import SyncServiceStub
from betterproto.grpcstub.grpclib_server import ServiceBase

from .. import types as _types__


if TYPE_CHECKING:
    import grpclib.server
    from betterproto.grpcstub.grpclib_client import MetadataLike
    from grpclib.metadata import Deadline


@dataclass(eq=False, repr=False)
class CreatePodRequest(betterproto.Message):
    stub_id: str = betterproto.string_field(1)
    image_id: Optional[str] = betterproto.string_field(2, optional=True)
    checkpoint_id: Optional[str] = betterproto.string_field(3, optional=True)


@dataclass(eq=False, repr=False)
class CreatePodResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    container_id: str = betterproto.string_field(2)
    error_msg: str = betterproto.string_field(3)
    stub_id: str = betterproto.string_field(4)


@dataclass(eq=False, repr=False)
class PodSandboxExecRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    command: str = betterproto.string_field(2)
    cwd: str = betterproto.string_field(3)
    env: Dict[str, str] = betterproto.map_field(
        4, betterproto.TYPE_STRING, betterproto.TYPE_STRING
    )


@dataclass(eq=False, repr=False)
class PodSandboxExecResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    pid: int = betterproto.int32_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxStatusRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    pid: int = betterproto.int32_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxStatusResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    status: str = betterproto.string_field(3)
    exit_code: int = betterproto.int32_field(4)


@dataclass(eq=False, repr=False)
class PodSandboxStdoutRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    pid: int = betterproto.int32_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxStdoutResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    stdout: str = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxStderrRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    pid: int = betterproto.int32_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxStderrResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    stderr: str = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxKillRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    pid: int = betterproto.int32_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxKillResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxUploadFileRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    container_path: str = betterproto.string_field(2)
    mode: int = betterproto.int32_field(3)
    data: bytes = betterproto.bytes_field(4)


@dataclass(eq=False, repr=False)
class PodSandboxUploadFileResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxDownloadFileRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    container_path: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxDownloadFileResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    data: bytes = betterproto.bytes_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxListFilesRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    container_path: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxListFilesResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    files: List["PodSandboxFileInfo"] = betterproto.message_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxDeleteFileRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    container_path: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxDeleteFileResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxCreateDirectoryRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    container_path: str = betterproto.string_field(2)
    mode: int = betterproto.int32_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxCreateDirectoryResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxDeleteDirectoryRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    container_path: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxDeleteDirectoryResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxStatFileRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    container_path: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxStatFileResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    file_info: "PodSandboxFileInfo" = betterproto.message_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxFileInfo(betterproto.Message):
    mode: int = betterproto.int32_field(1)
    size: int = betterproto.int64_field(2)
    mod_time: int = betterproto.int64_field(3)
    owner: str = betterproto.string_field(4)
    group: str = betterproto.string_field(5)
    is_dir: bool = betterproto.bool_field(6)
    name: str = betterproto.string_field(7)
    permissions: int = betterproto.uint32_field(8)


@dataclass(eq=False, repr=False)
class PodSandboxReplaceInFilesRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    container_path: str = betterproto.string_field(2)
    pattern: str = betterproto.string_field(3)
    new_string: str = betterproto.string_field(4)


@dataclass(eq=False, repr=False)
class PodSandboxReplaceInFilesResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxExposePortRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    stub_id: str = betterproto.string_field(2)
    port: int = betterproto.int32_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxExposePortResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    url: str = betterproto.string_field(2)
    error_msg: str = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxFindInFilesRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    container_path: str = betterproto.string_field(2)
    pattern: str = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxFindInFilesResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    results: List["_types__.FileSearchResult"] = betterproto.message_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxConnectRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class PodSandboxConnectResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    stub_id: str = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxUpdateTtlRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)
    ttl: int = betterproto.int32_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxUpdateTtlResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxCreateImageFromFilesystemRequest(betterproto.Message):
    stub_id: str = betterproto.string_field(1)
    container_id: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxCreateImageFromFilesystemResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    image_id: str = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxSnapshotMemoryRequest(betterproto.Message):
    stub_id: str = betterproto.string_field(1)
    container_id: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class PodSandboxSnapshotMemoryResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    checkpoint_id: str = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxListProcessesRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class PodSandboxListProcessesResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    error_msg: str = betterproto.string_field(2)
    processes: List["_types__.ProcessInfo"] = betterproto.message_field(3)


@dataclass(eq=False, repr=False)
class PodSandboxListUrlsRequest(betterproto.Message):
    container_id: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class PodSandboxListUrlsResponse(betterproto.Message):
    ok: bool = betterproto.bool_field(1)
    urls: Dict[int, str] = betterproto.map_field(
        2, betterproto.TYPE_INT32, betterproto.TYPE_STRING
    )
    error_msg: str = betterproto.string_field(3)


class PodServiceStub(SyncServiceStub):
    def create_pod(self, create_pod_request: "CreatePodRequest") -> "CreatePodResponse":
        return self._unary_unary(
            "/pod.PodService/CreatePod",
            CreatePodRequest,
            CreatePodResponse,
        )(create_pod_request)

    def sandbox_exec(
        self, pod_sandbox_exec_request: "PodSandboxExecRequest"
    ) -> "PodSandboxExecResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxExec",
            PodSandboxExecRequest,
            PodSandboxExecResponse,
        )(pod_sandbox_exec_request)

    def sandbox_status(
        self, pod_sandbox_status_request: "PodSandboxStatusRequest"
    ) -> "PodSandboxStatusResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxStatus",
            PodSandboxStatusRequest,
            PodSandboxStatusResponse,
        )(pod_sandbox_status_request)

    def sandbox_stdout(
        self, pod_sandbox_stdout_request: "PodSandboxStdoutRequest"
    ) -> "PodSandboxStdoutResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxStdout",
            PodSandboxStdoutRequest,
            PodSandboxStdoutResponse,
        )(pod_sandbox_stdout_request)

    def sandbox_stderr(
        self, pod_sandbox_stderr_request: "PodSandboxStderrRequest"
    ) -> "PodSandboxStderrResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxStderr",
            PodSandboxStderrRequest,
            PodSandboxStderrResponse,
        )(pod_sandbox_stderr_request)

    def sandbox_kill(
        self, pod_sandbox_kill_request: "PodSandboxKillRequest"
    ) -> "PodSandboxKillResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxKill",
            PodSandboxKillRequest,
            PodSandboxKillResponse,
        )(pod_sandbox_kill_request)

    def sandbox_list_processes(
        self, pod_sandbox_list_processes_request: "PodSandboxListProcessesRequest"
    ) -> "PodSandboxListProcessesResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxListProcesses",
            PodSandboxListProcessesRequest,
            PodSandboxListProcessesResponse,
        )(pod_sandbox_list_processes_request)

    def sandbox_upload_file(
        self, pod_sandbox_upload_file_request: "PodSandboxUploadFileRequest"
    ) -> "PodSandboxUploadFileResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxUploadFile",
            PodSandboxUploadFileRequest,
            PodSandboxUploadFileResponse,
        )(pod_sandbox_upload_file_request)

    def sandbox_download_file(
        self, pod_sandbox_download_file_request: "PodSandboxDownloadFileRequest"
    ) -> "PodSandboxDownloadFileResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxDownloadFile",
            PodSandboxDownloadFileRequest,
            PodSandboxDownloadFileResponse,
        )(pod_sandbox_download_file_request)

    def sandbox_stat_file(
        self, pod_sandbox_stat_file_request: "PodSandboxStatFileRequest"
    ) -> "PodSandboxStatFileResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxStatFile",
            PodSandboxStatFileRequest,
            PodSandboxStatFileResponse,
        )(pod_sandbox_stat_file_request)

    def sandbox_list_files(
        self, pod_sandbox_list_files_request: "PodSandboxListFilesRequest"
    ) -> "PodSandboxListFilesResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxListFiles",
            PodSandboxListFilesRequest,
            PodSandboxListFilesResponse,
        )(pod_sandbox_list_files_request)

    def sandbox_delete_file(
        self, pod_sandbox_delete_file_request: "PodSandboxDeleteFileRequest"
    ) -> "PodSandboxDeleteFileResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxDeleteFile",
            PodSandboxDeleteFileRequest,
            PodSandboxDeleteFileResponse,
        )(pod_sandbox_delete_file_request)

    def sandbox_create_directory(
        self, pod_sandbox_create_directory_request: "PodSandboxCreateDirectoryRequest"
    ) -> "PodSandboxCreateDirectoryResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxCreateDirectory",
            PodSandboxCreateDirectoryRequest,
            PodSandboxCreateDirectoryResponse,
        )(pod_sandbox_create_directory_request)

    def sandbox_delete_directory(
        self, pod_sandbox_delete_directory_request: "PodSandboxDeleteDirectoryRequest"
    ) -> "PodSandboxDeleteDirectoryResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxDeleteDirectory",
            PodSandboxDeleteDirectoryRequest,
            PodSandboxDeleteDirectoryResponse,
        )(pod_sandbox_delete_directory_request)

    def sandbox_expose_port(
        self, pod_sandbox_expose_port_request: "PodSandboxExposePortRequest"
    ) -> "PodSandboxExposePortResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxExposePort",
            PodSandboxExposePortRequest,
            PodSandboxExposePortResponse,
        )(pod_sandbox_expose_port_request)

    def sandbox_replace_in_files(
        self, pod_sandbox_replace_in_files_request: "PodSandboxReplaceInFilesRequest"
    ) -> "PodSandboxReplaceInFilesResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxReplaceInFiles",
            PodSandboxReplaceInFilesRequest,
            PodSandboxReplaceInFilesResponse,
        )(pod_sandbox_replace_in_files_request)

    def sandbox_find_in_files(
        self, pod_sandbox_find_in_files_request: "PodSandboxFindInFilesRequest"
    ) -> "PodSandboxFindInFilesResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxFindInFiles",
            PodSandboxFindInFilesRequest,
            PodSandboxFindInFilesResponse,
        )(pod_sandbox_find_in_files_request)

    def sandbox_connect(
        self, pod_sandbox_connect_request: "PodSandboxConnectRequest"
    ) -> "PodSandboxConnectResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxConnect",
            PodSandboxConnectRequest,
            PodSandboxConnectResponse,
        )(pod_sandbox_connect_request)

    def sandbox_update_ttl(
        self, pod_sandbox_update_ttl_request: "PodSandboxUpdateTtlRequest"
    ) -> "PodSandboxUpdateTtlResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxUpdateTTL",
            PodSandboxUpdateTtlRequest,
            PodSandboxUpdateTtlResponse,
        )(pod_sandbox_update_ttl_request)

    def sandbox_create_image_from_filesystem(
        self,
        pod_sandbox_create_image_from_filesystem_request: "PodSandboxCreateImageFromFilesystemRequest",
    ) -> "PodSandboxCreateImageFromFilesystemResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxCreateImageFromFilesystem",
            PodSandboxCreateImageFromFilesystemRequest,
            PodSandboxCreateImageFromFilesystemResponse,
        )(pod_sandbox_create_image_from_filesystem_request)

    def sandbox_snapshot_memory(
        self, pod_sandbox_snapshot_memory_request: "PodSandboxSnapshotMemoryRequest"
    ) -> "PodSandboxSnapshotMemoryResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxSnapshotMemory",
            PodSandboxSnapshotMemoryRequest,
            PodSandboxSnapshotMemoryResponse,
        )(pod_sandbox_snapshot_memory_request)

    def sandbox_list_urls(
        self, pod_sandbox_list_urls_request: "PodSandboxListUrlsRequest"
    ) -> "PodSandboxListUrlsResponse":
        return self._unary_unary(
            "/pod.PodService/SandboxListUrls",
            PodSandboxListUrlsRequest,
            PodSandboxListUrlsResponse,
        )(pod_sandbox_list_urls_request)
