Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add common proto #16

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ vars:

includes:
install: taskfiles/install.yaml
proto: taskfiles/proto.yaml

tasks:
lint:
Expand Down
21 changes: 21 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: v2
managed:
enabled: true
plugins:
- remote: buf.build/protocolbuffers/go
out: proto/gen/go
opt: paths=source_relative
- remote: buf.build/connectrpc/go
out: gen
opt: paths=source_relative
- remote: buf.build/bufbuild/validate-go:v1.0.2
out: proto/gen/go
opt: paths=source_relative
- remote: buf.build/bufbuild/es:v1.6.0
out: proto/gen/es
opt:
- target=ts
- import_extension=
- js_import_style=legacy_commonjs
inputs:
- directory: proto
6 changes: 6 additions & 0 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated by buf. DO NOT EDIT.
version: v2
deps:
- name: buf.build/googleapis/googleapis
commit: e7f8d366f5264595bcc4cd4139af9973
digest: b5:0cd69a689ee320ed815663d57d1bc3a1d6823224a7a717d46fee3a68197c25a6f5f932c0b0e49f8370c70c247a6635969a6a54af5345cafd51e0667298768aca
12 changes: 12 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: v2
modules:
- path: proto
name: buf.build/redpandadata/common
deps:
- buf.build/googleapis/googleapis
lint:
use:
- DEFAULT
breaking:
use:
- FILE
138 changes: 138 additions & 0 deletions proto/gen/es/redpanda/api/common/v1/errordetails_pb.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
// @generated by protoc-gen-es v1.6.0 with parameter "target=ts,import_extension=,js_import_style=legacy_commonjs"
// @generated from file redpanda/api/common/v1/errordetails.proto (package redpanda.api.common.v1, syntax proto3)
/* eslint-disable */
// @ts-nocheck

import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Any, Message, proto3 } from "@bufbuild/protobuf";
import { Status } from "../../../../google/rpc/status_pb";

/**
* AttemptInfo contains information about retryable actions and their specific attempts.
*
* @generated from message redpanda.api.common.v1.AttemptInfo
*/
export class AttemptInfo extends Message<AttemptInfo> {
/**
* @generated from field: repeated redpanda.api.common.v1.AttemptInfo.Attempt attempts = 1;
*/
attempts: AttemptInfo_Attempt[] = [];

constructor(data?: PartialMessage<AttemptInfo>) {
super();
proto3.util.initPartial(data, this);
}

static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "redpanda.api.common.v1.AttemptInfo";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "attempts", kind: "message", T: AttemptInfo_Attempt, repeated: true },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AttemptInfo {
return new AttemptInfo().fromBinary(bytes, options);
}

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AttemptInfo {
return new AttemptInfo().fromJson(jsonValue, options);
}

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AttemptInfo {
return new AttemptInfo().fromJsonString(jsonString, options);
}

static equals(a: AttemptInfo | PlainMessage<AttemptInfo> | undefined, b: AttemptInfo | PlainMessage<AttemptInfo> | undefined): boolean {
return proto3.util.equals(AttemptInfo, a, b);
}
}

/**
* @generated from message redpanda.api.common.v1.AttemptInfo.Attempt
*/
export class AttemptInfo_Attempt extends Message<AttemptInfo_Attempt> {
/**
* @generated from field: int32 number = 1;
*/
number = 0;

/**
* @generated from field: google.rpc.Status status = 2;
*/
status?: Status;

constructor(data?: PartialMessage<AttemptInfo_Attempt>) {
super();
proto3.util.initPartial(data, this);
}

static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "redpanda.api.common.v1.AttemptInfo.Attempt";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "number", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 2, name: "status", kind: "message", T: Status },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AttemptInfo_Attempt {
return new AttemptInfo_Attempt().fromBinary(bytes, options);
}

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): AttemptInfo_Attempt {
return new AttemptInfo_Attempt().fromJson(jsonValue, options);
}

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): AttemptInfo_Attempt {
return new AttemptInfo_Attempt().fromJsonString(jsonString, options);
}

static equals(a: AttemptInfo_Attempt | PlainMessage<AttemptInfo_Attempt> | undefined, b: AttemptInfo_Attempt | PlainMessage<AttemptInfo_Attempt> | undefined): boolean {
return proto3.util.equals(AttemptInfo_Attempt, a, b);
}
}

/**
* ExternalError is an error that may be returned to external users. Other
* errors thrown by internal systems are discarded by default, so internal
* errors with sensitive information are not exposed.
*
* @generated from message redpanda.api.common.v1.ExternalError
*/
export class ExternalError extends Message<ExternalError> {
/**
* @generated from field: string message = 1;
*/
message = "";

/**
* @generated from field: repeated google.protobuf.Any details = 2;
*/
details: Any[] = [];

constructor(data?: PartialMessage<ExternalError>) {
super();
proto3.util.initPartial(data, this);
}

static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "redpanda.api.common.v1.ExternalError";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "details", kind: "message", T: Any, repeated: true },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ExternalError {
return new ExternalError().fromBinary(bytes, options);
}

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ExternalError {
return new ExternalError().fromJson(jsonValue, options);
}

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ExternalError {
return new ExternalError().fromJsonString(jsonString, options);
}

static equals(a: ExternalError | PlainMessage<ExternalError> | undefined, b: ExternalError | PlainMessage<ExternalError> | undefined): boolean {
return proto3.util.equals(ExternalError, a, b);
}
}

181 changes: 181 additions & 0 deletions proto/gen/es/redpanda/api/common/v1alpha1/common_pb.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
// @generated by protoc-gen-es v1.6.0 with parameter "target=ts,import_extension=,js_import_style=legacy_commonjs"
// @generated from file redpanda/api/common/v1alpha1/common.proto (package redpanda.api.common.v1alpha1, syntax proto3)
/* eslint-disable */
// @ts-nocheck

import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Any, Message, proto3 } from "@bufbuild/protobuf";
import { Code } from "../../../../google/rpc/code_pb";

/**
* @generated from enum redpanda.api.common.v1alpha1.Reason
*/
export enum Reason {
/**
* @generated from enum value: REASON_UNSPECIFIED = 0;
*/
UNSPECIFIED = 0,

/**
* The specified resource could not be found.
*
* @generated from enum value: REASON_RESOURCE_NOT_FOUND = 1;
*/
RESOURCE_NOT_FOUND = 1,

/**
* The input provided with the request is invalid.
*
* @generated from enum value: REASON_INVALID_INPUT = 2;
*/
INVALID_INPUT = 2,

/**
* Authentication token is missing.
*
* @generated from enum value: REASON_NO_AUTHENTICATION_TOKEN = 3;
*/
NO_AUTHENTICATION_TOKEN = 3,

/**
* The authentication token provided has expired.
*
* @generated from enum value: REASON_AUTHENTICATION_TOKEN_EXPIRED = 4;
*/
AUTHENTICATION_TOKEN_EXPIRED = 4,

/**
* The authentication token provided is invalid.
*
* @generated from enum value: REASON_AUTHENTICATION_TOKEN_INVALID = 5;
*/
AUTHENTICATION_TOKEN_INVALID = 5,

/**
* The user does not have the necessary permissions.
*
* @generated from enum value: REASON_PERMISSION_DENIED = 6;
*/
PERMISSION_DENIED = 6,

/**
* The request cannot be completed due to server error.
*
* @generated from enum value: REASON_SERVER_ERROR = 7;
*/
SERVER_ERROR = 7,

/**
* The request rate is too high.
*
* @generated from enum value: REASON_TOO_MANY_REQUESTS = 8;
*/
TOO_MANY_REQUESTS = 8,

/**
* The request timed out.
*
* @generated from enum value: REASON_TIMEOUT = 9;
*/
TIMEOUT = 9,

/**
* The feature is not configured.
*
* @generated from enum value: REASON_FEATURE_NOT_CONFIGURED = 10;
*/
FEATURE_NOT_CONFIGURED = 10,

/**
* The feature is not supported in the requested environment.
*
* @generated from enum value: REASON_FEATURE_NOT_SUPPORTED = 11;
*/
FEATURE_NOT_SUPPORTED = 11,
}
// Retrieve enum metadata with: proto3.getEnumType(Reason)
proto3.util.setEnumType(Reason, "redpanda.api.common.v1alpha1.Reason", [
{ no: 0, name: "REASON_UNSPECIFIED" },
{ no: 1, name: "REASON_RESOURCE_NOT_FOUND" },
{ no: 2, name: "REASON_INVALID_INPUT" },
{ no: 3, name: "REASON_NO_AUTHENTICATION_TOKEN" },
{ no: 4, name: "REASON_AUTHENTICATION_TOKEN_EXPIRED" },
{ no: 5, name: "REASON_AUTHENTICATION_TOKEN_INVALID" },
{ no: 6, name: "REASON_PERMISSION_DENIED" },
{ no: 7, name: "REASON_SERVER_ERROR" },
{ no: 8, name: "REASON_TOO_MANY_REQUESTS" },
{ no: 9, name: "REASON_TIMEOUT" },
{ no: 10, name: "REASON_FEATURE_NOT_CONFIGURED" },
{ no: 11, name: "REASON_FEATURE_NOT_SUPPORTED" },
]);

/**
* Modified variant of google.rpc.Status, that uses enum instead of int32 for
* code, so it's nicer in REST.
* The `Status` type defines a logical error model that is suitable for
* different programming environments, including REST APIs and RPC APIs. It is
* used by [gRPC](https://github.com/grpc). Each `Status` message contains
* three pieces of data: error code, error message, and error details.
*
* You can find out more about this error model and how to work with it in the
* [API Design Guide](https://cloud.google.com/apis/design/errors).
*
* @generated from message redpanda.api.common.v1alpha1.ErrorStatus
*/
export class ErrorStatus extends Message<ErrorStatus> {
/**
* The status code, which should be an enum value of
* [google.rpc.Code][google.rpc.Code].
*
* @generated from field: google.rpc.Code code = 1;
*/
code = Code.OK;

/**
* A developer-facing error message, which should be in English. Any
* user-facing error message should be localized and sent in the
* [google.rpc.Status.details][google.rpc.Status.details] field, or localized
* by the client.
*
* @generated from field: string message = 2;
*/
message = "";

/**
* A list of messages that carry the error details. There is a common set of
* message types for APIs to use.
*
* @generated from field: repeated google.protobuf.Any details = 3;
*/
details: Any[] = [];

constructor(data?: PartialMessage<ErrorStatus>) {
super();
proto3.util.initPartial(data, this);
}

static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "redpanda.api.common.v1alpha1.ErrorStatus";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "code", kind: "enum", T: proto3.getEnumType(Code) },
{ no: 2, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "details", kind: "message", T: Any, repeated: true },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ErrorStatus {
return new ErrorStatus().fromBinary(bytes, options);
}

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ErrorStatus {
return new ErrorStatus().fromJson(jsonValue, options);
}

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ErrorStatus {
return new ErrorStatus().fromJsonString(jsonString, options);
}

static equals(a: ErrorStatus | PlainMessage<ErrorStatus> | undefined, b: ErrorStatus | PlainMessage<ErrorStatus> | undefined): boolean {
return proto3.util.equals(ErrorStatus, a, b);
}
}

Loading
Loading