Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat(api): the proto definition of the anomaly service (#4829)

h3n4l267c2fdc0e31
diff --git a/frontend/src/types/proto/v1/anomaly_service.ts b/frontend/src/types/proto/v1/anomaly_service.ts
new file mode 100644
index 0000000000..93318c0ea5
--- /dev/null
+++ b/frontend/src/types/proto/v1/anomaly_service.ts
@@ -0,0 +1,948 @@
+/* eslint-disable */
+import type { CallContext, CallOptions } from "nice-grpc-common";
+import * as _m0 from "protobufjs/minimal";
+import { Timestamp } from "../google/protobuf/timestamp";
+
+export const protobufPackage = "bytebase.v1";
+
+export interface SearchAnomaliesRequest {
+ /**
+ * filter is the filter to apply on the search anomaly request,
+ * follow the [google cel-spec](https://github.com/google/cel-spec) syntax.
+ * For example:
+ * Search the anomalies of a specific resource: 'anomaly.resource_name="environments/{environemnt}/instances/{instance}"'
+ * Search the specified type of anomalies: 'anomaly.type="DATABASE_BACKUP_POLICY_VIOLATION"'
+ */
+ filter: string;
+ /**
+ * Not used. The maximum number of anomalies to return. The service may return fewer than
+ * this value.
+ * If unspecified, at most 50 anomalies will be returned.
+ * The maximum value is 1000; values above 1000 will be coerced to 1000.
+ */
+ pageSize: number;
+ /**
+ * Not used. A page token, received from a previous `SearchAnomalies` call.
+ * Provide this to retrieve the subsequent page.
+ *
+ * When paginating, all other parameters provided to `SearchAnomalies` must match
+ * the call that provided the page token.
+ */
+ pageToken: string;
+}
+
+export interface SearchAnomaliesResponse {
+ /** anomalies is the list of anomalies. */
+ anomalies: Anomaly[];
+ /**
+ * Not used. A token, which can be sent as `page_token` to retrieve the next page.
+ * If this field is omitted, there are no subsequent pages.
+ */
+ nextPageToken: string;
+}
+
+export interface Anomaly {
+ /**
+ * The resource that is the target of the operation.
+ * Format:
+ * - Instance: environments/{environment}/instnaces/{instance}
+ * - Database: environments/{environment}/instnaces/{instance}/databases/{database}
+ */
+ resource: string;
+ /** type is the type of the anomaly. */
+ type: Anomaly_AnomalyType;
+ /** serverity is the serverity of the anomaly. */
+ serverity: Anomaly_AnomalyServerity;
+ instanceConnectionDetail?: Anomaly_InstanceConnectionDetail | undefined;
+ databaseConnectionDetail?: Anomaly_DatabaseConnectionDetail | undefined;
+ databaseBackupPolicyViolationDetail?: Anomaly_DatabaseBackupPolicyViolationDetail | undefined;
+ databaseBackupMissingDetail?: Anomaly_DatabaseBackupMissingDetail | undefined;
+ databaseSchemaDriftDetail?: Anomaly_DatabaseSchemaDriftDetail | undefined;
+}
+
+/** AnomalyType is the type of the anomaly. */
+export enum Anomaly_AnomalyType {
+ /** ANOMALY_TYPE_UNSPECIFIED - Unspecified anomaly type. */
+ ANOMALY_TYPE_UNSPECIFIED = 0,
+ /**
+ * INSTANCE_CONNECTION - Instance level anomaly.
+ *
+ * INSTANCE_CONNECTION is the anomaly type for instance connection, e.g. the instance is down.
+ */
+ INSTANCE_CONNECTION = 1,
+ /** MIGRATION_SCHEMA - MIGRATION_SCHEMA is the anomaly type for migration schema, e.g. the migration schema in the instance is missing. */
+ MIGRATION_SCHEMA = 2,
+ /**
+ * DATABASE_BACKUP_POLICY_VIOLATION - Database level anomaly.
+ *
+ * DATABASE_BACKUP_POLICY_VIOLATION is the anomaly type for database backup policy violation,
+ * e.g. the database backup policy is not meet the environment backup policy.
+ */
+ DATABASE_BACKUP_POLICY_VIOLATION = 3,
+ /** DATABASE_BACKUP_MISSING - DATABASE_BACKUP_MISSING is the anomaly type for the backup missing, e.g. the backup is missing. */
+ DATABASE_BACKUP_MISSING = 4,
+ /** DATABASE_CONNECTION - DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted. */
+ DATABASE_CONNECTION = 5,
+ /**
+ * DATABASE_SCHEMA_DRIFT - DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift,
+ * e.g. the database schema had been changed without bytebase migration.
+ */
+ DATABASE_SCHEMA_DRIFT = 6,
+ UNRECOGNIZED = -1,
+}
+
+export function anomaly_AnomalyTypeFromJSON(object: any): Anomaly_AnomalyType {
+ switch (object) {
+ case 0:
+ case "ANOMALY_TYPE_UNSPECIFIED":
+ return Anomaly_AnomalyType.ANOMALY_TYPE_UNSPECIFIED;
+ case 1:
+ case "INSTANCE_CONNECTION":
+ return Anomaly_AnomalyType.INSTANCE_CONNECTION;
+ case 2:
+ case "MIGRATION_SCHEMA":
+ return Anomaly_AnomalyType.MIGRATION_SCHEMA;
+ case 3:
+ case "DATABASE_BACKUP_POLICY_VIOLATION":
+ return Anomaly_AnomalyType.DATABASE_BACKUP_POLICY_VIOLATION;
+ case 4:
+ case "DATABASE_BACKUP_MISSING":
+ return Anomaly_AnomalyType.DATABASE_BACKUP_MISSING;
+ case 5:
+ case "DATABASE_CONNECTION":
+ return Anomaly_AnomalyType.DATABASE_CONNECTION;
+ case 6:
+ case "DATABASE_SCHEMA_DRIFT":
+ return Anomaly_AnomalyType.DATABASE_SCHEMA_DRIFT;
+ case -1:
+ case "UNRECOGNIZED":
+ default:
+ return Anomaly_AnomalyType.UNRECOGNIZED;
+ }
+}
+
+export function anomaly_AnomalyTypeToJSON(object: Anomaly_AnomalyType): string {
+ switch (object) {
+ case Anomaly_AnomalyType.ANOMALY_TYPE_UNSPECIFIED:
+ return "ANOMALY_TYPE_UNSPECIFIED";
+ case Anomaly_AnomalyType.INSTANCE_CONNECTION:
+ return "INSTANCE_CONNECTION";
+ case Anomaly_AnomalyType.MIGRATION_SCHEMA:
+ return "MIGRATION_SCHEMA";
+ case Anomaly_AnomalyType.DATABASE_BACKUP_POLICY_VIOLATION:
+ return "DATABASE_BACKUP_POLICY_VIOLATION";
+ case Anomaly_AnomalyType.DATABASE_BACKUP_MISSING:
+ return "DATABASE_BACKUP_MISSING";
+ case Anomaly_AnomalyType.DATABASE_CONNECTION:
+ return "DATABASE_CONNECTION";
+ case Anomaly_AnomalyType.DATABASE_SCHEMA_DRIFT:
+ return "DATABASE_SCHEMA_DRIFT";
+ case Anomaly_AnomalyType.UNRECOGNIZED:
+ default:
+ return "UNRECOGNIZED";
+ }
+}
+
+/** AnomalyServerity is the severity of the anomaly. */
+export enum Anomaly_AnomalyServerity {
+ /** ANOMALY_SERVERITY_UNSPECIFIED - Unspecified anomaly serverity. */
+ ANOMALY_SERVERITY_UNSPECIFIED = 0,
+ /** MEDIUM - MEDIUM is the info level anomaly serverity. */
+ MEDIUM = 1,
+ /** HIGH - HIGH is the warning level anomaly serverity. */
+ HIGH = 2,
+ /** CRITICAL - CRITICAL is the critical level anomaly serverity. */
+ CRITICAL = 3,
+ UNRECOGNIZED = -1,
+}
+
+export function anomaly_AnomalyServerityFromJSON(object: any): Anomaly_AnomalyServerity {
+ switch (object) {
+ case 0:
+ case "ANOMALY_SERVERITY_UNSPECIFIED":
+ return Anomaly_AnomalyServerity.ANOMALY_SERVERITY_UNSPECIFIED;
+ case 1:
+ case "MEDIUM":
+ return Anomaly_AnomalyServerity.MEDIUM;
+ case 2:
+ case "HIGH":
+ return Anomaly_AnomalyServerity.HIGH;
+ case 3:
+ case "CRITICAL":
+ return Anomaly_AnomalyServerity.CRITICAL;
+ case -1:
+ case "UNRECOGNIZED":
+ default:
+ return Anomaly_AnomalyServerity.UNRECOGNIZED;
+ }
+}
+
+export function anomaly_AnomalyServerityToJSON(object: Anomaly_AnomalyServerity): string {
+ switch (object) {
+ case Anomaly_AnomalyServerity.ANOMALY_SERVERITY_UNSPECIFIED:
+ return "ANOMALY_SERVERITY_UNSPECIFIED";
+ case Anomaly_AnomalyServerity.MEDIUM:
+ return "MEDIUM";
+ case Anomaly_AnomalyServerity.HIGH:
+ return "HIGH";
+ case Anomaly_AnomalyServerity.CRITICAL:
+ return "CRITICAL";
+ case Anomaly_AnomalyServerity.UNRECOGNIZED:
+ default:
+ return "UNRECOGNIZED";
+ }
+}
+
+/** BackupPlanSchedule is the backup plan schedule. */
+export enum Anomaly_BackupPlanSchedule {
+ /** BACKUP_PLAN_SCHEDULE_UNSPECIFIED - Unspecified backup plan schedule. */
+ BACKUP_PLAN_SCHEDULE_UNSPECIFIED = 0,
+ /** UNSET - UNSET is the unset backup plan schedule. */
+ UNSET = 1,
+ /** DAILY - DAILY is the daily backup plan schedule. */
+ DAILY = 2,
+ /** WEEKLY - WEEKLY is the weekly backup plan schedule. */
+ WEEKLY = 3,
+ UNRECOGNIZED = -1,
+}
+
+export function anomaly_BackupPlanScheduleFromJSON(object: any): Anomaly_BackupPlanSchedule {
+ switch (object) {
+ case 0:
+ case "BACKUP_PLAN_SCHEDULE_UNSPECIFIED":
+ return Anomaly_BackupPlanSchedule.BACKUP_PLAN_SCHEDULE_UNSPECIFIED;
+ case 1:
+ case "UNSET":
+ return Anomaly_BackupPlanSchedule.UNSET;
+ case 2:
+ case "DAILY":
+ return Anomaly_BackupPlanSchedule.DAILY;
+ case 3:
+ case "WEEKLY":
+ return Anomaly_BackupPlanSchedule.WEEKLY;
+ case -1:
+ case "UNRECOGNIZED":
+ default:
+ return Anomaly_BackupPlanSchedule.UNRECOGNIZED;
+ }
+}
+
+export function anomaly_BackupPlanScheduleToJSON(object: Anomaly_BackupPlanSchedule): string {
+ switch (object) {
+ case Anomaly_BackupPlanSchedule.BACKUP_PLAN_SCHEDULE_UNSPECIFIED:
+ return "BACKUP_PLAN_SCHEDULE_UNSPECIFIED";
+ case Anomaly_BackupPlanSchedule.UNSET:
+ return "UNSET";
+ case Anomaly_BackupPlanSchedule.DAILY:
+ return "DAILY";
+ case Anomaly_BackupPlanSchedule.WEEKLY:
+ return "WEEKLY";
+ case Anomaly_BackupPlanSchedule.UNRECOGNIZED:
+ default:
+ return "UNRECOGNIZED";
+ }
+}
+
+/**
+ * Instance level anomaly detail.
+ *
+ * InstanceConnectionDetail is the detail for instance connection anomaly.
+ */
+export interface Anomaly_InstanceConnectionDetail {
+ /** detail is the detail of the instance connection failure. */
+ detail: string;
+}
+
+/**
+ * Database level anomaly detial.
+ *
+ * DatbaaseConnectionDetail is the detail for database connection anomaly.
+ */
+export interface Anomaly_DatabaseConnectionDetail {
+ /** detail is the detail of the database connection failure. */
+ detail: string;
+}
+
+/** DatabaseBackupPolicyViolationDetail is the detail for database backup policy violation anomaly. */
+export interface Anomaly_DatabaseBackupPolicyViolationDetail {
+ /**
+ * parent is the parent of the database.
+ * Format: environments/{environment}
+ */
+ parent: string;
+ /** expected_schedule is the expected backup plan schedule in the parent. */
+ expectedSchedule: Anomaly_BackupPlanSchedule;
+ /** actual_schedule is the actual backup plan schedule in the database. */
+ actualSchedule: Anomaly_BackupPlanSchedule;
+}
+
+/** DatabaseBackupMissingDetail is the detail for database backup missing anomaly. */
+export interface Anomaly_DatabaseBackupMissingDetail {
+ /** expected_schedule is the expected backup plan schedule in the database. */
+ expectedSchedule: Anomaly_BackupPlanSchedule;
+ /** lastest_backup_time is the last backup time in the database. */
+ lastestBackupTime?: Date;
+}
+
+/** DatabaseSchemaDriftDetail is the detail for database schema drift anomaly. */
+export interface Anomaly_DatabaseSchemaDriftDetail {
+ /** record_version is the record version of the database schema drift. */
+ recordVersion: string;
+ /** expected_schema is the expected schema in the database. */
+ expectedSchema: string;
+ /** actual_schema is the actual schema in the database. */
+ actualSchema: string;
+}
+
+function createBaseSearchAnomaliesRequest(): SearchAnomaliesRequest {
+ return { filter: "", pageSize: 0, pageToken: "" };
+}
+
+export const SearchAnomaliesRequest = {
+ encode(message: SearchAnomaliesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.filter !== "") {
+ writer.uint32(10).string(message.filter);
+ }
+ if (message.pageSize !== 0) {
+ writer.uint32(16).int32(message.pageSize);
+ }
+ if (message.pageToken !== "") {
+ writer.uint32(26).string(message.pageToken);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): SearchAnomaliesRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseSearchAnomaliesRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ message.filter = reader.string();
+ break;
+ case 2:
+ message.pageSize = reader.int32();
+ break;
+ case 3:
+ message.pageToken = reader.string();
+ break;
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ },
+
+ fromJSON(object: any): SearchAnomaliesRequest {
+ return {
+ filter: isSet(object.filter) ? String(object.filter) : "",
+ pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0,
+ pageToken: isSet(object.pageToken) ? String(object.pageToken) : "",
+ };
+ },
+
+ toJSON(message: SearchAnomaliesRequest): unknown {
+ const obj: any = {};
+ message.filter !== undefined && (obj.filter = message.filter);
+ message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize));
+ message.pageToken !== undefined && (obj.pageToken = message.pageToken);
+ return obj;
+ },
+
+ fromPartial(object: DeepPartial<SearchAnomaliesRequest>): SearchAnomaliesRequest {
+ const message = createBaseSearchAnomaliesRequest();
+ message.filter = object.filter ?? "";
+ message.pageSize = object.pageSize ?? 0;
+ message.pageToken = object.pageToken ?? "";
+ return message;
+ },
+};
+
+function createBaseSearchAnomaliesResponse(): SearchAnomaliesResponse {
+ return { anomalies: [], nextPageToken: "" };
+}
+
+export const SearchAnomaliesResponse = {
+ encode(message: SearchAnomaliesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.anomalies) {
+ Anomaly.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+ if (message.nextPageToken !== "") {
+ writer.uint32(18).string(message.nextPageToken);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): SearchAnomaliesResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseSearchAnomaliesResponse();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ message.anomalies.push(Anomaly.decode(reader, reader.uint32()));
+ break;
+ case 2:
+ message.nextPageToken = reader.string();
+ break;
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ },
+
+ fromJSON(object: any): SearchAnomaliesResponse {
+ return {
+ anomalies: Array.isArray(object?.anomalies) ? object.anomalies.map((e: any) => Anomaly.fromJSON(e)) : [],
+ nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "",
+ };
+ },
+
+ toJSON(message: SearchAnomaliesResponse): unknown {
+ const obj: any = {};
+ if (message.anomalies) {
+ obj.anomalies = message.anomalies.map((e) => e ? Anomaly.toJSON(e) : undefined);
+ } else {
+ obj.anomalies = [];
+ }
+ message.nextPageToken !== undefined && (obj.nextPageToken = message.nextPageToken);
+ return obj;
+ },
+
+ fromPartial(object: DeepPartial<SearchAnomaliesResponse>): SearchAnomaliesResponse {
+ const message = createBaseSearchAnomaliesResponse();
+ message.anomalies = object.anomalies?.map((e) => Anomaly.fromPartial(e)) || [];
+ message.nextPageToken = object.nextPageToken ?? "";
+ return message;
+ },
+};
+
+function createBaseAnomaly(): Anomaly {
+ return {
+ resource: "",
+ type: 0,
+ serverity: 0,
+ instanceConnectionDetail: undefined,
+ databaseConnectionDetail: undefined,
+ databaseBackupPolicyViolationDetail: undefined,
+ databaseBackupMissingDetail: undefined,
+ databaseSchemaDriftDetail: undefined,
+ };
+}
+
+export const Anomaly = {
+ encode(message: Anomaly, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.resource !== "") {
+ writer.uint32(10).string(message.resource);
+ }
+ if (message.type !== 0) {
+ writer.uint32(16).int32(message.type);
+ }
+ if (message.serverity !== 0) {
+ writer.uint32(24).int32(message.serverity);
+ }
+ if (message.instanceConnectionDetail !== undefined) {
+ Anomaly_InstanceConnectionDetail.encode(message.instanceConnectionDetail, writer.uint32(34).fork()).ldelim();
+ }
+ if (message.databaseConnectionDetail !== undefined) {
+ Anomaly_DatabaseConnectionDetail.encode(message.databaseConnectionDetail, writer.uint32(42).fork()).ldelim();
+ }
+ if (message.databaseBackupPolicyViolationDetail !== undefined) {
+ Anomaly_DatabaseBackupPolicyViolationDetail.encode(
+ message.databaseBackupPolicyViolationDetail,
+ writer.uint32(50).fork(),
+ ).ldelim();
+ }
+ if (message.databaseBackupMissingDetail !== undefined) {
+ Anomaly_DatabaseBackupMissingDetail.encode(message.databaseBackupMissingDetail, writer.uint32(58).fork())
+ .ldelim();
+ }
+ if (message.databaseSchemaDriftDetail !== undefined) {
+ Anomaly_DatabaseSchemaDriftDetail.encode(message.databaseSchemaDriftDetail, writer.uint32(66).fork()).ldelim();
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Anomaly {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAnomaly();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ message.resource = reader.string();
+ break;
+ case 2:
+ message.type = reader.int32() as any;
+ break;
+ case 3:
+ message.serverity = reader.int32() as any;
+ break;
+ case 4:
+ message.instanceConnectionDetail = Anomaly_InstanceConnectionDetail.decode(reader, reader.uint32());
+ break;
+ case 5:
+ message.databaseConnectionDetail = Anomaly_DatabaseConnectionDetail.decode(reader, reader.uint32());
+ break;
+ case 6:
+ message.databaseBackupPolicyViolationDetail = Anomaly_DatabaseBackupPolicyViolationDetail.decode(
+ reader,
+ reader.uint32(),
+ );
+ break;
+ case 7:
+ message.databaseBackupMissingDetail = Anomaly_DatabaseBackupMissingDetail.decode(reader, reader.uint32());
+ break;
+ case 8:
+ message.databaseSchemaDriftDetail = Anomaly_DatabaseSchemaDriftDetail.decode(reader, reader.uint32());
+ break;
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ },
+
+ fromJSON(object: any): Anomaly {
+ return {
+ resource: isSet(object.resource) ? String(object.resource) : "",
+ type: isSet(object.type) ? anomaly_AnomalyTypeFromJSON(object.type) : 0,
+ serverity: isSet(object.serverity) ? anomaly_AnomalyServerityFromJSON(object.serverity) : 0,
+ instanceConnectionDetail: isSet(object.instanceConnectionDetail)
+ ? Anomaly_InstanceConnectionDetail.fromJSON(object.instanceConnectionDetail)
+ : undefined,
+ databaseConnectionDetail: isSet(object.databaseConnectionDetail)
+ ? Anomaly_DatabaseConnectionDetail.fromJSON(object.databaseConnectionDetail)
+ : undefined,
+ databaseBackupPolicyViolationDetail: isSet(object.databaseBackupPolicyViolationDetail)
+ ? Anomaly_DatabaseBackupPolicyViolationDetail.fromJSON(object.databaseBackupPolicyViolationDetail)
+ : undefined,
+ databaseBackupMissingDetail: isSet(object.databaseBackupMissingDetail)
+ ? Anomaly_DatabaseBackupMissingDetail.fromJSON(object.databaseBackupMissingDetail)
+ : undefined,
+ databaseSchemaDriftDetail: isSet(object.databaseSchemaDriftDetail)
+ ? Anomaly_DatabaseSchemaDriftDetail.fromJSON(object.databaseSchemaDriftDetail)
+ : undefined,
+ };
+ },
+
+ toJSON(message: Anomaly): unknown {
+ const obj: any = {};
+ message.resource !== undefined && (obj.resource = message.resource);
+ message.type !== undefined && (obj.type = anomaly_AnomalyTypeToJSON(message.type));
+ message.serverity !== undefined && (obj.serverity = anomaly_AnomalyServerityToJSON(message.serverity));
+ message.instanceConnectionDetail !== undefined && (obj.instanceConnectionDetail = message.instanceConnectionDetail
+ ? Anomaly_InstanceConnectionDetail.toJSON(message.instanceConnectionDetail)
+ : undefined);
+ message.databaseConnectionDetail !== undefined && (obj.databaseConnectionDetail = message.databaseConnectionDetail
+ ? Anomaly_DatabaseConnectionDetail.toJSON(message.databaseConnectionDetail)
+ : undefined);
+ message.databaseBackupPolicyViolationDetail !== undefined &&
+ (obj.databaseBackupPolicyViolationDetail = message.databaseBackupPolicyViolationDetail
+ ? Anomaly_DatabaseBackupPolicyViolationDetail.toJSON(message.databaseBackupPolicyViolationDetail)
+ : undefined);
+ message.databaseBackupMissingDetail !== undefined &&
+ (obj.databaseBackupMissingDetail = message.databaseBackupMissingDetail
+ ? Anomaly_DatabaseBackupMissingDetail.toJSON(message.databaseBackupMissingDetail)
+ : undefined);
+ message.databaseSchemaDriftDetail !== undefined &&
+ (obj.databaseSchemaDriftDetail = message.databaseSchemaDriftDetail
+ ? Anomaly_DatabaseSchemaDriftDetail.toJSON(message.databaseSchemaDriftDetail)
+ : undefined);
+ return obj;
+ },
+
+ fromPartial(object: DeepPartial<Anomaly>): Anomaly {
+ const message = createBaseAnomaly();
+ message.resource = object.resource ?? "";
+ message.type = object.type ?? 0;
+ message.serverity = object.serverity ?? 0;
+ message.instanceConnectionDetail =
+ (object.instanceConnectionDetail !== undefined && object.instanceConnectionDetail !== null)
+ ? Anomaly_InstanceConnectionDetail.fromPartial(object.instanceConnectionDetail)
+ : undefined;
+ message.databaseConnectionDetail =
+ (object.databaseConnectionDetail !== undefined && object.databaseConnectionDetail !== null)
+ ? Anomaly_DatabaseConnectionDetail.fromPartial(object.databaseConnectionDetail)
+ : undefined;
+ message.databaseBackupPolicyViolationDetail =
+ (object.databaseBackupPolicyViolationDetail !== undefined && object.databaseBackupPolicyViolationDetail !== null)
+ ? Anomaly_DatabaseBackupPolicyViolationDetail.fromPartial(object.databaseBackupPolicyViolationDetail)
+ : undefined;
+ message.databaseBackupMissingDetail =
+ (object.databaseBackupMissingDetail !== undefined && object.databaseBackupMissingDetail !== null)
+ ? Anomaly_DatabaseBackupMissingDetail.fromPartial(object.databaseBackupMissingDetail)
+ : undefined;
+ message.databaseSchemaDriftDetail =
+ (object.databaseSchemaDriftDetail !== undefined && object.databaseSchemaDriftDetail !== null)
+ ? Anomaly_DatabaseSchemaDriftDetail.fromPartial(object.databaseSchemaDriftDetail)
+ : undefined;
+ return message;
+ },
+};
+
+function createBaseAnomaly_InstanceConnectionDetail(): Anomaly_InstanceConnectionDetail {
+ return { detail: "" };
+}
+
+export const Anomaly_InstanceConnectionDetail = {
+ encode(message: Anomaly_InstanceConnectionDetail, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.detail !== "") {
+ writer.uint32(10).string(message.detail);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Anomaly_InstanceConnectionDetail {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAnomaly_InstanceConnectionDetail();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ message.detail = reader.string();
+ break;
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ },
+
+ fromJSON(object: any): Anomaly_InstanceConnectionDetail {
+ return { detail: isSet(object.detail) ? String(object.detail) : "" };
+ },
+
+ toJSON(message: Anomaly_InstanceConnectionDetail): unknown {
+ const obj: any = {};
+ message.detail !== undefined && (obj.detail = message.detail);
+ return obj;
+ },
+
+ fromPartial(object: DeepPartial<Anomaly_InstanceConnectionDetail>): Anomaly_InstanceConnectionDetail {
+ const message = createBaseAnomaly_InstanceConnectionDetail();
+ message.detail = object.detail ?? "";
+ return message;
+ },
+};
+
+function createBaseAnomaly_DatabaseConnectionDetail(): Anomaly_DatabaseConnectionDetail {
+ return { detail: "" };
+}
+
+export const Anomaly_DatabaseConnectionDetail = {
+ encode(message: Anomaly_DatabaseConnectionDetail, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.detail !== "") {
+ writer.uint32(10).string(message.detail);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Anomaly_DatabaseConnectionDetail {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAnomaly_DatabaseConnectionDetail();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ message.detail = reader.string();
+ break;
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ },
+
+ fromJSON(object: any): Anomaly_DatabaseConnectionDetail {
+ return { detail: isSet(object.detail) ? String(object.detail) : "" };
+ },
+
+ toJSON(message: Anomaly_DatabaseConnectionDetail): unknown {
+ const obj: any = {};
+ message.detail !== undefined && (obj.detail = message.detail);
+ return obj;
+ },
+
+ fromPartial(object: DeepPartial<Anomaly_DatabaseConnectionDetail>): Anomaly_DatabaseConnectionDetail {
+ const message = createBaseAnomaly_DatabaseConnectionDetail();
+ message.detail = object.detail ?? "";
+ return message;
+ },
+};
+
+function createBaseAnomaly_DatabaseBackupPolicyViolationDetail(): Anomaly_DatabaseBackupPolicyViolationDetail {
+ return { parent: "", expectedSchedule: 0, actualSchedule: 0 };
+}
+
+export const Anomaly_DatabaseBackupPolicyViolationDetail = {
+ encode(message: Anomaly_DatabaseBackupPolicyViolationDetail, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.parent !== "") {
+ writer.uint32(10).string(message.parent);
+ }
+ if (message.expectedSchedule !== 0) {
+ writer.uint32(16).int32(message.expectedSchedule);
+ }
+ if (message.actualSchedule !== 0) {
+ writer.uint32(24).int32(message.actualSchedule);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Anomaly_DatabaseBackupPolicyViolationDetail {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAnomaly_DatabaseBackupPolicyViolationDetail();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ message.parent = reader.string();
+ break;
+ case 2:
+ message.expectedSchedule = reader.int32() as any;
+ break;
+ case 3:
+ message.actualSchedule = reader.int32() as any;
+ break;
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ },
+
+ fromJSON(object: any): Anomaly_DatabaseBackupPolicyViolationDetail {
+ return {
+ parent: isSet(object.parent) ? String(object.parent) : "",
+ expectedSchedule: isSet(object.expectedSchedule)
+ ? anomaly_BackupPlanScheduleFromJSON(object.expectedSchedule)
+ : 0,
+ actualSchedule: isSet(object.actualSchedule) ? anomaly_BackupPlanScheduleFromJSON(object.actualSchedule) : 0,
+ };
+ },
+
+ toJSON(message: Anomaly_DatabaseBackupPolicyViolationDetail): unknown {
+ const obj: any = {};
+ message.parent !== undefined && (obj.parent = message.parent);
+ message.expectedSchedule !== undefined &&
+ (obj.expectedSchedule = anomaly_BackupPlanScheduleToJSON(message.expectedSchedule));
+ message.actualSchedule !== undefined &&
+ (obj.actualSchedule = anomaly_BackupPlanScheduleToJSON(message.actualSchedule));
+ return obj;
+ },
+
+ fromPartial(
+ object: DeepPartial<Anomaly_DatabaseBackupPolicyViolationDetail>,
+ ): Anomaly_DatabaseBackupPolicyViolationDetail {
+ const message = createBaseAnomaly_DatabaseBackupPolicyViolationDetail();
+ message.parent = object.parent ?? "";
+ message.expectedSchedule = object.expectedSchedule ?? 0;
+ message.actualSchedule = object.actualSchedule ?? 0;
+ return message;
+ },
+};
+
+function createBaseAnomaly_DatabaseBackupMissingDetail(): Anomaly_DatabaseBackupMissingDetail {
+ return { expectedSchedule: 0, lastestBackupTime: undefined };
+}
+
+export const Anomaly_DatabaseBackupMissingDetail = {
+ encode(message: Anomaly_DatabaseBackupMissingDetail, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.expectedSchedule !== 0) {
+ writer.uint32(8).int32(message.expectedSchedule);
+ }
+ if (message.lastestBackupTime !== undefined) {
+ Timestamp.encode(toTimestamp(message.lastestBackupTime), writer.uint32(18).fork()).ldelim();
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Anomaly_DatabaseBackupMissingDetail {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAnomaly_DatabaseBackupMissingDetail();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ message.expectedSchedule = reader.int32() as any;
+ break;
+ case 2:
+ message.lastestBackupTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ break;
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ },
+
+ fromJSON(object: any): Anomaly_DatabaseBackupMissingDetail {
+ return {
+ expectedSchedule: isSet(object.expectedSchedule)
+ ? anomaly_BackupPlanScheduleFromJSON(object.expectedSchedule)
+ : 0,
+ lastestBackupTime: isSet(object.lastestBackupTime) ? fromJsonTimestamp(object.lastestBackupTime) : undefined,
+ };
+ },
+
+ toJSON(message: Anomaly_DatabaseBackupMissingDetail): unknown {
+ const obj: any = {};
+ message.expectedSchedule !== undefined &&
+ (obj.expectedSchedule = anomaly_BackupPlanScheduleToJSON(message.expectedSchedule));
+ message.lastestBackupTime !== undefined && (obj.lastestBackupTime = message.lastestBackupTime.toISOString());
+ return obj;
+ },
+
+ fromPartial(object: DeepPartial<Anomaly_DatabaseBackupMissingDetail>): Anomaly_DatabaseBackupMissingDetail {
+ const message = createBaseAnomaly_DatabaseBackupMissingDetail();
+ message.expectedSchedule = object.expectedSchedule ?? 0;
+ message.lastestBackupTime = object.lastestBackupTime ?? undefined;
+ return message;
+ },
+};
+
+function createBaseAnomaly_DatabaseSchemaDriftDetail(): Anomaly_DatabaseSchemaDriftDetail {
+ return { recordVersion: "", expectedSchema: "", actualSchema: "" };
+}
+
+export const Anomaly_DatabaseSchemaDriftDetail = {
+ encode(message: Anomaly_DatabaseSchemaDriftDetail, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.recordVersion !== "") {
+ writer.uint32(10).string(message.recordVersion);
+ }
+ if (message.expectedSchema !== "") {
+ writer.uint32(18).string(message.expectedSchema);
+ }
+ if (message.actualSchema !== "") {
+ writer.uint32(26).string(message.actualSchema);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Anomaly_DatabaseSchemaDriftDetail {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAnomaly_DatabaseSchemaDriftDetail();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ message.recordVersion = reader.string();
+ break;
+ case 2:
+ message.expectedSchema = reader.string();
+ break;
+ case 3:
+ message.actualSchema = reader.string();
+ break;
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ },
+
+ fromJSON(object: any): Anomaly_DatabaseSchemaDriftDetail {
+ return {
+ recordVersion: isSet(object.recordVersion) ? String(object.recordVersion) : "",
+ expectedSchema: isSet(object.expectedSchema) ? String(object.expectedSchema) : "",
+ actualSchema: isSet(object.actualSchema) ? String(object.actualSchema) : "",
+ };
+ },
+
+ toJSON(message: Anomaly_DatabaseSchemaDriftDetail): unknown {
+ const obj: any = {};
+ message.recordVersion !== undefined && (obj.recordVersion = message.recordVersion);
+ message.expectedSchema !== undefined && (obj.expectedSchema = message.expectedSchema);
+ message.actualSchema !== undefined && (obj.actualSchema = message.actualSchema);
+ return obj;
+ },
+
+ fromPartial(object: DeepPartial<Anomaly_DatabaseSchemaDriftDetail>): Anomaly_DatabaseSchemaDriftDetail {
+ const message = createBaseAnomaly_DatabaseSchemaDriftDetail();
+ message.recordVersion = object.recordVersion ?? "";
+ message.expectedSchema = object.expectedSchema ?? "";
+ message.actualSchema = object.actualSchema ?? "";
+ return message;
+ },
+};
+
+export type AnomalyServiceDefinition = typeof AnomalyServiceDefinition;
+export const AnomalyServiceDefinition = {
+ name: "AnomalyService",
+ fullName: "bytebase.v1.AnomalyService",
+ methods: {
+ searchAnomalies: {
+ name: "SearchAnomalies",
+ requestType: SearchAnomaliesRequest,
+ requestStream: false,
+ responseType: SearchAnomaliesResponse,
+ responseStream: false,
+ options: {},
+ },
+ },
+} as const;
+
+export interface AnomalyServiceImplementation<CallContextExt = {}> {
+ searchAnomalies(
+ request: SearchAnomaliesRequest,
+ context: CallContext & CallContextExt,
+ ): Promise<DeepPartial<SearchAnomaliesResponse>>;
+}
+
+export interface AnomalyServiceClient<CallOptionsExt = {}> {
+ searchAnomalies(
+ request: DeepPartial<SearchAnomaliesRequest>,
+ options?: CallOptions & CallOptionsExt,
+ ): Promise<SearchAnomaliesResponse>;
+}
+
+type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
+
+export type DeepPartial<T> = T extends Builtin ? T
+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
+ : Partial<T>;
+
+function toTimestamp(date: Date): Timestamp {
+ const seconds = date.getTime() / 1_000;
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
+ return { seconds, nanos };
+}
+
+function fromTimestamp(t: Timestamp): Date {
+ let millis = t.seconds * 1_000;
+ millis += t.nanos / 1_000_000;
+ return new Date(millis);
+}
+
+function fromJsonTimestamp(o: any): Date {
+ if (o instanceof Date) {
+ return o;
+ } else if (typeof o === "string") {
+ return new Date(o);
+ } else {
+ return fromTimestamp(Timestamp.fromJSON(o));
+ }
+}
+
+function isSet(value: any): boolean {
+ return value !== null && value !== undefined;
+}
diff --git a/proto/generated-go/v1/anomaly_service.pb.go b/proto/generated-go/v1/anomaly_service.pb.go
new file mode 100644
index 0000000000..1d9feb988b
--- /dev/null
+++ b/proto/generated-go/v1/anomaly_service.pb.go
@@ -0,0 +1,1141 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.28.1
+// protoc (unknown)
+// source: v1/anomaly_service.proto
+
+package v1
+
+import (
+ _ "google.golang.org/genproto/googleapis/api/annotations"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ _ "google.golang.org/protobuf/types/known/fieldmaskpb"
+ timestamppb "google.golang.org/protobuf/types/known/timestamppb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// AnomalyType is the type of the anomaly.
+type Anomaly_AnomalyType int32
+
+const (
+ // Unspecified anomaly type.
+ Anomaly_ANOMALY_TYPE_UNSPECIFIED Anomaly_AnomalyType = 0
+ // Instance level anomaly.
+ //
+ // INSTANCE_CONNECTION is the anomaly type for instance connection, e.g. the instance is down.
+ Anomaly_INSTANCE_CONNECTION Anomaly_AnomalyType = 1
+ // MIGRATION_SCHEMA is the anomaly type for migration schema, e.g. the migration schema in the instance is missing.
+ Anomaly_MIGRATION_SCHEMA Anomaly_AnomalyType = 2
+ // Database level anomaly.
+ //
+ // DATABASE_BACKUP_POLICY_VIOLATION is the anomaly type for database backup policy violation,
+ // e.g. the database backup policy is not meet the environment backup policy.
+ Anomaly_DATABASE_BACKUP_POLICY_VIOLATION Anomaly_AnomalyType = 3
+ // DATABASE_BACKUP_MISSING is the anomaly type for the backup missing, e.g. the backup is missing.
+ Anomaly_DATABASE_BACKUP_MISSING Anomaly_AnomalyType = 4
+ // DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted.
+ Anomaly_DATABASE_CONNECTION Anomaly_AnomalyType = 5
+ // DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift,
+ // e.g. the database schema had been changed without bytebase migration.
+ Anomaly_DATABASE_SCHEMA_DRIFT Anomaly_AnomalyType = 6
+)
+
+// Enum value maps for Anomaly_AnomalyType.
+var (
+ Anomaly_AnomalyType_name = map[int32]string{
+ 0: "ANOMALY_TYPE_UNSPECIFIED",
+ 1: "INSTANCE_CONNECTION",
+ 2: "MIGRATION_SCHEMA",
+ 3: "DATABASE_BACKUP_POLICY_VIOLATION",
+ 4: "DATABASE_BACKUP_MISSING",
+ 5: "DATABASE_CONNECTION",
+ 6: "DATABASE_SCHEMA_DRIFT",
+ }
+ Anomaly_AnomalyType_value = map[string]int32{
+ "ANOMALY_TYPE_UNSPECIFIED": 0,
+ "INSTANCE_CONNECTION": 1,
+ "MIGRATION_SCHEMA": 2,
+ "DATABASE_BACKUP_POLICY_VIOLATION": 3,
+ "DATABASE_BACKUP_MISSING": 4,
+ "DATABASE_CONNECTION": 5,
+ "DATABASE_SCHEMA_DRIFT": 6,
+ }
+)
+
+func (x Anomaly_AnomalyType) Enum() *Anomaly_AnomalyType {
+ p := new(Anomaly_AnomalyType)
+ *p = x
+ return p
+}
+
+func (x Anomaly_AnomalyType) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Anomaly_AnomalyType) Descriptor() protoreflect.EnumDescriptor {
+ return file_v1_anomaly_service_proto_enumTypes[0].Descriptor()
+}
+
+func (Anomaly_AnomalyType) Type() protoreflect.EnumType {
+ return &file_v1_anomaly_service_proto_enumTypes[0]
+}
+
+func (x Anomaly_AnomalyType) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use Anomaly_AnomalyType.Descriptor instead.
+func (Anomaly_AnomalyType) EnumDescriptor() ([]byte, []int) {
+ return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 0}
+}
+
+// AnomalyServerity is the severity of the anomaly.
+type Anomaly_AnomalyServerity int32
+
+const (
+ // Unspecified anomaly serverity.
+ Anomaly_ANOMALY_SERVERITY_UNSPECIFIED Anomaly_AnomalyServerity = 0
+ // MEDIUM is the info level anomaly serverity.
+ Anomaly_MEDIUM Anomaly_AnomalyServerity = 1
+ // HIGH is the warning level anomaly serverity.
+ Anomaly_HIGH Anomaly_AnomalyServerity = 2
+ // CRITICAL is the critical level anomaly serverity.
+ Anomaly_CRITICAL Anomaly_AnomalyServerity = 3
+)
+
+// Enum value maps for Anomaly_AnomalyServerity.
+var (
+ Anomaly_AnomalyServerity_name = map[int32]string{
+ 0: "ANOMALY_SERVERITY_UNSPECIFIED",
+ 1: "MEDIUM",
+ 2: "HIGH",
+ 3: "CRITICAL",
+ }
+ Anomaly_AnomalyServerity_value = map[string]int32{
+ "ANOMALY_SERVERITY_UNSPECIFIED": 0,
+ "MEDIUM": 1,
+ "HIGH": 2,
+ "CRITICAL": 3,
+ }
+)
+
+func (x Anomaly_AnomalyServerity) Enum() *Anomaly_AnomalyServerity {
+ p := new(Anomaly_AnomalyServerity)
+ *p = x
+ return p
+}
+
+func (x Anomaly_AnomalyServerity) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Anomaly_AnomalyServerity) Descriptor() protoreflect.EnumDescriptor {
+ return file_v1_anomaly_service_proto_enumTypes[1].Descriptor()
+}
+
+func (Anomaly_AnomalyServerity) Type() protoreflect.EnumType {
+ return &file_v1_anomaly_service_proto_enumTypes[1]
+}
+
+func (x Anomaly_AnomalyServerity) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use Anomaly_AnomalyServerity.Descriptor instead.
+func (Anomaly_AnomalyServerity) EnumDescriptor() ([]byte, []int) {
+ return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 1}
+}
+
+// BackupPlanSchedule is the backup plan schedule.
+type Anomaly_BackupPlanSchedule int32
+
+const (
+ // Unspecified backup plan schedule.
+ Anomaly_BACKUP_PLAN_SCHEDULE_UNSPECIFIED Anomaly_BackupPlanSchedule = 0
+ // UNSET is the unset backup plan schedule.
+ Anomaly_UNSET Anomaly_BackupPlanSchedule = 1
+ // DAILY is the daily backup plan schedule.
+ Anomaly_DAILY Anomaly_BackupPlanSchedule = 2
+ // WEEKLY is the weekly backup plan schedule.
+ Anomaly_WEEKLY Anomaly_BackupPlanSchedule = 3
+)
+
+// Enum value maps for Anomaly_BackupPlanSchedule.
+var (
+ Anomaly_BackupPlanSchedule_name = map[int32]string{
+ 0: "BACKUP_PLAN_SCHEDULE_UNSPECIFIED",
+ 1: "UNSET",
+ 2: "DAILY",
+ 3: "WEEKLY",
+ }
+ Anomaly_BackupPlanSchedule_value = map[string]int32{
+ "BACKUP_PLAN_SCHEDULE_UNSPECIFIED": 0,
+ "UNSET": 1,
+ "DAILY": 2,
+ "WEEKLY": 3,
+ }
+)
+
+func (x Anomaly_BackupPlanSchedule) Enum() *Anomaly_BackupPlanSchedule {
+ p := new(Anomaly_BackupPlanSchedule)
+ *p = x
+ return p
+}
+
+func (x Anomaly_BackupPlanSchedule) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Anomaly_BackupPlanSchedule) Descriptor() protoreflect.EnumDescriptor {
+ return file_v1_anomaly_service_proto_enumTypes[2].Descriptor()
+}
+
+func (Anomaly_BackupPlanSchedule) Type() protoreflect.EnumType {
+ return &file_v1_anomaly_service_proto_enumTypes[2]
+}
+
+func (x Anomaly_BackupPlanSchedule) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use Anomaly_BackupPlanSchedule.Descriptor instead.
+func (Anomaly_BackupPlanSchedule) EnumDescriptor() ([]byte, []int) {
+ return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 2}
+}
+
+type SearchAnomaliesRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // filter is the filter to apply on the search anomaly request,
+ // follow the [google cel-spec](https://github.com/google/cel-spec) syntax.
+ // For example:
+ // Search the anomalies of a specific resource: 'anomaly.resource_name="environments/{environemnt}/instances/{instance}"'
+ // Search the specified type of anomalies: 'anomaly.type="DATABASE_BACKUP_POLICY_VIOLATION"'
+ Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`
+ // Not used. The maximum number of anomalies to return. The service may return fewer than
+ // this value.
+ // If unspecified, at most 50 anomalies will be returned.
+ // The maximum value is 1000; values above 1000 will be coerced to 1000.
+ PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
+ // Not used. A page token, received from a previous `SearchAnomalies` call.
+ // Provide this to retrieve the subsequent page.
+ //
+ // When paginating, all other parameters provided to `SearchAnomalies` must match
+ // the call that provided the page token.
+ PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
+}
+
+func (x *SearchAnomaliesRequest) Reset() {
+ *x = SearchAnomaliesRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_anomaly_service_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SearchAnomaliesRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SearchAnomaliesRequest) ProtoMessage() {}
+
+func (x *SearchAnomaliesRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_anomaly_service_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SearchAnomaliesRequest.ProtoReflect.Descriptor instead.
+func (*SearchAnomaliesRequest) Descriptor() ([]byte, []int) {
+ return file_v1_anomaly_service_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *SearchAnomaliesRequest) GetFilter() string {
+ if x != nil {
+ return x.Filter
+ }
+ return ""
+}
+
+func (x *SearchAnomaliesRequest) GetPageSize() int32 {
+ if x != nil {
+ return x.PageSize
+ }
+ return 0
+}
+
+func (x *SearchAnomaliesRequest) GetPageToken() string {
+ if x != nil {
+ return x.PageToken
+ }
+ return ""
+}
+
+type SearchAnomaliesResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // anomalies is the list of anomalies.
+ Anomalies []*Anomaly `protobuf:"bytes,1,rep,name=anomalies,proto3" json:"anomalies,omitempty"`
+ // Not used. A token, which can be sent as `page_token` to retrieve the next page.
+ // If this field is omitted, there are no subsequent pages.
+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
+}
+
+func (x *SearchAnomaliesResponse) Reset() {
+ *x = SearchAnomaliesResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_anomaly_service_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SearchAnomaliesResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SearchAnomaliesResponse) ProtoMessage() {}
+
+func (x *SearchAnomaliesResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_anomaly_service_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SearchAnomaliesResponse.ProtoReflect.Descriptor instead.
+func (*SearchAnomaliesResponse) Descriptor() ([]byte, []int) {
+ return file_v1_anomaly_service_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *SearchAnomaliesResponse) GetAnomalies() []*Anomaly {
+ if x != nil {
+ return x.Anomalies
+ }
+ return nil
+}
+
+func (x *SearchAnomaliesResponse) GetNextPageToken() string {
+ if x != nil {
+ return x.NextPageToken
+ }
+ return ""
+}
+
+type Anomaly struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The resource that is the target of the operation.
+ // Format:
+ // - Instance: environments/{environment}/instnaces/{instance}
+ // - Database: environments/{environment}/instnaces/{instance}/databases/{database}
+ Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"`
+ // type is the type of the anomaly.
+ Type Anomaly_AnomalyType `protobuf:"varint,2,opt,name=type,proto3,enum=bytebase.v1.Anomaly_AnomalyType" json:"type,omitempty"`
+ // serverity is the serverity of the anomaly.
+ Serverity Anomaly_AnomalyServerity `protobuf:"varint,3,opt,name=serverity,proto3,enum=bytebase.v1.Anomaly_AnomalyServerity" json:"serverity,omitempty"`
+ // detail is the detail of the anomaly.
+ //
+ // Types that are assignable to Detail:
+ //
+ // *Anomaly_InstanceConnectionDetail_
+ // *Anomaly_DatabaseConnectionDetail_
+ // *Anomaly_DatabaseBackupPolicyViolationDetail_
+ // *Anomaly_DatabaseBackupMissingDetail_
+ // *Anomaly_DatabaseSchemaDriftDetail_
+ Detail isAnomaly_Detail `protobuf_oneof:"detail"`
+}
+
+func (x *Anomaly) Reset() {
+ *x = Anomaly{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_anomaly_service_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Anomaly) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Anomaly) ProtoMessage() {}
+
+func (x *Anomaly) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_anomaly_service_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Anomaly.ProtoReflect.Descriptor instead.
+func (*Anomaly) Descriptor() ([]byte, []int) {
+ return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *Anomaly) GetResource() string {
+ if x != nil {
+ return x.Resource
+ }
+ return ""
+}
+
+func (x *Anomaly) GetType() Anomaly_AnomalyType {
+ if x != nil {
+ return x.Type
+ }
+ return Anomaly_ANOMALY_TYPE_UNSPECIFIED
+}
+
+func (x *Anomaly) GetServerity() Anomaly_AnomalyServerity {
+ if x != nil {
+ return x.Serverity
+ }
+ return Anomaly_ANOMALY_SERVERITY_UNSPECIFIED
+}
+
+func (m *Anomaly) GetDetail() isAnomaly_Detail {
+ if m != nil {
+ return m.Detail
+ }
+ return nil
+}
+
+func (x *Anomaly) GetInstanceConnectionDetail() *Anomaly_InstanceConnectionDetail {
+ if x, ok := x.GetDetail().(*Anomaly_InstanceConnectionDetail_); ok {
+ return x.InstanceConnectionDetail
+ }
+ return nil
+}
+
+func (x *Anomaly) GetDatabaseConnectionDetail() *Anomaly_DatabaseConnectionDetail {
+ if x, ok := x.GetDetail().(*Anomaly_DatabaseConnectionDetail_); ok {
+ return x.DatabaseConnectionDetail
+ }
+ return nil
+}
+
+func (x *Anomaly) GetDatabaseBackupPolicyViolationDetail() *Anomaly_DatabaseBackupPolicyViolationDetail {
+ if x, ok := x.GetDetail().(*Anomaly_DatabaseBackupPolicyViolationDetail_); ok {
+ return x.DatabaseBackupPolicyViolationDetail
+ }
+ return nil
+}
+
+func (x *Anomaly) GetDatabaseBackupMissingDetail() *Anomaly_DatabaseBackupMissingDetail {
+ if x, ok := x.GetDetail().(*Anomaly_DatabaseBackupMissingDetail_); ok {
+ return x.DatabaseBackupMissingDetail
+ }
+ return nil
+}
+
+func (x *Anomaly) GetDatabaseSchemaDriftDetail() *Anomaly_DatabaseSchemaDriftDetail {
+ if x, ok := x.GetDetail().(*Anomaly_DatabaseSchemaDriftDetail_); ok {
+ return x.DatabaseSchemaDriftDetail
+ }
+ return nil
+}
+
+type isAnomaly_Detail interface {
+ isAnomaly_Detail()
+}
+
+type Anomaly_InstanceConnectionDetail_ struct {
+ InstanceConnectionDetail *Anomaly_InstanceConnectionDetail `protobuf:"bytes,4,opt,name=instance_connection_detail,json=instanceConnectionDetail,proto3,oneof"`
+}
+
+type Anomaly_DatabaseConnectionDetail_ struct {
+ DatabaseConnectionDetail *Anomaly_DatabaseConnectionDetail `protobuf:"bytes,5,opt,name=database_connection_detail,json=databaseConnectionDetail,proto3,oneof"`
+}
+
+type Anomaly_DatabaseBackupPolicyViolationDetail_ struct {
+ DatabaseBackupPolicyViolationDetail *Anomaly_DatabaseBackupPolicyViolationDetail `protobuf:"bytes,6,opt,name=database_backup_policy_violation_detail,json=databaseBackupPolicyViolationDetail,proto3,oneof"`
+}
+
+type Anomaly_DatabaseBackupMissingDetail_ struct {
+ DatabaseBackupMissingDetail *Anomaly_DatabaseBackupMissingDetail `protobuf:"bytes,7,opt,name=database_backup_missing_detail,json=databaseBackupMissingDetail,proto3,oneof"`
+}
+
+type Anomaly_DatabaseSchemaDriftDetail_ struct {
+ DatabaseSchemaDriftDetail *Anomaly_DatabaseSchemaDriftDetail `protobuf:"bytes,8,opt,name=database_schema_drift_detail,json=databaseSchemaDriftDetail,proto3,oneof"`
+}
+
+func (*Anomaly_InstanceConnectionDetail_) isAnomaly_Detail() {}
+
+func (*Anomaly_DatabaseConnectionDetail_) isAnomaly_Detail() {}
+
+func (*Anomaly_DatabaseBackupPolicyViolationDetail_) isAnomaly_Detail() {}
+
+func (*Anomaly_DatabaseBackupMissingDetail_) isAnomaly_Detail() {}
+
+func (*Anomaly_DatabaseSchemaDriftDetail_) isAnomaly_Detail() {}
+
+// Instance level anomaly detail.
+//
+// InstanceConnectionDetail is the detail for instance connection anomaly.
+type Anomaly_InstanceConnectionDetail struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // detail is the detail of the instance connection failure.
+ Detail string `protobuf:"bytes,1,opt,name=detail,proto3" json:"detail,omitempty"`
+}
+
+func (x *Anomaly_InstanceConnectionDetail) Reset() {
+ *x = Anomaly_InstanceConnectionDetail{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_anomaly_service_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Anomaly_InstanceConnectionDetail) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Anomaly_InstanceConnectionDetail) ProtoMessage() {}
+
+func (x *Anomaly_InstanceConnectionDetail) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_anomaly_service_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Anomaly_InstanceConnectionDetail.ProtoReflect.Descriptor instead.
+func (*Anomaly_InstanceConnectionDetail) Descriptor() ([]byte, []int) {
+ return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 0}
+}
+
+func (x *Anomaly_InstanceConnectionDetail) GetDetail() string {
+ if x != nil {
+ return x.Detail
+ }
+ return ""
+}
+
+// Database level anomaly detial.
+//
+// DatbaaseConnectionDetail is the detail for database connection anomaly.
+type Anomaly_DatabaseConnectionDetail struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // detail is the detail of the database connection failure.
+ Detail string `protobuf:"bytes,1,opt,name=detail,proto3" json:"detail,omitempty"`
+}
+
+func (x *Anomaly_DatabaseConnectionDetail) Reset() {
+ *x = Anomaly_DatabaseConnectionDetail{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_anomaly_service_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Anomaly_DatabaseConnectionDetail) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Anomaly_DatabaseConnectionDetail) ProtoMessage() {}
+
+func (x *Anomaly_DatabaseConnectionDetail) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_anomaly_service_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Anomaly_DatabaseConnectionDetail.ProtoReflect.Descriptor instead.
+func (*Anomaly_DatabaseConnectionDetail) Descriptor() ([]byte, []int) {
+ return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 1}
+}
+
+func (x *Anomaly_DatabaseConnectionDetail) GetDetail() string {
+ if x != nil {
+ return x.Detail
+ }
+ return ""
+}
+
+// DatabaseBackupPolicyViolationDetail is the detail for database backup policy violation anomaly.
+type Anomaly_DatabaseBackupPolicyViolationDetail struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // parent is the parent of the database.
+ // Format: environments/{environment}
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ // expected_schedule is the expected backup plan schedule in the parent.
+ ExpectedSchedule Anomaly_BackupPlanSchedule `protobuf:"varint,2,opt,name=expected_schedule,json=expectedSchedule,proto3,enum=bytebase.v1.Anomaly_BackupPlanSchedule" json:"expected_schedule,omitempty"`
+ // actual_schedule is the actual backup plan schedule in the database.
+ ActualSchedule Anomaly_BackupPlanSchedule `protobuf:"varint,3,opt,name=actual_schedule,json=actualSchedule,proto3,enum=bytebase.v1.Anomaly_BackupPlanSchedule" json:"actual_schedule,omitempty"`
+}
+
+func (x *Anomaly_DatabaseBackupPolicyViolationDetail) Reset() {
+ *x = Anomaly_DatabaseBackupPolicyViolationDetail{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_anomaly_service_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Anomaly_DatabaseBackupPolicyViolationDetail) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Anomaly_DatabaseBackupPolicyViolationDetail) ProtoMessage() {}
+
+func (x *Anomaly_DatabaseBackupPolicyViolationDetail) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_anomaly_service_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Anomaly_DatabaseBackupPolicyViolationDetail.ProtoReflect.Descriptor instead.
+func (*Anomaly_DatabaseBackupPolicyViolationDetail) Descriptor() ([]byte, []int) {
+ return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 2}
+}
+
+func (x *Anomaly_DatabaseBackupPolicyViolationDetail) GetParent() string {
+ if x != nil {
+ return x.Parent
+ }
+ return ""
+}
+
+func (x *Anomaly_DatabaseBackupPolicyViolationDetail) GetExpectedSchedule() Anomaly_BackupPlanSchedule {
+ if x != nil {
+ return x.ExpectedSchedule
+ }
+ return Anomaly_BACKUP_PLAN_SCHEDULE_UNSPECIFIED
+}
+
+func (x *Anomaly_DatabaseBackupPolicyViolationDetail) GetActualSchedule() Anomaly_BackupPlanSchedule {
+ if x != nil {
+ return x.ActualSchedule
+ }
+ return Anomaly_BACKUP_PLAN_SCHEDULE_UNSPECIFIED
+}
+
+// DatabaseBackupMissingDetail is the detail for database backup missing anomaly.
+type Anomaly_DatabaseBackupMissingDetail struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // expected_schedule is the expected backup plan schedule in the database.
+ ExpectedSchedule Anomaly_BackupPlanSchedule `protobuf:"varint,1,opt,name=expected_schedule,json=expectedSchedule,proto3,enum=bytebase.v1.Anomaly_BackupPlanSchedule" json:"expected_schedule,omitempty"`
+ // lastest_backup_time is the last backup time in the database.
+ LastestBackupTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=lastest_backup_time,json=lastestBackupTime,proto3" json:"lastest_backup_time,omitempty"`
+}
+
+func (x *Anomaly_DatabaseBackupMissingDetail) Reset() {
+ *x = Anomaly_DatabaseBackupMissingDetail{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_anomaly_service_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Anomaly_DatabaseBackupMissingDetail) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Anomaly_DatabaseBackupMissingDetail) ProtoMessage() {}
+
+func (x *Anomaly_DatabaseBackupMissingDetail) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_anomaly_service_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Anomaly_DatabaseBackupMissingDetail.ProtoReflect.Descriptor instead.
+func (*Anomaly_DatabaseBackupMissingDetail) Descriptor() ([]byte, []int) {
+ return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 3}
+}
+
+func (x *Anomaly_DatabaseBackupMissingDetail) GetExpectedSchedule() Anomaly_BackupPlanSchedule {
+ if x != nil {
+ return x.ExpectedSchedule
+ }
+ return Anomaly_BACKUP_PLAN_SCHEDULE_UNSPECIFIED
+}
+
+func (x *Anomaly_DatabaseBackupMissingDetail) GetLastestBackupTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.LastestBackupTime
+ }
+ return nil
+}
+
+// DatabaseSchemaDriftDetail is the detail for database schema drift anomaly.
+type Anomaly_DatabaseSchemaDriftDetail struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // record_version is the record version of the database schema drift.
+ RecordVersion string `protobuf:"bytes,1,opt,name=record_version,json=recordVersion,proto3" json:"record_version,omitempty"`
+ // expected_schema is the expected schema in the database.
+ ExpectedSchema string `protobuf:"bytes,2,opt,name=expected_schema,json=expectedSchema,proto3" json:"expected_schema,omitempty"`
+ // actual_schema is the actual schema in the database.
+ ActualSchema string `protobuf:"bytes,3,opt,name=actual_schema,json=actualSchema,proto3" json:"actual_schema,omitempty"`
+}
+
+func (x *Anomaly_DatabaseSchemaDriftDetail) Reset() {
+ *x = Anomaly_DatabaseSchemaDriftDetail{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_anomaly_service_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Anomaly_DatabaseSchemaDriftDetail) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Anomaly_DatabaseSchemaDriftDetail) ProtoMessage() {}
+
+func (x *Anomaly_DatabaseSchemaDriftDetail) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_anomaly_service_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Anomaly_DatabaseSchemaDriftDetail.ProtoReflect.Descriptor instead.
+func (*Anomaly_DatabaseSchemaDriftDetail) Descriptor() ([]byte, []int) {
+ return file_v1_anomaly_service_proto_rawDescGZIP(), []int{2, 4}
+}
+
+func (x *Anomaly_DatabaseSchemaDriftDetail) GetRecordVersion() string {
+ if x != nil {
+ return x.RecordVersion
+ }
+ return ""
+}
+
+func (x *Anomaly_DatabaseSchemaDriftDetail) GetExpectedSchema() string {
+ if x != nil {
+ return x.ExpectedSchema
+ }
+ return ""
+}
+
+func (x *Anomaly_DatabaseSchemaDriftDetail) GetActualSchema() string {
+ if x != nil {
+ return x.ActualSchema
+ }
+ return ""
+}
+
+var File_v1_anomaly_service_proto protoreflect.FileDescriptor
+
+var file_v1_anomaly_service_proto_rawDesc = []byte{
+ 0x0a, 0x18, 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x5f, 0x73, 0x65, 0x72,
+ 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62, 0x79, 0x74, 0x65,
+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
+ 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,
+ 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15,
+ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,
+ 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61,
+ 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
+ 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x63, 0x6f,
+ 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6c, 0x0a, 0x16, 0x53, 0x65,
+ 0x61, 0x72, 0x63, 0x68, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09,
+ 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
+ 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67,
+ 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70,
+ 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x75, 0x0a, 0x17, 0x53, 0x65, 0x61, 0x72,
+ 0x63, 0x68, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x61, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73,
+ 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x52, 0x09, 0x61, 0x6e,
+ 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f,
+ 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22,
+ 0xbf, 0x0e, 0x0a, 0x07, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x12, 0x20, 0x0a, 0x08, 0x72,
+ 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2,
+ 0x41, 0x01, 0x02, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x34, 0x0a,
+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x62, 0x79,
+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c,
+ 0x79, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74,
+ 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
+ 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x41, 0x6e, 0x6f,
+ 0x6d, 0x61, 0x6c, 0x79, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x09, 0x73,
+ 0x65, 0x72, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x6d, 0x0a, 0x1a, 0x69, 0x6e, 0x73, 0x74,
+ 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
+ 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x62,
+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61,
+ 0x6c, 0x79, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65,
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x18, 0x69,
+ 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f,
+ 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x6d, 0x0a, 0x1a, 0x64, 0x61, 0x74, 0x61, 0x62,
+ 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64,
+ 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x62, 0x79,
+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c,
+ 0x79, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
+ 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x18, 0x64, 0x61,
+ 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
+ 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x90, 0x01, 0x0a, 0x27, 0x64, 0x61, 0x74, 0x61, 0x62,
+ 0x61, 0x73, 0x65, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63,
+ 0x79, 0x5f, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x65, 0x74, 0x61,
+ 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x44,
+ 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x6c,
+ 0x69, 0x63, 0x79, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61,
+ 0x69, 0x6c, 0x48, 0x00, 0x52, 0x23, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42, 0x61,
+ 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x77, 0x0a, 0x1e, 0x64, 0x61, 0x74,
+ 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x6d, 0x69, 0x73,
+ 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x30, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
+ 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,
+ 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74,
+ 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x1b, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42,
+ 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74, 0x61,
+ 0x69, 0x6c, 0x12, 0x71, 0x0a, 0x1c, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x73,
+ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x64, 0x72, 0x69, 0x66, 0x74, 0x5f, 0x64, 0x65, 0x74, 0x61,
+ 0x69, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x44,
+ 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x72, 0x69,
+ 0x66, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x19, 0x64, 0x61, 0x74, 0x61,
+ 0x62, 0x61, 0x73, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x72, 0x69, 0x66, 0x74, 0x44,
+ 0x65, 0x74, 0x61, 0x69, 0x6c, 0x1a, 0x32, 0x0a, 0x18, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,
+ 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69,
+ 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x1a, 0x32, 0x0a, 0x18, 0x44, 0x61, 0x74,
+ 0x61, 0x62, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44,
+ 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x1a, 0xe5, 0x01,
+ 0x0a, 0x23, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70,
+ 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44,
+ 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x54, 0x0a,
+ 0x11, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75,
+ 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x42,
+ 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c,
+ 0x65, 0x52, 0x10, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x64,
+ 0x75, 0x6c, 0x65, 0x12, 0x50, 0x0a, 0x0f, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x73, 0x63,
+ 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x62,
+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6e, 0x6f, 0x6d, 0x61,
+ 0x6c, 0x79, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68,
+ 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x53, 0x63, 0x68,
+ 0x65, 0x64, 0x75, 0x6c, 0x65, 0x1a, 0xbf, 0x01, 0x0a, 0x1b, 0x44, 0x61, 0x74, 0x61, 0x62, 0x61,
+ 0x73, 0x65, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x44,
+ 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x54, 0x0a, 0x11, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65,
+ 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e,
+ 0x32, 0x27, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41,
+ 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61,
+ 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x10, 0x65, 0x78, 0x70, 0x65, 0x63,
+ 0x74, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x4a, 0x0a, 0x13, 0x6c,
+ 0x61, 0x73, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x5f, 0x74, 0x69,
+ 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
+ 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,
+ 0x74, 0x61, 0x6d, 0x70, 0x52, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x65, 0x73, 0x74, 0x42, 0x61, 0x63,
+ 0x6b, 0x75, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x1a, 0x90, 0x01, 0x0a, 0x19, 0x44, 0x61, 0x74, 0x61,
+ 0x62, 0x61, 0x73, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x44, 0x72, 0x69, 0x66, 0x74, 0x44,
+ 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f,
+ 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72,
+ 0x65, 0x63, 0x6f, 0x72, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f,
+ 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x53,
+ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x5f,
+ 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63,
+ 0x74, 0x75, 0x61, 0x6c, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0xd1, 0x01, 0x0a, 0x0b, 0x41,
+ 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x41, 0x4e,
+ 0x4f, 0x4d, 0x41, 0x4c, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45,
+ 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x4e, 0x53, 0x54,
+ 0x41, 0x4e, 0x43, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10,
+ 0x01, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x49, 0x47, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53,
+ 0x43, 0x48, 0x45, 0x4d, 0x41, 0x10, 0x02, 0x12, 0x24, 0x0a, 0x20, 0x44, 0x41, 0x54, 0x41, 0x42,
+ 0x41, 0x53, 0x45, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x55, 0x50, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43,
+ 0x59, 0x5f, 0x56, 0x49, 0x4f, 0x4c, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x03, 0x12, 0x1b, 0x0a,
+ 0x17, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x55, 0x50,
+ 0x5f, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x41,
+ 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, 0x4f,
+ 0x4e, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x41, 0x54, 0x41, 0x42, 0x41, 0x53, 0x45, 0x5f,
+ 0x53, 0x43, 0x48, 0x45, 0x4d, 0x41, 0x5f, 0x44, 0x52, 0x49, 0x46, 0x54, 0x10, 0x06, 0x22, 0x59,
+ 0x0a, 0x10, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x69,
+ 0x74, 0x79, 0x12, 0x21, 0x0a, 0x1d, 0x41, 0x4e, 0x4f, 0x4d, 0x41, 0x4c, 0x59, 0x5f, 0x53, 0x45,
+ 0x52, 0x56, 0x45, 0x52, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,
+ 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x44, 0x49, 0x55, 0x4d, 0x10,
+ 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x47, 0x48, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x43,
+ 0x52, 0x49, 0x54, 0x49, 0x43, 0x41, 0x4c, 0x10, 0x03, 0x22, 0x5c, 0x0a, 0x12, 0x42, 0x61, 0x63,
+ 0x6b, 0x75, 0x70, 0x50, 0x6c, 0x61, 0x6e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12,
+ 0x24, 0x0a, 0x20, 0x42, 0x41, 0x43, 0x4b, 0x55, 0x50, 0x5f, 0x50, 0x4c, 0x41, 0x4e, 0x5f, 0x53,
+ 0x43, 0x48, 0x45, 0x44, 0x55, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,
+ 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x01,
+ 0x12, 0x09, 0x0a, 0x05, 0x44, 0x41, 0x49, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x57,
+ 0x45, 0x45, 0x4b, 0x4c, 0x59, 0x10, 0x03, 0x42, 0x08, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69,
+ 0x6c, 0x32, 0x8f, 0x01, 0x0a, 0x0e, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x79, 0x53, 0x65, 0x72,
+ 0x76, 0x69, 0x63, 0x65, 0x12, 0x7d, 0x0a, 0x0f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x41, 0x6e,
+ 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x41, 0x6e, 0x6f, 0x6d,
+ 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x62,
+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63,
+ 0x68, 0x41, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f,
+ 0x76, 0x31, 0x2f, 0x61, 0x6e, 0x6f, 0x6d, 0x61, 0x6c, 0x69, 0x65, 0x73, 0x2f, 0x73, 0x65, 0x61,
+ 0x72, 0x63, 0x68, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64,
+ 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_v1_anomaly_service_proto_rawDescOnce sync.Once
+ file_v1_anomaly_service_proto_rawDescData = file_v1_anomaly_service_proto_rawDesc
+)
+
+func file_v1_anomaly_service_proto_rawDescGZIP() []byte {
+ file_v1_anomaly_service_proto_rawDescOnce.Do(func() {
+ file_v1_anomaly_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_v1_anomaly_service_proto_rawDescData)
+ })
+ return file_v1_anomaly_service_proto_rawDescData
+}
+
+var file_v1_anomaly_service_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
+var file_v1_anomaly_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
+var file_v1_anomaly_service_proto_goTypes = []interface{}{
+ (Anomaly_AnomalyType)(0), // 0: bytebase.v1.Anomaly.AnomalyType
+ (Anomaly_AnomalyServerity)(0), // 1: bytebase.v1.Anomaly.AnomalyServerity
+ (Anomaly_BackupPlanSchedule)(0), // 2: bytebase.v1.Anomaly.BackupPlanSchedule
+ (*SearchAnomaliesRequest)(nil), // 3: bytebase.v1.SearchAnomaliesRequest
+ (*SearchAnomaliesResponse)(nil), // 4: bytebase.v1.SearchAnomaliesResponse
+ (*Anomaly)(nil), // 5: bytebase.v1.Anomaly
+ (*Anomaly_InstanceConnectionDetail)(nil), // 6: bytebase.v1.Anomaly.InstanceConnectionDetail
+ (*Anomaly_DatabaseConnectionDetail)(nil), // 7: bytebase.v1.Anomaly.DatabaseConnectionDetail
+ (*Anomaly_DatabaseBackupPolicyViolationDetail)(nil), // 8: bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail
+ (*Anomaly_DatabaseBackupMissingDetail)(nil), // 9: bytebase.v1.Anomaly.DatabaseBackupMissingDetail
+ (*Anomaly_DatabaseSchemaDriftDetail)(nil), // 10: bytebase.v1.Anomaly.DatabaseSchemaDriftDetail
+ (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp
+}
+var file_v1_anomaly_service_proto_depIdxs = []int32{
+ 5, // 0: bytebase.v1.SearchAnomaliesResponse.anomalies:type_name -> bytebase.v1.Anomaly
+ 0, // 1: bytebase.v1.Anomaly.type:type_name -> bytebase.v1.Anomaly.AnomalyType
+ 1, // 2: bytebase.v1.Anomaly.serverity:type_name -> bytebase.v1.Anomaly.AnomalyServerity
+ 6, // 3: bytebase.v1.Anomaly.instance_connection_detail:type_name -> bytebase.v1.Anomaly.InstanceConnectionDetail
+ 7, // 4: bytebase.v1.Anomaly.database_connection_detail:type_name -> bytebase.v1.Anomaly.DatabaseConnectionDetail
+ 8, // 5: bytebase.v1.Anomaly.database_backup_policy_violation_detail:type_name -> bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail
+ 9, // 6: bytebase.v1.Anomaly.database_backup_missing_detail:type_name -> bytebase.v1.Anomaly.DatabaseBackupMissingDetail
+ 10, // 7: bytebase.v1.Anomaly.database_schema_drift_detail:type_name -> bytebase.v1.Anomaly.DatabaseSchemaDriftDetail
+ 2, // 8: bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail.expected_schedule:type_name -> bytebase.v1.Anomaly.BackupPlanSchedule
+ 2, // 9: bytebase.v1.Anomaly.DatabaseBackupPolicyViolationDetail.actual_schedule:type_name -> bytebase.v1.Anomaly.BackupPlanSchedule
+ 2, // 10: bytebase.v1.Anomaly.DatabaseBackupMissingDetail.expected_schedule:type_name -> bytebase.v1.Anomaly.BackupPlanSchedule
+ 11, // 11: bytebase.v1.Anomaly.DatabaseBackupMissingDetail.lastest_backup_time:type_name -> google.protobuf.Timestamp
+ 3, // 12: bytebase.v1.AnomalyService.SearchAnomalies:input_type -> bytebase.v1.SearchAnomaliesRequest
+ 4, // 13: bytebase.v1.AnomalyService.SearchAnomalies:output_type -> bytebase.v1.SearchAnomaliesResponse
+ 13, // [13:14] is the sub-list for method output_type
+ 12, // [12:13] is the sub-list for method input_type
+ 12, // [12:12] is the sub-list for extension type_name
+ 12, // [12:12] is the sub-list for extension extendee
+ 0, // [0:12] is the sub-list for field type_name
+}
+
+func init() { file_v1_anomaly_service_proto_init() }
+func file_v1_anomaly_service_proto_init() {
+ if File_v1_anomaly_service_proto != nil {
+ return
+ }
+ file_v1_common_proto_init()
+ if !protoimpl.UnsafeEnabled {
+ file_v1_anomaly_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SearchAnomaliesRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_anomaly_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SearchAnomaliesResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_anomaly_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Anomaly); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_anomaly_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Anomaly_InstanceConnectionDetail); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_anomaly_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Anomaly_DatabaseConnectionDetail); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_anomaly_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Anomaly_DatabaseBackupPolicyViolationDetail); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_anomaly_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Anomaly_DatabaseBackupMissingDetail); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_anomaly_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Anomaly_DatabaseSchemaDriftDetail); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ file_v1_anomaly_service_proto_msgTypes[2].OneofWrappers = []interface{}{
+ (*Anomaly_InstanceConnectionDetail_)(nil),
+ (*Anomaly_DatabaseConnectionDetail_)(nil),
+ (*Anomaly_DatabaseBackupPolicyViolationDetail_)(nil),
+ (*Anomaly_DatabaseBackupMissingDetail_)(nil),
+ (*Anomaly_DatabaseSchemaDriftDetail_)(nil),
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_v1_anomaly_service_proto_rawDesc,
+ NumEnums: 3,
+ NumMessages: 8,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_v1_anomaly_service_proto_goTypes,
+ DependencyIndexes: file_v1_anomaly_service_proto_depIdxs,
+ EnumInfos: file_v1_anomaly_service_proto_enumTypes,
+ MessageInfos: file_v1_anomaly_service_proto_msgTypes,
+ }.Build()
+ File_v1_anomaly_service_proto = out.File
+ file_v1_anomaly_service_proto_rawDesc = nil
+ file_v1_anomaly_service_proto_goTypes = nil
+ file_v1_anomaly_service_proto_depIdxs = nil
+}
diff --git a/proto/generated-go/v1/anomaly_service.pb.gw.go b/proto/generated-go/v1/anomaly_service.pb.gw.go
new file mode 100644
index 0000000000..bb1966e3d7
--- /dev/null
+++ b/proto/generated-go/v1/anomaly_service.pb.gw.go
@@ -0,0 +1,171 @@
+// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
+// source: v1/anomaly_service.proto
+
+/*
+Package v1 is a reverse proxy.
+
+It translates gRPC into RESTful JSON APIs.
+*/
+package v1
+
+import (
+ "context"
+ "io"
+ "net/http"
+
+ "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
+ "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/grpclog"
+ "google.golang.org/grpc/metadata"
+ "google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
+)
+
+// Suppress "imported and not used" errors
+var _ codes.Code
+var _ io.Reader
+var _ status.Status
+var _ = runtime.String
+var _ = utilities.NewDoubleArray
+var _ = metadata.Join
+
+func request_AnomalyService_SearchAnomalies_0(ctx context.Context, marshaler runtime.Marshaler, client AnomalyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq SearchAnomaliesRequest
+ var metadata runtime.ServerMetadata
+
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.SearchAnomalies(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_AnomalyService_SearchAnomalies_0(ctx context.Context, marshaler runtime.Marshaler, server AnomalyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq SearchAnomaliesRequest
+ var metadata runtime.ServerMetadata
+
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.SearchAnomalies(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
+// RegisterAnomalyServiceHandlerServer registers the http handlers for service AnomalyService to "mux".
+// UnaryRPC :call AnomalyServiceServer directly.
+// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
+// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAnomalyServiceHandlerFromEndpoint instead.
+func RegisterAnomalyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AnomalyServiceServer) error {
+
+ mux.Handle("POST", pattern_AnomalyService_SearchAnomalies_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.AnomalyService/SearchAnomalies", runtime.WithHTTPPathPattern("/v1/anomalies/search"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_AnomalyService_SearchAnomalies_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_AnomalyService_SearchAnomalies_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ return nil
+}
+
+// RegisterAnomalyServiceHandlerFromEndpoint is same as RegisterAnomalyServiceHandler but
+// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
+func RegisterAnomalyServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
+ conn, err := grpc.Dial(endpoint, opts...)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if err != nil {
+ if cerr := conn.Close(); cerr != nil {
+ grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
+ }
+ return
+ }
+ go func() {
+ <-ctx.Done()
+ if cerr := conn.Close(); cerr != nil {
+ grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
+ }
+ }()
+ }()
+
+ return RegisterAnomalyServiceHandler(ctx, mux, conn)
+}
+
+// RegisterAnomalyServiceHandler registers the http handlers for service AnomalyService to "mux".
+// The handlers forward requests to the grpc endpoint over "conn".
+func RegisterAnomalyServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
+ return RegisterAnomalyServiceHandlerClient(ctx, mux, NewAnomalyServiceClient(conn))
+}
+
+// RegisterAnomalyServiceHandlerClient registers the http handlers for service AnomalyService
+// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AnomalyServiceClient".
+// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AnomalyServiceClient"
+// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
+// "AnomalyServiceClient" to call the correct interceptors.
+func RegisterAnomalyServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AnomalyServiceClient) error {
+
+ mux.Handle("POST", pattern_AnomalyService_SearchAnomalies_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.AnomalyService/SearchAnomalies", runtime.WithHTTPPathPattern("/v1/anomalies/search"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_AnomalyService_SearchAnomalies_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_AnomalyService_SearchAnomalies_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ return nil
+}
+
+var (
+ pattern_AnomalyService_SearchAnomalies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "anomalies", "search"}, ""))
+)
+
+var (
+ forward_AnomalyService_SearchAnomalies_0 = runtime.ForwardResponseMessage
+)
diff --git a/proto/generated-go/v1/anomaly_service_grpc.pb.go b/proto/generated-go/v1/anomaly_service_grpc.pb.go
new file mode 100644
index 0000000000..f02257e217
--- /dev/null
+++ b/proto/generated-go/v1/anomaly_service_grpc.pb.go
@@ -0,0 +1,105 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.2.0
+// - protoc (unknown)
+// source: v1/anomaly_service.proto
+
+package v1
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+// AnomalyServiceClient is the client API for AnomalyService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type AnomalyServiceClient interface {
+ SearchAnomalies(ctx context.Context, in *SearchAnomaliesRequest, opts ...grpc.CallOption) (*SearchAnomaliesResponse, error)
+}
+
+type anomalyServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewAnomalyServiceClient(cc grpc.ClientConnInterface) AnomalyServiceClient {
+ return &anomalyServiceClient{cc}
+}
+
+func (c *anomalyServiceClient) SearchAnomalies(ctx context.Context, in *SearchAnomaliesRequest, opts ...grpc.CallOption) (*SearchAnomaliesResponse, error) {
+ out := new(SearchAnomaliesResponse)
+ err := c.cc.Invoke(ctx, "/bytebase.v1.AnomalyService/SearchAnomalies", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// AnomalyServiceServer is the server API for AnomalyService service.
+// All implementations must embed UnimplementedAnomalyServiceServer
+// for forward compatibility
+type AnomalyServiceServer interface {
+ SearchAnomalies(context.Context, *SearchAnomaliesRequest) (*SearchAnomaliesResponse, error)
+ mustEmbedUnimplementedAnomalyServiceServer()
+}
+
+// UnimplementedAnomalyServiceServer must be embedded to have forward compatible implementations.
+type UnimplementedAnomalyServiceServer struct {
+}
+
+func (UnimplementedAnomalyServiceServer) SearchAnomalies(context.Context, *SearchAnomaliesRequest) (*SearchAnomaliesResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SearchAnomalies not implemented")
+}
+func (UnimplementedAnomalyServiceServer) mustEmbedUnimplementedAnomalyServiceServer() {}
+
+// UnsafeAnomalyServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to AnomalyServiceServer will
+// result in compilation errors.
+type UnsafeAnomalyServiceServer interface {
+ mustEmbedUnimplementedAnomalyServiceServer()
+}
+
+func RegisterAnomalyServiceServer(s grpc.ServiceRegistrar, srv AnomalyServiceServer) {
+ s.RegisterService(&AnomalyService_ServiceDesc, srv)
+}
+
+func _AnomalyService_SearchAnomalies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(SearchAnomaliesRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(AnomalyServiceServer).SearchAnomalies(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/bytebase.v1.AnomalyService/SearchAnomalies",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(AnomalyServiceServer).SearchAnomalies(ctx, req.(*SearchAnomaliesRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// AnomalyService_ServiceDesc is the grpc.ServiceDesc for AnomalyService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var AnomalyService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "bytebase.v1.AnomalyService",
+ HandlerType: (*AnomalyServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "SearchAnomalies",
+ Handler: _AnomalyService_SearchAnomalies_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "v1/anomaly_service.proto",
+}
diff --git a/proto/v1/anomaly_service.proto b/proto/v1/anomaly_service.proto
new file mode 100644
index 0000000000..78348087de
--- /dev/null
+++ b/proto/v1/anomaly_service.proto
@@ -0,0 +1,176 @@
+syntax = "proto3";
+
+package bytebase.v1;
+
+import "google/api/annotations.proto";
+import "google/api/client.proto";
+import "google/api/http.proto";
+import "google/api/field_behavior.proto";
+import "google/protobuf/field_mask.proto";
+import "google/protobuf/timestamp.proto";
+
+import "v1/common.proto";
+
+option go_package = "generated-go/v1";
+
+service AnomalyService {
+ rpc SearchAnomalies(SearchAnomaliesRequest) returns (SearchAnomaliesResponse) {
+ option (google.api.http) = {
+ post: "/v1/anomalies/search"
+ body: "*"
+ };
+ }
+}
+
+message SearchAnomaliesRequest {
+ // filter is the filter to apply on the search anomaly request,
+ // follow the [google cel-spec](https://github.com/google/cel-spec) syntax.
+ // For example:
+ // Search the anomalies of a specific resource: 'anomaly.resource_name="environments/{environemnt}/instances/{instance}"'
+ // Search the specified type of anomalies: 'anomaly.type="DATABASE_BACKUP_POLICY_VIOLATION"'
+ string filter = 1;
+
+ // Not used. The maximum number of anomalies to return. The service may return fewer than
+ // this value.
+ // If unspecified, at most 50 anomalies will be returned.
+ // The maximum value is 1000; values above 1000 will be coerced to 1000.
+ int32 page_size = 2;
+
+ // Not used. A page token, received from a previous `SearchAnomalies` call.
+ // Provide this to retrieve the subsequent page.
+ //
+ // When paginating, all other parameters provided to `SearchAnomalies` must match
+ // the call that provided the page token.
+ string page_token = 3;
+}
+
+message SearchAnomaliesResponse {
+ // anomalies is the list of anomalies.
+ repeated Anomaly anomalies = 1;
+
+ // Not used. A token, which can be sent as `page_token` to retrieve the next page.
+ // If this field is omitted, there are no subsequent pages.
+ string next_page_token = 2;
+}
+
+message Anomaly {
+ // AnomalyType is the type of the anomaly.
+ enum AnomalyType {
+ // Unspecified anomaly type.
+ ANOMALY_TYPE_UNSPECIFIED = 0;
+ // Instance level anomaly.
+ //
+ // INSTANCE_CONNECTION is the anomaly type for instance connection, e.g. the instance is down.
+ INSTANCE_CONNECTION = 1;
+ // MIGRATION_SCHEMA is the anomaly type for migration schema, e.g. the migration schema in the instance is missing.
+ MIGRATION_SCHEMA = 2;
+
+ // Database level anomaly.
+ //
+ // DATABASE_BACKUP_POLICY_VIOLATION is the anomaly type for database backup policy violation,
+ // e.g. the database backup policy is not meet the environment backup policy.
+ DATABASE_BACKUP_POLICY_VIOLATION = 3;
+ // DATABASE_BACKUP_MISSING is the anomaly type for the backup missing, e.g. the backup is missing.
+ DATABASE_BACKUP_MISSING = 4;
+ // DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted.
+ DATABASE_CONNECTION = 5;
+ // DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift,
+ // e.g. the database schema had been changed without bytebase migration.
+ DATABASE_SCHEMA_DRIFT = 6;
+ }
+
+ // AnomalyServerity is the severity of the anomaly.
+ enum AnomalyServerity {
+ // Unspecified anomaly serverity.
+ ANOMALY_SERVERITY_UNSPECIFIED = 0;
+ // MEDIUM is the info level anomaly serverity.
+ MEDIUM = 1;
+ // HIGH is the warning level anomaly serverity.
+ HIGH = 2;
+ // CRITICAL is the critical level anomaly serverity.
+ CRITICAL = 3;
+ }
+
+ // The resource that is the target of the operation.
+ // Format:
+ // - Instance: environments/{environment}/instnaces/{instance}
+ // - Database: environments/{environment}/instnaces/{instance}/databases/{database}
+ string resource = 1 [(google.api.field_behavior) = REQUIRED];
+
+ // type is the type of the anomaly.
+ AnomalyType type = 2;
+
+ // serverity is the serverity of the anomaly.
+ AnomalyServerity serverity = 3;
+
+ // Instance level anomaly detail.
+ //
+ // InstanceConnectionDetail is the detail for instance connection anomaly.
+ message InstanceConnectionDetail {
+ // detail is the detail of the instance connection failure.
+ string detail = 1;
+ }
+
+ // Database level anomaly detial.
+ //
+ // DatbaaseConnectionDetail is the detail for database connection anomaly.
+ message DatabaseConnectionDetail {
+ // detail is the detail of the database connection failure.
+ string detail = 1;
+ }
+
+ // BackupPlanSchedule is the backup plan schedule.
+ enum BackupPlanSchedule {
+ // Unspecified backup plan schedule.
+ BACKUP_PLAN_SCHEDULE_UNSPECIFIED = 0;
+ // UNSET is the unset backup plan schedule.
+ UNSET = 1;
+ // DAILY is the daily backup plan schedule.
+ DAILY = 2;
+ // WEEKLY is the weekly backup plan schedule.
+ WEEKLY = 3;
+ }
+
+ // DatabaseBackupPolicyViolationDetail is the detail for database backup policy violation anomaly.
+ message DatabaseBackupPolicyViolationDetail {
+ // parent is the parent of the database.
+ // Format: environments/{environment}
+ string parent = 1;
+
+ // expected_schedule is the expected backup plan schedule in the parent.
+ BackupPlanSchedule expected_schedule = 2;
+
+ // actual_schedule is the actual backup plan schedule in the database.
+ BackupPlanSchedule actual_schedule = 3;
+ }
+
+ // DatabaseBackupMissingDetail is the detail for database backup missing anomaly.
+ message DatabaseBackupMissingDetail {
+ // expected_schedule is the expected backup plan schedule in the database.
+ BackupPlanSchedule expected_schedule = 1;
+
+ // lastest_backup_time is the last backup time in the database.
+ google.protobuf.Timestamp lastest_backup_time = 2;
+ }
+
+ // DatabaseSchemaDriftDetail is the detail for database schema drift anomaly.
+ message DatabaseSchemaDriftDetail {
+ // record_version is the record version of the database schema drift.
+ string record_version = 1;
+
+ // expected_schema is the expected schema in the database.
+ string expected_schema = 2;
+
+ // actual_schema is the actual schema in the database.
+ string actual_schema = 3;
+ }
+
+ // detail is the detail of the anomaly.
+ oneof detail {
+ InstanceConnectionDetail instance_connection_detail = 4;
+ DatabaseConnectionDetail database_connection_detail = 5;
+ DatabaseBackupPolicyViolationDetail database_backup_policy_violation_detail = 6;
+ DatabaseBackupMissingDetail database_backup_missing_detail = 7;
+ DatabaseSchemaDriftDetail database_schema_drift_detail = 8;
+ }
+}
\ No newline at end of file