Source code for soulfire.registry_connect

# Generated from soulfire/registry.proto. DO NOT EDIT.
# Generated by protoc-gen-connectrpc-py v0.11.1 with parameter "protobuf=google".
# ruff: noqa: PGH004
# ruff: noqa
# fmt: off

from __future__ import annotations

from typing import Protocol, TYPE_CHECKING

from connectrpc.client import ConnectClient, ConnectClientSync
from connectrpc.code import Code
from connectrpc.compat import google_protobuf_binary_codec, google_protobuf_codecs
from connectrpc.compression.gzip import GzipCompression
from connectrpc.errors import ConnectError
from connectrpc.method import IdempotencyLevel, MethodInfo
from connectrpc.protocol import ProtocolType
from connectrpc.server import ConnectASGIApplication, ConnectWSGIApplication, Endpoint, EndpointSync
from pyqwest import Client, SyncClient

from .registry_pb2 import GetRegistryEntryRequest, GetRegistryEntryResponse, GetRegistryIdentityRequest, GetRegistryIdentityResponse, ListRegistryEntriesRequest, ListRegistryEntriesResponse, ListRegistryTagsRequest, ListRegistryTagsResponse

if TYPE_CHECKING:
    from collections.abc import AsyncGenerator, Iterable, Mapping

    from connectrpc.codec import Codec
    from connectrpc.compression import Compression
    from connectrpc.interceptor import Interceptor, InterceptorSync
    from connectrpc.request import Headers, RequestContext



_DEFAULT_CODECS = google_protobuf_codecs()
_PROTO_BINARY_CODEC = google_protobuf_binary_codec()
_GZIP_COMPRESSION = GzipCompression()

[docs] class RegistryService(Protocol):
[docs] async def get_registry_identity(self, request: GetRegistryIdentityRequest, ctx: RequestContext[GetRegistryIdentityRequest, GetRegistryIdentityResponse]) -> GetRegistryIdentityResponse: raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs] async def list_registry_entries(self, request: ListRegistryEntriesRequest, ctx: RequestContext[ListRegistryEntriesRequest, ListRegistryEntriesResponse]) -> ListRegistryEntriesResponse: raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs] async def get_registry_entry(self, request: GetRegistryEntryRequest, ctx: RequestContext[GetRegistryEntryRequest, GetRegistryEntryResponse]) -> GetRegistryEntryResponse: raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs] async def list_registry_tags(self, request: ListRegistryTagsRequest, ctx: RequestContext[ListRegistryTagsRequest, ListRegistryTagsResponse]) -> ListRegistryTagsResponse: raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs] class RegistryServiceASGIApplication(ConnectASGIApplication[RegistryService]): def __init__( self, service: RegistryService | AsyncGenerator[RegistryService], *, interceptors: Iterable[Interceptor] = (), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None, codecs: Iterable[Codec] | None = _DEFAULT_CODECS, ) -> None: super().__init__( service=service, endpoints=lambda svc: { "/soulfire.v1.RegistryService/GetRegistryIdentity": Endpoint.unary( method=MethodInfo( name="GetRegistryIdentity", service_name="soulfire.v1.RegistryService", input=GetRegistryIdentityRequest, output=GetRegistryIdentityResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), function=svc.get_registry_identity, ), "/soulfire.v1.RegistryService/ListRegistryEntries": Endpoint.unary( method=MethodInfo( name="ListRegistryEntries", service_name="soulfire.v1.RegistryService", input=ListRegistryEntriesRequest, output=ListRegistryEntriesResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), function=svc.list_registry_entries, ), "/soulfire.v1.RegistryService/GetRegistryEntry": Endpoint.unary( method=MethodInfo( name="GetRegistryEntry", service_name="soulfire.v1.RegistryService", input=GetRegistryEntryRequest, output=GetRegistryEntryResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), function=svc.get_registry_entry, ), "/soulfire.v1.RegistryService/ListRegistryTags": Endpoint.unary( method=MethodInfo( name="ListRegistryTags", service_name="soulfire.v1.RegistryService", input=ListRegistryTagsRequest, output=ListRegistryTagsResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), function=svc.list_registry_tags, ), }, interceptors=interceptors, read_max_bytes=read_max_bytes, compressions=compressions, codecs=codecs, ) @property def path(self) -> str: """Returns the URL path to mount the application to when serving multiple applications.""" return "/soulfire.v1.RegistryService"
[docs] class RegistryServiceClient(ConnectClient): def __init__( self, address: str, *, codec: Codec | None = _PROTO_BINARY_CODEC, protocol: ProtocolType = ProtocolType.CONNECT, accept_compression: Iterable[Compression] | None = None, send_compression: Compression | None = _GZIP_COMPRESSION, timeout_ms: int | None = None, read_max_bytes: int | None = None, interceptors: Iterable[Interceptor] = (), http_client: Client | None = None, ) -> None: super().__init__( address=address, codec=codec, protocol=protocol, accept_compression=accept_compression, send_compression=send_compression, timeout_ms=timeout_ms, read_max_bytes=read_max_bytes, interceptors=interceptors, http_client=http_client, )
[docs] async def get_registry_identity( self, request: GetRegistryIdentityRequest, *, headers: Headers | Mapping[str, str] | None = None, timeout_ms: int | None = None, ) -> GetRegistryIdentityResponse: return await self.execute_unary( request=request, method=MethodInfo( name="GetRegistryIdentity", service_name="soulfire.v1.RegistryService", input=GetRegistryIdentityRequest, output=GetRegistryIdentityResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), headers=headers, timeout_ms=timeout_ms, )
[docs] async def list_registry_entries( self, request: ListRegistryEntriesRequest, *, headers: Headers | Mapping[str, str] | None = None, timeout_ms: int | None = None, ) -> ListRegistryEntriesResponse: return await self.execute_unary( request=request, method=MethodInfo( name="ListRegistryEntries", service_name="soulfire.v1.RegistryService", input=ListRegistryEntriesRequest, output=ListRegistryEntriesResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), headers=headers, timeout_ms=timeout_ms, )
[docs] async def get_registry_entry( self, request: GetRegistryEntryRequest, *, headers: Headers | Mapping[str, str] | None = None, timeout_ms: int | None = None, ) -> GetRegistryEntryResponse: return await self.execute_unary( request=request, method=MethodInfo( name="GetRegistryEntry", service_name="soulfire.v1.RegistryService", input=GetRegistryEntryRequest, output=GetRegistryEntryResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), headers=headers, timeout_ms=timeout_ms, )
[docs] async def list_registry_tags( self, request: ListRegistryTagsRequest, *, headers: Headers | Mapping[str, str] | None = None, timeout_ms: int | None = None, ) -> ListRegistryTagsResponse: return await self.execute_unary( request=request, method=MethodInfo( name="ListRegistryTags", service_name="soulfire.v1.RegistryService", input=ListRegistryTagsRequest, output=ListRegistryTagsResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), headers=headers, timeout_ms=timeout_ms, )
[docs] class RegistryServiceSync(Protocol):
[docs] def get_registry_identity(self, request: GetRegistryIdentityRequest, ctx: RequestContext[GetRegistryIdentityRequest, GetRegistryIdentityResponse]) -> GetRegistryIdentityResponse: raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs] def list_registry_entries(self, request: ListRegistryEntriesRequest, ctx: RequestContext[ListRegistryEntriesRequest, ListRegistryEntriesResponse]) -> ListRegistryEntriesResponse: raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs] def get_registry_entry(self, request: GetRegistryEntryRequest, ctx: RequestContext[GetRegistryEntryRequest, GetRegistryEntryResponse]) -> GetRegistryEntryResponse: raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs] def list_registry_tags(self, request: ListRegistryTagsRequest, ctx: RequestContext[ListRegistryTagsRequest, ListRegistryTagsResponse]) -> ListRegistryTagsResponse: raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs] class RegistryServiceWSGIApplication(ConnectWSGIApplication): def __init__( self, service: RegistryServiceSync, interceptors: Iterable[InterceptorSync] = (), read_max_bytes: int | None = None, compressions: Iterable[Compression] | None = None, codecs: Iterable[Codec] | None = _DEFAULT_CODECS, ) -> None: super().__init__( endpoints={ "/soulfire.v1.RegistryService/GetRegistryIdentity": EndpointSync.unary( method=MethodInfo( name="GetRegistryIdentity", service_name="soulfire.v1.RegistryService", input=GetRegistryIdentityRequest, output=GetRegistryIdentityResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), function=service.get_registry_identity, ), "/soulfire.v1.RegistryService/ListRegistryEntries": EndpointSync.unary( method=MethodInfo( name="ListRegistryEntries", service_name="soulfire.v1.RegistryService", input=ListRegistryEntriesRequest, output=ListRegistryEntriesResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), function=service.list_registry_entries, ), "/soulfire.v1.RegistryService/GetRegistryEntry": EndpointSync.unary( method=MethodInfo( name="GetRegistryEntry", service_name="soulfire.v1.RegistryService", input=GetRegistryEntryRequest, output=GetRegistryEntryResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), function=service.get_registry_entry, ), "/soulfire.v1.RegistryService/ListRegistryTags": EndpointSync.unary( method=MethodInfo( name="ListRegistryTags", service_name="soulfire.v1.RegistryService", input=ListRegistryTagsRequest, output=ListRegistryTagsResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), function=service.list_registry_tags, ), }, interceptors=interceptors, read_max_bytes=read_max_bytes, compressions=compressions, codecs=codecs, ) @property def path(self) -> str: """Returns the URL path to mount the application to when serving multiple applications.""" return "/soulfire.v1.RegistryService"
[docs] class RegistryServiceClientSync(ConnectClientSync): def __init__( self, address: str, *, codec: Codec | None = _PROTO_BINARY_CODEC, protocol: ProtocolType = ProtocolType.CONNECT, accept_compression: Iterable[Compression] | None = None, send_compression: Compression | None = _GZIP_COMPRESSION, timeout_ms: int | None = None, read_max_bytes: int | None = None, interceptors: Iterable[InterceptorSync] = (), http_client: SyncClient | None = None, ) -> None: super().__init__( address=address, codec=codec, protocol=protocol, accept_compression=accept_compression, send_compression=send_compression, timeout_ms=timeout_ms, read_max_bytes=read_max_bytes, interceptors=interceptors, http_client=http_client, )
[docs] def get_registry_identity( self, request: GetRegistryIdentityRequest, *, headers: Headers | Mapping[str, str] | None = None, timeout_ms: int | None = None, ) -> GetRegistryIdentityResponse: return self.execute_unary( request=request, method=MethodInfo( name="GetRegistryIdentity", service_name="soulfire.v1.RegistryService", input=GetRegistryIdentityRequest, output=GetRegistryIdentityResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), headers=headers, timeout_ms=timeout_ms, )
[docs] def list_registry_entries( self, request: ListRegistryEntriesRequest, *, headers: Headers | Mapping[str, str] | None = None, timeout_ms: int | None = None, ) -> ListRegistryEntriesResponse: return self.execute_unary( request=request, method=MethodInfo( name="ListRegistryEntries", service_name="soulfire.v1.RegistryService", input=ListRegistryEntriesRequest, output=ListRegistryEntriesResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), headers=headers, timeout_ms=timeout_ms, )
[docs] def get_registry_entry( self, request: GetRegistryEntryRequest, *, headers: Headers | Mapping[str, str] | None = None, timeout_ms: int | None = None, ) -> GetRegistryEntryResponse: return self.execute_unary( request=request, method=MethodInfo( name="GetRegistryEntry", service_name="soulfire.v1.RegistryService", input=GetRegistryEntryRequest, output=GetRegistryEntryResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), headers=headers, timeout_ms=timeout_ms, )
[docs] def list_registry_tags( self, request: ListRegistryTagsRequest, *, headers: Headers | Mapping[str, str] | None = None, timeout_ms: int | None = None, ) -> ListRegistryTagsResponse: return self.execute_unary( request=request, method=MethodInfo( name="ListRegistryTags", service_name="soulfire.v1.RegistryService", input=ListRegistryTagsRequest, output=ListRegistryTagsResponse, idempotency_level=IdempotencyLevel.UNKNOWN, ), headers=headers, timeout_ms=timeout_ms, )