Rename rpc methods for watcher
This commit is contained in:
parent
ec106392b8
commit
23ea4adfb1
2
Makefile
2
Makefile
@ -9,7 +9,7 @@ generate: generate-js generate-python
|
||||
generate-js:
|
||||
cd packages/js-sdk && pnpm generate
|
||||
cd packages/js-sdk && pnpm generate-envd-api
|
||||
buf generate --template spec/envd/buf-js.gen.yaml
|
||||
cd spec/envd && buf generate --template buf-js.gen.yaml
|
||||
|
||||
generate-python:
|
||||
cd packages/python-sdk && make generate-api
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ListDirRequest, ListDirResponse, MakeDirRequest, MakeDirResponse, MoveRequest, MoveResponse, RemoveRequest, RemoveResponse, StatRequest, StatResponse, WatchDirRequest, WatchDirResponse } from "./filesystem_pb.js";
|
||||
import { CreateWatcherRequest, CreateWatcherResponse, GetWatcherEventsRequest, GetWatcherEventsResponse, ListDirRequest, ListDirResponse, MakeDirRequest, MakeDirResponse, MoveRequest, MoveResponse, RemoveRequest, RemoveResponse, RemoveWatcherRequest, RemoveWatcherResponse, StatRequest, StatResponse, WatchDirRequest, WatchDirResponse } from "./filesystem_pb.js";
|
||||
import { MethodKind } from "@bufbuild/protobuf";
|
||||
|
||||
/**
|
||||
@ -48,6 +48,15 @@ export const Filesystem = {
|
||||
O: ListDirResponse,
|
||||
kind: MethodKind.Unary,
|
||||
},
|
||||
/**
|
||||
* @generated from rpc filesystem.Filesystem.Remove
|
||||
*/
|
||||
remove: {
|
||||
name: "Remove",
|
||||
I: RemoveRequest,
|
||||
O: RemoveResponse,
|
||||
kind: MethodKind.Unary,
|
||||
},
|
||||
/**
|
||||
* @generated from rpc filesystem.Filesystem.WatchDir
|
||||
*/
|
||||
@ -58,12 +67,32 @@ export const Filesystem = {
|
||||
kind: MethodKind.ServerStreaming,
|
||||
},
|
||||
/**
|
||||
* @generated from rpc filesystem.Filesystem.Remove
|
||||
* Non-streaming versions of WatchDir
|
||||
*
|
||||
* @generated from rpc filesystem.Filesystem.CreateWatcher
|
||||
*/
|
||||
remove: {
|
||||
name: "Remove",
|
||||
I: RemoveRequest,
|
||||
O: RemoveResponse,
|
||||
createWatcher: {
|
||||
name: "CreateWatcher",
|
||||
I: CreateWatcherRequest,
|
||||
O: CreateWatcherResponse,
|
||||
kind: MethodKind.Unary,
|
||||
},
|
||||
/**
|
||||
* @generated from rpc filesystem.Filesystem.GetWatcherEvents
|
||||
*/
|
||||
getWatcherEvents: {
|
||||
name: "GetWatcherEvents",
|
||||
I: GetWatcherEventsRequest,
|
||||
O: GetWatcherEventsResponse,
|
||||
kind: MethodKind.Unary,
|
||||
},
|
||||
/**
|
||||
* @generated from rpc filesystem.Filesystem.RemoveWatcher
|
||||
*/
|
||||
removeWatcher: {
|
||||
name: "RemoveWatcher",
|
||||
I: RemoveWatcherRequest,
|
||||
O: RemoveWatcherResponse,
|
||||
kind: MethodKind.Unary,
|
||||
},
|
||||
}
|
||||
|
||||
@ -532,6 +532,49 @@ export class WatchDirRequest extends Message<WatchDirRequest> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message filesystem.FilesystemEvent
|
||||
*/
|
||||
export class FilesystemEvent extends Message<FilesystemEvent> {
|
||||
/**
|
||||
* @generated from field: string name = 1;
|
||||
*/
|
||||
name = "";
|
||||
|
||||
/**
|
||||
* @generated from field: filesystem.EventType type = 2;
|
||||
*/
|
||||
type = EventType.UNSPECIFIED;
|
||||
|
||||
constructor(data?: PartialMessage<FilesystemEvent>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime: typeof proto3 = proto3;
|
||||
static readonly typeName = "filesystem.FilesystemEvent";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 2, name: "type", kind: "enum", T: proto3.getEnumType(EventType) },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FilesystemEvent {
|
||||
return new FilesystemEvent().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): FilesystemEvent {
|
||||
return new FilesystemEvent().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): FilesystemEvent {
|
||||
return new FilesystemEvent().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: FilesystemEvent | PlainMessage<FilesystemEvent> | undefined, b: FilesystemEvent | PlainMessage<FilesystemEvent> | undefined): boolean {
|
||||
return proto3.util.equals(FilesystemEvent, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message filesystem.WatchDirResponse
|
||||
*/
|
||||
@ -547,9 +590,9 @@ export class WatchDirResponse extends Message<WatchDirResponse> {
|
||||
case: "start";
|
||||
} | {
|
||||
/**
|
||||
* @generated from field: filesystem.WatchDirResponse.FilesystemEvent filesystem = 2;
|
||||
* @generated from field: filesystem.FilesystemEvent filesystem = 2;
|
||||
*/
|
||||
value: WatchDirResponse_FilesystemEvent;
|
||||
value: FilesystemEvent;
|
||||
case: "filesystem";
|
||||
} | {
|
||||
/**
|
||||
@ -568,7 +611,7 @@ export class WatchDirResponse extends Message<WatchDirResponse> {
|
||||
static readonly typeName = "filesystem.WatchDirResponse";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "start", kind: "message", T: WatchDirResponse_StartEvent, oneof: "event" },
|
||||
{ no: 2, name: "filesystem", kind: "message", T: WatchDirResponse_FilesystemEvent, oneof: "event" },
|
||||
{ no: 2, name: "filesystem", kind: "message", T: FilesystemEvent, oneof: "event" },
|
||||
{ no: 3, name: "keepalive", kind: "message", T: WatchDirResponse_KeepAlive, oneof: "event" },
|
||||
]);
|
||||
|
||||
@ -620,49 +663,6 @@ export class WatchDirResponse_StartEvent extends Message<WatchDirResponse_StartE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message filesystem.WatchDirResponse.FilesystemEvent
|
||||
*/
|
||||
export class WatchDirResponse_FilesystemEvent extends Message<WatchDirResponse_FilesystemEvent> {
|
||||
/**
|
||||
* @generated from field: string name = 1;
|
||||
*/
|
||||
name = "";
|
||||
|
||||
/**
|
||||
* @generated from field: filesystem.EventType type = 2;
|
||||
*/
|
||||
type = EventType.UNSPECIFIED;
|
||||
|
||||
constructor(data?: PartialMessage<WatchDirResponse_FilesystemEvent>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime: typeof proto3 = proto3;
|
||||
static readonly typeName = "filesystem.WatchDirResponse.FilesystemEvent";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
{ no: 2, name: "type", kind: "enum", T: proto3.getEnumType(EventType) },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WatchDirResponse_FilesystemEvent {
|
||||
return new WatchDirResponse_FilesystemEvent().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WatchDirResponse_FilesystemEvent {
|
||||
return new WatchDirResponse_FilesystemEvent().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WatchDirResponse_FilesystemEvent {
|
||||
return new WatchDirResponse_FilesystemEvent().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: WatchDirResponse_FilesystemEvent | PlainMessage<WatchDirResponse_FilesystemEvent> | undefined, b: WatchDirResponse_FilesystemEvent | PlainMessage<WatchDirResponse_FilesystemEvent> | undefined): boolean {
|
||||
return proto3.util.equals(WatchDirResponse_FilesystemEvent, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message filesystem.WatchDirResponse.KeepAlive
|
||||
*/
|
||||
@ -694,3 +694,219 @@ export class WatchDirResponse_KeepAlive extends Message<WatchDirResponse_KeepAli
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message filesystem.CreateWatcherRequest
|
||||
*/
|
||||
export class CreateWatcherRequest extends Message<CreateWatcherRequest> {
|
||||
/**
|
||||
* @generated from field: string path = 1;
|
||||
*/
|
||||
path = "";
|
||||
|
||||
constructor(data?: PartialMessage<CreateWatcherRequest>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime: typeof proto3 = proto3;
|
||||
static readonly typeName = "filesystem.CreateWatcherRequest";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateWatcherRequest {
|
||||
return new CreateWatcherRequest().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateWatcherRequest {
|
||||
return new CreateWatcherRequest().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateWatcherRequest {
|
||||
return new CreateWatcherRequest().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: CreateWatcherRequest | PlainMessage<CreateWatcherRequest> | undefined, b: CreateWatcherRequest | PlainMessage<CreateWatcherRequest> | undefined): boolean {
|
||||
return proto3.util.equals(CreateWatcherRequest, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message filesystem.CreateWatcherResponse
|
||||
*/
|
||||
export class CreateWatcherResponse extends Message<CreateWatcherResponse> {
|
||||
/**
|
||||
* @generated from field: string watcher_id = 1;
|
||||
*/
|
||||
watcherId = "";
|
||||
|
||||
constructor(data?: PartialMessage<CreateWatcherResponse>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime: typeof proto3 = proto3;
|
||||
static readonly typeName = "filesystem.CreateWatcherResponse";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "watcher_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CreateWatcherResponse {
|
||||
return new CreateWatcherResponse().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CreateWatcherResponse {
|
||||
return new CreateWatcherResponse().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CreateWatcherResponse {
|
||||
return new CreateWatcherResponse().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: CreateWatcherResponse | PlainMessage<CreateWatcherResponse> | undefined, b: CreateWatcherResponse | PlainMessage<CreateWatcherResponse> | undefined): boolean {
|
||||
return proto3.util.equals(CreateWatcherResponse, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message filesystem.GetWatcherEventsRequest
|
||||
*/
|
||||
export class GetWatcherEventsRequest extends Message<GetWatcherEventsRequest> {
|
||||
/**
|
||||
* @generated from field: string watcher_id = 1;
|
||||
*/
|
||||
watcherId = "";
|
||||
|
||||
constructor(data?: PartialMessage<GetWatcherEventsRequest>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime: typeof proto3 = proto3;
|
||||
static readonly typeName = "filesystem.GetWatcherEventsRequest";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "watcher_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetWatcherEventsRequest {
|
||||
return new GetWatcherEventsRequest().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetWatcherEventsRequest {
|
||||
return new GetWatcherEventsRequest().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetWatcherEventsRequest {
|
||||
return new GetWatcherEventsRequest().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: GetWatcherEventsRequest | PlainMessage<GetWatcherEventsRequest> | undefined, b: GetWatcherEventsRequest | PlainMessage<GetWatcherEventsRequest> | undefined): boolean {
|
||||
return proto3.util.equals(GetWatcherEventsRequest, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message filesystem.GetWatcherEventsResponse
|
||||
*/
|
||||
export class GetWatcherEventsResponse extends Message<GetWatcherEventsResponse> {
|
||||
/**
|
||||
* @generated from field: repeated filesystem.FilesystemEvent events = 1;
|
||||
*/
|
||||
events: FilesystemEvent[] = [];
|
||||
|
||||
constructor(data?: PartialMessage<GetWatcherEventsResponse>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime: typeof proto3 = proto3;
|
||||
static readonly typeName = "filesystem.GetWatcherEventsResponse";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "events", kind: "message", T: FilesystemEvent, repeated: true },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetWatcherEventsResponse {
|
||||
return new GetWatcherEventsResponse().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetWatcherEventsResponse {
|
||||
return new GetWatcherEventsResponse().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetWatcherEventsResponse {
|
||||
return new GetWatcherEventsResponse().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: GetWatcherEventsResponse | PlainMessage<GetWatcherEventsResponse> | undefined, b: GetWatcherEventsResponse | PlainMessage<GetWatcherEventsResponse> | undefined): boolean {
|
||||
return proto3.util.equals(GetWatcherEventsResponse, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message filesystem.RemoveWatcherRequest
|
||||
*/
|
||||
export class RemoveWatcherRequest extends Message<RemoveWatcherRequest> {
|
||||
/**
|
||||
* @generated from field: string watcher_id = 1;
|
||||
*/
|
||||
watcherId = "";
|
||||
|
||||
constructor(data?: PartialMessage<RemoveWatcherRequest>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime: typeof proto3 = proto3;
|
||||
static readonly typeName = "filesystem.RemoveWatcherRequest";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
{ no: 1, name: "watcher_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RemoveWatcherRequest {
|
||||
return new RemoveWatcherRequest().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RemoveWatcherRequest {
|
||||
return new RemoveWatcherRequest().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RemoveWatcherRequest {
|
||||
return new RemoveWatcherRequest().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: RemoveWatcherRequest | PlainMessage<RemoveWatcherRequest> | undefined, b: RemoveWatcherRequest | PlainMessage<RemoveWatcherRequest> | undefined): boolean {
|
||||
return proto3.util.equals(RemoveWatcherRequest, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @generated from message filesystem.RemoveWatcherResponse
|
||||
*/
|
||||
export class RemoveWatcherResponse extends Message<RemoveWatcherResponse> {
|
||||
constructor(data?: PartialMessage<RemoveWatcherResponse>) {
|
||||
super();
|
||||
proto3.util.initPartial(data, this);
|
||||
}
|
||||
|
||||
static readonly runtime: typeof proto3 = proto3;
|
||||
static readonly typeName = "filesystem.RemoveWatcherResponse";
|
||||
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
||||
]);
|
||||
|
||||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RemoveWatcherResponse {
|
||||
return new RemoveWatcherResponse().fromBinary(bytes, options);
|
||||
}
|
||||
|
||||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RemoveWatcherResponse {
|
||||
return new RemoveWatcherResponse().fromJson(jsonValue, options);
|
||||
}
|
||||
|
||||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RemoveWatcherResponse {
|
||||
return new RemoveWatcherResponse().fromJsonString(jsonString, options);
|
||||
}
|
||||
|
||||
static equals(a: RemoveWatcherResponse | PlainMessage<RemoveWatcherResponse> | undefined, b: RemoveWatcherResponse | PlainMessage<RemoveWatcherResponse> | undefined): boolean {
|
||||
return proto3.util.equals(RemoveWatcherResponse, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,9 @@ def _get_kwargs() -> Dict[str, Any]:
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Any]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
return None
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
@ -28,7 +30,9 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Any]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
|
||||
@ -19,7 +19,9 @@ def _get_kwargs(
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Any]:
|
||||
if response.status_code == HTTPStatus.NO_CONTENT:
|
||||
return None
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
@ -34,7 +36,9 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Any]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
|
||||
@ -5,7 +5,9 @@ import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.post_sandboxes_sandbox_id_refreshes_body import PostSandboxesSandboxIDRefreshesBody
|
||||
from ...models.post_sandboxes_sandbox_id_refreshes_body import (
|
||||
PostSandboxesSandboxIDRefreshesBody,
|
||||
)
|
||||
from ...types import Response
|
||||
|
||||
|
||||
@ -30,7 +32,9 @@ def _get_kwargs(
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Any]:
|
||||
if response.status_code == HTTPStatus.NO_CONTENT:
|
||||
return None
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
@ -43,7 +47,9 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Any]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
|
||||
@ -5,7 +5,9 @@ import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.post_sandboxes_sandbox_id_timeout_body import PostSandboxesSandboxIDTimeoutBody
|
||||
from ...models.post_sandboxes_sandbox_id_timeout_body import (
|
||||
PostSandboxesSandboxIDTimeoutBody,
|
||||
)
|
||||
from ...types import Response
|
||||
|
||||
|
||||
@ -30,7 +32,9 @@ def _get_kwargs(
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Any]:
|
||||
if response.status_code == HTTPStatus.NO_CONTENT:
|
||||
return None
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
@ -45,7 +49,9 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Any]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
|
||||
@ -19,7 +19,9 @@ def _get_kwargs(
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Any]:
|
||||
if response.status_code == HTTPStatus.NO_CONTENT:
|
||||
return None
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
@ -32,7 +34,9 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Any]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
|
||||
@ -20,7 +20,9 @@ def _get_kwargs(
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Any]:
|
||||
if response.status_code == HTTPStatus.ACCEPTED:
|
||||
return None
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
@ -33,7 +35,9 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Any]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
|
||||
36
packages/python-sdk/e2b/api/client/client.py
generated
36
packages/python-sdk/e2b/api/client/client.py
generated
@ -38,9 +38,15 @@ class Client:
|
||||
_base_url: str = field(alias="base_url")
|
||||
_cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
||||
_headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
||||
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
||||
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
||||
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
||||
_timeout: Optional[httpx.Timeout] = field(
|
||||
default=None, kw_only=True, alias="timeout"
|
||||
)
|
||||
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(
|
||||
default=True, kw_only=True, alias="verify_ssl"
|
||||
)
|
||||
_follow_redirects: bool = field(
|
||||
default=False, kw_only=True, alias="follow_redirects"
|
||||
)
|
||||
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
||||
_client: Optional[httpx.Client] = field(default=None, init=False)
|
||||
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
||||
@ -168,9 +174,15 @@ class AuthenticatedClient:
|
||||
_base_url: str = field(alias="base_url")
|
||||
_cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
||||
_headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
||||
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
||||
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
||||
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
||||
_timeout: Optional[httpx.Timeout] = field(
|
||||
default=None, kw_only=True, alias="timeout"
|
||||
)
|
||||
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(
|
||||
default=True, kw_only=True, alias="verify_ssl"
|
||||
)
|
||||
_follow_redirects: bool = field(
|
||||
default=False, kw_only=True, alias="follow_redirects"
|
||||
)
|
||||
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
||||
_client: Optional[httpx.Client] = field(default=None, init=False)
|
||||
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
||||
@ -214,7 +226,9 @@ class AuthenticatedClient:
|
||||
def get_httpx_client(self) -> httpx.Client:
|
||||
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
||||
if self._client is None:
|
||||
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||
self._headers[self.auth_header_name] = (
|
||||
f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||
)
|
||||
self._client = httpx.Client(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
@ -235,7 +249,9 @@ class AuthenticatedClient:
|
||||
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
||||
self.get_httpx_client().__exit__(*args, **kwargs)
|
||||
|
||||
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
|
||||
def set_async_httpx_client(
|
||||
self, async_client: httpx.AsyncClient
|
||||
) -> "AuthenticatedClient":
|
||||
"""Manually the underlying httpx.AsyncClient
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
@ -246,7 +262,9 @@ class AuthenticatedClient:
|
||||
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
||||
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
||||
if self._async_client is None:
|
||||
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||
self._headers[self.auth_header_name] = (
|
||||
f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||
)
|
||||
self._async_client = httpx.AsyncClient(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
|
||||
@ -2,7 +2,9 @@
|
||||
|
||||
from .error import Error
|
||||
from .new_sandbox import NewSandbox
|
||||
from .post_sandboxes_sandbox_id_refreshes_body import PostSandboxesSandboxIDRefreshesBody
|
||||
from .post_sandboxes_sandbox_id_refreshes_body import (
|
||||
PostSandboxesSandboxIDRefreshesBody,
|
||||
)
|
||||
from .post_sandboxes_sandbox_id_timeout_body import PostSandboxesSandboxIDTimeoutBody
|
||||
from .running_sandbox import RunningSandbox
|
||||
from .sandbox import Sandbox
|
||||
|
||||
@ -74,29 +74,29 @@ class FilesystemClient:
|
||||
json=json,
|
||||
**opts,
|
||||
)
|
||||
self._watch_dir_start = connect.Client(
|
||||
self._create_watcher = connect.Client(
|
||||
pool=pool,
|
||||
async_pool=async_pool,
|
||||
url=f"{base_url}/{FilesystemName}/WatchDirStart",
|
||||
response_type=filesystem_dot_filesystem__pb2.WatchDirStartResponse,
|
||||
url=f"{base_url}/{FilesystemName}/CreateWatcher",
|
||||
response_type=filesystem_dot_filesystem__pb2.CreateWatcherResponse,
|
||||
compressor=compressor,
|
||||
json=json,
|
||||
**opts,
|
||||
)
|
||||
self._watch_dir_get = connect.Client(
|
||||
self._get_watcher_events = connect.Client(
|
||||
pool=pool,
|
||||
async_pool=async_pool,
|
||||
url=f"{base_url}/{FilesystemName}/WatchDirGet",
|
||||
response_type=filesystem_dot_filesystem__pb2.WatchDirGetResponse,
|
||||
url=f"{base_url}/{FilesystemName}/GetWatcherEvents",
|
||||
response_type=filesystem_dot_filesystem__pb2.GetWatcherEventsResponse,
|
||||
compressor=compressor,
|
||||
json=json,
|
||||
**opts,
|
||||
)
|
||||
self._watch_dir_stop = connect.Client(
|
||||
self._remove_watcher = connect.Client(
|
||||
pool=pool,
|
||||
async_pool=async_pool,
|
||||
url=f"{base_url}/{FilesystemName}/WatchDirStop",
|
||||
response_type=filesystem_dot_filesystem__pb2.WatchDirStopResponse,
|
||||
url=f"{base_url}/{FilesystemName}/RemoveWatcher",
|
||||
response_type=filesystem_dot_filesystem__pb2.RemoveWatcherResponse,
|
||||
compressor=compressor,
|
||||
json=json,
|
||||
**opts,
|
||||
@ -162,32 +162,32 @@ class FilesystemClient:
|
||||
) -> AsyncGenerator[filesystem_dot_filesystem__pb2.WatchDirResponse, Any]:
|
||||
return self._watch_dir.acall_server_stream(req, **opts)
|
||||
|
||||
def watch_dir_start(
|
||||
self, req: filesystem_dot_filesystem__pb2.WatchDirRequest, **opts
|
||||
) -> filesystem_dot_filesystem__pb2.WatchDirStartResponse:
|
||||
return self._watch_dir_start.call_unary(req, **opts)
|
||||
def create_watcher(
|
||||
self, req: filesystem_dot_filesystem__pb2.CreateWatcherRequest, **opts
|
||||
) -> filesystem_dot_filesystem__pb2.CreateWatcherResponse:
|
||||
return self._create_watcher.call_unary(req, **opts)
|
||||
|
||||
def awatch_dir_start(
|
||||
self, req: filesystem_dot_filesystem__pb2.WatchDirRequest, **opts
|
||||
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.WatchDirStartResponse]:
|
||||
return self._watch_dir_start.acall_unary(req, **opts)
|
||||
def acreate_watcher(
|
||||
self, req: filesystem_dot_filesystem__pb2.CreateWatcherRequest, **opts
|
||||
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.CreateWatcherResponse]:
|
||||
return self._create_watcher.acall_unary(req, **opts)
|
||||
|
||||
def watch_dir_get(
|
||||
self, req: filesystem_dot_filesystem__pb2.WatchDirGetRequest, **opts
|
||||
) -> filesystem_dot_filesystem__pb2.WatchDirGetResponse:
|
||||
return self._watch_dir_get.call_unary(req, **opts)
|
||||
def get_watcher_events(
|
||||
self, req: filesystem_dot_filesystem__pb2.GetWatcherEventsRequest, **opts
|
||||
) -> filesystem_dot_filesystem__pb2.GetWatcherEventsResponse:
|
||||
return self._get_watcher_events.call_unary(req, **opts)
|
||||
|
||||
def awatch_dir_get(
|
||||
self, req: filesystem_dot_filesystem__pb2.WatchDirGetRequest, **opts
|
||||
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.WatchDirGetResponse]:
|
||||
return self._watch_dir_get.acall_unary(req, **opts)
|
||||
def aget_watcher_events(
|
||||
self, req: filesystem_dot_filesystem__pb2.GetWatcherEventsRequest, **opts
|
||||
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.GetWatcherEventsResponse]:
|
||||
return self._get_watcher_events.acall_unary(req, **opts)
|
||||
|
||||
def watch_dir_stop(
|
||||
self, req: filesystem_dot_filesystem__pb2.WatchDirStopRequest, **opts
|
||||
) -> filesystem_dot_filesystem__pb2.WatchDirStopResponse:
|
||||
return self._watch_dir_stop.call_unary(req, **opts)
|
||||
def remove_watcher(
|
||||
self, req: filesystem_dot_filesystem__pb2.RemoveWatcherRequest, **opts
|
||||
) -> filesystem_dot_filesystem__pb2.RemoveWatcherResponse:
|
||||
return self._remove_watcher.call_unary(req, **opts)
|
||||
|
||||
def awatch_dir_stop(
|
||||
self, req: filesystem_dot_filesystem__pb2.WatchDirStopRequest, **opts
|
||||
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.WatchDirStopResponse]:
|
||||
return self._watch_dir_stop.acall_unary(req, **opts)
|
||||
def aremove_watcher(
|
||||
self, req: filesystem_dot_filesystem__pb2.RemoveWatcherRequest, **opts
|
||||
) -> Coroutine[Any, Any, filesystem_dot_filesystem__pb2.RemoveWatcherResponse]:
|
||||
return self._remove_watcher.acall_unary(req, **opts)
|
||||
|
||||
@ -1,20 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# NO CHECKED-IN PROTOBUF GENCODE
|
||||
# source: filesystem/filesystem.proto
|
||||
# Protobuf Python Version: 5.27.3
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import runtime_version as _runtime_version
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
|
||||
_runtime_version.ValidateProtobufRuntimeVersion(
|
||||
_runtime_version.Domain.PUBLIC, 5, 27, 3, "", "filesystem/filesystem.proto"
|
||||
)
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
|
||||
b'\n\x1b\x66ilesystem/filesystem.proto\x12\nfilesystem"G\n\x0bMoveRequest\x12\x16\n\x06source\x18\x01 \x01(\tR\x06source\x12 \n\x0b\x64\x65stination\x18\x02 \x01(\tR\x0b\x64\x65stination";\n\x0cMoveResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry"$\n\x0eMakeDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path">\n\x0fMakeDirResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry"#\n\rRemoveRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"\x10\n\x0eRemoveResponse"!\n\x0bStatRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path";\n\x0cStatResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry"]\n\tEntryInfo\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x04type\x18\x02 \x01(\x0e\x32\x14.filesystem.FileTypeR\x04type\x12\x12\n\x04path\x18\x03 \x01(\tR\x04path"$\n\x0eListDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"B\n\x0fListDirResponse\x12/\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x15.filesystem.EntryInfoR\x07\x65ntries"%\n\x0fWatchDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"P\n\x0f\x46ilesystemEvent\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.filesystem.EventTypeR\x04type"\xfe\x01\n\x10WatchDirResponse\x12?\n\x05start\x18\x01 \x01(\x0b\x32\'.filesystem.WatchDirResponse.StartEventH\x00R\x05start\x12=\n\nfilesystem\x18\x02 \x01(\x0b\x32\x1b.filesystem.FilesystemEventH\x00R\nfilesystem\x12\x46\n\tkeepalive\x18\x03 \x01(\x0b\x32&.filesystem.WatchDirResponse.KeepAliveH\x00R\tkeepalive\x1a\x0c\n\nStartEvent\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent"6\n\x15WatchDirStartResponse\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId"3\n\x12WatchDirGetRequest\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId"J\n\x13WatchDirGetResponse\x12\x33\n\x06\x65vents\x18\x01 \x03(\x0b\x32\x1b.filesystem.FilesystemEventR\x06\x65vents"4\n\x13WatchDirStopRequest\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId"\x16\n\x14WatchDirStopResponse*R\n\x08\x46ileType\x12\x19\n\x15\x46ILE_TYPE_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x46ILE_TYPE_FILE\x10\x01\x12\x17\n\x13\x46ILE_TYPE_DIRECTORY\x10\x02*\x98\x01\n\tEventType\x12\x1a\n\x16\x45VENT_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x45VENT_TYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENT_TYPE_WRITE\x10\x02\x12\x15\n\x11\x45VENT_TYPE_REMOVE\x10\x03\x12\x15\n\x11\x45VENT_TYPE_RENAME\x10\x04\x12\x14\n\x10\x45VENT_TYPE_CHMOD\x10\x05\x32\x88\x05\n\nFilesystem\x12\x39\n\x04Stat\x12\x17.filesystem.StatRequest\x1a\x18.filesystem.StatResponse\x12\x42\n\x07MakeDir\x12\x1a.filesystem.MakeDirRequest\x1a\x1b.filesystem.MakeDirResponse\x12\x39\n\x04Move\x12\x17.filesystem.MoveRequest\x1a\x18.filesystem.MoveResponse\x12\x42\n\x07ListDir\x12\x1a.filesystem.ListDirRequest\x1a\x1b.filesystem.ListDirResponse\x12?\n\x06Remove\x12\x19.filesystem.RemoveRequest\x1a\x1a.filesystem.RemoveResponse\x12G\n\x08WatchDir\x12\x1b.filesystem.WatchDirRequest\x1a\x1c.filesystem.WatchDirResponse0\x01\x12O\n\rWatchDirStart\x12\x1b.filesystem.WatchDirRequest\x1a!.filesystem.WatchDirStartResponse\x12N\n\x0bWatchDirGet\x12\x1e.filesystem.WatchDirGetRequest\x1a\x1f.filesystem.WatchDirGetResponse\x12Q\n\x0cWatchDirStop\x12\x1f.filesystem.WatchDirStopRequest\x1a .filesystem.WatchDirStopResponseBi\n\x0e\x63om.filesystemB\x0f\x46ilesystemProtoP\x01\xa2\x02\x03\x46XX\xaa\x02\nFilesystem\xca\x02\nFilesystem\xe2\x02\x16\x46ilesystem\\GPBMetadata\xea\x02\nFilesystemb\x06proto3'
|
||||
b'\n\x1b\x66ilesystem/filesystem.proto\x12\nfilesystem"G\n\x0bMoveRequest\x12\x16\n\x06source\x18\x01 \x01(\tR\x06source\x12 \n\x0b\x64\x65stination\x18\x02 \x01(\tR\x0b\x64\x65stination";\n\x0cMoveResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry"$\n\x0eMakeDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path">\n\x0fMakeDirResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry"#\n\rRemoveRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"\x10\n\x0eRemoveResponse"!\n\x0bStatRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path";\n\x0cStatResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry"]\n\tEntryInfo\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x04type\x18\x02 \x01(\x0e\x32\x14.filesystem.FileTypeR\x04type\x12\x12\n\x04path\x18\x03 \x01(\tR\x04path"$\n\x0eListDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"B\n\x0fListDirResponse\x12/\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x15.filesystem.EntryInfoR\x07\x65ntries"%\n\x0fWatchDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"P\n\x0f\x46ilesystemEvent\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.filesystem.EventTypeR\x04type"\xfe\x01\n\x10WatchDirResponse\x12?\n\x05start\x18\x01 \x01(\x0b\x32\'.filesystem.WatchDirResponse.StartEventH\x00R\x05start\x12=\n\nfilesystem\x18\x02 \x01(\x0b\x32\x1b.filesystem.FilesystemEventH\x00R\nfilesystem\x12\x46\n\tkeepalive\x18\x03 \x01(\x0b\x32&.filesystem.WatchDirResponse.KeepAliveH\x00R\tkeepalive\x1a\x0c\n\nStartEvent\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent"*\n\x14\x43reateWatcherRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"6\n\x15\x43reateWatcherResponse\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId"8\n\x17GetWatcherEventsRequest\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId"O\n\x18GetWatcherEventsResponse\x12\x33\n\x06\x65vents\x18\x01 \x03(\x0b\x32\x1b.filesystem.FilesystemEventR\x06\x65vents"5\n\x14RemoveWatcherRequest\x12\x1d\n\nwatcher_id\x18\x01 \x01(\tR\twatcherId"\x17\n\x15RemoveWatcherResponse*R\n\x08\x46ileType\x12\x19\n\x15\x46ILE_TYPE_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x46ILE_TYPE_FILE\x10\x01\x12\x17\n\x13\x46ILE_TYPE_DIRECTORY\x10\x02*\x98\x01\n\tEventType\x12\x1a\n\x16\x45VENT_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x45VENT_TYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENT_TYPE_WRITE\x10\x02\x12\x15\n\x11\x45VENT_TYPE_REMOVE\x10\x03\x12\x15\n\x11\x45VENT_TYPE_RENAME\x10\x04\x12\x14\n\x10\x45VENT_TYPE_CHMOD\x10\x05\x32\x9f\x05\n\nFilesystem\x12\x39\n\x04Stat\x12\x17.filesystem.StatRequest\x1a\x18.filesystem.StatResponse\x12\x42\n\x07MakeDir\x12\x1a.filesystem.MakeDirRequest\x1a\x1b.filesystem.MakeDirResponse\x12\x39\n\x04Move\x12\x17.filesystem.MoveRequest\x1a\x18.filesystem.MoveResponse\x12\x42\n\x07ListDir\x12\x1a.filesystem.ListDirRequest\x1a\x1b.filesystem.ListDirResponse\x12?\n\x06Remove\x12\x19.filesystem.RemoveRequest\x1a\x1a.filesystem.RemoveResponse\x12G\n\x08WatchDir\x12\x1b.filesystem.WatchDirRequest\x1a\x1c.filesystem.WatchDirResponse0\x01\x12T\n\rCreateWatcher\x12 .filesystem.CreateWatcherRequest\x1a!.filesystem.CreateWatcherResponse\x12]\n\x10GetWatcherEvents\x12#.filesystem.GetWatcherEventsRequest\x1a$.filesystem.GetWatcherEventsResponse\x12T\n\rRemoveWatcher\x12 .filesystem.RemoveWatcherRequest\x1a!.filesystem.RemoveWatcherResponseBi\n\x0e\x63om.filesystemB\x0f\x46ilesystemProtoP\x01\xa2\x02\x03\x46XX\xaa\x02\nFilesystem\xca\x02\nFilesystem\xe2\x02\x16\x46ilesystem\\GPBMetadata\xea\x02\nFilesystemb\x06proto3'
|
||||
)
|
||||
|
||||
_globals = globals()
|
||||
@ -24,13 +29,13 @@ _builder.BuildTopDescriptorsAndMessages(
|
||||
)
|
||||
if not _descriptor._USE_C_DESCRIPTORS:
|
||||
_globals["DESCRIPTOR"]._loaded_options = None
|
||||
_globals["DESCRIPTOR"]._serialized_options = (
|
||||
b"\n\016com.filesystemB\017FilesystemProtoP\001\242\002\003FXX\252\002\nFilesystem\312\002\nFilesystem\342\002\026Filesystem\\GPBMetadata\352\002\nFilesystem"
|
||||
)
|
||||
_globals["_FILETYPE"]._serialized_start = 1272
|
||||
_globals["_FILETYPE"]._serialized_end = 1354
|
||||
_globals["_EVENTTYPE"]._serialized_start = 1357
|
||||
_globals["_EVENTTYPE"]._serialized_end = 1509
|
||||
_globals[
|
||||
"DESCRIPTOR"
|
||||
]._serialized_options = b"\n\016com.filesystemB\017FilesystemProtoP\001\242\002\003FXX\252\002\nFilesystem\312\002\nFilesystem\342\002\026Filesystem\\GPBMetadata\352\002\nFilesystem"
|
||||
_globals["_FILETYPE"]._serialized_start = 1328
|
||||
_globals["_FILETYPE"]._serialized_end = 1410
|
||||
_globals["_EVENTTYPE"]._serialized_start = 1413
|
||||
_globals["_EVENTTYPE"]._serialized_end = 1565
|
||||
_globals["_MOVEREQUEST"]._serialized_start = 43
|
||||
_globals["_MOVEREQUEST"]._serialized_end = 114
|
||||
_globals["_MOVERESPONSE"]._serialized_start = 116
|
||||
@ -63,16 +68,18 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
||||
_globals["_WATCHDIRRESPONSE_STARTEVENT"]._serialized_end = 985
|
||||
_globals["_WATCHDIRRESPONSE_KEEPALIVE"]._serialized_start = 987
|
||||
_globals["_WATCHDIRRESPONSE_KEEPALIVE"]._serialized_end = 998
|
||||
_globals["_WATCHDIRSTARTRESPONSE"]._serialized_start = 1009
|
||||
_globals["_WATCHDIRSTARTRESPONSE"]._serialized_end = 1063
|
||||
_globals["_WATCHDIRGETREQUEST"]._serialized_start = 1065
|
||||
_globals["_WATCHDIRGETREQUEST"]._serialized_end = 1116
|
||||
_globals["_WATCHDIRGETRESPONSE"]._serialized_start = 1118
|
||||
_globals["_WATCHDIRGETRESPONSE"]._serialized_end = 1192
|
||||
_globals["_WATCHDIRSTOPREQUEST"]._serialized_start = 1194
|
||||
_globals["_WATCHDIRSTOPREQUEST"]._serialized_end = 1246
|
||||
_globals["_WATCHDIRSTOPRESPONSE"]._serialized_start = 1248
|
||||
_globals["_WATCHDIRSTOPRESPONSE"]._serialized_end = 1270
|
||||
_globals["_FILESYSTEM"]._serialized_start = 1512
|
||||
_globals["_FILESYSTEM"]._serialized_end = 2160
|
||||
_globals["_CREATEWATCHERREQUEST"]._serialized_start = 1009
|
||||
_globals["_CREATEWATCHERREQUEST"]._serialized_end = 1051
|
||||
_globals["_CREATEWATCHERRESPONSE"]._serialized_start = 1053
|
||||
_globals["_CREATEWATCHERRESPONSE"]._serialized_end = 1107
|
||||
_globals["_GETWATCHEREVENTSREQUEST"]._serialized_start = 1109
|
||||
_globals["_GETWATCHEREVENTSREQUEST"]._serialized_end = 1165
|
||||
_globals["_GETWATCHEREVENTSRESPONSE"]._serialized_start = 1167
|
||||
_globals["_GETWATCHEREVENTSRESPONSE"]._serialized_end = 1246
|
||||
_globals["_REMOVEWATCHERREQUEST"]._serialized_start = 1248
|
||||
_globals["_REMOVEWATCHERREQUEST"]._serialized_end = 1301
|
||||
_globals["_REMOVEWATCHERRESPONSE"]._serialized_start = 1303
|
||||
_globals["_REMOVEWATCHERRESPONSE"]._serialized_end = 1326
|
||||
_globals["_FILESYSTEM"]._serialized_start = 1568
|
||||
_globals["_FILESYSTEM"]._serialized_end = 2239
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
|
||||
@ -155,19 +155,25 @@ class WatchDirResponse(_message.Message):
|
||||
keepalive: _Optional[_Union[WatchDirResponse.KeepAlive, _Mapping]] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class WatchDirStartResponse(_message.Message):
|
||||
class CreateWatcherRequest(_message.Message):
|
||||
__slots__ = ("path",)
|
||||
PATH_FIELD_NUMBER: _ClassVar[int]
|
||||
path: str
|
||||
def __init__(self, path: _Optional[str] = ...) -> None: ...
|
||||
|
||||
class CreateWatcherResponse(_message.Message):
|
||||
__slots__ = ("watcher_id",)
|
||||
WATCHER_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
watcher_id: str
|
||||
def __init__(self, watcher_id: _Optional[str] = ...) -> None: ...
|
||||
|
||||
class WatchDirGetRequest(_message.Message):
|
||||
class GetWatcherEventsRequest(_message.Message):
|
||||
__slots__ = ("watcher_id",)
|
||||
WATCHER_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
watcher_id: str
|
||||
def __init__(self, watcher_id: _Optional[str] = ...) -> None: ...
|
||||
|
||||
class WatchDirGetResponse(_message.Message):
|
||||
class GetWatcherEventsResponse(_message.Message):
|
||||
__slots__ = ("events",)
|
||||
EVENTS_FIELD_NUMBER: _ClassVar[int]
|
||||
events: _containers.RepeatedCompositeFieldContainer[FilesystemEvent]
|
||||
@ -175,12 +181,12 @@ class WatchDirGetResponse(_message.Message):
|
||||
self, events: _Optional[_Iterable[_Union[FilesystemEvent, _Mapping]]] = ...
|
||||
) -> None: ...
|
||||
|
||||
class WatchDirStopRequest(_message.Message):
|
||||
class RemoveWatcherRequest(_message.Message):
|
||||
__slots__ = ("watcher_id",)
|
||||
WATCHER_ID_FIELD_NUMBER: _ClassVar[int]
|
||||
watcher_id: str
|
||||
def __init__(self, watcher_id: _Optional[str] = ...) -> None: ...
|
||||
|
||||
class WatchDirStopResponse(_message.Message):
|
||||
class RemoveWatcherResponse(_message.Message):
|
||||
__slots__ = ()
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@ -1,13 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# NO CHECKED-IN PROTOBUF GENCODE
|
||||
# source: process/process.proto
|
||||
# Protobuf Python Version: 5.27.3
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import runtime_version as _runtime_version
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
|
||||
_runtime_version.ValidateProtobufRuntimeVersion(
|
||||
_runtime_version.Domain.PUBLIC, 5, 27, 3, "", "process/process.proto"
|
||||
)
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
@ -22,9 +27,9 @@ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "process.process_pb2", _globals)
|
||||
if not _descriptor._USE_C_DESCRIPTORS:
|
||||
_globals["DESCRIPTOR"]._loaded_options = None
|
||||
_globals["DESCRIPTOR"]._serialized_options = (
|
||||
b"\n\013com.processB\014ProcessProtoP\001\242\002\003PXX\252\002\007Process\312\002\007Process\342\002\023Process\\GPBMetadata\352\002\007Process"
|
||||
)
|
||||
_globals[
|
||||
"DESCRIPTOR"
|
||||
]._serialized_options = b"\n\013com.processB\014ProcessProtoP\001\242\002\003PXX\252\002\007Process\312\002\007Process\342\002\023Process\\GPBMetadata\352\002\007Process"
|
||||
_globals["_PROCESSCONFIG_ENVSENTRY"]._loaded_options = None
|
||||
_globals["_PROCESSCONFIG_ENVSENTRY"]._serialized_options = b"8\001"
|
||||
_globals["_SIGNAL"]._serialized_start = 2316
|
||||
|
||||
@ -52,7 +52,8 @@ class Filesystem:
|
||||
format: Literal["text"] = "text",
|
||||
user: Username = "user",
|
||||
request_timeout: Optional[float] = None,
|
||||
) -> str: ...
|
||||
) -> str:
|
||||
...
|
||||
|
||||
@overload
|
||||
async def read(
|
||||
@ -61,7 +62,8 @@ class Filesystem:
|
||||
format: Literal["bytes"],
|
||||
user: Username = "user",
|
||||
request_timeout: Optional[float] = None,
|
||||
) -> bytearray: ...
|
||||
) -> bytearray:
|
||||
...
|
||||
|
||||
@overload
|
||||
async def read(
|
||||
@ -70,7 +72,8 @@ class Filesystem:
|
||||
format: Literal["stream"],
|
||||
user: Username = "user",
|
||||
request_timeout: Optional[float] = None,
|
||||
) -> AsyncIterator[bytes]: ...
|
||||
) -> AsyncIterator[bytes]:
|
||||
...
|
||||
|
||||
async def read(
|
||||
self,
|
||||
|
||||
@ -253,7 +253,8 @@ class AsyncSandbox(SandboxSetup, SandboxApi):
|
||||
await self.kill()
|
||||
|
||||
@overload
|
||||
async def kill(self, request_timeout: Optional[float] = None) -> bool: ...
|
||||
async def kill(self, request_timeout: Optional[float] = None) -> bool:
|
||||
...
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
@ -263,7 +264,8 @@ class AsyncSandbox(SandboxSetup, SandboxApi):
|
||||
domain: Optional[str] = None,
|
||||
debug: Optional[bool] = None,
|
||||
request_timeout: Optional[float] = None,
|
||||
) -> bool: ...
|
||||
) -> bool:
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_kill")
|
||||
async def kill(self, request_timeout: Optional[float] = None) -> bool: # type: ignore
|
||||
@ -290,7 +292,8 @@ class AsyncSandbox(SandboxSetup, SandboxApi):
|
||||
self,
|
||||
timeout: int,
|
||||
request_timeout: Optional[float] = None,
|
||||
) -> None: ...
|
||||
) -> None:
|
||||
...
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
@ -301,7 +304,8 @@ class AsyncSandbox(SandboxSetup, SandboxApi):
|
||||
domain: Optional[str] = None,
|
||||
debug: Optional[bool] = None,
|
||||
request_timeout: Optional[float] = None,
|
||||
) -> None: ...
|
||||
) -> None:
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_set_timeout")
|
||||
async def set_timeout( # type: ignore
|
||||
|
||||
@ -137,7 +137,8 @@ class Process:
|
||||
on_stderr: Optional[OutputHandler[Stderr]] = None,
|
||||
timeout: Optional[float] = 60,
|
||||
request_timeout: Optional[float] = None,
|
||||
) -> ProcessResult: ...
|
||||
) -> ProcessResult:
|
||||
...
|
||||
|
||||
@overload
|
||||
async def run(
|
||||
@ -151,7 +152,8 @@ class Process:
|
||||
on_stderr: Optional[OutputHandler[Stderr]] = None,
|
||||
timeout: Optional[float] = 60,
|
||||
request_timeout: Optional[float] = None,
|
||||
) -> AsyncProcessHandle: ...
|
||||
) -> AsyncProcessHandle:
|
||||
...
|
||||
|
||||
async def run(
|
||||
self,
|
||||
|
||||
@ -314,8 +314,8 @@ class Filesystem:
|
||||
:return: Watcher handle
|
||||
"""
|
||||
try:
|
||||
r = self._rpc.watch_dir_start(
|
||||
filesystem_pb2.WatchDirRequest(path=path),
|
||||
r = self._rpc.create_watcher(
|
||||
filesystem_pb2.CreateWatcherRequest(path=path),
|
||||
request_timeout=self._connection_config.get_request_timeout(
|
||||
request_timeout
|
||||
),
|
||||
|
||||
@ -2,7 +2,10 @@ from typing import List
|
||||
|
||||
from e2b import SandboxException
|
||||
from e2b.envd.filesystem import filesystem_connect
|
||||
from e2b.envd.filesystem.filesystem_pb2 import WatchDirStopRequest, WatchDirGetRequest
|
||||
from e2b.envd.filesystem.filesystem_pb2 import (
|
||||
GetWatcherEventsRequest,
|
||||
RemoveWatcherRequest,
|
||||
)
|
||||
from e2b.envd.rpc import handle_rpc_exception
|
||||
from e2b.sandbox.filesystem.watch_handle import FilesystemEvent, map_event_type
|
||||
|
||||
@ -26,7 +29,7 @@ class WatchHandle:
|
||||
Stop watching the directory. After you stop the watcher you won't be able to get the events anymore.
|
||||
"""
|
||||
try:
|
||||
self._rpc.watch_dir_stop(WatchDirStopRequest(watcher_id=self._watcher_id))
|
||||
self._rpc.remove_watcher(RemoveWatcherRequest(watcher_id=self._watcher_id))
|
||||
except Exception as e:
|
||||
raise handle_rpc_exception(e)
|
||||
|
||||
@ -40,7 +43,9 @@ class WatchHandle:
|
||||
raise SandboxException("The watcher is already stopped")
|
||||
|
||||
try:
|
||||
r = self._rpc.watch_dir_get(WatchDirGetRequest(watcher_id=self._watcher_id))
|
||||
r = self._rpc.get_watcher_events(
|
||||
GetWatcherEventsRequest(watcher_id=self._watcher_id)
|
||||
)
|
||||
except Exception as e:
|
||||
raise handle_rpc_exception(e)
|
||||
|
||||
|
||||
@ -12,9 +12,9 @@ service Filesystem {
|
||||
rpc WatchDir(WatchDirRequest) returns (stream WatchDirResponse);
|
||||
|
||||
// Non-streaming versions of WatchDir
|
||||
rpc WatchDirStart(WatchDirRequest) returns (WatchDirStartResponse);
|
||||
rpc WatchDirGet(WatchDirGetRequest) returns (WatchDirGetResponse);
|
||||
rpc WatchDirStop(WatchDirStopRequest) returns (WatchDirStopResponse);
|
||||
rpc CreateWatcher(CreateWatcherRequest) returns (CreateWatcherResponse);
|
||||
rpc GetWatcherEvents(GetWatcherEventsRequest) returns (GetWatcherEventsResponse);
|
||||
rpc RemoveWatcher(RemoveWatcherRequest) returns (RemoveWatcherResponse);
|
||||
}
|
||||
|
||||
message MoveRequest {
|
||||
@ -89,23 +89,27 @@ message WatchDirResponse {
|
||||
message KeepAlive {}
|
||||
}
|
||||
|
||||
message WatchDirStartResponse {
|
||||
message CreateWatcherRequest {
|
||||
string path = 1;
|
||||
}
|
||||
|
||||
message CreateWatcherResponse {
|
||||
string watcher_id = 1;
|
||||
}
|
||||
|
||||
message WatchDirGetRequest {
|
||||
message GetWatcherEventsRequest {
|
||||
string watcher_id = 1;
|
||||
}
|
||||
|
||||
message WatchDirGetResponse {
|
||||
message GetWatcherEventsResponse {
|
||||
repeated FilesystemEvent events = 1;
|
||||
}
|
||||
|
||||
message WatchDirStopRequest {
|
||||
message RemoveWatcherRequest {
|
||||
string watcher_id = 1;
|
||||
}
|
||||
|
||||
message WatchDirStopResponse {}
|
||||
message RemoveWatcherResponse {}
|
||||
|
||||
enum EventType {
|
||||
EVENT_TYPE_UNSPECIFIED = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user