@cerbos/http
Version:
Client library for interacting with the Cerbos policy decision point service over HTTP from browser-based applications
111 lines (97 loc) • 2.81 kB
text/typescript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// source: grpc/health/v1/health.proto
/* eslint-disable */
export const protobufPackage = "grpc.health.v1";
export interface HealthCheckRequest {
service: string;
}
export interface HealthCheckResponse {
status: HealthCheckResponse_ServingStatus;
}
export enum HealthCheckResponse_ServingStatus {
UNKNOWN = 0,
SERVING = 1,
NOT_SERVING = 2,
SERVICE_UNKNOWN = 3,
}
export function healthCheckResponse_ServingStatusFromJSON(
object: any,
): HealthCheckResponse_ServingStatus {
switch (object) {
case 0:
case "UNKNOWN":
return HealthCheckResponse_ServingStatus.UNKNOWN;
case 1:
case "SERVING":
return HealthCheckResponse_ServingStatus.SERVING;
case 2:
case "NOT_SERVING":
return HealthCheckResponse_ServingStatus.NOT_SERVING;
case 3:
case "SERVICE_UNKNOWN":
return HealthCheckResponse_ServingStatus.SERVICE_UNKNOWN;
default:
throw new globalThis.Error(
"Unrecognized enum value " +
object +
" for enum HealthCheckResponse_ServingStatus",
);
}
}
export function healthCheckResponse_ServingStatusToJSON(
object: HealthCheckResponse_ServingStatus,
): string {
switch (object) {
case HealthCheckResponse_ServingStatus.UNKNOWN:
return "UNKNOWN";
case HealthCheckResponse_ServingStatus.SERVING:
return "SERVING";
case HealthCheckResponse_ServingStatus.NOT_SERVING:
return "NOT_SERVING";
case HealthCheckResponse_ServingStatus.SERVICE_UNKNOWN:
return "SERVICE_UNKNOWN";
default:
throw new globalThis.Error(
"Unrecognized enum value " +
object +
" for enum HealthCheckResponse_ServingStatus",
);
}
}
export const HealthCheckRequest: MessageFns<HealthCheckRequest> = {
fromJSON(object: any): HealthCheckRequest {
return {
service: isSet(object.service) ? globalThis.String(object.service) : "",
};
},
toJSON(message: HealthCheckRequest): unknown {
const obj: any = {};
if (message.service !== "") {
obj.service = message.service;
}
return obj;
},
};
export const HealthCheckResponse: MessageFns<HealthCheckResponse> = {
fromJSON(object: any): HealthCheckResponse {
return {
status: isSet(object.status)
? healthCheckResponse_ServingStatusFromJSON(object.status)
: 0,
};
},
toJSON(message: HealthCheckResponse): unknown {
const obj: any = {};
if (message.status !== 0) {
obj.status = healthCheckResponse_ServingStatusToJSON(message.status);
}
return obj;
},
};
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
export interface MessageFns<T> {
fromJSON(object: any): T;
toJSON(message: T): unknown;
}