|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# Generated by https://github.com/connectrpc/connect-python. DO NOT EDIT! |
| 3 | +# source: flyteidl2/app/app_logs_service.proto |
| 4 | + |
| 5 | +from collections.abc import AsyncGenerator, AsyncIterator, Iterable, Iterator, Mapping |
| 6 | +from typing import Protocol |
| 7 | + |
| 8 | +from connectrpc.client import ConnectClient, ConnectClientSync |
| 9 | +from connectrpc.code import Code |
| 10 | +from connectrpc.compression import Compression |
| 11 | +from connectrpc.errors import ConnectError |
| 12 | +from connectrpc.interceptor import Interceptor, InterceptorSync |
| 13 | +from connectrpc.method import IdempotencyLevel, MethodInfo |
| 14 | +from connectrpc.request import Headers, RequestContext |
| 15 | +from connectrpc.server import ConnectASGIApplication, ConnectWSGIApplication, Endpoint, EndpointSync |
| 16 | +import flyteidl2.app.app_logs_payload_pb2 as flyteidl2_dot_app_dot_app__logs__payload__pb2 |
| 17 | + |
| 18 | + |
| 19 | +class AppLogsService(Protocol): |
| 20 | + def tail_logs(self, request: flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsRequest, ctx: RequestContext) -> AsyncIterator[flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsResponse]: |
| 21 | + raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") |
| 22 | + |
| 23 | + |
| 24 | +class AppLogsServiceASGIApplication(ConnectASGIApplication[AppLogsService]): |
| 25 | + def __init__(self, service: AppLogsService | AsyncGenerator[AppLogsService], *, interceptors: Iterable[Interceptor]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None: |
| 26 | + super().__init__( |
| 27 | + service=service, |
| 28 | + endpoints=lambda svc: { |
| 29 | + "/flyteidl2.app.AppLogsService/TailLogs": Endpoint.server_stream( |
| 30 | + method=MethodInfo( |
| 31 | + name="TailLogs", |
| 32 | + service_name="flyteidl2.app.AppLogsService", |
| 33 | + input=flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsRequest, |
| 34 | + output=flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsResponse, |
| 35 | + idempotency_level=IdempotencyLevel.NO_SIDE_EFFECTS, |
| 36 | + ), |
| 37 | + function=svc.tail_logs, |
| 38 | + ), |
| 39 | + }, |
| 40 | + interceptors=interceptors, |
| 41 | + read_max_bytes=read_max_bytes, |
| 42 | + compressions=compressions, |
| 43 | + ) |
| 44 | + |
| 45 | + @property |
| 46 | + def path(self) -> str: |
| 47 | + """Returns the URL path to mount the application to when serving multiple applications.""" |
| 48 | + return "/flyteidl2.app.AppLogsService" |
| 49 | + |
| 50 | + |
| 51 | +class AppLogsServiceClient(ConnectClient): |
| 52 | + def tail_logs( |
| 53 | + self, |
| 54 | + request: flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsRequest, |
| 55 | + *, |
| 56 | + headers: Headers | Mapping[str, str] | None = None, |
| 57 | + timeout_ms: int | None = None, |
| 58 | + ) -> AsyncIterator[flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsResponse]: |
| 59 | + return self.execute_server_stream( |
| 60 | + request=request, |
| 61 | + method=MethodInfo( |
| 62 | + name="TailLogs", |
| 63 | + service_name="flyteidl2.app.AppLogsService", |
| 64 | + input=flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsRequest, |
| 65 | + output=flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsResponse, |
| 66 | + idempotency_level=IdempotencyLevel.NO_SIDE_EFFECTS, |
| 67 | + ), |
| 68 | + headers=headers, |
| 69 | + timeout_ms=timeout_ms, |
| 70 | + ) |
| 71 | + |
| 72 | + |
| 73 | +class AppLogsServiceSync(Protocol): |
| 74 | + def tail_logs(self, request: flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsRequest, ctx: RequestContext) -> Iterator[flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsResponse]: |
| 75 | + raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") |
| 76 | + |
| 77 | + |
| 78 | +class AppLogsServiceWSGIApplication(ConnectWSGIApplication): |
| 79 | + def __init__(self, service: AppLogsServiceSync, interceptors: Iterable[InterceptorSync]=(), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None) -> None: |
| 80 | + super().__init__( |
| 81 | + endpoints={ |
| 82 | + "/flyteidl2.app.AppLogsService/TailLogs": EndpointSync.server_stream( |
| 83 | + method=MethodInfo( |
| 84 | + name="TailLogs", |
| 85 | + service_name="flyteidl2.app.AppLogsService", |
| 86 | + input=flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsRequest, |
| 87 | + output=flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsResponse, |
| 88 | + idempotency_level=IdempotencyLevel.NO_SIDE_EFFECTS, |
| 89 | + ), |
| 90 | + function=service.tail_logs, |
| 91 | + ), |
| 92 | + }, |
| 93 | + interceptors=interceptors, |
| 94 | + read_max_bytes=read_max_bytes, |
| 95 | + compressions=compressions, |
| 96 | + ) |
| 97 | + |
| 98 | + @property |
| 99 | + def path(self) -> str: |
| 100 | + """Returns the URL path to mount the application to when serving multiple applications.""" |
| 101 | + return "/flyteidl2.app.AppLogsService" |
| 102 | + |
| 103 | + |
| 104 | +class AppLogsServiceClientSync(ConnectClientSync): |
| 105 | + def tail_logs( |
| 106 | + self, |
| 107 | + request: flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsRequest, |
| 108 | + *, |
| 109 | + headers: Headers | Mapping[str, str] | None = None, |
| 110 | + timeout_ms: int | None = None, |
| 111 | + ) -> Iterator[flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsResponse]: |
| 112 | + return self.execute_server_stream( |
| 113 | + request=request, |
| 114 | + method=MethodInfo( |
| 115 | + name="TailLogs", |
| 116 | + service_name="flyteidl2.app.AppLogsService", |
| 117 | + input=flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsRequest, |
| 118 | + output=flyteidl2_dot_app_dot_app__logs__payload__pb2.TailLogsResponse, |
| 119 | + idempotency_level=IdempotencyLevel.NO_SIDE_EFFECTS, |
| 120 | + ), |
| 121 | + headers=headers, |
| 122 | + timeout_ms=timeout_ms, |
| 123 | + ) |
0 commit comments