Skip to content

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

chore: move stats to the actuator API (#15673)

ecmadaoaec3a97cf21c
diff --git a/backend/api/v1/actuator_service.go b/backend/api/v1/actuator_service.go
index 8c34042e98..1e783b3d51 100644
--- a/backend/api/v1/actuator_service.go
+++ b/backend/api/v1/actuator_service.go
@@ -135,6 +135,30 @@ func (s *ActuatorService) getServerInfo(ctx context.Context) (*v1pb.ActuatorInfo
PasswordRestriction: passwordSetting,
}
+ stats, err := s.store.StatUsers(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to stat users, error: %v", err)
+ }
+ for _, stat := range stats {
+ serverInfo.UserStats = append(serverInfo.UserStats, &v1pb.ActuatorInfo_StatUser{
+ State: convertDeletedToState(stat.Deleted),
+ UserType: convertToV1UserType(stat.Type),
+ Count: int32(stat.Count),
+ })
+ }
+
+ activatedInstanceCount, err := s.store.GetActivatedInstanceCount(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to count activated instance, error: %v", err)
+ }
+ serverInfo.ActivatedInstanceCount = int32(activatedInstanceCount)
+
+ totalInstanceCount, err := s.store.CountInstance(ctx, &store.CountInstanceMessage{})
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to count total instance, error: %v", err)
+ }
+ serverInfo.TotalInstanceCount = int32(totalInstanceCount)
+
return &serverInfo, nil
}
diff --git a/backend/api/v1/user_service.go b/backend/api/v1/user_service.go
index 3fc86c23cb..736161fac4 100644
--- a/backend/api/v1/user_service.go
+++ b/backend/api/v1/user_service.go
@@ -88,24 +88,6 @@ func (s *UserService) GetUser(ctx context.Context, request *v1pb.GetUserRequest)
return convertToUser(user), nil
}
-// StatUsers count users by type and state.
-func (s *UserService) StatUsers(ctx context.Context, _ *v1pb.StatUsersRequest) (*v1pb.StatUsersResponse, error) {
- stats, err := s.store.StatUsers(ctx)
- if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to stat users, error: %v", err)
- }
- response := &v1pb.StatUsersResponse{}
-
- for _, stat := range stats {
- response.Stats = append(response.Stats, &v1pb.StatUsersResponse_StatUser{
- State: convertDeletedToState(stat.Deleted),
- UserType: convertToV1UserType(stat.Type),
- Count: int32(stat.Count),
- })
- }
- return response, nil
-}
-
// ListUsers lists all users.
func (s *UserService) ListUsers(ctx context.Context, request *v1pb.ListUsersRequest) (*v1pb.ListUsersResponse, error) {
offset, err := parseLimitAndOffset(&pageSize{
diff --git a/frontend/src/components/AuditLog/AuditLogSearch/AuditLogSearch.vue b/frontend/src/components/AuditLog/AuditLogSearch/AuditLogSearch.vue
index 844965fedb..926988e794 100644
--- a/frontend/src/components/AuditLog/AuditLogSearch/AuditLogSearch.vue
+++ b/frontend/src/components/AuditLog/AuditLogSearch/AuditLogSearch.vue
@@ -32,12 +32,7 @@ import { ALL_METHODS_WITH_AUDIT } from "@/grpcweb/methods";
import { useCurrentUserV1, useProjectV1Store, useUserStore } from "@/store";
import { SYSTEM_BOT_USER_NAME, type ComposedProject } from "@/types";
import { AuditLog_Severity } from "@/types/proto/v1/audit_log_service";
-import { State, stateToJSON } from "@/types/proto/v1/common";
-import {
- type User,
- UserType,
- userTypeToJSON,
-} from "@/types/proto/v1/user_service";
+import { type User, UserType } from "@/types/proto/v1/user_service";
import {
getDefaultPagination,
extractProjectResourceName,
@@ -64,8 +59,9 @@ onMounted(async () => {
const [listUsersResponse, listProjectsResponse] = await Promise.all([
userStore.fetchUserList({
pageSize: getDefaultPagination(),
- showDeleted: false,
- filter: `state == "${stateToJSON(State.ACTIVE)}" && user_type == "${userTypeToJSON(UserType.USER)}"`,
+ filter: {
+ types: [UserType.USER],
+ },
}),
projectStore.fetchProjectList({
pageSize: getDefaultPagination(),
diff --git a/frontend/src/components/FeatureGuard/FeatureAttentionForInstanceLicense.vue b/frontend/src/components/FeatureGuard/FeatureAttentionForInstanceLicense.vue
index da9d701418..d0b455907c 100644
--- a/frontend/src/components/FeatureGuard/FeatureAttentionForInstanceLicense.vue
+++ b/frontend/src/components/FeatureGuard/FeatureAttentionForInstanceLicense.vue
@@ -27,7 +27,7 @@
<script lang="ts" setup>
import { reactive, computed } from "vue";
import { BBAttention } from "@/bbkit";
-import { useSubscriptionV1Store, useInstanceResourceList } from "@/store";
+import { useSubscriptionV1Store, useActuatorV1Store } from "@/store";
import type { FeatureType } from "@/types";
import { instanceLimitFeature } from "@/types";
import { PlanType } from "@/types/proto/v1/subscription_service";
@@ -49,8 +49,8 @@ const state = reactive<LocalState>({
});
const subscriptionV1Store = useSubscriptionV1Store();
+const actuatorStore = useActuatorV1Store();
const featureKey = props.feature.split(".").join("-");
-const instanceList = useInstanceResourceList();
const onClick = () => {
state.showInstanceAssignmentDrawer = true;
@@ -61,6 +61,8 @@ const canManageSubscription = computed((): boolean => {
});
const existInstanceWithoutLicense = computed(() => {
- return instanceList.value.some((ins) => !ins.activation);
+ return (
+ actuatorStore.totalInstanceCount > actuatorStore.activatedInstanceCount
+ );
});
</script>
diff --git a/frontend/src/components/InstanceForm/Form.vue b/frontend/src/components/InstanceForm/Form.vue
index 1f9f6f3ba1..71b4fdd325 100644
--- a/frontend/src/components/InstanceForm/Form.vue
+++ b/frontend/src/components/InstanceForm/Form.vue
@@ -496,6 +496,7 @@ import {
useActuatorV1Store,
useInstanceV1Store,
useSubscriptionV1Store,
+ pushNotification,
} from "@/store";
import { instanceNamePrefix } from "@/store/modules/v1/common";
import type { ResourceId, ValidatedMessage, ComposedInstance } from "@/types";
@@ -560,7 +561,7 @@ const availableLicenseCount = computed(() => {
return Math.max(
0,
subscriptionStore.instanceLicenseCount -
- instanceV1Store.activateInstanceCount
+ actuatorStore.activatedInstanceCount
);
});
@@ -758,6 +759,14 @@ const changeInstanceActivation = async (on: boolean) => {
activation: on,
};
await instanceV1Store.updateInstance(instancePatch, ["activation"]);
+ // refresh activatedInstanceCount
+ await actuatorStore.fetchServerInfo();
+
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.updated"),
+ });
}
};
diff --git a/frontend/src/components/InstanceForm/common.ts b/frontend/src/components/InstanceForm/common.ts
index 0936d09c0d..1abfb09a05 100644
--- a/frontend/src/components/InstanceForm/common.ts
+++ b/frontend/src/components/InstanceForm/common.ts
@@ -1,5 +1,6 @@
+import { cloneDeep, first } from "lodash-es";
import { t } from "@/plugins/i18n";
-import { useInstanceV1Store, useSubscriptionV1Store } from "@/store";
+import { useActuatorV1Store, useSubscriptionV1Store } from "@/store";
import {
emptyDataSource,
UNKNOWN_ENVIRONMENT_NAME,
@@ -10,7 +11,6 @@ import type { DataSource, Instance } from "@/types/proto/v1/instance_service";
import { DataSourceType } from "@/types/proto/v1/instance_service";
import { PlanType } from "@/types/proto/v1/subscription_service";
import { calcUpdateMask } from "@/utils";
-import { cloneDeep, first } from "lodash-es";
export type BasicInfo = Omit<Instance, "dataSources" | "engineVersion">;
@@ -54,11 +54,12 @@ export const extractDataSourceEditState = (
export const extractBasicInfo = (instance: Instance | undefined): BasicInfo => {
const subscriptionStore = useSubscriptionV1Store();
- const instanceStore = useInstanceV1Store();
+ const actuatorStore = useActuatorV1Store();
const availableLicenseCount = Math.max(
0,
- subscriptionStore.instanceLicenseCount - instanceStore.activateInstanceCount
+ subscriptionStore.instanceLicenseCount -
+ actuatorStore.activatedInstanceCount
);
return {
@@ -103,15 +104,17 @@ export const applyExtraConnectionParameters = (
if (editState.extraConnectionParameters) {
// Clone the map manually to ensure it's a plain object, not a Proxy
const params: Record<string, string> = {};
- Object.entries(editState.extraConnectionParameters).forEach(([key, value]) => {
- params[key] = value;
- });
-
+ Object.entries(editState.extraConnectionParameters).forEach(
+ ([key, value]) => {
+ params[key] = value;
+ }
+ );
+
dataSource.extraConnectionParameters = params;
} else {
- dataSource.extraConnectionParameters = {};
+ dataSource.extraConnectionParameters = {};
}
-
+
return dataSource;
};
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue
index 42b5834e71..3cc693e58d 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue
@@ -44,9 +44,9 @@ import { updateIssueSubscribers, useIssueContext } from "@/components/IssueV1";
import UserAvatar from "@/components/User/UserAvatar.vue";
import { useUserStore } from "@/store";
import { unknownUser } from "@/types";
-import { State, stateToJSON } from "@/types/proto/v1/common";
+import { State } from "@/types/proto/v1/common";
import { type User } from "@/types/proto/v1/user_service";
-import { UserType, userTypeToJSON } from "@/types/proto/v1/user_service";
+import { UserType } from "@/types/proto/v1/user_service";
import { getDefaultPagination } from "@/utils";
import SubscriberListItem from "./SubscriberListItem.vue";
@@ -170,21 +170,15 @@ const onUpdateShow = (show: boolean) => {
};
const handleSearch = useDebounceFn(async (search: string) => {
- const filter = [
- `state == "${stateToJSON(State.ACTIVE)}"`,
- `user_type == "${userTypeToJSON(UserType.USER)}"`,
- ];
- if (search) {
- filter.push(`(name.matches("${search}") || email.matches("${search}"))`);
- }
-
state.loading = true;
try {
const { users } = await userStore.fetchUserList({
- filter: filter.join(" && "),
+ filter: {
+ types: [UserType.USER],
+ query: search,
+ },
pageSize: getDefaultPagination(),
- showDeleted: false,
});
state.rawUserList = users;
} finally {
diff --git a/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue b/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue
index 0bdc26c113..31ae56a819 100644
--- a/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue
+++ b/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue
@@ -43,8 +43,7 @@ import { ref, computed, onMounted } from "vue";
import AdvancedSearch from "@/components/AdvancedSearch";
import TimeRange from "@/components/AdvancedSearch/TimeRange.vue";
import { useUserStore } from "@/store";
-import { State, stateToJSON } from "@/types/proto/v1/common";
-import { User, UserType, userTypeToJSON } from "@/types/proto/v1/user_service";
+import { User, UserType } from "@/types/proto/v1/user_service";
import type { SearchParams, SearchScopeId } from "@/utils";
import {
getDefaultPagination,
@@ -90,8 +89,9 @@ const activeUserList = ref<User[]>([]);
onMounted(async () => {
const { users } = await userStore.fetchUserList({
pageSize: getDefaultPagination(),
- showDeleted: false,
- filter: `state == "${stateToJSON(State.ACTIVE)}" && user_type == "${userTypeToJSON(UserType.USER)}"`,
+ filter: {
+ types: [UserType.USER],
+ },
});
activeUserList.value = users;
});
diff --git a/frontend/src/components/ProfileDropdown.vue b/frontend/src/components/ProfileDropdown.vue
index 4afee446fd..52f0d22216 100644
--- a/frontend/src/components/ProfileDropdown.vue
+++ b/frontend/src/components/ProfileDropdown.vue
@@ -21,7 +21,6 @@ import { computed, ref, h } from "vue";
import { useI18n } from "vue-i18n";
import { useLanguage } from "@/composables/useLanguage";
import {
- useUserStore,
useActuatorV1Store,
useAppFeature,
useAuthStore,
@@ -41,7 +40,6 @@ const props = defineProps<{
link?: boolean;
}>();
-const userStore = useUserStore();
const actuatorStore = useActuatorV1Store();
const authStore = useAuthStore();
const subscriptionStore = useSubscriptionV1Store();
@@ -54,7 +52,7 @@ const hideQuickstart = computed(() => {
return true;
}
// Hide quickstart if there are more than 1 active users.
- return userStore.activeUserCountWithoutBot > 1;
+ return actuatorStore.getActiveUserCount({ includeBot: false }) > 1;
});
const hideHelp = useAppFeature("bb.feature.hide-help");
diff --git a/frontend/src/components/ProvideDashboardContext.vue b/frontend/src/components/ProvideDashboardContext.vue
index 76cbe00e2a..6421763b9f 100644
--- a/frontend/src/components/ProvideDashboardContext.vue
+++ b/frontend/src/components/ProvideDashboardContext.vue
@@ -20,7 +20,6 @@ import {
usePolicyV1Store,
useRoleStore,
useSettingV1Store,
- useUserStore,
useUIStateStore,
useGroupStore,
} from "@/store";
@@ -47,7 +46,6 @@ onMounted(async () => {
// Then prepare the other resources.
await Promise.all([
- useUserStore().refreshUserStat(),
useGroupStore().fetchGroupList(),
useEnvironmentV1Store().fetchEnvironments(),
]);
diff --git a/frontend/src/components/ProvideSQLEditorSettingContext.vue b/frontend/src/components/ProvideSQLEditorSettingContext.vue
index 64e2e6e7bd..e549ed2e83 100644
--- a/frontend/src/components/ProvideSQLEditorSettingContext.vue
+++ b/frontend/src/components/ProvideSQLEditorSettingContext.vue
@@ -4,11 +4,10 @@
<script lang="ts" setup>
import { onMounted } from "vue";
-import { useGroupStore, useRoleStore, useUserStore } from "@/store";
+import { useGroupStore, useRoleStore } from "@/store";
onMounted(async () => {
await Promise.all([
- useUserStore().refreshUserStat(),
useRoleStore().fetchRoleList(),
useGroupStore().fetchGroupList(),
]);
diff --git a/frontend/src/components/Quickstart.vue b/frontend/src/components/Quickstart.vue
index 79cc245cff..5e7a881837 100644
--- a/frontend/src/components/Quickstart.vue
+++ b/frontend/src/components/Quickstart.vue
@@ -126,7 +126,7 @@ import {
pushNotification,
useUIStateStore,
useProjectV1Store,
- useUserStore,
+ useActuatorV1Store,
} from "@/store";
import { projectNamePrefix } from "@/store/modules/v1/common";
import type { Permission } from "@/types";
@@ -152,7 +152,7 @@ type IntroItem = {
const { t } = useI18n();
const projectStore = useProjectV1Store();
const uiStateStore = useUIStateStore();
-const userStore = useUserStore();
+const actuatorStore = useActuatorV1Store();
const show = computed(() => {
return !uiStateStore.getIntroStateByKey("hidden");
@@ -252,7 +252,7 @@ const introList = computed(() => {
});
const isFirstUser = computed(() => {
- return userStore.activeUserCountWithoutBot === 1;
+ return actuatorStore.getActiveUserCount({ includeBot: false }) === 1;
});
const showQuickstart = computed(() => {
diff --git a/frontend/src/components/WorkspaceInstanceLicenseStats.vue b/frontend/src/components/WorkspaceInstanceLicenseStats.vue
index 701b84500b..ab6970a8fd 100644
--- a/frontend/src/components/WorkspaceInstanceLicenseStats.vue
+++ b/frontend/src/components/WorkspaceInstanceLicenseStats.vue
@@ -42,11 +42,7 @@ import { storeToRefs } from "pinia";
import { computed, reactive } from "vue";
import { useI18n } from "vue-i18n";
import InstanceAssignment from "@/components/InstanceAssignment.vue";
-import {
- useInstanceV1List,
- useInstanceV1Store,
- useSubscriptionV1Store,
-} from "@/store";
+import { useActuatorV1Store, useSubscriptionV1Store } from "@/store";
import { PlanType } from "@/types/proto/v1/subscription_service";
interface LocalState {
@@ -58,9 +54,7 @@ const state = reactive<LocalState>({
showInstanceAssignmentDrawer: false,
});
const subscriptionStore = useSubscriptionV1Store();
-const instanceV1Store = useInstanceV1Store();
-// Prepare instance list.
-useInstanceV1List();
+const actuatorStore = useActuatorV1Store();
const { instanceLicenseCount } = storeToRefs(subscriptionStore);
@@ -72,6 +66,6 @@ const totalLicenseCount = computed((): string => {
});
const activateLicenseCount = computed((): string => {
- return `${instanceV1Store.activateInstanceCount}`;
+ return `${actuatorStore.activatedInstanceCount}`;
});
</script>
diff --git a/frontend/src/components/v2/Select/UserSelect.vue b/frontend/src/components/v2/Select/UserSelect.vue
index 44694bd4ea..fdbdb7b9b5 100644
--- a/frontend/src/components/v2/Select/UserSelect.vue
+++ b/frontend/src/components/v2/Select/UserSelect.vue
@@ -26,19 +26,14 @@ import { useI18n } from "vue-i18n";
import UserIcon from "~icons/heroicons-outline/user";
import UserAvatar from "@/components/User/UserAvatar.vue";
import ServiceAccountTag from "@/components/misc/ServiceAccountTag.vue";
-import { extractUserId, useUserStore } from "@/store";
+import { extractUserId, useUserStore, type UserFilter } from "@/store";
import {
SYSTEM_BOT_USER_NAME,
UNKNOWN_USER_NAME,
allUsersUser,
- isValidProjectName,
isValidUserName,
} from "@/types";
-import {
- UserType,
- userTypeToJSON,
- type User,
-} from "@/types/proto/v1/user_service";
+import { UserType, type User } from "@/types/proto/v1/user_service";
import { getDefaultPagination, ensureUserFullName } from "@/utils";
import ResourceSelect from "./ResourceSelect.vue";
@@ -52,7 +47,6 @@ const props = withDefaults(
includeAllUsers?: boolean;
includeSystemBot?: boolean;
includeServiceAccount?: boolean;
- includeArchived?: boolean;
autoReset?: boolean;
filter?: (user: User, index: number) => boolean;
size?: "tiny" | "small" | "medium" | "large";
@@ -65,7 +59,6 @@ const props = withDefaults(
includeAllUsers: false,
includeSystemBot: false,
includeServiceAccount: false,
- includeArchived: false,
autoReset: true,
filter: undefined,
size: "medium",
@@ -89,7 +82,7 @@ const state = reactive<LocalState>({
rawUserList: [],
});
-const getFilter = (search: string) => {
+const getFilter = (search: string): UserFilter => {
const filter = [];
if (search) {
filter.push(`(name.matches("${search}") || email.matches("${search}"))`);
@@ -101,18 +94,12 @@ const getFilter = (search: string) => {
if (props.includeSystemBot) {
allowedType.push(UserType.SYSTEM_BOT);
}
- if (allowedType.length === 1) {
- filter.push(`user_type == "${userTypeToJSON(allowedType[0])}"`);
- } else {
- filter.push(
- `user_type in [${allowedType.map((t) => `"${userTypeToJSON(t)}"`).join(", ")}]`
- );
- }
- if (props.projectName && isValidProjectName(props.projectName)) {
- filter.push(`project == "${props.projectName}"`);
- }
- return filter.join(" && ");
+ return {
+ query: search,
+ project: props.projectName,
+ types: allowedType,
+ };
};
const initSelectedUsers = async (userIds: string[]) => {
@@ -131,7 +118,6 @@ const searchUsers = async (search: string) => {
const { users } = await userStore.fetchUserList({
filter: getFilter(search),
pageSize: getDefaultPagination(),
- showDeleted: props.includeArchived,
});
return users;
};
diff --git a/frontend/src/store/modules/user.ts b/frontend/src/store/modules/user.ts
index afe74953c0..b3aa9524b5 100644
--- a/frontend/src/store/modules/user.ts
+++ b/frontend/src/store/modules/user.ts
@@ -4,25 +4,51 @@ import { defineStore } from "pinia";
import { computed, ref } from "vue";
import { userServiceClient } from "@/grpcweb";
import {
+ isValidProjectName,
allUsersUser,
SYSTEM_BOT_USER_NAME,
isValidUserName,
unknownUser,
} from "@/types";
-import { State } from "@/types/proto/v1/common";
-import type {
- UpdateUserRequest,
- User,
- StatUsersResponse_StatUser,
-} from "@/types/proto/v1/user_service";
-import { UserType } from "@/types/proto/v1/user_service";
+import { State, stateToJSON } from "@/types/proto/v1/common";
+import type { UpdateUserRequest, User } from "@/types/proto/v1/user_service";
+import { UserType, userTypeToJSON } from "@/types/proto/v1/user_service";
import { ensureUserFullName } from "@/utils";
+import { useActuatorV1Store } from "./v1/actuator";
import { userNamePrefix, extractUserId } from "./v1/common";
import { usePermissionStore } from "./v1/permission";
+export interface UserFilter {
+ query?: string;
+ types?: UserType[];
+ project?: string;
+ state?: State;
+}
+
+const getListUserFilter = (params: UserFilter) => {
+ const filter = [];
+ const search = params.query?.trim()?.toLowerCase();
+ if (search) {
+ filter.push(`(name.matches("${search}") || email.matches("${search}"))`);
+ }
+ if (params.types) {
+ filter.push(
+ `user_type in [${params.types.map((t) => `"${userTypeToJSON(t)}"`).join(", ")}]`
+ );
+ }
+ if (isValidProjectName(params.project)) {
+ filter.push(`project == "${params.project}"`);
+ }
+ if (params.state === State.DELETED) {
+ filter.push(`state == "${stateToJSON(params.state)}"`);
+ }
+
+ return filter.join(" && ");
+};
+
export const useUserStore = defineStore("user", () => {
+ const actuatorStore = useActuatorV1Store();
const allUser = computed(() => allUsersUser());
- const userStats = ref<StatUsersResponse_StatUser[]>([]);
const userRequestCache = new Map<string, Promise<User>>();
const userMapByName = ref<Map<string, User>>(
@@ -42,24 +68,22 @@ export const useUserStore = defineStore("user", () => {
const fetchUserList = async (params: {
pageSize: number;
pageToken?: string;
- filter?: string;
- showDeleted?: boolean;
+ filter?: UserFilter;
}): Promise<{
users: User[];
nextPageToken: string;
}> => {
- const response = await userServiceClient.listUsers(params);
+ const response = await userServiceClient.listUsers({
+ ...params,
+ filter: getListUserFilter(params.filter ?? {}),
+ showDeleted: params.filter?.state === State.DELETED ? true : false,
+ });
for (const user of response.users) {
setUser(user);
}
return response;
};
- const refreshUserStat = async () => {
- const { stats } = await userServiceClient.statUsers({});
- userStats.value = stats;
- };
-
const fetchUser = async (name: string, silent = false) => {
const user = await userServiceClient.getUser(
{
@@ -76,7 +100,7 @@ export const useUserStore = defineStore("user", () => {
const createdUser = await userServiceClient.createUser({
user,
});
- await refreshUserStat();
+ await actuatorStore.fetchServerInfo();
return setUser(createdUser);
};
@@ -95,7 +119,7 @@ export const useUserStore = defineStore("user", () => {
name: user.name,
});
user.state = State.DELETED;
- await refreshUserStat();
+ await actuatorStore.fetchServerInfo();
return user;
};
@@ -103,7 +127,7 @@ export const useUserStore = defineStore("user", () => {
const restoredUser = await userServiceClient.undeleteUser({
name: user.name,
});
- await refreshUserStat();
+ await actuatorStore.fetchServerInfo();
return setUser(restoredUser);
};
@@ -140,31 +164,16 @@ export const useUserStore = defineStore("user", () => {
return userMapByName.value.get(`${userNamePrefix}${id}`);
};
- const activeUserCountWithoutBot = computed(() => {
- return userStats.value.reduce((count, stat) => {
- if (
- stat.state === State.ACTIVE &&
- stat.userType !== UserType.SYSTEM_BOT
- ) {
- count += stat.count;
- }
- return count;
- }, 0);
- });
-
return {
allUser,
- userStats,
systemBotUser,
fetchUserList,
- refreshUserStat,
createUser,
updateUser,
getOrFetchUserByIdentifier,
getUserByIdentifier,
archiveUser,
restoreUser,
- activeUserCountWithoutBot,
};
});
diff --git a/frontend/src/store/modules/v1/actuator.ts b/frontend/src/store/modules/v1/actuator.ts
index 5ff38baaaf..563aaa20ff 100644
--- a/frontend/src/store/modules/v1/actuator.ts
+++ b/frontend/src/store/modules/v1/actuator.ts
@@ -1,3 +1,9 @@
+import type { RemovableRef } from "@vueuse/core";
+import { useLocalStorage } from "@vueuse/core";
+import axios from "axios";
+import { defineStore } from "pinia";
+import semver from "semver";
+import { computed } from "vue";
import { actuatorServiceClient } from "@/grpcweb";
import { useSilentRequest } from "@/plugins/silent-request";
import {
@@ -11,14 +17,10 @@ import type {
ActuatorInfo,
ResourcePackage,
} from "@/types/proto/v1/actuator_service";
+import { State } from "@/types/proto/v1/common";
import { PasswordRestrictionSetting } from "@/types/proto/v1/setting_service";
+import { UserType } from "@/types/proto/v1/user_service";
import { semverCompare } from "@/utils";
-import type { RemovableRef } from "@vueuse/core";
-import { useLocalStorage } from "@vueuse/core";
-import axios from "axios";
-import { defineStore } from "pinia";
-import semver from "semver";
-import { computed } from "vue";
const EXTERNAL_URL_PLACEHOLDER =
"https://www.bytebase.com/docs/get-started/install/external-url";
@@ -114,8 +116,34 @@ export const useActuatorV1Store = defineStore("actuator_v1", {
})
);
},
+ activatedInstanceCount: (state) => {
+ return state.serverInfo?.activatedInstanceCount ?? 0;
+ },
+ totalInstanceCount: (state) => {
+ return state.serverInfo?.totalInstanceCount ?? 0;
+ },
+ inactiveUserCount: (state) => {
+ return (state.serverInfo?.userStats ?? []).reduce((count, stat) => {
+ if (stat.state === State.DELETED) {
+ count += stat.count;
+ }
+ return count;
+ }, 0);
+ },
},
actions: {
+ getActiveUserCount({ includeBot }: { includeBot: boolean }) {
+ return (this.serverInfo?.userStats ?? []).reduce((count, stat) => {
+ if (stat.state !== State.ACTIVE) {
+ return count;
+ }
+ if (!includeBot && stat.userType === UserType.SYSTEM_BOT) {
+ return count;
+ }
+ count += stat.count;
+ return count;
+ }, 0);
+ },
setLogo(logo: string) {
if (this.resourcePackage) {
this.resourcePackage.logo = new TextEncoder().encode(logo);
diff --git a/frontend/src/types/proto/google/protobuf/descriptor.ts b/frontend/src/types/proto/google/protobuf/descriptor.ts
index ae3f877dc7..2fdf22f5e2 100644
--- a/frontend/src/types/proto/google/protobuf/descriptor.ts
+++ b/frontend/src/types/proto/google/protobuf/descriptor.ts
@@ -36,7 +36,7 @@ export enum Edition {
EDITION_2024 = "EDITION_2024",
/**
* EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be
- * used or relyed on outside of tests.
+ * used or relied on outside of tests.
*/
EDITION_1_TEST_ONLY = "EDITION_1_TEST_ONLY",
EDITION_2_TEST_ONLY = "EDITION_2_TEST_ONLY",
@@ -1093,12 +1093,13 @@ export interface MessageOptions {
export interface FieldOptions {
/**
+ * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
* The ctype option instructs the C++ code generator to use a different
* representation of the field than it normally would. See the specific
* options below. This option is only implemented to support use of
* [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
- * type "bytes" in the open source release -- sorry, we'll try to include
- * other types in a future version!
+ * type "bytes" in the open source release.
+ * TODO: make ctype actually deprecated.
*/
ctype?:
| FieldOptions_CType
@@ -1314,11 +1315,7 @@ export function fieldOptions_JSTypeToNumber(object: FieldOptions_JSType): number
}
}
-/**
- * If set to RETENTION_SOURCE, the option will be omitted from the binary.
- * Note: as of January 2023, support for this is in progress and does not yet
- * have an effect (b/264593489).
- */
+/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */
export enum FieldOptions_OptionRetention {
RETENTION_UNKNOWN = "RETENTION_UNKNOWN",
RETENTION_RUNTIME = "RETENTION_RUNTIME",
@@ -1375,8 +1372,7 @@ export function fieldOptions_OptionRetentionToNumber(object: FieldOptions_Option
/**
* This indicates the types of entities that the field may apply to when used
* as an option. If it is unset, then the field may be freely used as an
- * option on any kind of entity. Note: as of January 2023, support for this is
- * in progress and does not yet have an effect (b/264593489).
+ * option on any kind of entity.
*/
export enum FieldOptions_OptionTargetType {
TARGET_TYPE_UNKNOWN = "TARGET_TYPE_UNKNOWN",
diff --git a/frontend/src/types/proto/v1/actuator_service.ts b/frontend/src/types/proto/v1/actuator_service.ts
index 0c5f1bd309..ad51ae7485 100644
--- a/frontend/src/types/proto/v1/actuator_service.ts
+++ b/frontend/src/types/proto/v1/actuator_service.ts
@@ -10,7 +10,9 @@ import Long from "long";
import { Empty } from "../google/protobuf/empty";
import { FieldMask } from "../google/protobuf/field_mask";
import { Timestamp } from "../google/protobuf/timestamp";
+import { State, stateFromJSON, stateToJSON, stateToNumber } from "./common";
import { PasswordRestrictionSetting } from "./setting_service";
+import { UserType, userTypeFromJSON, userTypeToJSON, userTypeToNumber } from "./user_service";
export const protobufPackage = "bytebase.v1";
@@ -82,6 +84,15 @@ export interface ActuatorInfo {
| undefined;
/** docker flag means if the Bytebase instance is running in docker. */
docker: boolean;
+ userStats: ActuatorInfo_StatUser[];
+ activatedInstanceCount: number;
+ totalInstanceCount: number;
+}
+
+export interface ActuatorInfo_StatUser {
+ userType: UserType;
+ state: State;
+ count: number;
}
function createBaseGetResourcePackageRequest(): GetResourcePackageRequest {
@@ -369,6 +380,9 @@ function createBaseActuatorInfo(): ActuatorInfo {
disallowPasswordSignin: false,
passwordRestriction: undefined,
docker: false,
+ userStats: [],
+ activatedInstanceCount: 0,
+ totalInstanceCount: 0,
};
}
@@ -428,6 +442,15 @@ export const ActuatorInfo: MessageFns<ActuatorInfo> = {
if (message.docker !== false) {
writer.uint32(176).bool(message.docker);
}
+ for (const v of message.userStats) {
+ ActuatorInfo_StatUser.encode(v!, writer.uint32(186).fork()).join();
+ }
+ if (message.activatedInstanceCount !== 0) {
+ writer.uint32(192).int32(message.activatedInstanceCount);
+ }
+ if (message.totalInstanceCount !== 0) {
+ writer.uint32(200).int32(message.totalInstanceCount);
+ }
return writer;
},
@@ -582,6 +605,30 @@ export const ActuatorInfo: MessageFns<ActuatorInfo> = {
message.docker = reader.bool();
continue;
}
+ case 23: {
+ if (tag !== 186) {
+ break;
+ }
+
+ message.userStats.push(ActuatorInfo_StatUser.decode(reader, reader.uint32()));
+ continue;
+ }
+ case 24: {
+ if (tag !== 192) {
+ break;
+ }
+
+ message.activatedInstanceCount = reader.int32();
+ continue;
+ }
+ case 25: {
+ if (tag !== 200) {
+ break;
+ }
+
+ message.totalInstanceCount = reader.int32();
+ continue;
+ }
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -617,6 +664,13 @@ export const ActuatorInfo: MessageFns<ActuatorInfo> = {
? PasswordRestrictionSetting.fromJSON(object.passwordRestriction)
: undefined,
docker: isSet(object.docker) ? globalThis.Boolean(object.docker) : false,
+ userStats: globalThis.Array.isArray(object?.userStats)
+ ? object.userStats.map((e: any) => ActuatorInfo_StatUser.fromJSON(e))
+ : [],
+ activatedInstanceCount: isSet(object.activatedInstanceCount)
+ ? globalThis.Number(object.activatedInstanceCount)
+ : 0,
+ totalInstanceCount: isSet(object.totalInstanceCount) ? globalThis.Number(object.totalInstanceCount) : 0,
};
},
@@ -676,6 +730,15 @@ export const ActuatorInfo: MessageFns<ActuatorInfo> = {
if (message.docker !== false) {
obj.docker = message.docker;
}
+ if (message.userStats?.length) {
+ obj.userStats = message.userStats.map((e) => ActuatorInfo_StatUser.toJSON(e));
+ }
+ if (message.activatedInstanceCount !== 0) {
+ obj.activatedInstanceCount = Math.round(message.activatedInstanceCount);
+ }
+ if (message.totalInstanceCount !== 0) {
+ obj.totalInstanceCount = Math.round(message.totalInstanceCount);
+ }
return obj;
},
@@ -706,6 +769,101 @@ export const ActuatorInfo: MessageFns<ActuatorInfo> = {
? PasswordRestrictionSetting.fromPartial(object.passwordRestriction)
: undefined;
message.docker = object.docker ?? false;
+ message.userStats = object.userStats?.map((e) => ActuatorInfo_StatUser.fromPartial(e)) || [];
+ message.activatedInstanceCount = object.activatedInstanceCount ?? 0;
+ message.totalInstanceCount = object.totalInstanceCount ?? 0;
+ return message;
+ },
+};
+
+function createBaseActuatorInfo_StatUser(): ActuatorInfo_StatUser {
+ return { userType: UserType.USER_TYPE_UNSPECIFIED, state: State.STATE_UNSPECIFIED, count: 0 };
+}
+
+export const ActuatorInfo_StatUser: MessageFns<ActuatorInfo_StatUser> = {
+ encode(message: ActuatorInfo_StatUser, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
+ if (message.userType !== UserType.USER_TYPE_UNSPECIFIED) {
+ writer.uint32(8).int32(userTypeToNumber(message.userType));
+ }
+ if (message.state !== State.STATE_UNSPECIFIED) {
+ writer.uint32(16).int32(stateToNumber(message.state));
+ }
+ if (message.count !== 0) {
+ writer.uint32(24).int32(message.count);
+ }
+ return writer;
+ },
+
+ decode(input: BinaryReader | Uint8Array, length?: number): ActuatorInfo_StatUser {
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseActuatorInfo_StatUser();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (tag !== 8) {
+ break;
+ }
+
+ message.userType = userTypeFromJSON(reader.int32());
+ continue;
+ }
+ case 2: {
+ if (tag !== 16) {
+ break;
+ }
+
+ message.state = stateFromJSON(reader.int32());
+ continue;
+ }
+ case 3: {
+ if (tag !== 24) {
+ break;
+ }
+
+ message.count = reader.int32();
+ continue;
+ }
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skip(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): ActuatorInfo_StatUser {
+ return {
+ userType: isSet(object.userType) ? userTypeFromJSON(object.userType) : UserType.USER_TYPE_UNSPECIFIED,
+ state: isSet(object.state) ? stateFromJSON(object.state) : State.STATE_UNSPECIFIED,
+ count: isSet(object.count) ? globalThis.Number(object.count) : 0,
+ };
+ },
+
+ toJSON(message: ActuatorInfo_StatUser): unknown {
+ const obj: any = {};
+ if (message.userType !== UserType.USER_TYPE_UNSPECIFIED) {
+ obj.userType = userTypeToJSON(message.userType);
+ }
+ if (message.state !== State.STATE_UNSPECIFIED) {
+ obj.state = stateToJSON(message.state);
+ }
+ if (message.count !== 0) {
+ obj.count = Math.round(message.count);
+ }
+ return obj;
+ },
+
+ create(base?: DeepPartial<ActuatorInfo_StatUser>): ActuatorInfo_StatUser {
+ return ActuatorInfo_StatUser.fromPartial(base ?? {});
+ },
+ fromPartial(object: DeepPartial<ActuatorInfo_StatUser>): ActuatorInfo_StatUser {
+ const message = createBaseActuatorInfo_StatUser();
+ message.userType = object.userType ?? UserType.USER_TYPE_UNSPECIFIED;
+ message.state = object.state ?? State.STATE_UNSPECIFIED;
+ message.count = object.count ?? 0;
return message;
},
};
diff --git a/frontend/src/types/proto/v1/user_service.ts b/frontend/src/types/proto/v1/user_service.ts
index 2c813244f6..84e8958402 100644
--- a/frontend/src/types/proto/v1/user_service.ts
+++ b/frontend/src/types/proto/v1/user_service.ts
@@ -83,19 +83,6 @@ export interface GetUserRequest {
name: string;
}
-export interface StatUsersRequest {
-}
-
-export interface StatUsersResponse {
- stats: StatUsersResponse_StatUser[];
-}
-
-export interface StatUsersResponse_StatUser {
- userType: UserType;
- state: State;
- count: number;
-}
-
export interface ListUsersRequest {
/**
* The maximum number of users to return. The service may return fewer than
@@ -291,203 +278,6 @@ export const GetUserRequest: MessageFns<GetUserRequest> = {
},
};
-function createBaseStatUsersRequest(): StatUsersRequest {
- return {};
-}
-
-export const StatUsersRequest: MessageFns<StatUsersRequest> = {
- encode(_: StatUsersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): StatUsersRequest {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseStatUsersRequest();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(_: any): StatUsersRequest {
- return {};
- },
-
- toJSON(_: StatUsersRequest): unknown {
- const obj: any = {};
- return obj;
- },
-
- create(base?: DeepPartial<StatUsersRequest>): StatUsersRequest {
- return StatUsersRequest.fromPartial(base ?? {});
- },
- fromPartial(_: DeepPartial<StatUsersRequest>): StatUsersRequest {
- const message = createBaseStatUsersRequest();
- return message;
- },
-};
-
-function createBaseStatUsersResponse(): StatUsersResponse {
- return { stats: [] };
-}
-
-export const StatUsersResponse: MessageFns<StatUsersResponse> = {
- encode(message: StatUsersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- for (const v of message.stats) {
- StatUsersResponse_StatUser.encode(v!, writer.uint32(10).fork()).join();
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): StatUsersResponse {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseStatUsersResponse();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 10) {
- break;
- }
-
- message.stats.push(StatUsersResponse_StatUser.decode(reader, reader.uint32()));
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): StatUsersResponse {
- return {
- stats: globalThis.Array.isArray(object?.stats)
- ? object.stats.map((e: any) => StatUsersResponse_StatUser.fromJSON(e))
- : [],
- };
- },
-
- toJSON(message: StatUsersResponse): unknown {
- const obj: any = {};
- if (message.stats?.length) {
- obj.stats = message.stats.map((e) => StatUsersResponse_StatUser.toJSON(e));
- }
- return obj;
- },
-
- create(base?: DeepPartial<StatUsersResponse>): StatUsersResponse {
- return StatUsersResponse.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<StatUsersResponse>): StatUsersResponse {
- const message = createBaseStatUsersResponse();
- message.stats = object.stats?.map((e) => StatUsersResponse_StatUser.fromPartial(e)) || [];
- return message;
- },
-};
-
-function createBaseStatUsersResponse_StatUser(): StatUsersResponse_StatUser {
- return { userType: UserType.USER_TYPE_UNSPECIFIED, state: State.STATE_UNSPECIFIED, count: 0 };
-}
-
-export const StatUsersResponse_StatUser: MessageFns<StatUsersResponse_StatUser> = {
- encode(message: StatUsersResponse_StatUser, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
- if (message.userType !== UserType.USER_TYPE_UNSPECIFIED) {
- writer.uint32(8).int32(userTypeToNumber(message.userType));
- }
- if (message.state !== State.STATE_UNSPECIFIED) {
- writer.uint32(16).int32(stateToNumber(message.state));
- }
- if (message.count !== 0) {
- writer.uint32(24).int32(message.count);
- }
- return writer;
- },
-
- decode(input: BinaryReader | Uint8Array, length?: number): StatUsersResponse_StatUser {
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
- let end = length === undefined ? reader.len : reader.pos + length;
- const message = createBaseStatUsersResponse_StatUser();
- while (reader.pos < end) {
- const tag = reader.uint32();
- switch (tag >>> 3) {
- case 1: {
- if (tag !== 8) {
- break;
- }
-
- message.userType = userTypeFromJSON(reader.int32());
- continue;
- }
- case 2: {
- if (tag !== 16) {
- break;
- }
-
- message.state = stateFromJSON(reader.int32());
- continue;
- }
- case 3: {
- if (tag !== 24) {
- break;
- }
-
- message.count = reader.int32();
- continue;
- }
- }
- if ((tag & 7) === 4 || tag === 0) {
- break;
- }
- reader.skip(tag & 7);
- }
- return message;
- },
-
- fromJSON(object: any): StatUsersResponse_StatUser {
- return {
- userType: isSet(object.userType) ? userTypeFromJSON(object.userType) : UserType.USER_TYPE_UNSPECIFIED,
- state: isSet(object.state) ? stateFromJSON(object.state) : State.STATE_UNSPECIFIED,
- count: isSet(object.count) ? globalThis.Number(object.count) : 0,
- };
- },
-
- toJSON(message: StatUsersResponse_StatUser): unknown {
- const obj: any = {};
- if (message.userType !== UserType.USER_TYPE_UNSPECIFIED) {
- obj.userType = userTypeToJSON(message.userType);
- }
- if (message.state !== State.STATE_UNSPECIFIED) {
- obj.state = stateToJSON(message.state);
- }
- if (message.count !== 0) {
- obj.count = Math.round(message.count);
- }
- return obj;
- },
-
- create(base?: DeepPartial<StatUsersResponse_StatUser>): StatUsersResponse_StatUser {
- return StatUsersResponse_StatUser.fromPartial(base ?? {});
- },
- fromPartial(object: DeepPartial<StatUsersResponse_StatUser>): StatUsersResponse_StatUser {
- const message = createBaseStatUsersResponse_StatUser();
- message.userType = object.userType ?? UserType.USER_TYPE_UNSPECIFIED;
- message.state = object.state ?? State.STATE_UNSPECIFIED;
- message.count = object.count ?? 0;
- return message;
- },
-};
-
function createBaseListUsersRequest(): ListUsersRequest {
return { pageSize: 0, pageToken: "", showDeleted: false, filter: "" };
}
@@ -1397,26 +1187,6 @@ export const UserServiceDefinition = {
},
},
},
- /**
- * Get user stat.
- * Any authenticated user can get stat.
- */
- statUsers: {
- name: "StatUsers",
- requestType: StatUsersRequest,
- requestStream: false,
- responseType: StatUsersResponse,
- responseStream: false,
- options: {
- _unknownFields: {
- 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],
- 800016: [new Uint8Array([2])],
- 578365826: [
- new Uint8Array([19, 58, 1, 42, 34, 14, 47, 118, 49, 47, 117, 115, 101, 114, 115, 58, 115, 116, 97, 116]),
- ],
- },
- },
- },
/**
* Create a user.
* When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.
diff --git a/frontend/src/views/SettingWorkspaceSubscription.vue b/frontend/src/views/SettingWorkspaceSubscription.vue
index 609f8109b8..7e2cdb3dc7 100644
--- a/frontend/src/views/SettingWorkspaceSubscription.vue
+++ b/frontend/src/views/SettingWorkspaceSubscription.vue
@@ -72,7 +72,7 @@
{{ $t("subscription.instance-assignment.used-and-total-user") }}
</div>
<div class="mt-1 text-4xl flex items-center gap-2">
- {{ userStore.activeUserCountWithoutBot }}
+ {{ activeUserCountWithoutBot }}
<span class="font-mono text-gray-500">/</span>
{{ userLimit }}
</div>
@@ -170,7 +170,7 @@ import {
pushNotification,
useSubscriptionV1Store,
useSettingV1Store,
- useUserStore,
+ useActuatorV1Store,
} from "@/store";
import { ENTERPRISE_INQUIRE_LINK } from "@/types";
import { PlanType } from "@/types/proto/v1/subscription_service";
@@ -191,7 +191,7 @@ const { t } = useI18n();
const { locale } = useLanguage();
const subscriptionStore = useSubscriptionV1Store();
const settingV1Store = useSettingV1Store();
-const userStore = useUserStore();
+const actuatorStore = useActuatorV1Store();
const state = reactive<LocalState>({
loading: false,
@@ -204,6 +204,10 @@ const disabled = computed((): boolean => {
return state.loading || !state.license;
});
+const activeUserCountWithoutBot = computed(() =>
+ actuatorStore.getActiveUserCount({ includeBot: false })
+);
+
const userLimit = computed((): string => {
if (subscriptionStore.userCountLimit === Number.MAX_VALUE) {
return t("subscription.unlimited");
diff --git a/frontend/src/views/SettingWorkspaceUsers.vue b/frontend/src/views/SettingWorkspaceUsers.vue
index 835d81edcf..a6abeddcdf 100644
--- a/frontend/src/views/SettingWorkspaceUsers.vue
+++ b/frontend/src/views/SettingWorkspaceUsers.vue
@@ -208,9 +208,10 @@ import {
useSettingV1Store,
featureToRef,
useSubscriptionV1Store,
+ useActuatorV1Store,
} from "@/store";
import { groupNamePrefix } from "@/store/modules/v1/common";
-import { State, stateToJSON } from "@/types/proto/v1/common";
+import { State } from "@/types/proto/v1/common";
import type { Group } from "@/types/proto/v1/group_service";
import { WorkspaceProfileSetting } from "@/types/proto/v1/setting_service";
import { type User } from "@/types/proto/v1/user_service";
@@ -254,6 +255,7 @@ const router = useRouter();
const userStore = useUserStore();
const groupStore = useGroupStore();
const uiStateStore = useUIStateStore();
+const actuatorStore = useActuatorV1Store();
const settingV1Store = useSettingV1Store();
const subscriptionV1Store = useSubscriptionV1Store();
const userPagedTable = ref<ComponentExposed<typeof PagedTable<User>>>();
@@ -291,10 +293,9 @@ const fetchUserList = async ({
const { users, nextPageToken } = await userStore.fetchUserList({
pageToken,
pageSize,
- showDeleted: false,
- filter: state.activeUserFilterText
- ? `name.matches("${state.activeUserFilterText}")`
- : "",
+ filter: {
+ query: state.activeUserFilterText,
+ },
});
return { list: users, nextPageToken };
};
@@ -314,8 +315,9 @@ const fetchInactiveUserList = async ({
const { users, nextPageToken } = await userStore.fetchUserList({
pageToken,
pageSize,
- showDeleted: true,
- filter: `state == "${stateToJSON(State.DELETED)}"`,
+ filter: {
+ state: State.DELETED,
+ },
});
return { list: users, nextPageToken };
};
@@ -370,27 +372,18 @@ const filteredGroupList = computed(() => {
});
const activeUserCount = computed(() => {
- return userStore.userStats.reduce((count, stat) => {
- if (stat.state === State.ACTIVE) {
- count += stat.count;
- }
- return count;
- }, 0);
+ return actuatorStore.getActiveUserCount({ includeBot: true });
});
const inactiveUserCount = computed(() => {
- return userStore.userStats.reduce((count, stat) => {
- if (stat.state === State.DELETED) {
- count += stat.count;
- }
- return count;
- }, 0);
+ return actuatorStore.inactiveUserCount;
});
const remainingUserCount = computed((): number => {
return Math.max(
0,
- subscriptionV1Store.userCountLimit - userStore.activeUserCountWithoutBot
+ subscriptionV1Store.userCountLimit -
+ actuatorStore.getActiveUserCount({ includeBot: false })
);
});
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 01a8e03858..0107b70821 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -7318,33 +7318,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
- /v1/users:stat:
- post:
- tags:
- - UserService
- description: |-
- Get user stat.
- Any authenticated user can get stat.
- operationId: UserService_StatUsers
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/StatUsersRequest'
- required: true
- responses:
- "200":
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/StatUsersResponse'
- default:
- description: Default error response
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Status'
/v1/worksheets:
post:
tags:
@@ -7857,9 +7830,40 @@ components:
docker:
type: boolean
description: docker flag means if the Bytebase instance is running in docker.
+ userStats:
+ type: array
+ items:
+ $ref: '#/components/schemas/ActuatorInfo_StatUser'
+ activatedInstanceCount:
+ type: integer
+ format: int32
+ totalInstanceCount:
+ type: integer
+ format: int32
description: |-
ServerInfo is the API message for server info.
Actuator concept is similar to the Spring Boot Actuator.
+ ActuatorInfo_StatUser:
+ type: object
+ properties:
+ userType:
+ enum:
+ - USER_TYPE_UNSPECIFIED
+ - USER
+ - SYSTEM_BOT
+ - SERVICE_ACCOUNT
+ type: string
+ format: enum
+ state:
+ enum:
+ - STATE_UNSPECIFIED
+ - ACTIVE
+ - DELETED
+ type: string
+ format: enum
+ count:
+ type: integer
+ format: int32
AddDataSourceRequest:
required:
- name
@@ -13019,37 +13023,6 @@ components:
type: array
items:
$ref: '#/components/schemas/Task'
- StatUsersRequest:
- type: object
- properties: {}
- StatUsersResponse:
- type: object
- properties:
- stats:
- type: array
- items:
- $ref: '#/components/schemas/StatUsersResponse_StatUser'
- StatUsersResponse_StatUser:
- type: object
- properties:
- userType:
- enum:
- - USER_TYPE_UNSPECIFIED
- - USER
- - SYSTEM_BOT
- - SERVICE_ACCOUNT
- type: string
- format: enum
- state:
- enum:
- - STATE_UNSPECIFIED
- - ACTIVE
- - DELETED
- type: string
- format: enum
- count:
- type: integer
- format: int32
Status:
type: object
properties:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index b082c436ae..4552100e87 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -272,8 +272,24 @@
- [SettingService](#bytebase-v1-SettingService)
+- [v1/user_service.proto](#v1_user_service-proto)
+ - [CreateUserRequest](#bytebase-v1-CreateUserRequest)
+ - [DeleteUserRequest](#bytebase-v1-DeleteUserRequest)
+ - [GetUserRequest](#bytebase-v1-GetUserRequest)
+ - [ListUsersRequest](#bytebase-v1-ListUsersRequest)
+ - [ListUsersResponse](#bytebase-v1-ListUsersResponse)
+ - [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest)
+ - [UpdateUserRequest](#bytebase-v1-UpdateUserRequest)
+ - [User](#bytebase-v1-User)
+ - [User.Profile](#bytebase-v1-User-Profile)
+
+ - [UserType](#bytebase-v1-UserType)
+
+ - [UserService](#bytebase-v1-UserService)
+
- [v1/actuator_service.proto](#v1_actuator_service-proto)
- [ActuatorInfo](#bytebase-v1-ActuatorInfo)
+ - [ActuatorInfo.StatUser](#bytebase-v1-ActuatorInfo-StatUser)
- [DeleteCacheRequest](#bytebase-v1-DeleteCacheRequest)
- [GetActuatorInfoRequest](#bytebase-v1-GetActuatorInfoRequest)
- [GetResourcePackageRequest](#bytebase-v1-GetResourcePackageRequest)
@@ -315,24 +331,6 @@
- [AuditLogService](#bytebase-v1-AuditLogService)
-- [v1/user_service.proto](#v1_user_service-proto)
- - [CreateUserRequest](#bytebase-v1-CreateUserRequest)
- - [DeleteUserRequest](#bytebase-v1-DeleteUserRequest)
- - [GetUserRequest](#bytebase-v1-GetUserRequest)
- - [ListUsersRequest](#bytebase-v1-ListUsersRequest)
- - [ListUsersResponse](#bytebase-v1-ListUsersResponse)
- - [StatUsersRequest](#bytebase-v1-StatUsersRequest)
- - [StatUsersResponse](#bytebase-v1-StatUsersResponse)
- - [StatUsersResponse.StatUser](#bytebase-v1-StatUsersResponse-StatUser)
- - [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest)
- - [UpdateUserRequest](#bytebase-v1-UpdateUserRequest)
- - [User](#bytebase-v1-User)
- - [User.Profile](#bytebase-v1-User-Profile)
-
- - [UserType](#bytebase-v1-UserType)
-
- - [UserService](#bytebase-v1-UserService)
-
- [v1/auth_service.proto](#v1_auth_service-proto)
- [IdentityProviderContext](#bytebase-v1-IdentityProviderContext)
- [LoginRequest](#bytebase-v1-LoginRequest)
@@ -4952,6 +4950,213 @@ We support three types of SMTP encryption: NONE, STARTTLS, and SSL/TLS.
+<a name="v1_user_service-proto"></a>
+<p align="right"><a href="#top">Top</a></p>
+
+## v1/user_service.proto
+
+
+
+<a name="bytebase-v1-CreateUserRequest"></a>
+
+### CreateUserRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| user | [User](#bytebase-v1-User) | | The user to create. |
+
+
+
+
+
+
+<a name="bytebase-v1-DeleteUserRequest"></a>
+
+### DeleteUserRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| name | [string](#string) | | The name of the user to delete. Format: users/{user} |
+
+
+
+
+
+
+<a name="bytebase-v1-GetUserRequest"></a>
+
+### GetUserRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| name | [string](#string) | | The name of the user to retrieve. Format: users/{user uid or user email} |
+
+
+
+
+
+
+<a name="bytebase-v1-ListUsersRequest"></a>
+
+### ListUsersRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| page_size | [int32](#int32) | | The maximum number of users to return. The service may return fewer than this value. If unspecified, at most 10 users will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |
+| page_token | [string](#string) | | A page token, received from a previous `ListUsers` call. Provide this to retrieve the subsequent page.
+
+When paginating, all other parameters provided to `ListUsers` must match the call that provided the page token. |
+| show_deleted | [bool](#bool) | | Show deleted users if specified. |
+| filter | [string](#string) | | Filter is used to filter users returned in the list. Supported filter: - name - email - user_type - state - project
+
+For example: name == &#34;ed&#34; name.matches(&#34;ed&#34;) email == &#34;[email protected]&#34; email.matches(&#34;ed&#34;) user_type == &#34;SERVICE_ACCOUNT&#34; user_type in [&#34;SERVICE_ACCOUNT&#34;, &#34;USER&#34;] !(user_type in [&#34;SERVICE_ACCOUNT&#34;, &#34;USER&#34;]) state == &#34;DELETED&#34; project == &#34;projects/sample-project&#34; You can combine filter conditions like: name.matches(&#34;ed&#34;) &amp;&amp; project == &#34;projects/sample-project&#34; (name == &#34;ed&#34; || email == &#34;[email protected]&#34;) &amp;&amp; project == &#34;projects/sample-project&#34; |
+
+
+
+
+
+
+<a name="bytebase-v1-ListUsersResponse"></a>
+
+### ListUsersResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| users | [User](#bytebase-v1-User) | repeated | The users from the specified request. |
+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |
+
+
+
+
+
+
+<a name="bytebase-v1-UndeleteUserRequest"></a>
+
+### UndeleteUserRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| name | [string](#string) | | The name of the deleted user. Format: users/{user} |
+
+
+
+
+
+
+<a name="bytebase-v1-UpdateUserRequest"></a>
+
+### UpdateUserRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| user | [User](#bytebase-v1-User) | | The user to update.
+
+The user&#39;s `name` field is used to identify the user to update. Format: users/{user} |
+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |
+| otp_code | [string](#string) | optional | The otp_code is used to verify the user&#39;s identity by MFA. |
+| regenerate_temp_mfa_secret | [bool](#bool) | | The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user. This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response. |
+| regenerate_recovery_codes | [bool](#bool) | | The regenerate_recovery_codes flag means to regenerate recovery codes for user. |
+
+
+
+
+
+
+<a name="bytebase-v1-User"></a>
+
+### User
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| name | [string](#string) | | The name of the user. Format: users/{user}. {user} is a system-generated unique ID. |
+| state | [State](#bytebase-v1-State) | | |
+| email | [string](#string) | | |
+| title | [string](#string) | | |
+| user_type | [UserType](#bytebase-v1-UserType) | | |
+| password | [string](#string) | | |
+| service_key | [string](#string) | | |
+| mfa_enabled | [bool](#bool) | | The mfa_enabled flag means if the user has enabled MFA. |
+| mfa_secret | [string](#string) | | The mfa_secret is the temporary secret using in two phase verification. |
+| recovery_codes | [string](#string) | repeated | The recovery_codes is the temporary recovery codes using in two phase verification. |
+| phone | [string](#string) | | Should be a valid E.164 compliant phone number. Could be empty. |
+| profile | [User.Profile](#bytebase-v1-User-Profile) | | |
+
+
+
+
+
+
+<a name="bytebase-v1-User-Profile"></a>
+
+### User.Profile
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| last_login_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
+| last_change_password_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
+| source | [string](#string) | | source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. |
+
+
+
+
+
+
+
+
+<a name="bytebase-v1-UserType"></a>
+
+### UserType
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| USER_TYPE_UNSPECIFIED | 0 | |
+| USER | 1 | |
+| SYSTEM_BOT | 2 | |
+| SERVICE_ACCOUNT | 3 | |
+
+
+
+
+
+
+
+<a name="bytebase-v1-UserService"></a>
+
+### UserService
+
+
+| Method Name | Request Type | Response Type | Description |
+| ----------- | ------------ | ------------- | ------------|
+| GetUser | [GetUserRequest](#bytebase-v1-GetUserRequest) | [User](#bytebase-v1-User) | Get the user. Any authenticated user can get the user. |
+| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | List all users. Any authenticated user can list users. |
+| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | Create a user. When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user. Otherwise, any unauthenticated user can create a user. |
+| UpdateUser | [UpdateUserRequest](#bytebase-v1-UpdateUserRequest) | [User](#bytebase-v1-User) | Only the user itself and the user with bb.users.update permission on the workspace can update the user. |
+| DeleteUser | [DeleteUserRequest](#bytebase-v1-DeleteUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Only the user with bb.users.delete permission on the workspace can delete the user. The last remaining workspace admin cannot be deleted. |
+| UndeleteUser | [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest) | [User](#bytebase-v1-User) | Only the user with bb.users.undelete permission on the workspace can undelete the user. |
+
+
+
+
+
<a name="v1_actuator_service-proto"></a>
<p align="right"><a href="#top">Top</a></p>
@@ -4986,6 +5191,26 @@ Actuator concept is similar to the Spring Boot Actuator.
| disallow_password_signin | [bool](#bool) | | disallow_password_signin is the flag to disallow user signin with email&amp;password. (except workspace admins) |
| password_restriction | [PasswordRestrictionSetting](#bytebase-v1-PasswordRestrictionSetting) | | |
| docker | [bool](#bool) | | docker flag means if the Bytebase instance is running in docker. |
+| user_stats | [ActuatorInfo.StatUser](#bytebase-v1-ActuatorInfo-StatUser) | repeated | |
+| activated_instance_count | [int32](#int32) | | |
+| total_instance_count | [int32](#int32) | | |
+
+
+
+
+
+
+<a name="bytebase-v1-ActuatorInfo-StatUser"></a>
+
+### ActuatorInfo.StatUser
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| user_type | [UserType](#bytebase-v1-UserType) | | |
+| state | [State](#bytebase-v1-State) | | |
+| count | [int32](#int32) | | |
@@ -5488,256 +5713,6 @@ For example: - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39;&#
-<a name="v1_user_service-proto"></a>
-<p align="right"><a href="#top">Top</a></p>
-
-## v1/user_service.proto
-
-
-
-<a name="bytebase-v1-CreateUserRequest"></a>
-
-### CreateUserRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| user | [User](#bytebase-v1-User) | | The user to create. |
-
-
-
-
-
-
-<a name="bytebase-v1-DeleteUserRequest"></a>
-
-### DeleteUserRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of the user to delete. Format: users/{user} |
-
-
-
-
-
-
-<a name="bytebase-v1-GetUserRequest"></a>
-
-### GetUserRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of the user to retrieve. Format: users/{user uid or user email} |
-
-
-
-
-
-
-<a name="bytebase-v1-ListUsersRequest"></a>
-
-### ListUsersRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| page_size | [int32](#int32) | | The maximum number of users to return. The service may return fewer than this value. If unspecified, at most 10 users will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |
-| page_token | [string](#string) | | A page token, received from a previous `ListUsers` call. Provide this to retrieve the subsequent page.
-
-When paginating, all other parameters provided to `ListUsers` must match the call that provided the page token. |
-| show_deleted | [bool](#bool) | | Show deleted users if specified. |
-| filter | [string](#string) | | Filter is used to filter users returned in the list. Supported filter: - name - email - user_type - state - project
-
-For example: name == &#34;ed&#34; name.matches(&#34;ed&#34;) email == &#34;[email protected]&#34; email.matches(&#34;ed&#34;) user_type == &#34;SERVICE_ACCOUNT&#34; user_type in [&#34;SERVICE_ACCOUNT&#34;, &#34;USER&#34;] !(user_type in [&#34;SERVICE_ACCOUNT&#34;, &#34;USER&#34;]) state == &#34;DELETED&#34; project == &#34;projects/sample-project&#34; You can combine filter conditions like: name.matches(&#34;ed&#34;) &amp;&amp; project == &#34;projects/sample-project&#34; (name == &#34;ed&#34; || email == &#34;[email protected]&#34;) &amp;&amp; project == &#34;projects/sample-project&#34; |
-
-
-
-
-
-
-<a name="bytebase-v1-ListUsersResponse"></a>
-
-### ListUsersResponse
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| users | [User](#bytebase-v1-User) | repeated | The users from the specified request. |
-| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |
-
-
-
-
-
-
-<a name="bytebase-v1-StatUsersRequest"></a>
-
-### StatUsersRequest
-
-
-
-
-
-
-
-<a name="bytebase-v1-StatUsersResponse"></a>
-
-### StatUsersResponse
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| stats | [StatUsersResponse.StatUser](#bytebase-v1-StatUsersResponse-StatUser) | repeated | |
-
-
-
-
-
-
-<a name="bytebase-v1-StatUsersResponse-StatUser"></a>
-
-### StatUsersResponse.StatUser
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| user_type | [UserType](#bytebase-v1-UserType) | | |
-| state | [State](#bytebase-v1-State) | | |
-| count | [int32](#int32) | | |
-
-
-
-
-
-
-<a name="bytebase-v1-UndeleteUserRequest"></a>
-
-### UndeleteUserRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of the deleted user. Format: users/{user} |
-
-
-
-
-
-
-<a name="bytebase-v1-UpdateUserRequest"></a>
-
-### UpdateUserRequest
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| user | [User](#bytebase-v1-User) | | The user to update.
-
-The user&#39;s `name` field is used to identify the user to update. Format: users/{user} |
-| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to update. |
-| otp_code | [string](#string) | optional | The otp_code is used to verify the user&#39;s identity by MFA. |
-| regenerate_temp_mfa_secret | [bool](#bool) | | The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user. This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response. |
-| regenerate_recovery_codes | [bool](#bool) | | The regenerate_recovery_codes flag means to regenerate recovery codes for user. |
-
-
-
-
-
-
-<a name="bytebase-v1-User"></a>
-
-### User
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| name | [string](#string) | | The name of the user. Format: users/{user}. {user} is a system-generated unique ID. |
-| state | [State](#bytebase-v1-State) | | |
-| email | [string](#string) | | |
-| title | [string](#string) | | |
-| user_type | [UserType](#bytebase-v1-UserType) | | |
-| password | [string](#string) | | |
-| service_key | [string](#string) | | |
-| mfa_enabled | [bool](#bool) | | The mfa_enabled flag means if the user has enabled MFA. |
-| mfa_secret | [string](#string) | | The mfa_secret is the temporary secret using in two phase verification. |
-| recovery_codes | [string](#string) | repeated | The recovery_codes is the temporary recovery codes using in two phase verification. |
-| phone | [string](#string) | | Should be a valid E.164 compliant phone number. Could be empty. |
-| profile | [User.Profile](#bytebase-v1-User-Profile) | | |
-
-
-
-
-
-
-<a name="bytebase-v1-User-Profile"></a>
-
-### User.Profile
-
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| last_login_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
-| last_change_password_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |
-| source | [string](#string) | | source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. |
-
-
-
-
-
-
-
-
-<a name="bytebase-v1-UserType"></a>
-
-### UserType
-
-
-| Name | Number | Description |
-| ---- | ------ | ----------- |
-| USER_TYPE_UNSPECIFIED | 0 | |
-| USER | 1 | |
-| SYSTEM_BOT | 2 | |
-| SERVICE_ACCOUNT | 3 | |
-
-
-
-
-
-
-
-<a name="bytebase-v1-UserService"></a>
-
-### UserService
-
-
-| Method Name | Request Type | Response Type | Description |
-| ----------- | ------------ | ------------- | ------------|
-| GetUser | [GetUserRequest](#bytebase-v1-GetUserRequest) | [User](#bytebase-v1-User) | Get the user. Any authenticated user can get the user. |
-| ListUsers | [ListUsersRequest](#bytebase-v1-ListUsersRequest) | [ListUsersResponse](#bytebase-v1-ListUsersResponse) | List all users. Any authenticated user can list users. |
-| StatUsers | [StatUsersRequest](#bytebase-v1-StatUsersRequest) | [StatUsersResponse](#bytebase-v1-StatUsersResponse) | Get user stat. Any authenticated user can get stat. |
-| CreateUser | [CreateUserRequest](#bytebase-v1-CreateUserRequest) | [User](#bytebase-v1-User) | Create a user. When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user. Otherwise, any unauthenticated user can create a user. |
-| UpdateUser | [UpdateUserRequest](#bytebase-v1-UpdateUserRequest) | [User](#bytebase-v1-User) | Only the user itself and the user with bb.users.update permission on the workspace can update the user. |
-| DeleteUser | [DeleteUserRequest](#bytebase-v1-DeleteUserRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Only the user with bb.users.delete permission on the workspace can delete the user. The last remaining workspace admin cannot be deleted. |
-| UndeleteUser | [UndeleteUserRequest](#bytebase-v1-UndeleteUserRequest) | [User](#bytebase-v1-User) | Only the user with bb.users.undelete permission on the workspace can undelete the user. |
-
-
-
-
-
<a name="v1_auth_service-proto"></a>
<p align="right"><a href="#top">Top</a></p>
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 2df2b98fb1..eb7c2ce322 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -1217,6 +1217,61 @@
</li>
+ <li>
+ <a href="#v1%2fuser_service.proto">v1/user_service.proto</a>
+ <ul>
+
+ <li>
+ <a href="#bytebase.v1.CreateUserRequest"><span class="badge">M</span>CreateUserRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.DeleteUserRequest"><span class="badge">M</span>DeleteUserRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.GetUserRequest"><span class="badge">M</span>GetUserRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.ListUsersRequest"><span class="badge">M</span>ListUsersRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.ListUsersResponse"><span class="badge">M</span>ListUsersResponse</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.UndeleteUserRequest"><span class="badge">M</span>UndeleteUserRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.UpdateUserRequest"><span class="badge">M</span>UpdateUserRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.User"><span class="badge">M</span>User</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.User.Profile"><span class="badge">M</span>User.Profile</a>
+ </li>
+
+
+ <li>
+ <a href="#bytebase.v1.UserType"><span class="badge">E</span>UserType</a>
+ </li>
+
+
+
+ <li>
+ <a href="#bytebase.v1.UserService"><span class="badge">S</span>UserService</a>
+ </li>
+
+ </ul>
+ </li>
+
+
<li>
<a href="#v1%2factuator_service.proto">v1/actuator_service.proto</a>
<ul>
@@ -1225,6 +1280,10 @@
<a href="#bytebase.v1.ActuatorInfo"><span class="badge">M</span>ActuatorInfo</a>
</li>
+ <li>
+ <a href="#bytebase.v1.ActuatorInfo.StatUser"><span class="badge">M</span>ActuatorInfo.StatUser</a>
+ </li>
+
<li>
<a href="#bytebase.v1.DeleteCacheRequest"><span class="badge">M</span>DeleteCacheRequest</a>
</li>
@@ -1377,73 +1436,6 @@
</li>
- <li>
- <a href="#v1%2fuser_service.proto">v1/user_service.proto</a>
- <ul>
-
- <li>
- <a href="#bytebase.v1.CreateUserRequest"><span class="badge">M</span>CreateUserRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.DeleteUserRequest"><span class="badge">M</span>DeleteUserRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.GetUserRequest"><span class="badge">M</span>GetUserRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.ListUsersRequest"><span class="badge">M</span>ListUsersRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.ListUsersResponse"><span class="badge">M</span>ListUsersResponse</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.StatUsersRequest"><span class="badge">M</span>StatUsersRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.StatUsersResponse"><span class="badge">M</span>StatUsersResponse</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.StatUsersResponse.StatUser"><span class="badge">M</span>StatUsersResponse.StatUser</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.UndeleteUserRequest"><span class="badge">M</span>UndeleteUserRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.UpdateUserRequest"><span class="badge">M</span>UpdateUserRequest</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.User"><span class="badge">M</span>User</a>
- </li>
-
- <li>
- <a href="#bytebase.v1.User.Profile"><span class="badge">M</span>User.Profile</a>
- </li>
-
-
- <li>
- <a href="#bytebase.v1.UserType"><span class="badge">E</span>UserType</a>
- </li>
-
-
-
- <li>
- <a href="#bytebase.v1.UserService"><span class="badge">S</span>UserService</a>
- </li>
-
- </ul>
- </li>
-
-
<li>
<a href="#v1%2fauth_service.proto">v1/auth_service.proto</a>
<ul>
@@ -14367,13 +14359,13 @@ Default to this mode.</p></td>
<div class="file-heading">
- <h2 id="v1/actuator_service.proto">v1/actuator_service.proto</h2><a href="#title">Top</a>
+ <h2 id="v1/user_service.proto">v1/user_service.proto</h2><a href="#title">Top</a>
</div>
<p></p>
- <h3 id="bytebase.v1.ActuatorInfo">ActuatorInfo</h3>
- <p>ServerInfo is the API message for server info.</p><p>Actuator concept is similar to the Spring Boot Actuator.</p>
+ <h3 id="bytebase.v1.CreateUserRequest">CreateUserRequest</h3>
+ <p></p>
<table class="field-table">
@@ -14383,129 +14375,132 @@ Default to this mode.</p></td>
<tbody>
<tr>
- <td>version</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>version is the bytebase&#39;s server version </p></td>
- </tr>
-
- <tr>
- <td>git_commit</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>git_commit is the git commit hash of the build </p></td>
- </tr>
-
- <tr>
- <td>readonly</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>readonly flag means if the Bytebase is running in readonly mode. </p></td>
- </tr>
-
- <tr>
- <td>saas</td>
- <td><a href="#bool">bool</a></td>
+ <td>user</td>
+ <td><a href="#bytebase.v1.User">User</a></td>
<td></td>
- <td><p>saas flag means if the Bytebase is running in SaaS mode, some features are not allowed to edit by users. </p></td>
+ <td><p>The user to create. </p></td>
</tr>
- <tr>
- <td>demo</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>demo flag means if the Bytebase is running in demo mode. </p></td>
- </tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.DeleteUserRequest">DeleteUserRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
<tr>
- <td>host</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>host is the Bytebase instance host. </p></td>
+ <td><p>The name of the user to delete.
+Format: users/{user} </p></td>
</tr>
- <tr>
- <td>port</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>port is the Bytebase instance port. </p></td>
- </tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.GetUserRequest">GetUserRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
<tr>
- <td>external_url</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>external_url is the URL where user or webhook callback visits Bytebase. </p></td>
+ <td><p>The name of the user to retrieve.
+Format: users/{user uid or user email} </p></td>
</tr>
- <tr>
- <td>need_admin_setup</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>need_admin_setup flag means the Bytebase instance doesn&#39;t have any end users. </p></td>
- </tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.ListUsersRequest">ListUsersRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
<tr>
- <td>disallow_signup</td>
- <td><a href="#bool">bool</a></td>
+ <td>page_size</td>
+ <td><a href="#int32">int32</a></td>
<td></td>
- <td><p>disallow_signup is the flag to disable self-service signup. </p></td>
+ <td><p>The maximum number of users to return. The service may return fewer than
+this value.
+If unspecified, at most 10 users will be returned.
+The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>
</tr>
<tr>
- <td>last_active_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td>page_token</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>last_active_time is the service last active time in UTC Time Format, any API calls will refresh this value. </p></td>
+ <td><p>A page token, received from a previous `ListUsers` call.
+Provide this to retrieve the subsequent page.
+
+When paginating, all other parameters provided to `ListUsers` must match
+the call that provided the page token. </p></td>
</tr>
<tr>
- <td>require_2fa</td>
+ <td>show_deleted</td>
<td><a href="#bool">bool</a></td>
<td></td>
- <td><p>require_2fa is the flag to require 2FA for all users. </p></td>
+ <td><p>Show deleted users if specified. </p></td>
</tr>
<tr>
- <td>workspace_id</td>
+ <td>filter</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>workspace_id is the identifier for the workspace. </p></td>
- </tr>
-
- <tr>
- <td>debug</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>debug flag means if the debug mode is enabled. </p></td>
- </tr>
-
- <tr>
- <td>unlicensed_features</td>
- <td><a href="#string">string</a></td>
- <td>repeated</td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>disallow_password_signin</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>disallow_password_signin is the flag to disallow user signin with email&amp;password. (except workspace admins) </p></td>
- </tr>
-
- <tr>
- <td>password_restriction</td>
- <td><a href="#bytebase.v1.PasswordRestrictionSetting">PasswordRestrictionSetting</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>docker</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>docker flag means if the Bytebase instance is running in docker. </p></td>
+ <td><p>Filter is used to filter users returned in the list.
+Supported filter:
+- name
+- email
+- user_type
+- state
+- project
+
+For example:
+name == &#34;ed&#34;
+name.matches(&#34;ed&#34;)
+email == &#34;[email protected]&#34;
+email.matches(&#34;ed&#34;)
+user_type == &#34;SERVICE_ACCOUNT&#34;
+user_type in [&#34;SERVICE_ACCOUNT&#34;, &#34;USER&#34;]
+!(user_type in [&#34;SERVICE_ACCOUNT&#34;, &#34;USER&#34;])
+state == &#34;DELETED&#34;
+project == &#34;projects/sample-project&#34;
+You can combine filter conditions like:
+name.matches(&#34;ed&#34;) &amp;&amp; project == &#34;projects/sample-project&#34;
+(name == &#34;ed&#34; || email == &#34;[email protected]&#34;) &amp;&amp; project == &#34;projects/sample-project&#34; </p></td>
</tr>
</tbody>
@@ -14515,31 +14510,10 @@ Default to this mode.</p></td>
- <h3 id="bytebase.v1.DeleteCacheRequest">DeleteCacheRequest</h3>
- <p></p>
-
-
-
-
-
- <h3 id="bytebase.v1.GetActuatorInfoRequest">GetActuatorInfoRequest</h3>
+ <h3 id="bytebase.v1.ListUsersResponse">ListUsersResponse</h3>
<p></p>
-
-
-
- <h3 id="bytebase.v1.GetResourcePackageRequest">GetResourcePackageRequest</h3>
- <p>The request message for getting the theme resource.</p>
-
-
-
-
-
- <h3 id="bytebase.v1.ResourcePackage">ResourcePackage</h3>
- <p>The theme resources.</p>
-
-
<table class="field-table">
<thead>
<tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
@@ -14547,10 +14521,18 @@ Default to this mode.</p></td>
<tbody>
<tr>
- <td>logo</td>
- <td><a href="#bytes">bytes</a></td>
+ <td>users</td>
+ <td><a href="#bytebase.v1.User">User</a></td>
+ <td>repeated</td>
+ <td><p>The users from the specified request. </p></td>
+ </tr>
+
+ <tr>
+ <td>next_page_token</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>The branding logo. </p></td>
+ <td><p>A token, which can be sent as `page_token` to retrieve the next page.
+If this field is omitted, there are no subsequent pages. </p></td>
</tr>
</tbody>
@@ -14560,7 +14542,7 @@ Default to this mode.</p></td>
- <h3 id="bytebase.v1.UpdateActuatorInfoRequest">UpdateActuatorInfoRequest</h3>
+ <h3 id="bytebase.v1.UndeleteUserRequest">UndeleteUserRequest</h3>
<p></p>
@@ -14571,17 +14553,11 @@ Default to this mode.</p></td>
<tbody>
<tr>
- <td>actuator</td>
- <td><a href="#bytebase.v1.ActuatorInfo">ActuatorInfo</a></td>
- <td></td>
- <td><p>The actuator to update. </p></td>
- </tr>
-
- <tr>
- <td>update_mask</td>
- <td><a href="#google.protobuf.FieldMask">google.protobuf.FieldMask</a></td>
+ <td>name</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>The list of fields to update. </p></td>
+ <td><p>The name of the deleted user.
+Format: users/{user} </p></td>
</tr>
</tbody>
@@ -14591,119 +14567,63 @@ Default to this mode.</p></td>
-
-
-
-
-
-
- <h3 id="bytebase.v1.ActuatorService">ActuatorService</h3>
+ <h3 id="bytebase.v1.UpdateUserRequest">UpdateUserRequest</h3>
<p></p>
- <table class="enum-table">
- <thead>
- <tr><td>Method Name</td><td>Request Type</td><td>Response Type</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>GetActuatorInfo</td>
- <td><a href="#bytebase.v1.GetActuatorInfoRequest">GetActuatorInfoRequest</a></td>
- <td><a href="#bytebase.v1.ActuatorInfo">ActuatorInfo</a></td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>UpdateActuatorInfo</td>
- <td><a href="#bytebase.v1.UpdateActuatorInfoRequest">UpdateActuatorInfoRequest</a></td>
- <td><a href="#bytebase.v1.ActuatorInfo">ActuatorInfo</a></td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>DeleteCache</td>
- <td><a href="#bytebase.v1.DeleteCacheRequest">DeleteCacheRequest</a></td>
- <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>GetResourcePackage</td>
- <td><a href="#bytebase.v1.GetResourcePackageRequest">GetResourcePackageRequest</a></td>
- <td><a href="#bytebase.v1.ResourcePackage">ResourcePackage</a></td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
-
- <h4>Methods with HTTP bindings</h4>
- <table>
+ <table class="field-table">
<thead>
- <tr>
- <td>Method Name</td>
- <td>Method</td>
- <td>Pattern</td>
- <td>Body</td>
- </tr>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
</thead>
<tbody>
-
-
-
- <tr>
- <td>GetActuatorInfo</td>
- <td>GET</td>
- <td>/v1/actuator/info</td>
- <td></td>
- </tr>
-
-
-
-
- <tr>
- <td>UpdateActuatorInfo</td>
- <td>PATCH</td>
- <td>/v1/actuator/info</td>
- <td>actuator</td>
- </tr>
-
-
+ <tr>
+ <td>user</td>
+ <td><a href="#bytebase.v1.User">User</a></td>
+ <td></td>
+ <td><p>The user to update.
+
+The user&#39;s `name` field is used to identify the user to update.
+Format: users/{user} </p></td>
+ </tr>
- <tr>
- <td>DeleteCache</td>
- <td>DELETE</td>
- <td>/v1/actuator/cache</td>
- <td></td>
- </tr>
+ <tr>
+ <td>update_mask</td>
+ <td><a href="#google.protobuf.FieldMask">google.protobuf.FieldMask</a></td>
+ <td></td>
+ <td><p>The list of fields to update. </p></td>
+ </tr>
-
+ <tr>
+ <td>otp_code</td>
+ <td><a href="#string">string</a></td>
+ <td>optional</td>
+ <td><p>The otp_code is used to verify the user&#39;s identity by MFA. </p></td>
+ </tr>
+ <tr>
+ <td>regenerate_temp_mfa_secret</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.
+This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response. </p></td>
+ </tr>
- <tr>
- <td>GetResourcePackage</td>
- <td>GET</td>
- <td>/v1/actuator/resources</td>
- <td></td>
- </tr>
+ <tr>
+ <td>regenerate_recovery_codes</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>The regenerate_recovery_codes flag means to regenerate recovery codes for user. </p></td>
+ </tr>
-
</tbody>
</table>
+
-
-
-
- <div class="file-heading">
- <h2 id="v1/anomaly_service.proto">v1/anomaly_service.proto</h2><a href="#title">Top</a>
- </div>
- <p></p>
+
- <h3 id="bytebase.v1.Anomaly">Anomaly</h3>
+ <h3 id="bytebase.v1.User">User</h3>
<p></p>
@@ -14714,93 +14634,89 @@ Default to this mode.</p></td>
<tbody>
<tr>
- <td>resource</td>
+ <td>name</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The resource that is the target of the operation.
-Format:
-- Database: instances/{instance}/databases/{database} </p></td>
+ <td><p>The name of the user.
+Format: users/{user}. {user} is a system-generated unique ID. </p></td>
</tr>
<tr>
- <td>type</td>
- <td><a href="#bytebase.v1.Anomaly.AnomalyType">Anomaly.AnomalyType</a></td>
+ <td>state</td>
+ <td><a href="#bytebase.v1.State">State</a></td>
<td></td>
- <td><p>type is the type of the anomaly. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>severity</td>
- <td><a href="#bytebase.v1.Anomaly.AnomalySeverity">Anomaly.AnomalySeverity</a></td>
+ <td>email</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>severity is the severity of the anomaly. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>create_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td>title</td>
+ <td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.SearchAnomaliesRequest">SearchAnomaliesRequest</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
+ <tr>
+ <td>user_type</td>
+ <td><a href="#bytebase.v1.UserType">UserType</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
<tr>
- <td>parent</td>
+ <td>password</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The parent resource whose anomalies are to be listed.
-Format: projects/{project} </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>filter</td>
+ <td>service_key</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>filter is the filter to apply on the search anomaly request,
-follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.
-Only support filter by resource and type for now.
-For example:
-Search the anomalies of a specific resource: &#39;resource=&#34;instances/{instance}/databases/{database}&#34;.&#39;
-Search the specified types of anomalies: &#39;type=&#34;MIGRATION_SCHEMA&#34;.&#39; </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>page_size</td>
- <td><a href="#int32">int32</a></td>
+ <td>mfa_enabled</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>Not used.
-The maximum number of anomalies to return. The service may return fewer than
-this value.
-If unspecified, at most 10 anomalies will be returned.
-The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>
+ <td><p>The mfa_enabled flag means if the user has enabled MFA. </p></td>
</tr>
<tr>
- <td>page_token</td>
+ <td>mfa_secret</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>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. </p></td>
+ <td><p>The mfa_secret is the temporary secret using in two phase verification. </p></td>
+ </tr>
+
+ <tr>
+ <td>recovery_codes</td>
+ <td><a href="#string">string</a></td>
+ <td>repeated</td>
+ <td><p>The recovery_codes is the temporary recovery codes using in two phase verification. </p></td>
+ </tr>
+
+ <tr>
+ <td>phone</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Should be a valid E.164 compliant phone number.
+Could be empty. </p></td>
+ </tr>
+
+ <tr>
+ <td>profile</td>
+ <td><a href="#bytebase.v1.User.Profile">User.Profile</a></td>
+ <td></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -14810,7 +14726,7 @@ the call that provided the page token. </p></td>
- <h3 id="bytebase.v1.SearchAnomaliesResponse">SearchAnomaliesResponse</h3>
+ <h3 id="bytebase.v1.User.Profile">User.Profile</h3>
<p></p>
@@ -14821,18 +14737,24 @@ the call that provided the page token. </p></td>
<tbody>
<tr>
- <td>anomalies</td>
- <td><a href="#bytebase.v1.Anomaly">Anomaly</a></td>
- <td>repeated</td>
- <td><p>anomalies is the list of anomalies. </p></td>
+ <td>last_login_time</td>
+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>next_page_token</td>
+ <td>last_change_password_time</td>
+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>source</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>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. </p></td>
+ <td><p>source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. </p></td>
</tr>
</tbody>
@@ -14844,43 +14766,8 @@ If this field is omitted, there are no subsequent pages. </p></td>
- <h3 id="bytebase.v1.Anomaly.AnomalySeverity">Anomaly.AnomalySeverity</h3>
- <p>AnomalySeverity is the severity of the anomaly.</p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>ANOMALY_SEVERITY_UNSPECIFIED</td>
- <td>0</td>
- <td><p>Unspecified anomaly severity.</p></td>
- </tr>
-
- <tr>
- <td>MEDIUM</td>
- <td>1</td>
- <td><p>MEDIUM is the info level anomaly severity.</p></td>
- </tr>
-
- <tr>
- <td>HIGH</td>
- <td>2</td>
- <td><p>HIGH is the warning level anomaly severity.</p></td>
- </tr>
-
- <tr>
- <td>CRITICAL</td>
- <td>3</td>
- <td><p>CRITICAL is the critical level anomaly severity.</p></td>
- </tr>
-
- </tbody>
- </table>
-
- <h3 id="bytebase.v1.Anomaly.AnomalyType">Anomaly.AnomalyType</h3>
- <p>AnomalyType is the type of the anomaly.</p>
+ <h3 id="bytebase.v1.UserType">UserType</h3>
+ <p></p>
<table class="enum-table">
<thead>
<tr><td>Name</td><td>Number</td><td>Description</td></tr>
@@ -14888,24 +14775,27 @@ If this field is omitted, there are no subsequent pages. </p></td>
<tbody>
<tr>
- <td>ANOMALY_TYPE_UNSPECIFIED</td>
+ <td>USER_TYPE_UNSPECIFIED</td>
<td>0</td>
- <td><p>Unspecified anomaly type.</p></td>
+ <td><p></p></td>
</tr>
<tr>
- <td>DATABASE_CONNECTION</td>
- <td>5</td>
- <td><p>Database level anomaly.
-
-DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted.</p></td>
+ <td>USER</td>
+ <td>1</td>
+ <td><p></p></td>
</tr>
<tr>
- <td>DATABASE_SCHEMA_DRIFT</td>
- <td>6</td>
- <td><p>DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift,
-e.g. the database schema had been changed without bytebase migration.</p></td>
+ <td>SYSTEM_BOT</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>SERVICE_ACCOUNT</td>
+ <td>3</td>
+ <td><p></p></td>
</tr>
</tbody>
@@ -14915,7 +14805,7 @@ e.g. the database schema had been changed without bytebase migration.</p></td>
- <h3 id="bytebase.v1.AnomalyService">AnomalyService</h3>
+ <h3 id="bytebase.v1.UserService">UserService</h3>
<p></p>
<table class="enum-table">
<thead>
@@ -14924,10 +14814,50 @@ e.g. the database schema had been changed without bytebase migration.</p></td>
<tbody>
<tr>
- <td>SearchAnomalies</td>
- <td><a href="#bytebase.v1.SearchAnomaliesRequest">SearchAnomaliesRequest</a></td>
- <td><a href="#bytebase.v1.SearchAnomaliesResponse">SearchAnomaliesResponse</a></td>
- <td><p></p></td>
+ <td>GetUser</td>
+ <td><a href="#bytebase.v1.GetUserRequest">GetUserRequest</a></td>
+ <td><a href="#bytebase.v1.User">User</a></td>
+ <td><p>Get the user.
+Any authenticated user can get the user.</p></td>
+ </tr>
+
+ <tr>
+ <td>ListUsers</td>
+ <td><a href="#bytebase.v1.ListUsersRequest">ListUsersRequest</a></td>
+ <td><a href="#bytebase.v1.ListUsersResponse">ListUsersResponse</a></td>
+ <td><p>List all users.
+Any authenticated user can list users.</p></td>
+ </tr>
+
+ <tr>
+ <td>CreateUser</td>
+ <td><a href="#bytebase.v1.CreateUserRequest">CreateUserRequest</a></td>
+ <td><a href="#bytebase.v1.User">User</a></td>
+ <td><p>Create a user.
+When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.
+Otherwise, any unauthenticated user can create a user.</p></td>
+ </tr>
+
+ <tr>
+ <td>UpdateUser</td>
+ <td><a href="#bytebase.v1.UpdateUserRequest">UpdateUserRequest</a></td>
+ <td><a href="#bytebase.v1.User">User</a></td>
+ <td><p>Only the user itself and the user with bb.users.update permission on the workspace can update the user.</p></td>
+ </tr>
+
+ <tr>
+ <td>DeleteUser</td>
+ <td><a href="#bytebase.v1.DeleteUserRequest">DeleteUserRequest</a></td>
+ <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>
+ <td><p>Only the user with bb.users.delete permission on the workspace can delete the user.
+The last remaining workspace admin cannot be deleted.</p></td>
+ </tr>
+
+ <tr>
+ <td>UndeleteUser</td>
+ <td><a href="#bytebase.v1.UndeleteUserRequest">UndeleteUserRequest</a></td>
+ <td><a href="#bytebase.v1.User">User</a></td>
+ <td><p>Only the user with bb.users.undelete permission on the workspace can undelete the user.</p></td>
</tr>
</tbody>
@@ -14951,9 +14881,59 @@ e.g. the database schema had been changed without bytebase migration.</p></td>
<tr>
- <td>SearchAnomalies</td>
+ <td>GetUser</td>
+ <td>GET</td>
+ <td>/v1/{name=users/*}</td>
+ <td></td>
+ </tr>
+
+
+
+
+ <tr>
+ <td>ListUsers</td>
+ <td>GET</td>
+ <td>/v1/users</td>
+ <td></td>
+ </tr>
+
+
+
+
+ <tr>
+ <td>CreateUser</td>
<td>POST</td>
- <td>/v1/{parent=projects/*}/anomalies:search</td>
+ <td>/v1/users</td>
+ <td>user</td>
+ </tr>
+
+
+
+
+ <tr>
+ <td>UpdateUser</td>
+ <td>PATCH</td>
+ <td>/v1/{user.name=users/*}</td>
+ <td>user</td>
+ </tr>
+
+
+
+
+ <tr>
+ <td>DeleteUser</td>
+ <td>DELETE</td>
+ <td>/v1/{name=users/*}</td>
+ <td></td>
+ </tr>
+
+
+
+
+ <tr>
+ <td>UndeleteUser</td>
+ <td>POST</td>
+ <td>/v1/{name=users/*}:undelete</td>
<td>*</td>
</tr>
@@ -14965,13 +14945,13 @@ e.g. the database schema had been changed without bytebase migration.</p></td>
<div class="file-heading">
- <h2 id="v1/iam_policy.proto">v1/iam_policy.proto</h2><a href="#title">Top</a>
+ <h2 id="v1/actuator_service.proto">v1/actuator_service.proto</h2><a href="#title">Top</a>
</div>
<p></p>
- <h3 id="bytebase.v1.Binding">Binding</h3>
- <p></p>
+ <h3 id="bytebase.v1.ActuatorInfo">ActuatorInfo</h3>
+ <p>ServerInfo is the API message for server info.</p><p>Actuator concept is similar to the Spring Boot Actuator.</p>
<table class="field-table">
@@ -14981,166 +14961,150 @@ e.g. the database schema had been changed without bytebase migration.</p></td>
<tbody>
<tr>
- <td>role</td>
+ <td>version</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The role that is assigned to the members.
-Format: roles/{role} </p></td>
+ <td><p>version is the bytebase&#39;s server version </p></td>
</tr>
<tr>
- <td>members</td>
+ <td>git_commit</td>
<td><a href="#string">string</a></td>
- <td>repeated</td>
- <td><p>Specifies the principals requesting access for a Bytebase resource.
-For users, the member should be: user:{email}
-For groups, the member should be: group:{email} </p></td>
+ <td></td>
+ <td><p>git_commit is the git commit hash of the build </p></td>
</tr>
<tr>
- <td>condition</td>
- <td><a href="#google.type.Expr">google.type.Expr</a></td>
+ <td>readonly</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>The condition that is associated with this binding.
-If the condition evaluates to true, then this binding applies to the current request.
-If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. </p></td>
+ <td><p>readonly flag means if the Bytebase is running in readonly mode. </p></td>
</tr>
<tr>
- <td>parsed_expr</td>
- <td><a href="#google.api.expr.v1alpha1.Expr">google.api.expr.v1alpha1.Expr</a></td>
+ <td>saas</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>The parsed expression of the condition. </p></td>
+ <td><p>saas flag means if the Bytebase is running in SaaS mode, some features are not allowed to edit by users. </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.BindingDelta">BindingDelta</h3>
- <p>One delta entry for Binding. Each individual change (only one member in each</p><p>entry) to a binding will be a separate entry.</p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
+ <tr>
+ <td>demo</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>demo flag means if the Bytebase is running in demo mode. </p></td>
+ </tr>
<tr>
- <td>action</td>
- <td><a href="#bytebase.v1.BindingDelta.Action">BindingDelta.Action</a></td>
+ <td>host</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>The action that was performed on a Binding. </p></td>
+ <td><p>host is the Bytebase instance host. </p></td>
</tr>
<tr>
- <td>role</td>
+ <td>port</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>Role that is assigned to `members`.
-For example, `roles/projectOwner`. </p></td>
+ <td><p>port is the Bytebase instance port. </p></td>
</tr>
<tr>
- <td>member</td>
+ <td>external_url</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>Follows the same format of Binding.members. </p></td>
+ <td><p>external_url is the URL where user or webhook callback visits Bytebase. </p></td>
+ </tr>
+
+ <tr>
+ <td>need_admin_setup</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>need_admin_setup flag means the Bytebase instance doesn&#39;t have any end users. </p></td>
+ </tr>
+
+ <tr>
+ <td>disallow_signup</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>disallow_signup is the flag to disable self-service signup. </p></td>
+ </tr>
+
+ <tr>
+ <td>last_active_time</td>
+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td></td>
+ <td><p>last_active_time is the service last active time in UTC Time Format, any API calls will refresh this value. </p></td>
+ </tr>
+
+ <tr>
+ <td>require_2fa</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>require_2fa is the flag to require 2FA for all users. </p></td>
+ </tr>
+
+ <tr>
+ <td>workspace_id</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>workspace_id is the identifier for the workspace. </p></td>
+ </tr>
+
+ <tr>
+ <td>debug</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>debug flag means if the debug mode is enabled. </p></td>
+ </tr>
+
+ <tr>
+ <td>unlicensed_features</td>
+ <td><a href="#string">string</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>disallow_password_signin</td>
+ <td><a href="#bool">bool</a></td>
+ <td></td>
+ <td><p>disallow_password_signin is the flag to disallow user signin with email&amp;password. (except workspace admins) </p></td>
</tr>
<tr>
- <td>condition</td>
- <td><a href="#google.type.Expr">google.type.Expr</a></td>
+ <td>password_restriction</td>
+ <td><a href="#bytebase.v1.PasswordRestrictionSetting">PasswordRestrictionSetting</a></td>
<td></td>
- <td><p>The condition that is associated with this binding. </p></td>
+ <td><p> </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.GetIamPolicyRequest">GetIamPolicyRequest</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
<tr>
- <td>resource</td>
- <td><a href="#string">string</a></td>
+ <td>docker</td>
+ <td><a href="#bool">bool</a></td>
<td></td>
- <td><p>The name of the resource to get the IAM policy.
-Format: projects/{project}
-Format: workspaces/{workspace} </p></td>
+ <td><p>docker flag means if the Bytebase instance is running in docker. </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.IamPolicy">IamPolicy</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
<tr>
- <td>bindings</td>
- <td><a href="#bytebase.v1.Binding">Binding</a></td>
+ <td>user_stats</td>
+ <td><a href="#bytebase.v1.ActuatorInfo.StatUser">ActuatorInfo.StatUser</a></td>
<td>repeated</td>
- <td><p>Collection of binding.
-A binding binds one or more project members to a single project role. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>etag</td>
- <td><a href="#string">string</a></td>
+ <td>activated_instance_count</td>
+ <td><a href="#int32">int32</a></td>
<td></td>
- <td><p>The current etag of the policy.
-If an etag is provided and does not match the current etag of the poliy,
-the call will be blocked and an ABORTED error will be returned. </p></td>
+ <td><p> </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.PolicyDelta">PolicyDelta</h3>
- <p>The difference delta between two policies.</p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
<tr>
- <td>binding_deltas</td>
- <td><a href="#bytebase.v1.BindingDelta">BindingDelta</a></td>
- <td>repeated</td>
- <td><p>The delta for Bindings between two policies. </p></td>
+ <td>total_instance_count</td>
+ <td><a href="#int32">int32</a></td>
+ <td></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -15150,7 +15114,7 @@ the call will be blocked and an ABORTED error will be returned. </p></td>
- <h3 id="bytebase.v1.SetIamPolicyRequest">SetIamPolicyRequest</h3>
+ <h3 id="bytebase.v1.ActuatorInfo.StatUser">ActuatorInfo.StatUser</h3>
<p></p>
@@ -15161,26 +15125,24 @@ the call will be blocked and an ABORTED error will be returned. </p></td>
<tbody>
<tr>
- <td>resource</td>
- <td><a href="#string">string</a></td>
+ <td>user_type</td>
+ <td><a href="#bytebase.v1.UserType">UserType</a></td>
<td></td>
- <td><p>The name of the resource to set the IAM policy.
-Format: projects/{project}
-Format: workspaces/{workspace} </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>policy</td>
- <td><a href="#bytebase.v1.IamPolicy">IamPolicy</a></td>
+ <td>state</td>
+ <td><a href="#bytebase.v1.State">State</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>etag</td>
- <td><a href="#string">string</a></td>
+ <td>count</td>
+ <td><a href="#int32">int32</a></td>
<td></td>
- <td><p>The current etag of the policy. </p></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -15190,75 +15152,29 @@ Format: workspaces/{workspace} </p></td>
+ <h3 id="bytebase.v1.DeleteCacheRequest">DeleteCacheRequest</h3>
+ <p></p>
-
- <h3 id="bytebase.v1.BindingDelta.Action">BindingDelta.Action</h3>
- <p>The type of action performed on a Binding in a policy.</p>
- <table class="enum-table">
- <thead>
- <tr><td>Name</td><td>Number</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>ACTION_UNSPECIFIED</td>
- <td>0</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>ADD</td>
- <td>1</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>REMOVE</td>
- <td>2</td>
- <td><p></p></td>
- </tr>
-
- </tbody>
- </table>
-
+
+
+ <h3 id="bytebase.v1.GetActuatorInfoRequest">GetActuatorInfoRequest</h3>
+ <p></p>
-
-
-
- <div class="file-heading">
- <h2 id="v1/audit_log_service.proto">v1/audit_log_service.proto</h2><a href="#title">Top</a>
- </div>
- <p></p>
+
+
- <h3 id="bytebase.v1.AuditData">AuditData</h3>
- <p></p>
+ <h3 id="bytebase.v1.GetResourcePackageRequest">GetResourcePackageRequest</h3>
+ <p>The request message for getting the theme resource.</p>
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
-
- <tr>
- <td>policy_delta</td>
- <td><a href="#bytebase.v1.PolicyDelta">PolicyDelta</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- </tbody>
- </table>
-
-
- <h3 id="bytebase.v1.AuditLog">AuditLog</h3>
- <p></p>
+ <h3 id="bytebase.v1.ResourcePackage">ResourcePackage</h3>
+ <p>The theme resources.</p>
<table class="field-table">
@@ -15268,84 +15184,10 @@ Format: workspaces/{workspace} </p></td>
<tbody>
<tr>
- <td>name</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The name of the log.
-Formats:
-- projects/{project}/auditLogs/{uid}
-- workspaces/{workspace}/auditLogs/{uid} </p></td>
- </tr>
-
- <tr>
- <td>create_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>user</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Format: users/[email protected] </p></td>
- </tr>
-
- <tr>
- <td>method</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>e.g. `/bytebase.v1.SQLService/Query`, `bb.project.repository.push` </p></td>
- </tr>
-
- <tr>
- <td>severity</td>
- <td><a href="#bytebase.v1.AuditLog.Severity">AuditLog.Severity</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>resource</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The associated resource. </p></td>
- </tr>
-
- <tr>
- <td>request</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>JSON-encoded request. </p></td>
- </tr>
-
- <tr>
- <td>response</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>JSON-encoded response.
-Some fields are omitted because they are too large or contain sensitive information. </p></td>
- </tr>
-
- <tr>
- <td>status</td>
- <td><a href="#google.rpc.Status">google.rpc.Status</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>service_data</td>
- <td><a href="#google.protobuf.Any">google.protobuf.Any</a></td>
- <td></td>
- <td><p>service-specific data about the request, response, and other activities. </p></td>
- </tr>
-
- <tr>
- <td>request_metadata</td>
- <td><a href="#bytebase.v1.RequestMetadata">RequestMetadata</a></td>
+ <td>logo</td>
+ <td><a href="#bytes">bytes</a></td>
<td></td>
- <td><p>Metadata about the operation. </p></td>
+ <td><p>The branding logo. </p></td>
</tr>
</tbody>
@@ -15355,7 +15197,7 @@ Some fields are omitted because they are too large or contain sensitive informat
- <h3 id="bytebase.v1.ExportAuditLogsRequest">ExportAuditLogsRequest</h3>
+ <h3 id="bytebase.v1.UpdateActuatorInfoRequest">UpdateActuatorInfoRequest</h3>
<p></p>
@@ -15366,58 +15208,17 @@ Some fields are omitted because they are too large or contain sensitive informat
<tbody>
<tr>
- <td>parent</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>filter</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The filter of the log. It should be a valid CEL expression.
-For example:
- - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39;&#34;
- - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39;&#34;
- - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39; &amp;&amp; user == &#39;users/[email protected]&#39;&#34;
- - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39; &amp;&amp; create_time &lt;= &#39;2021-01-01T00:00:00Z&#39; &amp;&amp; create_time &gt;= &#39;2020-01-01T00:00:00Z&#39;&#34; </p></td>
- </tr>
-
- <tr>
- <td>order_by</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The order by of the log.
-Only support order by create_time.
-For example:
- - order_by = &#34;create_time asc&#34;
- - order_by = &#34;create_time desc&#34; </p></td>
- </tr>
-
- <tr>
- <td>format</td>
- <td><a href="#bytebase.v1.ExportFormat">ExportFormat</a></td>
- <td></td>
- <td><p>The export format. </p></td>
- </tr>
-
- <tr>
- <td>page_size</td>
- <td><a href="#int32">int32</a></td>
+ <td>actuator</td>
+ <td><a href="#bytebase.v1.ActuatorInfo">ActuatorInfo</a></td>
<td></td>
- <td><p>The maximum number of logs to return.
-The service may return fewer than this value.
-If unspecified, at most 10 log entries will be returned.
-The maximum value is 5000; values above 5000 will be coerced to 5000. </p></td>
+ <td><p>The actuator to update. </p></td>
</tr>
<tr>
- <td>page_token</td>
- <td><a href="#string">string</a></td>
+ <td>update_mask</td>
+ <td><a href="#google.protobuf.FieldMask">google.protobuf.FieldMask</a></td>
<td></td>
- <td><p>A page token, received from a previous `ExportAuditLogs` call.
-Provide this to retrieve the subsequent page. </p></td>
+ <td><p>The list of fields to update. </p></td>
</tr>
</tbody>
@@ -15427,41 +15228,120 @@ Provide this to retrieve the subsequent page. </p></td>
- <h3 id="bytebase.v1.ExportAuditLogsResponse">ExportAuditLogsResponse</h3>
+
+
+
+
+
+
+ <h3 id="bytebase.v1.ActuatorService">ActuatorService</h3>
<p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Method Name</td><td>Request Type</td><td>Response Type</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>GetActuatorInfo</td>
+ <td><a href="#bytebase.v1.GetActuatorInfoRequest">GetActuatorInfoRequest</a></td>
+ <td><a href="#bytebase.v1.ActuatorInfo">ActuatorInfo</a></td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>UpdateActuatorInfo</td>
+ <td><a href="#bytebase.v1.UpdateActuatorInfoRequest">UpdateActuatorInfoRequest</a></td>
+ <td><a href="#bytebase.v1.ActuatorInfo">ActuatorInfo</a></td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>DeleteCache</td>
+ <td><a href="#bytebase.v1.DeleteCacheRequest">DeleteCacheRequest</a></td>
+ <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>GetResourcePackage</td>
+ <td><a href="#bytebase.v1.GetResourcePackageRequest">GetResourcePackageRequest</a></td>
+ <td><a href="#bytebase.v1.ResourcePackage">ResourcePackage</a></td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
- <table class="field-table">
+
+
+ <h4>Methods with HTTP bindings</h4>
+ <table>
<thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ <tr>
+ <td>Method Name</td>
+ <td>Method</td>
+ <td>Pattern</td>
+ <td>Body</td>
+ </tr>
</thead>
<tbody>
+
- <tr>
- <td>content</td>
- <td><a href="#bytes">bytes</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
- <tr>
- <td>next_page_token</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>A token to retrieve next page of log entities.
-Pass this value in the page_token field in the subsequent call
-to retrieve the next page of log entities. </p></td>
- </tr>
+ <tr>
+ <td>GetActuatorInfo</td>
+ <td>GET</td>
+ <td>/v1/actuator/info</td>
+ <td></td>
+ </tr>
+
+
+
+
+ <tr>
+ <td>UpdateActuatorInfo</td>
+ <td>PATCH</td>
+ <td>/v1/actuator/info</td>
+ <td>actuator</td>
+ </tr>
+
+
+
+
+ <tr>
+ <td>DeleteCache</td>
+ <td>DELETE</td>
+ <td>/v1/actuator/cache</td>
+ <td></td>
+ </tr>
+
+
+
+
+ <tr>
+ <td>GetResourcePackage</td>
+ <td>GET</td>
+ <td>/v1/actuator/resources</td>
+ <td></td>
+ </tr>
+
</tbody>
</table>
-
-
+
- <h3 id="bytebase.v1.RequestMetadata">RequestMetadata</h3>
- <p>Metadata about the request.</p>
+ <div class="file-heading">
+ <h2 id="v1/anomaly_service.proto">v1/anomaly_service.proto</h2><a href="#title">Top</a>
+ </div>
+ <p></p>
+
+
+ <h3 id="bytebase.v1.Anomaly">Anomaly</h3>
+ <p></p>
<table class="field-table">
@@ -15471,18 +15351,33 @@ to retrieve the next page of log entities. </p></td>
<tbody>
<tr>
- <td>caller_ip</td>
+ <td>resource</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The IP address of the caller. </p></td>
+ <td><p>The resource that is the target of the operation.
+Format:
+- Database: instances/{instance}/databases/{database} </p></td>
</tr>
<tr>
- <td>caller_supplied_user_agent</td>
- <td><a href="#string">string</a></td>
+ <td>type</td>
+ <td><a href="#bytebase.v1.Anomaly.AnomalyType">Anomaly.AnomalyType</a></td>
<td></td>
- <td><p>The user agent of the caller.
-This information is not authenticated and should be treated accordingly. </p></td>
+ <td><p>type is the type of the anomaly. </p></td>
+ </tr>
+
+ <tr>
+ <td>severity</td>
+ <td><a href="#bytebase.v1.Anomaly.AnomalySeverity">Anomaly.AnomalySeverity</a></td>
+ <td></td>
+ <td><p>severity is the severity of the anomaly. </p></td>
+ </tr>
+
+ <tr>
+ <td>create_time</td>
+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
+ <td></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -15492,7 +15387,7 @@ This information is not authenticated and should be treated accordingly. </p></t
- <h3 id="bytebase.v1.SearchAuditLogsRequest">SearchAuditLogsRequest</h3>
+ <h3 id="bytebase.v1.SearchAnomaliesRequest">SearchAnomaliesRequest</h3>
<p></p>
@@ -15506,54 +15401,43 @@ This information is not authenticated and should be treated accordingly. </p></t
<td>parent</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The parent resource whose anomalies are to be listed.
+Format: projects/{project} </p></td>
</tr>
<tr>
<td>filter</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The filter of the log. It should be a valid CEL expression.
-Supported filter:
-- method
-- severity
-- user
-- create_time
-
-For example:
- - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39;&#34;
- - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39;&#34;
- - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39; &amp;&amp; user == &#39;users/[email protected]&#39;&#34;
- - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39; &amp;&amp; create_time &lt;= &#39;2021-01-01T00:00:00Z&#39; &amp;&amp; create_time &gt;= &#39;2020-01-01T00:00:00Z&#39;&#34; </p></td>
- </tr>
-
- <tr>
- <td>order_by</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>The order by of the log.
-Only support order by create_time.
+ <td><p>filter is the filter to apply on the search anomaly request,
+follow the [ebnf](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) syntax.
+Only support filter by resource and type for now.
For example:
- - order_by = &#34;create_time asc&#34;
- - order_by = &#34;create_time desc&#34; </p></td>
+Search the anomalies of a specific resource: &#39;resource=&#34;instances/{instance}/databases/{database}&#34;.&#39;
+Search the specified types of anomalies: &#39;type=&#34;MIGRATION_SCHEMA&#34;.&#39; </p></td>
</tr>
<tr>
<td>page_size</td>
<td><a href="#int32">int32</a></td>
<td></td>
- <td><p>The maximum number of logs to return.
-The service may return fewer than this value.
-If unspecified, at most 10 log entries will be returned.
-The maximum value is 5000; values above 5000 will be coerced to 5000. </p></td>
+ <td><p>Not used.
+The maximum number of anomalies to return. The service may return fewer than
+this value.
+If unspecified, at most 10 anomalies will be returned.
+The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>
</tr>
<tr>
<td>page_token</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>A page token, received from a previous `SearchLogs` call.
-Provide this to retrieve the subsequent page. </p></td>
+ <td><p>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. </p></td>
</tr>
</tbody>
@@ -15563,7 +15447,7 @@ Provide this to retrieve the subsequent page. </p></td>
- <h3 id="bytebase.v1.SearchAuditLogsResponse">SearchAuditLogsResponse</h3>
+ <h3 id="bytebase.v1.SearchAnomaliesResponse">SearchAnomaliesResponse</h3>
<p></p>
@@ -15574,19 +15458,18 @@ Provide this to retrieve the subsequent page. </p></td>
<tbody>
<tr>
- <td>audit_logs</td>
- <td><a href="#bytebase.v1.AuditLog">AuditLog</a></td>
+ <td>anomalies</td>
+ <td><a href="#bytebase.v1.Anomaly">Anomaly</a></td>
<td>repeated</td>
- <td><p> </p></td>
+ <td><p>anomalies is the list of anomalies. </p></td>
</tr>
<tr>
<td>next_page_token</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>A token to retrieve next page of log entities.
-Pass this value in the page_token field in the subsequent call
-to retrieve the next page of log entities. </p></td>
+ <td><p>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. </p></td>
</tr>
</tbody>
@@ -15598,8 +15481,8 @@ to retrieve the next page of log entities. </p></td>
- <h3 id="bytebase.v1.AuditLog.Severity">AuditLog.Severity</h3>
- <p></p>
+ <h3 id="bytebase.v1.Anomaly.AnomalySeverity">Anomaly.AnomalySeverity</h3>
+ <p>AnomalySeverity is the severity of the anomaly.</p>
<table class="enum-table">
<thead>
<tr><td>Name</td><td>Number</td><td>Description</td></tr>
@@ -15607,57 +15490,59 @@ to retrieve the next page of log entities. </p></td>
<tbody>
<tr>
- <td>DEFAULT</td>
+ <td>ANOMALY_SEVERITY_UNSPECIFIED</td>
<td>0</td>
- <td><p></p></td>
+ <td><p>Unspecified anomaly severity.</p></td>
</tr>
<tr>
- <td>DEBUG</td>
+ <td>MEDIUM</td>
<td>1</td>
- <td><p></p></td>
+ <td><p>MEDIUM is the info level anomaly severity.</p></td>
</tr>
<tr>
- <td>INFO</td>
+ <td>HIGH</td>
<td>2</td>
- <td><p></p></td>
+ <td><p>HIGH is the warning level anomaly severity.</p></td>
</tr>
<tr>
- <td>NOTICE</td>
+ <td>CRITICAL</td>
<td>3</td>
- <td><p></p></td>
+ <td><p>CRITICAL is the critical level anomaly severity.</p></td>
</tr>
+ </tbody>
+ </table>
+
+ <h3 id="bytebase.v1.Anomaly.AnomalyType">Anomaly.AnomalyType</h3>
+ <p>AnomalyType is the type of the anomaly.</p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
<tr>
- <td>WARNING</td>
- <td>4</td>
- <td><p></p></td>
+ <td>ANOMALY_TYPE_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p>Unspecified anomaly type.</p></td>
</tr>
<tr>
- <td>ERROR</td>
+ <td>DATABASE_CONNECTION</td>
<td>5</td>
- <td><p></p></td>
+ <td><p>Database level anomaly.
+
+DATABASE_CONNECTION is the anomaly type for database connection, e.g. the database had been deleted.</p></td>
</tr>
<tr>
- <td>CRITICAL</td>
+ <td>DATABASE_SCHEMA_DRIFT</td>
<td>6</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>ALERT</td>
- <td>7</td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>EMERGENCY</td>
- <td>8</td>
- <td><p></p></td>
+ <td><p>DATABASE_SCHEMA_DRIFT is the anomaly type for database schema drift,
+e.g. the database schema had been changed without bytebase migration.</p></td>
</tr>
</tbody>
@@ -15667,7 +15552,7 @@ to retrieve the next page of log entities. </p></td>
- <h3 id="bytebase.v1.AuditLogService">AuditLogService</h3>
+ <h3 id="bytebase.v1.AnomalyService">AnomalyService</h3>
<p></p>
<table class="enum-table">
<thead>
@@ -15676,16 +15561,9 @@ to retrieve the next page of log entities. </p></td>
<tbody>
<tr>
- <td>SearchAuditLogs</td>
- <td><a href="#bytebase.v1.SearchAuditLogsRequest">SearchAuditLogsRequest</a></td>
- <td><a href="#bytebase.v1.SearchAuditLogsResponse">SearchAuditLogsResponse</a></td>
- <td><p></p></td>
- </tr>
-
- <tr>
- <td>ExportAuditLogs</td>
- <td><a href="#bytebase.v1.ExportAuditLogsRequest">ExportAuditLogsRequest</a></td>
- <td><a href="#bytebase.v1.ExportAuditLogsResponse">ExportAuditLogsResponse</a></td>
+ <td>SearchAnomalies</td>
+ <td><a href="#bytebase.v1.SearchAnomaliesRequest">SearchAnomaliesRequest</a></td>
+ <td><a href="#bytebase.v1.SearchAnomaliesResponse">SearchAnomaliesResponse</a></td>
<td><p></p></td>
</tr>
@@ -15710,33 +15588,9 @@ to retrieve the next page of log entities. </p></td>
<tr>
- <td>SearchAuditLogs</td>
- <td>POST</td>
- <td>/v1/{parent=projects/*}/auditLogs:search</td>
- <td>*</td>
- </tr>
-
- <tr>
- <td>SearchAuditLogs</td>
- <td>POST</td>
- <td>/v1/auditLogs:search</td>
- <td>*</td>
- </tr>
-
-
-
-
- <tr>
- <td>ExportAuditLogs</td>
- <td>POST</td>
- <td>/v1/{parent=projects/*}/auditLogs:export</td>
- <td>*</td>
- </tr>
-
- <tr>
- <td>ExportAuditLogs</td>
+ <td>SearchAnomalies</td>
<td>POST</td>
- <td>/v1/auditLogs:export</td>
+ <td>/v1/{parent=projects/*}/anomalies:search</td>
<td>*</td>
</tr>
@@ -15748,12 +15602,12 @@ to retrieve the next page of log entities. </p></td>
<div class="file-heading">
- <h2 id="v1/user_service.proto">v1/user_service.proto</h2><a href="#title">Top</a>
+ <h2 id="v1/iam_policy.proto">v1/iam_policy.proto</h2><a href="#title">Top</a>
</div>
<p></p>
- <h3 id="bytebase.v1.CreateUserRequest">CreateUserRequest</h3>
+ <h3 id="bytebase.v1.Binding">Binding</h3>
<p></p>
@@ -15764,10 +15618,36 @@ to retrieve the next page of log entities. </p></td>
<tbody>
<tr>
- <td>user</td>
- <td><a href="#bytebase.v1.User">User</a></td>
+ <td>role</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>The user to create. </p></td>
+ <td><p>The role that is assigned to the members.
+Format: roles/{role} </p></td>
+ </tr>
+
+ <tr>
+ <td>members</td>
+ <td><a href="#string">string</a></td>
+ <td>repeated</td>
+ <td><p>Specifies the principals requesting access for a Bytebase resource.
+For users, the member should be: user:{email}
+For groups, the member should be: group:{email} </p></td>
+ </tr>
+
+ <tr>
+ <td>condition</td>
+ <td><a href="#google.type.Expr">google.type.Expr</a></td>
+ <td></td>
+ <td><p>The condition that is associated with this binding.
+If the condition evaluates to true, then this binding applies to the current request.
+If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. </p></td>
+ </tr>
+
+ <tr>
+ <td>parsed_expr</td>
+ <td><a href="#google.api.expr.v1alpha1.Expr">google.api.expr.v1alpha1.Expr</a></td>
+ <td></td>
+ <td><p>The parsed expression of the condition. </p></td>
</tr>
</tbody>
@@ -15777,8 +15657,8 @@ to retrieve the next page of log entities. </p></td>
- <h3 id="bytebase.v1.DeleteUserRequest">DeleteUserRequest</h3>
- <p></p>
+ <h3 id="bytebase.v1.BindingDelta">BindingDelta</h3>
+ <p>One delta entry for Binding. Each individual change (only one member in each</p><p>entry) to a binding will be a separate entry.</p>
<table class="field-table">
@@ -15788,11 +15668,32 @@ to retrieve the next page of log entities. </p></td>
<tbody>
<tr>
- <td>name</td>
+ <td>action</td>
+ <td><a href="#bytebase.v1.BindingDelta.Action">BindingDelta.Action</a></td>
+ <td></td>
+ <td><p>The action that was performed on a Binding. </p></td>
+ </tr>
+
+ <tr>
+ <td>role</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name of the user to delete.
-Format: users/{user} </p></td>
+ <td><p>Role that is assigned to `members`.
+For example, `roles/projectOwner`. </p></td>
+ </tr>
+
+ <tr>
+ <td>member</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Follows the same format of Binding.members. </p></td>
+ </tr>
+
+ <tr>
+ <td>condition</td>
+ <td><a href="#google.type.Expr">google.type.Expr</a></td>
+ <td></td>
+ <td><p>The condition that is associated with this binding. </p></td>
</tr>
</tbody>
@@ -15802,7 +15703,7 @@ Format: users/{user} </p></td>
- <h3 id="bytebase.v1.GetUserRequest">GetUserRequest</h3>
+ <h3 id="bytebase.v1.GetIamPolicyRequest">GetIamPolicyRequest</h3>
<p></p>
@@ -15813,11 +15714,12 @@ Format: users/{user} </p></td>
<tbody>
<tr>
- <td>name</td>
+ <td>resource</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name of the user to retrieve.
-Format: users/{user uid or user email} </p></td>
+ <td><p>The name of the resource to get the IAM policy.
+Format: projects/{project}
+Format: workspaces/{workspace} </p></td>
</tr>
</tbody>
@@ -15827,7 +15729,7 @@ Format: users/{user uid or user email} </p></td>
- <h3 id="bytebase.v1.ListUsersRequest">ListUsersRequest</h3>
+ <h3 id="bytebase.v1.IamPolicy">IamPolicy</h3>
<p></p>
@@ -15838,58 +15740,44 @@ Format: users/{user uid or user email} </p></td>
<tbody>
<tr>
- <td>page_size</td>
- <td><a href="#int32">int32</a></td>
- <td></td>
- <td><p>The maximum number of users to return. The service may return fewer than
-this value.
-If unspecified, at most 10 users will be returned.
-The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>
+ <td>bindings</td>
+ <td><a href="#bytebase.v1.Binding">Binding</a></td>
+ <td>repeated</td>
+ <td><p>Collection of binding.
+A binding binds one or more project members to a single project role. </p></td>
</tr>
<tr>
- <td>page_token</td>
+ <td>etag</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>A page token, received from a previous `ListUsers` call.
-Provide this to retrieve the subsequent page.
-
-When paginating, all other parameters provided to `ListUsers` must match
-the call that provided the page token. </p></td>
- </tr>
-
- <tr>
- <td>show_deleted</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>Show deleted users if specified. </p></td>
+ <td><p>The current etag of the policy.
+If an etag is provided and does not match the current etag of the poliy,
+the call will be blocked and an ABORTED error will be returned. </p></td>
</tr>
- <tr>
- <td>filter</td>
- <td><a href="#string">string</a></td>
- <td></td>
- <td><p>Filter is used to filter users returned in the list.
-Supported filter:
-- name
-- email
-- user_type
-- state
-- project
+ </tbody>
+ </table>
-For example:
-name == &#34;ed&#34;
-name.matches(&#34;ed&#34;)
-email == &#34;[email protected]&#34;
-email.matches(&#34;ed&#34;)
-user_type == &#34;SERVICE_ACCOUNT&#34;
-user_type in [&#34;SERVICE_ACCOUNT&#34;, &#34;USER&#34;]
-!(user_type in [&#34;SERVICE_ACCOUNT&#34;, &#34;USER&#34;])
-state == &#34;DELETED&#34;
-project == &#34;projects/sample-project&#34;
-You can combine filter conditions like:
-name.matches(&#34;ed&#34;) &amp;&amp; project == &#34;projects/sample-project&#34;
-(name == &#34;ed&#34; || email == &#34;[email protected]&#34;) &amp;&amp; project == &#34;projects/sample-project&#34; </p></td>
+
+
+
+
+ <h3 id="bytebase.v1.PolicyDelta">PolicyDelta</h3>
+ <p>The difference delta between two policies.</p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>binding_deltas</td>
+ <td><a href="#bytebase.v1.BindingDelta">BindingDelta</a></td>
+ <td>repeated</td>
+ <td><p>The delta for Bindings between two policies. </p></td>
</tr>
</tbody>
@@ -15899,7 +15787,7 @@ name.matches(&#34;ed&#34;) &amp;&amp; project == &#34;projects/sample-project&#3
- <h3 id="bytebase.v1.ListUsersResponse">ListUsersResponse</h3>
+ <h3 id="bytebase.v1.SetIamPolicyRequest">SetIamPolicyRequest</h3>
<p></p>
@@ -15910,18 +15798,26 @@ name.matches(&#34;ed&#34;) &amp;&amp; project == &#34;projects/sample-project&#3
<tbody>
<tr>
- <td>users</td>
- <td><a href="#bytebase.v1.User">User</a></td>
- <td>repeated</td>
- <td><p>The users from the specified request. </p></td>
+ <td>resource</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The name of the resource to set the IAM policy.
+Format: projects/{project}
+Format: workspaces/{workspace} </p></td>
</tr>
<tr>
- <td>next_page_token</td>
+ <td>policy</td>
+ <td><a href="#bytebase.v1.IamPolicy">IamPolicy</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>etag</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>A token, which can be sent as `page_token` to retrieve the next page.
-If this field is omitted, there are no subsequent pages. </p></td>
+ <td><p>The current etag of the policy. </p></td>
</tr>
</tbody>
@@ -15931,14 +15827,50 @@ If this field is omitted, there are no subsequent pages. </p></td>
- <h3 id="bytebase.v1.StatUsersRequest">StatUsersRequest</h3>
- <p></p>
-
+
+ <h3 id="bytebase.v1.BindingDelta.Action">BindingDelta.Action</h3>
+ <p>The type of action performed on a Binding in a policy.</p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>ACTION_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>ADD</td>
+ <td>1</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>REMOVE</td>
+ <td>2</td>
+ <td><p></p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+
+
+ <div class="file-heading">
+ <h2 id="v1/audit_log_service.proto">v1/audit_log_service.proto</h2><a href="#title">Top</a>
+ </div>
+ <p></p>
-
- <h3 id="bytebase.v1.StatUsersResponse">StatUsersResponse</h3>
+ <h3 id="bytebase.v1.AuditData">AuditData</h3>
<p></p>
@@ -15949,9 +15881,9 @@ If this field is omitted, there are no subsequent pages. </p></td>
<tbody>
<tr>
- <td>stats</td>
- <td><a href="#bytebase.v1.StatUsersResponse.StatUser">StatUsersResponse.StatUser</a></td>
- <td>repeated</td>
+ <td>policy_delta</td>
+ <td><a href="#bytebase.v1.PolicyDelta">PolicyDelta</a></td>
+ <td></td>
<td><p> </p></td>
</tr>
@@ -15962,7 +15894,7 @@ If this field is omitted, there are no subsequent pages. </p></td>
- <h3 id="bytebase.v1.StatUsersResponse.StatUser">StatUsersResponse.StatUser</h3>
+ <h3 id="bytebase.v1.AuditLog">AuditLog</h3>
<p></p>
@@ -15973,49 +15905,84 @@ If this field is omitted, there are no subsequent pages. </p></td>
<tbody>
<tr>
- <td>user_type</td>
- <td><a href="#bytebase.v1.UserType">UserType</a></td>
+ <td>name</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The name of the log.
+Formats:
+- projects/{project}/auditLogs/{uid}
+- workspaces/{workspace}/auditLogs/{uid} </p></td>
</tr>
<tr>
- <td>state</td>
- <td><a href="#bytebase.v1.State">State</a></td>
+ <td>create_time</td>
+ <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>count</td>
- <td><a href="#int32">int32</a></td>
+ <td>user</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Format: users/[email protected] </p></td>
+ </tr>
+
+ <tr>
+ <td>method</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>e.g. `/bytebase.v1.SQLService/Query`, `bb.project.repository.push` </p></td>
+ </tr>
+
+ <tr>
+ <td>severity</td>
+ <td><a href="#bytebase.v1.AuditLog.Severity">AuditLog.Severity</a></td>
<td></td>
<td><p> </p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.UndeleteUserRequest">UndeleteUserRequest</h3>
- <p></p>
-
-
- <table class="field-table">
- <thead>
- <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
- </thead>
- <tbody>
+ <tr>
+ <td>resource</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The associated resource. </p></td>
+ </tr>
<tr>
- <td>name</td>
+ <td>request</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The name of the deleted user.
-Format: users/{user} </p></td>
+ <td><p>JSON-encoded request. </p></td>
+ </tr>
+
+ <tr>
+ <td>response</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>JSON-encoded response.
+Some fields are omitted because they are too large or contain sensitive information. </p></td>
+ </tr>
+
+ <tr>
+ <td>status</td>
+ <td><a href="#google.rpc.Status">google.rpc.Status</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
+ <tr>
+ <td>service_data</td>
+ <td><a href="#google.protobuf.Any">google.protobuf.Any</a></td>
+ <td></td>
+ <td><p>service-specific data about the request, response, and other activities. </p></td>
+ </tr>
+
+ <tr>
+ <td>request_metadata</td>
+ <td><a href="#bytebase.v1.RequestMetadata">RequestMetadata</a></td>
+ <td></td>
+ <td><p>Metadata about the operation. </p></td>
</tr>
</tbody>
@@ -16025,7 +15992,7 @@ Format: users/{user} </p></td>
- <h3 id="bytebase.v1.UpdateUserRequest">UpdateUserRequest</h3>
+ <h3 id="bytebase.v1.ExportAuditLogsRequest">ExportAuditLogsRequest</h3>
<p></p>
@@ -16036,42 +16003,58 @@ Format: users/{user} </p></td>
<tbody>
<tr>
- <td>user</td>
- <td><a href="#bytebase.v1.User">User</a></td>
+ <td>parent</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>The user to update.
-
-The user&#39;s `name` field is used to identify the user to update.
-Format: users/{user} </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>update_mask</td>
- <td><a href="#google.protobuf.FieldMask">google.protobuf.FieldMask</a></td>
+ <td>filter</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p>The list of fields to update. </p></td>
+ <td><p>The filter of the log. It should be a valid CEL expression.
+For example:
+ - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39;&#34;
+ - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39;&#34;
+ - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39; &amp;&amp; user == &#39;users/[email protected]&#39;&#34;
+ - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39; &amp;&amp; create_time &lt;= &#39;2021-01-01T00:00:00Z&#39; &amp;&amp; create_time &gt;= &#39;2020-01-01T00:00:00Z&#39;&#34; </p></td>
</tr>
<tr>
- <td>otp_code</td>
+ <td>order_by</td>
<td><a href="#string">string</a></td>
- <td>optional</td>
- <td><p>The otp_code is used to verify the user&#39;s identity by MFA. </p></td>
+ <td></td>
+ <td><p>The order by of the log.
+Only support order by create_time.
+For example:
+ - order_by = &#34;create_time asc&#34;
+ - order_by = &#34;create_time desc&#34; </p></td>
</tr>
<tr>
- <td>regenerate_temp_mfa_secret</td>
- <td><a href="#bool">bool</a></td>
+ <td>format</td>
+ <td><a href="#bytebase.v1.ExportFormat">ExportFormat</a></td>
<td></td>
- <td><p>The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.
-This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response. </p></td>
+ <td><p>The export format. </p></td>
</tr>
<tr>
- <td>regenerate_recovery_codes</td>
- <td><a href="#bool">bool</a></td>
+ <td>page_size</td>
+ <td><a href="#int32">int32</a></td>
<td></td>
- <td><p>The regenerate_recovery_codes flag means to regenerate recovery codes for user. </p></td>
+ <td><p>The maximum number of logs to return.
+The service may return fewer than this value.
+If unspecified, at most 10 log entries will be returned.
+The maximum value is 5000; values above 5000 will be coerced to 5000. </p></td>
+ </tr>
+
+ <tr>
+ <td>page_token</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>A page token, received from a previous `ExportAuditLogs` call.
+Provide this to retrieve the subsequent page. </p></td>
</tr>
</tbody>
@@ -16081,7 +16064,7 @@ This is used for MFA setup. The temporary MFA secret and recovery codes will be
- <h3 id="bytebase.v1.User">User</h3>
+ <h3 id="bytebase.v1.ExportAuditLogsResponse">ExportAuditLogsResponse</h3>
<p></p>
@@ -16092,89 +16075,122 @@ This is used for MFA setup. The temporary MFA secret and recovery codes will be
<tbody>
<tr>
- <td>name</td>
- <td><a href="#string">string</a></td>
+ <td>content</td>
+ <td><a href="#bytes">bytes</a></td>
<td></td>
- <td><p>The name of the user.
-Format: users/{user}. {user} is a system-generated unique ID. </p></td>
+ <td><p> </p></td>
</tr>
<tr>
- <td>state</td>
- <td><a href="#bytebase.v1.State">State</a></td>
+ <td>next_page_token</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>A token to retrieve next page of log entities.
+Pass this value in the page_token field in the subsequent call
+to retrieve the next page of log entities. </p></td>
</tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.RequestMetadata">RequestMetadata</h3>
+ <p>Metadata about the request.</p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
<tr>
- <td>email</td>
+ <td>caller_ip</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The IP address of the caller. </p></td>
</tr>
<tr>
- <td>title</td>
+ <td>caller_supplied_user_agent</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>The user agent of the caller.
+This information is not authenticated and should be treated accordingly. </p></td>
</tr>
- <tr>
- <td>user_type</td>
- <td><a href="#bytebase.v1.UserType">UserType</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.SearchAuditLogsRequest">SearchAuditLogsRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
<tr>
- <td>password</td>
+ <td>parent</td>
<td><a href="#string">string</a></td>
<td></td>
<td><p> </p></td>
</tr>
<tr>
- <td>service_key</td>
+ <td>filter</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>mfa_enabled</td>
- <td><a href="#bool">bool</a></td>
- <td></td>
- <td><p>The mfa_enabled flag means if the user has enabled MFA. </p></td>
+ <td><p>The filter of the log. It should be a valid CEL expression.
+Supported filter:
+- method
+- severity
+- user
+- create_time
+
+For example:
+ - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39;&#34;
+ - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39;&#34;
+ - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39; &amp;&amp; user == &#39;users/[email protected]&#39;&#34;
+ - filter = &#34;method == &#39;/bytebase.v1.SQLService/Query&#39; &amp;&amp; severity == &#39;ERROR&#39; &amp;&amp; create_time &lt;= &#39;2021-01-01T00:00:00Z&#39; &amp;&amp; create_time &gt;= &#39;2020-01-01T00:00:00Z&#39;&#34; </p></td>
</tr>
<tr>
- <td>mfa_secret</td>
+ <td>order_by</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>The mfa_secret is the temporary secret using in two phase verification. </p></td>
- </tr>
-
- <tr>
- <td>recovery_codes</td>
- <td><a href="#string">string</a></td>
- <td>repeated</td>
- <td><p>The recovery_codes is the temporary recovery codes using in two phase verification. </p></td>
+ <td><p>The order by of the log.
+Only support order by create_time.
+For example:
+ - order_by = &#34;create_time asc&#34;
+ - order_by = &#34;create_time desc&#34; </p></td>
</tr>
<tr>
- <td>phone</td>
- <td><a href="#string">string</a></td>
+ <td>page_size</td>
+ <td><a href="#int32">int32</a></td>
<td></td>
- <td><p>Should be a valid E.164 compliant phone number.
-Could be empty. </p></td>
+ <td><p>The maximum number of logs to return.
+The service may return fewer than this value.
+If unspecified, at most 10 log entries will be returned.
+The maximum value is 5000; values above 5000 will be coerced to 5000. </p></td>
</tr>
<tr>
- <td>profile</td>
- <td><a href="#bytebase.v1.User.Profile">User.Profile</a></td>
+ <td>page_token</td>
+ <td><a href="#string">string</a></td>
<td></td>
- <td><p> </p></td>
+ <td><p>A page token, received from a previous `SearchLogs` call.
+Provide this to retrieve the subsequent page. </p></td>
</tr>
</tbody>
@@ -16184,7 +16200,7 @@ Could be empty. </p></td>
- <h3 id="bytebase.v1.User.Profile">User.Profile</h3>
+ <h3 id="bytebase.v1.SearchAuditLogsResponse">SearchAuditLogsResponse</h3>
<p></p>
@@ -16195,24 +16211,19 @@ Could be empty. </p></td>
<tbody>
<tr>
- <td>last_login_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
- <td></td>
- <td><p> </p></td>
- </tr>
-
- <tr>
- <td>last_change_password_time</td>
- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
- <td></td>
+ <td>audit_logs</td>
+ <td><a href="#bytebase.v1.AuditLog">AuditLog</a></td>
+ <td>repeated</td>
<td><p> </p></td>
</tr>
<tr>
- <td>source</td>
+ <td>next_page_token</td>
<td><a href="#string">string</a></td>
<td></td>
- <td><p>source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. </p></td>
+ <td><p>A token to retrieve next page of log entities.
+Pass this value in the page_token field in the subsequent call
+to retrieve the next page of log entities. </p></td>
</tr>
</tbody>
@@ -16224,7 +16235,7 @@ Could be empty. </p></td>
- <h3 id="bytebase.v1.UserType">UserType</h3>
+ <h3 id="bytebase.v1.AuditLog.Severity">AuditLog.Severity</h3>
<p></p>
<table class="enum-table">
<thead>
@@ -16233,97 +16244,86 @@ Could be empty. </p></td>
<tbody>
<tr>
- <td>USER_TYPE_UNSPECIFIED</td>
+ <td>DEFAULT</td>
<td>0</td>
<td><p></p></td>
</tr>
<tr>
- <td>USER</td>
+ <td>DEBUG</td>
<td>1</td>
<td><p></p></td>
</tr>
<tr>
- <td>SYSTEM_BOT</td>
+ <td>INFO</td>
<td>2</td>
<td><p></p></td>
</tr>
<tr>
- <td>SERVICE_ACCOUNT</td>
+ <td>NOTICE</td>
<td>3</td>
<td><p></p></td>
</tr>
- </tbody>
- </table>
-
-
-
-
-
- <h3 id="bytebase.v1.UserService">UserService</h3>
- <p></p>
- <table class="enum-table">
- <thead>
- <tr><td>Method Name</td><td>Request Type</td><td>Response Type</td><td>Description</td></tr>
- </thead>
- <tbody>
-
<tr>
- <td>GetUser</td>
- <td><a href="#bytebase.v1.GetUserRequest">GetUserRequest</a></td>
- <td><a href="#bytebase.v1.User">User</a></td>
- <td><p>Get the user.
-Any authenticated user can get the user.</p></td>
+ <td>WARNING</td>
+ <td>4</td>
+ <td><p></p></td>
</tr>
<tr>
- <td>ListUsers</td>
- <td><a href="#bytebase.v1.ListUsersRequest">ListUsersRequest</a></td>
- <td><a href="#bytebase.v1.ListUsersResponse">ListUsersResponse</a></td>
- <td><p>List all users.
-Any authenticated user can list users.</p></td>
+ <td>ERROR</td>
+ <td>5</td>
+ <td><p></p></td>
</tr>
<tr>
- <td>StatUsers</td>
- <td><a href="#bytebase.v1.StatUsersRequest">StatUsersRequest</a></td>
- <td><a href="#bytebase.v1.StatUsersResponse">StatUsersResponse</a></td>
- <td><p>Get user stat.
-Any authenticated user can get stat.</p></td>
+ <td>CRITICAL</td>
+ <td>6</td>
+ <td><p></p></td>
</tr>
<tr>
- <td>CreateUser</td>
- <td><a href="#bytebase.v1.CreateUserRequest">CreateUserRequest</a></td>
- <td><a href="#bytebase.v1.User">User</a></td>
- <td><p>Create a user.
-When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.
-Otherwise, any unauthenticated user can create a user.</p></td>
+ <td>ALERT</td>
+ <td>7</td>
+ <td><p></p></td>
</tr>
<tr>
- <td>UpdateUser</td>
- <td><a href="#bytebase.v1.UpdateUserRequest">UpdateUserRequest</a></td>
- <td><a href="#bytebase.v1.User">User</a></td>
- <td><p>Only the user itself and the user with bb.users.update permission on the workspace can update the user.</p></td>
+ <td>EMERGENCY</td>
+ <td>8</td>
+ <td><p></p></td>
</tr>
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.AuditLogService">AuditLogService</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Method Name</td><td>Request Type</td><td>Response Type</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
<tr>
- <td>DeleteUser</td>
- <td><a href="#bytebase.v1.DeleteUserRequest">DeleteUserRequest</a></td>
- <td><a href="#google.protobuf.Empty">.google.protobuf.Empty</a></td>
- <td><p>Only the user with bb.users.delete permission on the workspace can delete the user.
-The last remaining workspace admin cannot be deleted.</p></td>
+ <td>SearchAuditLogs</td>
+ <td><a href="#bytebase.v1.SearchAuditLogsRequest">SearchAuditLogsRequest</a></td>
+ <td><a href="#bytebase.v1.SearchAuditLogsResponse">SearchAuditLogsResponse</a></td>
+ <td><p></p></td>
</tr>
<tr>
- <td>UndeleteUser</td>
- <td><a href="#bytebase.v1.UndeleteUserRequest">UndeleteUserRequest</a></td>
- <td><a href="#bytebase.v1.User">User</a></td>
- <td><p>Only the user with bb.users.undelete permission on the workspace can undelete the user.</p></td>
+ <td>ExportAuditLogs</td>
+ <td><a href="#bytebase.v1.ExportAuditLogsRequest">ExportAuditLogsRequest</a></td>
+ <td><a href="#bytebase.v1.ExportAuditLogsResponse">ExportAuditLogsResponse</a></td>
+ <td><p></p></td>
</tr>
</tbody>
@@ -16347,69 +16347,33 @@ The last remaining workspace admin cannot be deleted.</p></td>
<tr>
- <td>GetUser</td>
- <td>GET</td>
- <td>/v1/{name=users/*}</td>
- <td></td>
- </tr>
-
-
-
-
- <tr>
- <td>ListUsers</td>
- <td>GET</td>
- <td>/v1/users</td>
- <td></td>
- </tr>
-
-
-
-
- <tr>
- <td>StatUsers</td>
+ <td>SearchAuditLogs</td>
<td>POST</td>
- <td>/v1/users:stat</td>
+ <td>/v1/{parent=projects/*}/auditLogs:search</td>
<td>*</td>
</tr>
-
-
-
<tr>
- <td>CreateUser</td>
+ <td>SearchAuditLogs</td>
<td>POST</td>
- <td>/v1/users</td>
- <td>user</td>
- </tr>
-
-
-
-
- <tr>
- <td>UpdateUser</td>
- <td>PATCH</td>
- <td>/v1/{user.name=users/*}</td>
- <td>user</td>
+ <td>/v1/auditLogs:search</td>
+ <td>*</td>
</tr>
<tr>
- <td>DeleteUser</td>
- <td>DELETE</td>
- <td>/v1/{name=users/*}</td>
- <td></td>
+ <td>ExportAuditLogs</td>
+ <td>POST</td>
+ <td>/v1/{parent=projects/*}/auditLogs:export</td>
+ <td>*</td>
</tr>
-
-
-
<tr>
- <td>UndeleteUser</td>
+ <td>ExportAuditLogs</td>
<td>POST</td>
- <td>/v1/{name=users/*}:undelete</td>
+ <td>/v1/auditLogs:export</td>
<td>*</td>
</tr>
diff --git a/proto/generated-go/v1/actuator_service.pb.go b/proto/generated-go/v1/actuator_service.pb.go
index fed54a6247..82a0f3044d 100644
--- a/proto/generated-go/v1/actuator_service.pb.go
+++ b/proto/generated-go/v1/actuator_service.pb.go
@@ -271,9 +271,12 @@ type ActuatorInfo struct {
DisallowPasswordSignin bool `protobuf:"varint,20,opt,name=disallow_password_signin,json=disallowPasswordSignin,proto3" json:"disallow_password_signin,omitempty"`
PasswordRestriction *PasswordRestrictionSetting `protobuf:"bytes,21,opt,name=password_restriction,json=passwordRestriction,proto3" json:"password_restriction,omitempty"`
// docker flag means if the Bytebase instance is running in docker.
- Docker bool `protobuf:"varint,22,opt,name=docker,proto3" json:"docker,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ Docker bool `protobuf:"varint,22,opt,name=docker,proto3" json:"docker,omitempty"`
+ UserStats []*ActuatorInfo_StatUser `protobuf:"bytes,23,rep,name=user_stats,json=userStats,proto3" json:"user_stats,omitempty"`
+ ActivatedInstanceCount int32 `protobuf:"varint,24,opt,name=activated_instance_count,json=activatedInstanceCount,proto3" json:"activated_instance_count,omitempty"`
+ TotalInstanceCount int32 `protobuf:"varint,25,opt,name=total_instance_count,json=totalInstanceCount,proto3" json:"total_instance_count,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *ActuatorInfo) Reset() {
@@ -432,11 +435,92 @@ func (x *ActuatorInfo) GetDocker() bool {
return false
}
+func (x *ActuatorInfo) GetUserStats() []*ActuatorInfo_StatUser {
+ if x != nil {
+ return x.UserStats
+ }
+ return nil
+}
+
+func (x *ActuatorInfo) GetActivatedInstanceCount() int32 {
+ if x != nil {
+ return x.ActivatedInstanceCount
+ }
+ return 0
+}
+
+func (x *ActuatorInfo) GetTotalInstanceCount() int32 {
+ if x != nil {
+ return x.TotalInstanceCount
+ }
+ return 0
+}
+
+type ActuatorInfo_StatUser struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ UserType UserType `protobuf:"varint,1,opt,name=user_type,json=userType,proto3,enum=bytebase.v1.UserType" json:"user_type,omitempty"`
+ State State `protobuf:"varint,2,opt,name=state,proto3,enum=bytebase.v1.State" json:"state,omitempty"`
+ Count int32 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ActuatorInfo_StatUser) Reset() {
+ *x = ActuatorInfo_StatUser{}
+ mi := &file_v1_actuator_service_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ActuatorInfo_StatUser) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ActuatorInfo_StatUser) ProtoMessage() {}
+
+func (x *ActuatorInfo_StatUser) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_actuator_service_proto_msgTypes[6]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ActuatorInfo_StatUser.ProtoReflect.Descriptor instead.
+func (*ActuatorInfo_StatUser) Descriptor() ([]byte, []int) {
+ return file_v1_actuator_service_proto_rawDescGZIP(), []int{5, 0}
+}
+
+func (x *ActuatorInfo_StatUser) GetUserType() UserType {
+ if x != nil {
+ return x.UserType
+ }
+ return UserType_USER_TYPE_UNSPECIFIED
+}
+
+func (x *ActuatorInfo_StatUser) GetState() State {
+ if x != nil {
+ return x.State
+ }
+ return State_STATE_UNSPECIFIED
+}
+
+func (x *ActuatorInfo_StatUser) GetCount() int32 {
+ if x != nil {
+ return x.Count
+ }
+ return 0
+}
+
var File_v1_actuator_service_proto protoreflect.FileDescriptor
const file_v1_actuator_service_proto_rawDesc = "" +
"\n" +
- "\x19v1/actuator_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x18v1/setting_service.proto\"\x1b\n" +
+ "\x19v1/actuator_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\x1a\x18v1/setting_service.proto\x1a\x15v1/user_service.proto\"\x1b\n" +
"\x19GetResourcePackageRequest\"%\n" +
"\x0fResourcePackage\x12\x12\n" +
"\x04logo\x18\x01 \x01(\fR\x04logo\"\x18\n" +
@@ -445,7 +529,7 @@ const file_v1_actuator_service_proto_rawDesc = "" +
"\bactuator\x18\x01 \x01(\v2\x19.bytebase.v1.ActuatorInfoB\x04\xe2A\x01\x02R\bactuator\x12A\n" +
"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x04\xe2A\x01\x02R\n" +
"updateMask\"\x14\n" +
- "\x12DeleteCacheRequest\"\xf6\x05\n" +
+ "\x12DeleteCacheRequest\"\xa5\b\n" +
"\fActuatorInfo\x12\x1e\n" +
"\aversion\x18\x01 \x01(\tB\x04\xe2A\x01\x03R\aversion\x12#\n" +
"\n" +
@@ -467,7 +551,15 @@ const file_v1_actuator_service_proto_rawDesc = "" +
"\x13unlicensed_features\x18\x13 \x03(\tR\x12unlicensedFeatures\x128\n" +
"\x18disallow_password_signin\x18\x14 \x01(\bR\x16disallowPasswordSignin\x12Z\n" +
"\x14password_restriction\x18\x15 \x01(\v2'.bytebase.v1.PasswordRestrictionSettingR\x13passwordRestriction\x12\x16\n" +
- "\x06docker\x18\x16 \x01(\bR\x06docker2\x9f\x04\n" +
+ "\x06docker\x18\x16 \x01(\bR\x06docker\x12A\n" +
+ "\n" +
+ "user_stats\x18\x17 \x03(\v2\".bytebase.v1.ActuatorInfo.StatUserR\tuserStats\x128\n" +
+ "\x18activated_instance_count\x18\x18 \x01(\x05R\x16activatedInstanceCount\x120\n" +
+ "\x14total_instance_count\x18\x19 \x01(\x05R\x12totalInstanceCount\x1a~\n" +
+ "\bStatUser\x122\n" +
+ "\tuser_type\x18\x01 \x01(\x0e2\x15.bytebase.v1.UserTypeR\buserType\x12(\n" +
+ "\x05state\x18\x02 \x01(\x0e2\x12.bytebase.v1.StateR\x05state\x12\x14\n" +
+ "\x05count\x18\x03 \x01(\x05R\x05count2\x9f\x04\n" +
"\x0fActuatorService\x12s\n" +
"\x0fGetActuatorInfo\x12#.bytebase.v1.GetActuatorInfoRequest\x1a\x19.bytebase.v1.ActuatorInfo\" \xdaA\x00\x80\xea0\x01\x82\xd3\xe4\x93\x02\x13\x12\x11/v1/actuator/info\x12\xaa\x01\n" +
"\x12UpdateActuatorInfo\x12&.bytebase.v1.UpdateActuatorInfoRequest\x1a\x19.bytebase.v1.ActuatorInfo\"Q\xdaA\x14actuator,update_mask\x8a\xea0\x0fbb.settings.set\x90\xea0\x01\x82\xd3\xe4\x93\x02\x1d:\bactuator2\x11/v1/actuator/info\x12f\n" +
@@ -486,7 +578,7 @@ func file_v1_actuator_service_proto_rawDescGZIP() []byte {
return file_v1_actuator_service_proto_rawDescData
}
-var file_v1_actuator_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
+var file_v1_actuator_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_v1_actuator_service_proto_goTypes = []any{
(*GetResourcePackageRequest)(nil), // 0: bytebase.v1.GetResourcePackageRequest
(*ResourcePackage)(nil), // 1: bytebase.v1.ResourcePackage
@@ -494,29 +586,35 @@ var file_v1_actuator_service_proto_goTypes = []any{
(*UpdateActuatorInfoRequest)(nil), // 3: bytebase.v1.UpdateActuatorInfoRequest
(*DeleteCacheRequest)(nil), // 4: bytebase.v1.DeleteCacheRequest
(*ActuatorInfo)(nil), // 5: bytebase.v1.ActuatorInfo
- (*fieldmaskpb.FieldMask)(nil), // 6: google.protobuf.FieldMask
- (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp
- (*PasswordRestrictionSetting)(nil), // 8: bytebase.v1.PasswordRestrictionSetting
- (*emptypb.Empty)(nil), // 9: google.protobuf.Empty
+ (*ActuatorInfo_StatUser)(nil), // 6: bytebase.v1.ActuatorInfo.StatUser
+ (*fieldmaskpb.FieldMask)(nil), // 7: google.protobuf.FieldMask
+ (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp
+ (*PasswordRestrictionSetting)(nil), // 9: bytebase.v1.PasswordRestrictionSetting
+ (UserType)(0), // 10: bytebase.v1.UserType
+ (State)(0), // 11: bytebase.v1.State
+ (*emptypb.Empty)(nil), // 12: google.protobuf.Empty
}
var file_v1_actuator_service_proto_depIdxs = []int32{
- 5, // 0: bytebase.v1.UpdateActuatorInfoRequest.actuator:type_name -> bytebase.v1.ActuatorInfo
- 6, // 1: bytebase.v1.UpdateActuatorInfoRequest.update_mask:type_name -> google.protobuf.FieldMask
- 7, // 2: bytebase.v1.ActuatorInfo.last_active_time:type_name -> google.protobuf.Timestamp
- 8, // 3: bytebase.v1.ActuatorInfo.password_restriction:type_name -> bytebase.v1.PasswordRestrictionSetting
- 2, // 4: bytebase.v1.ActuatorService.GetActuatorInfo:input_type -> bytebase.v1.GetActuatorInfoRequest
- 3, // 5: bytebase.v1.ActuatorService.UpdateActuatorInfo:input_type -> bytebase.v1.UpdateActuatorInfoRequest
- 4, // 6: bytebase.v1.ActuatorService.DeleteCache:input_type -> bytebase.v1.DeleteCacheRequest
- 0, // 7: bytebase.v1.ActuatorService.GetResourcePackage:input_type -> bytebase.v1.GetResourcePackageRequest
- 5, // 8: bytebase.v1.ActuatorService.GetActuatorInfo:output_type -> bytebase.v1.ActuatorInfo
- 5, // 9: bytebase.v1.ActuatorService.UpdateActuatorInfo:output_type -> bytebase.v1.ActuatorInfo
- 9, // 10: bytebase.v1.ActuatorService.DeleteCache:output_type -> google.protobuf.Empty
- 1, // 11: bytebase.v1.ActuatorService.GetResourcePackage:output_type -> bytebase.v1.ResourcePackage
- 8, // [8:12] is the sub-list for method output_type
- 4, // [4:8] is the sub-list for method input_type
- 4, // [4:4] is the sub-list for extension type_name
- 4, // [4:4] is the sub-list for extension extendee
- 0, // [0:4] is the sub-list for field type_name
+ 5, // 0: bytebase.v1.UpdateActuatorInfoRequest.actuator:type_name -> bytebase.v1.ActuatorInfo
+ 7, // 1: bytebase.v1.UpdateActuatorInfoRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 8, // 2: bytebase.v1.ActuatorInfo.last_active_time:type_name -> google.protobuf.Timestamp
+ 9, // 3: bytebase.v1.ActuatorInfo.password_restriction:type_name -> bytebase.v1.PasswordRestrictionSetting
+ 6, // 4: bytebase.v1.ActuatorInfo.user_stats:type_name -> bytebase.v1.ActuatorInfo.StatUser
+ 10, // 5: bytebase.v1.ActuatorInfo.StatUser.user_type:type_name -> bytebase.v1.UserType
+ 11, // 6: bytebase.v1.ActuatorInfo.StatUser.state:type_name -> bytebase.v1.State
+ 2, // 7: bytebase.v1.ActuatorService.GetActuatorInfo:input_type -> bytebase.v1.GetActuatorInfoRequest
+ 3, // 8: bytebase.v1.ActuatorService.UpdateActuatorInfo:input_type -> bytebase.v1.UpdateActuatorInfoRequest
+ 4, // 9: bytebase.v1.ActuatorService.DeleteCache:input_type -> bytebase.v1.DeleteCacheRequest
+ 0, // 10: bytebase.v1.ActuatorService.GetResourcePackage:input_type -> bytebase.v1.GetResourcePackageRequest
+ 5, // 11: bytebase.v1.ActuatorService.GetActuatorInfo:output_type -> bytebase.v1.ActuatorInfo
+ 5, // 12: bytebase.v1.ActuatorService.UpdateActuatorInfo:output_type -> bytebase.v1.ActuatorInfo
+ 12, // 13: bytebase.v1.ActuatorService.DeleteCache:output_type -> google.protobuf.Empty
+ 1, // 14: bytebase.v1.ActuatorService.GetResourcePackage:output_type -> bytebase.v1.ResourcePackage
+ 11, // [11:15] is the sub-list for method output_type
+ 7, // [7:11] is the sub-list for method input_type
+ 7, // [7:7] is the sub-list for extension type_name
+ 7, // [7:7] is the sub-list for extension extendee
+ 0, // [0:7] is the sub-list for field type_name
}
func init() { file_v1_actuator_service_proto_init() }
@@ -525,14 +623,16 @@ func file_v1_actuator_service_proto_init() {
return
}
file_v1_annotation_proto_init()
+ file_v1_common_proto_init()
file_v1_setting_service_proto_init()
+ file_v1_user_service_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_actuator_service_proto_rawDesc), len(file_v1_actuator_service_proto_rawDesc)),
NumEnums: 0,
- NumMessages: 6,
+ NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/generated-go/v1/user_service.pb.go b/proto/generated-go/v1/user_service.pb.go
index f03d73eabf..29434c9a24 100644
--- a/proto/generated-go/v1/user_service.pb.go
+++ b/proto/generated-go/v1/user_service.pb.go
@@ -123,86 +123,6 @@ func (x *GetUserRequest) GetName() string {
return ""
}
-type StatUsersRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *StatUsersRequest) Reset() {
- *x = StatUsersRequest{}
- mi := &file_v1_user_service_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *StatUsersRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*StatUsersRequest) ProtoMessage() {}
-
-func (x *StatUsersRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[1]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use StatUsersRequest.ProtoReflect.Descriptor instead.
-func (*StatUsersRequest) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{1}
-}
-
-type StatUsersResponse struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Stats []*StatUsersResponse_StatUser `protobuf:"bytes,1,rep,name=stats,proto3" json:"stats,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *StatUsersResponse) Reset() {
- *x = StatUsersResponse{}
- mi := &file_v1_user_service_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *StatUsersResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*StatUsersResponse) ProtoMessage() {}
-
-func (x *StatUsersResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[2]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use StatUsersResponse.ProtoReflect.Descriptor instead.
-func (*StatUsersResponse) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *StatUsersResponse) GetStats() []*StatUsersResponse_StatUser {
- if x != nil {
- return x.Stats
- }
- return nil
-}
-
type ListUsersRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The maximum number of users to return. The service may return fewer than
@@ -246,7 +166,7 @@ type ListUsersRequest struct {
func (x *ListUsersRequest) Reset() {
*x = ListUsersRequest{}
- mi := &file_v1_user_service_proto_msgTypes[3]
+ mi := &file_v1_user_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -258,7 +178,7 @@ func (x *ListUsersRequest) String() string {
func (*ListUsersRequest) ProtoMessage() {}
func (x *ListUsersRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[3]
+ mi := &file_v1_user_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -271,7 +191,7 @@ func (x *ListUsersRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListUsersRequest.ProtoReflect.Descriptor instead.
func (*ListUsersRequest) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{3}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{1}
}
func (x *ListUsersRequest) GetPageSize() int32 {
@@ -315,7 +235,7 @@ type ListUsersResponse struct {
func (x *ListUsersResponse) Reset() {
*x = ListUsersResponse{}
- mi := &file_v1_user_service_proto_msgTypes[4]
+ mi := &file_v1_user_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -327,7 +247,7 @@ func (x *ListUsersResponse) String() string {
func (*ListUsersResponse) ProtoMessage() {}
func (x *ListUsersResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[4]
+ mi := &file_v1_user_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -340,7 +260,7 @@ func (x *ListUsersResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListUsersResponse.ProtoReflect.Descriptor instead.
func (*ListUsersResponse) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{4}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{2}
}
func (x *ListUsersResponse) GetUsers() []*User {
@@ -367,7 +287,7 @@ type CreateUserRequest struct {
func (x *CreateUserRequest) Reset() {
*x = CreateUserRequest{}
- mi := &file_v1_user_service_proto_msgTypes[5]
+ mi := &file_v1_user_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -379,7 +299,7 @@ func (x *CreateUserRequest) String() string {
func (*CreateUserRequest) ProtoMessage() {}
func (x *CreateUserRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[5]
+ mi := &file_v1_user_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -392,7 +312,7 @@ func (x *CreateUserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead.
func (*CreateUserRequest) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{5}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{3}
}
func (x *CreateUserRequest) GetUser() *User {
@@ -424,7 +344,7 @@ type UpdateUserRequest struct {
func (x *UpdateUserRequest) Reset() {
*x = UpdateUserRequest{}
- mi := &file_v1_user_service_proto_msgTypes[6]
+ mi := &file_v1_user_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -436,7 +356,7 @@ func (x *UpdateUserRequest) String() string {
func (*UpdateUserRequest) ProtoMessage() {}
func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[6]
+ mi := &file_v1_user_service_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -449,7 +369,7 @@ func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.
func (*UpdateUserRequest) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{6}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{4}
}
func (x *UpdateUserRequest) GetUser() *User {
@@ -498,7 +418,7 @@ type DeleteUserRequest struct {
func (x *DeleteUserRequest) Reset() {
*x = DeleteUserRequest{}
- mi := &file_v1_user_service_proto_msgTypes[7]
+ mi := &file_v1_user_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -510,7 +430,7 @@ func (x *DeleteUserRequest) String() string {
func (*DeleteUserRequest) ProtoMessage() {}
func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[7]
+ mi := &file_v1_user_service_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -523,7 +443,7 @@ func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead.
func (*DeleteUserRequest) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{7}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{5}
}
func (x *DeleteUserRequest) GetName() string {
@@ -544,7 +464,7 @@ type UndeleteUserRequest struct {
func (x *UndeleteUserRequest) Reset() {
*x = UndeleteUserRequest{}
- mi := &file_v1_user_service_proto_msgTypes[8]
+ mi := &file_v1_user_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -556,7 +476,7 @@ func (x *UndeleteUserRequest) String() string {
func (*UndeleteUserRequest) ProtoMessage() {}
func (x *UndeleteUserRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[8]
+ mi := &file_v1_user_service_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -569,7 +489,7 @@ func (x *UndeleteUserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UndeleteUserRequest.ProtoReflect.Descriptor instead.
func (*UndeleteUserRequest) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{8}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{6}
}
func (x *UndeleteUserRequest) GetName() string {
@@ -606,7 +526,7 @@ type User struct {
func (x *User) Reset() {
*x = User{}
- mi := &file_v1_user_service_proto_msgTypes[9]
+ mi := &file_v1_user_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -618,7 +538,7 @@ func (x *User) String() string {
func (*User) ProtoMessage() {}
func (x *User) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[9]
+ mi := &file_v1_user_service_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -631,7 +551,7 @@ func (x *User) ProtoReflect() protoreflect.Message {
// Deprecated: Use User.ProtoReflect.Descriptor instead.
func (*User) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{9}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{7}
}
func (x *User) GetName() string {
@@ -718,66 +638,6 @@ func (x *User) GetProfile() *User_Profile {
return nil
}
-type StatUsersResponse_StatUser struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- UserType UserType `protobuf:"varint,1,opt,name=user_type,json=userType,proto3,enum=bytebase.v1.UserType" json:"user_type,omitempty"`
- State State `protobuf:"varint,2,opt,name=state,proto3,enum=bytebase.v1.State" json:"state,omitempty"`
- Count int32 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *StatUsersResponse_StatUser) Reset() {
- *x = StatUsersResponse_StatUser{}
- mi := &file_v1_user_service_proto_msgTypes[10]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *StatUsersResponse_StatUser) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*StatUsersResponse_StatUser) ProtoMessage() {}
-
-func (x *StatUsersResponse_StatUser) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[10]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use StatUsersResponse_StatUser.ProtoReflect.Descriptor instead.
-func (*StatUsersResponse_StatUser) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{2, 0}
-}
-
-func (x *StatUsersResponse_StatUser) GetUserType() UserType {
- if x != nil {
- return x.UserType
- }
- return UserType_USER_TYPE_UNSPECIFIED
-}
-
-func (x *StatUsersResponse_StatUser) GetState() State {
- if x != nil {
- return x.State
- }
- return State_STATE_UNSPECIFIED
-}
-
-func (x *StatUsersResponse_StatUser) GetCount() int32 {
- if x != nil {
- return x.Count
- }
- return 0
-}
-
type User_Profile struct {
state protoimpl.MessageState `protogen:"open.v1"`
LastLoginTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=last_login_time,json=lastLoginTime,proto3" json:"last_login_time,omitempty"`
@@ -790,7 +650,7 @@ type User_Profile struct {
func (x *User_Profile) Reset() {
*x = User_Profile{}
- mi := &file_v1_user_service_proto_msgTypes[11]
+ mi := &file_v1_user_service_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -802,7 +662,7 @@ func (x *User_Profile) String() string {
func (*User_Profile) ProtoMessage() {}
func (x *User_Profile) ProtoReflect() protoreflect.Message {
- mi := &file_v1_user_service_proto_msgTypes[11]
+ mi := &file_v1_user_service_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -815,7 +675,7 @@ func (x *User_Profile) ProtoReflect() protoreflect.Message {
// Deprecated: Use User_Profile.ProtoReflect.Descriptor instead.
func (*User_Profile) Descriptor() ([]byte, []int) {
- return file_v1_user_service_proto_rawDescGZIP(), []int{9, 0}
+ return file_v1_user_service_proto_rawDescGZIP(), []int{7, 0}
}
func (x *User_Profile) GetLastLoginTime() *timestamppb.Timestamp {
@@ -846,14 +706,7 @@ const file_v1_user_service_proto_rawDesc = "" +
"\x15v1/user_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\x1a\x0fv1/common.proto\"@\n" +
"\x0eGetUserRequest\x12.\n" +
"\x04name\x18\x01 \x01(\tB\x1a\xe2A\x01\x02\xfaA\x13\n" +
- "\x11bytebase.com/UserR\x04name\"\x12\n" +
- "\x10StatUsersRequest\"\xd2\x01\n" +
- "\x11StatUsersResponse\x12=\n" +
- "\x05stats\x18\x01 \x03(\v2'.bytebase.v1.StatUsersResponse.StatUserR\x05stats\x1a~\n" +
- "\bStatUser\x122\n" +
- "\tuser_type\x18\x01 \x01(\x0e2\x15.bytebase.v1.UserTypeR\buserType\x12(\n" +
- "\x05state\x18\x02 \x01(\x0e2\x12.bytebase.v1.StateR\x05state\x12\x14\n" +
- "\x05count\x18\x03 \x01(\x05R\x05count\"\x89\x01\n" +
+ "\x11bytebase.com/UserR\x04name\"\x89\x01\n" +
"\x10ListUsersRequest\x12\x1b\n" +
"\tpage_size\x18\x01 \x01(\x05R\bpageSize\x12\x1d\n" +
"\n" +
@@ -906,11 +759,10 @@ const file_v1_user_service_proto_rawDesc = "" +
"\x04USER\x10\x01\x12\x0e\n" +
"\n" +
"SYSTEM_BOT\x10\x02\x12\x13\n" +
- "\x0fSERVICE_ACCOUNT\x10\x032\xa6\x06\n" +
+ "\x0fSERVICE_ACCOUNT\x10\x032\xb2\x05\n" +
"\vUserService\x12`\n" +
"\aGetUser\x12\x1b.bytebase.v1.GetUserRequest\x1a\x11.bytebase.v1.User\"%\xdaA\x04name\x90\xea0\x02\x82\xd3\xe4\x93\x02\x14\x12\x12/v1/{name=users/*}\x12j\n" +
- "\tListUsers\x12\x1d.bytebase.v1.ListUsersRequest\x1a\x1e.bytebase.v1.ListUsersResponse\"\x1e\xdaA\x06parent\x90\xea0\x02\x82\xd3\xe4\x93\x02\v\x12\t/v1/users\x12r\n" +
- "\tStatUsers\x12\x1d.bytebase.v1.StatUsersRequest\x1a\x1e.bytebase.v1.StatUsersResponse\"&\xdaA\x06parent\x90\xea0\x02\x82\xd3\xe4\x93\x02\x13:\x01*\"\x0e/v1/users:stat\x12k\n" +
+ "\tListUsers\x12\x1d.bytebase.v1.ListUsersRequest\x1a\x1e.bytebase.v1.ListUsersResponse\"\x1e\xdaA\x06parent\x90\xea0\x02\x82\xd3\xe4\x93\x02\v\x12\t/v1/users\x12k\n" +
"\n" +
"CreateUser\x12\x1e.bytebase.v1.CreateUserRequest\x1a\x11.bytebase.v1.User\"*\xdaA\x04user\x80\xea0\x01\x90\xea0\x02\x98\xea0\x01\x82\xd3\xe4\x93\x02\x11:\x04user\"\t/v1/users\x12\x81\x01\n" +
"\n" +
@@ -932,58 +784,50 @@ func file_v1_user_service_proto_rawDescGZIP() []byte {
}
var file_v1_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
+var file_v1_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_v1_user_service_proto_goTypes = []any{
- (UserType)(0), // 0: bytebase.v1.UserType
- (*GetUserRequest)(nil), // 1: bytebase.v1.GetUserRequest
- (*StatUsersRequest)(nil), // 2: bytebase.v1.StatUsersRequest
- (*StatUsersResponse)(nil), // 3: bytebase.v1.StatUsersResponse
- (*ListUsersRequest)(nil), // 4: bytebase.v1.ListUsersRequest
- (*ListUsersResponse)(nil), // 5: bytebase.v1.ListUsersResponse
- (*CreateUserRequest)(nil), // 6: bytebase.v1.CreateUserRequest
- (*UpdateUserRequest)(nil), // 7: bytebase.v1.UpdateUserRequest
- (*DeleteUserRequest)(nil), // 8: bytebase.v1.DeleteUserRequest
- (*UndeleteUserRequest)(nil), // 9: bytebase.v1.UndeleteUserRequest
- (*User)(nil), // 10: bytebase.v1.User
- (*StatUsersResponse_StatUser)(nil), // 11: bytebase.v1.StatUsersResponse.StatUser
- (*User_Profile)(nil), // 12: bytebase.v1.User.Profile
- (*fieldmaskpb.FieldMask)(nil), // 13: google.protobuf.FieldMask
- (State)(0), // 14: bytebase.v1.State
- (*timestamppb.Timestamp)(nil), // 15: google.protobuf.Timestamp
- (*emptypb.Empty)(nil), // 16: google.protobuf.Empty
+ (UserType)(0), // 0: bytebase.v1.UserType
+ (*GetUserRequest)(nil), // 1: bytebase.v1.GetUserRequest
+ (*ListUsersRequest)(nil), // 2: bytebase.v1.ListUsersRequest
+ (*ListUsersResponse)(nil), // 3: bytebase.v1.ListUsersResponse
+ (*CreateUserRequest)(nil), // 4: bytebase.v1.CreateUserRequest
+ (*UpdateUserRequest)(nil), // 5: bytebase.v1.UpdateUserRequest
+ (*DeleteUserRequest)(nil), // 6: bytebase.v1.DeleteUserRequest
+ (*UndeleteUserRequest)(nil), // 7: bytebase.v1.UndeleteUserRequest
+ (*User)(nil), // 8: bytebase.v1.User
+ (*User_Profile)(nil), // 9: bytebase.v1.User.Profile
+ (*fieldmaskpb.FieldMask)(nil), // 10: google.protobuf.FieldMask
+ (State)(0), // 11: bytebase.v1.State
+ (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp
+ (*emptypb.Empty)(nil), // 13: google.protobuf.Empty
}
var file_v1_user_service_proto_depIdxs = []int32{
- 11, // 0: bytebase.v1.StatUsersResponse.stats:type_name -> bytebase.v1.StatUsersResponse.StatUser
- 10, // 1: bytebase.v1.ListUsersResponse.users:type_name -> bytebase.v1.User
- 10, // 2: bytebase.v1.CreateUserRequest.user:type_name -> bytebase.v1.User
- 10, // 3: bytebase.v1.UpdateUserRequest.user:type_name -> bytebase.v1.User
- 13, // 4: bytebase.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask
- 14, // 5: bytebase.v1.User.state:type_name -> bytebase.v1.State
- 0, // 6: bytebase.v1.User.user_type:type_name -> bytebase.v1.UserType
- 12, // 7: bytebase.v1.User.profile:type_name -> bytebase.v1.User.Profile
- 0, // 8: bytebase.v1.StatUsersResponse.StatUser.user_type:type_name -> bytebase.v1.UserType
- 14, // 9: bytebase.v1.StatUsersResponse.StatUser.state:type_name -> bytebase.v1.State
- 15, // 10: bytebase.v1.User.Profile.last_login_time:type_name -> google.protobuf.Timestamp
- 15, // 11: bytebase.v1.User.Profile.last_change_password_time:type_name -> google.protobuf.Timestamp
- 1, // 12: bytebase.v1.UserService.GetUser:input_type -> bytebase.v1.GetUserRequest
- 4, // 13: bytebase.v1.UserService.ListUsers:input_type -> bytebase.v1.ListUsersRequest
- 2, // 14: bytebase.v1.UserService.StatUsers:input_type -> bytebase.v1.StatUsersRequest
- 6, // 15: bytebase.v1.UserService.CreateUser:input_type -> bytebase.v1.CreateUserRequest
- 7, // 16: bytebase.v1.UserService.UpdateUser:input_type -> bytebase.v1.UpdateUserRequest
- 8, // 17: bytebase.v1.UserService.DeleteUser:input_type -> bytebase.v1.DeleteUserRequest
- 9, // 18: bytebase.v1.UserService.UndeleteUser:input_type -> bytebase.v1.UndeleteUserRequest
- 10, // 19: bytebase.v1.UserService.GetUser:output_type -> bytebase.v1.User
- 5, // 20: bytebase.v1.UserService.ListUsers:output_type -> bytebase.v1.ListUsersResponse
- 3, // 21: bytebase.v1.UserService.StatUsers:output_type -> bytebase.v1.StatUsersResponse
- 10, // 22: bytebase.v1.UserService.CreateUser:output_type -> bytebase.v1.User
- 10, // 23: bytebase.v1.UserService.UpdateUser:output_type -> bytebase.v1.User
- 16, // 24: bytebase.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty
- 10, // 25: bytebase.v1.UserService.UndeleteUser:output_type -> bytebase.v1.User
- 19, // [19:26] is the sub-list for method output_type
- 12, // [12:19] 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
+ 8, // 0: bytebase.v1.ListUsersResponse.users:type_name -> bytebase.v1.User
+ 8, // 1: bytebase.v1.CreateUserRequest.user:type_name -> bytebase.v1.User
+ 8, // 2: bytebase.v1.UpdateUserRequest.user:type_name -> bytebase.v1.User
+ 10, // 3: bytebase.v1.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 11, // 4: bytebase.v1.User.state:type_name -> bytebase.v1.State
+ 0, // 5: bytebase.v1.User.user_type:type_name -> bytebase.v1.UserType
+ 9, // 6: bytebase.v1.User.profile:type_name -> bytebase.v1.User.Profile
+ 12, // 7: bytebase.v1.User.Profile.last_login_time:type_name -> google.protobuf.Timestamp
+ 12, // 8: bytebase.v1.User.Profile.last_change_password_time:type_name -> google.protobuf.Timestamp
+ 1, // 9: bytebase.v1.UserService.GetUser:input_type -> bytebase.v1.GetUserRequest
+ 2, // 10: bytebase.v1.UserService.ListUsers:input_type -> bytebase.v1.ListUsersRequest
+ 4, // 11: bytebase.v1.UserService.CreateUser:input_type -> bytebase.v1.CreateUserRequest
+ 5, // 12: bytebase.v1.UserService.UpdateUser:input_type -> bytebase.v1.UpdateUserRequest
+ 6, // 13: bytebase.v1.UserService.DeleteUser:input_type -> bytebase.v1.DeleteUserRequest
+ 7, // 14: bytebase.v1.UserService.UndeleteUser:input_type -> bytebase.v1.UndeleteUserRequest
+ 8, // 15: bytebase.v1.UserService.GetUser:output_type -> bytebase.v1.User
+ 3, // 16: bytebase.v1.UserService.ListUsers:output_type -> bytebase.v1.ListUsersResponse
+ 8, // 17: bytebase.v1.UserService.CreateUser:output_type -> bytebase.v1.User
+ 8, // 18: bytebase.v1.UserService.UpdateUser:output_type -> bytebase.v1.User
+ 13, // 19: bytebase.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty
+ 8, // 20: bytebase.v1.UserService.UndeleteUser:output_type -> bytebase.v1.User
+ 15, // [15:21] is the sub-list for method output_type
+ 9, // [9:15] is the sub-list for method input_type
+ 9, // [9:9] is the sub-list for extension type_name
+ 9, // [9:9] is the sub-list for extension extendee
+ 0, // [0:9] is the sub-list for field type_name
}
func init() { file_v1_user_service_proto_init() }
@@ -993,14 +837,14 @@ func file_v1_user_service_proto_init() {
}
file_v1_annotation_proto_init()
file_v1_common_proto_init()
- file_v1_user_service_proto_msgTypes[6].OneofWrappers = []any{}
+ file_v1_user_service_proto_msgTypes[4].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_user_service_proto_rawDesc), len(file_v1_user_service_proto_rawDesc)),
NumEnums: 1,
- NumMessages: 12,
+ NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/generated-go/v1/user_service.pb.gw.go b/proto/generated-go/v1/user_service.pb.gw.go
index 4a21ccea75..2c00ed8b98 100644
--- a/proto/generated-go/v1/user_service.pb.gw.go
+++ b/proto/generated-go/v1/user_service.pb.gw.go
@@ -105,30 +105,6 @@ func local_request_UserService_ListUsers_0(ctx context.Context, marshaler runtim
return msg, metadata, err
}
-func request_UserService_StatUsers_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq StatUsersRequest
- metadata runtime.ServerMetadata
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := client.StatUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
- return msg, metadata, err
-}
-
-func local_request_UserService_StatUsers_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var (
- protoReq StatUsersRequest
- metadata runtime.ServerMetadata
- )
- if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- msg, err := server.StatUsers(ctx, &protoReq)
- return msg, metadata, err
-}
-
func request_UserService_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CreateUserRequest
@@ -356,26 +332,6 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_ListUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodPost, pattern_UserService_StatUsers_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)
- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.UserService/StatUsers", runtime.WithHTTPPathPattern("/v1/users:stat"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := local_request_UserService_StatUsers_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_UserService_StatUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
mux.Handle(http.MethodPost, pattern_UserService_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -530,23 +486,6 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_ListUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
- mux.Handle(http.MethodPost, pattern_UserService_StatUsers_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)
- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.UserService/StatUsers", runtime.WithHTTPPathPattern("/v1/users:stat"))
- if err != nil {
- runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
- return
- }
- resp, md, err := request_UserService_StatUsers_0(annotatedContext, inboundMarshaler, client, req, pathParams)
- annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
- if err != nil {
- runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
- return
- }
- forward_UserService_StatUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
- })
mux.Handle(http.MethodPost, pattern_UserService_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -621,7 +560,6 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
var (
pattern_UserService_GetUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "name"}, ""))
pattern_UserService_ListUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))
- pattern_UserService_StatUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, "stat"))
pattern_UserService_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "users"}, ""))
pattern_UserService_UpdateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "user.name"}, ""))
pattern_UserService_DeleteUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "users", "name"}, ""))
@@ -631,7 +569,6 @@ var (
var (
forward_UserService_GetUser_0 = runtime.ForwardResponseMessage
forward_UserService_ListUsers_0 = runtime.ForwardResponseMessage
- forward_UserService_StatUsers_0 = runtime.ForwardResponseMessage
forward_UserService_CreateUser_0 = runtime.ForwardResponseMessage
forward_UserService_UpdateUser_0 = runtime.ForwardResponseMessage
forward_UserService_DeleteUser_0 = runtime.ForwardResponseMessage
diff --git a/proto/generated-go/v1/user_service_grpc.pb.go b/proto/generated-go/v1/user_service_grpc.pb.go
index 3f3dcf8e21..8bf7378714 100644
--- a/proto/generated-go/v1/user_service_grpc.pb.go
+++ b/proto/generated-go/v1/user_service_grpc.pb.go
@@ -22,7 +22,6 @@ const _ = grpc.SupportPackageIsVersion9
const (
UserService_GetUser_FullMethodName = "/bytebase.v1.UserService/GetUser"
UserService_ListUsers_FullMethodName = "/bytebase.v1.UserService/ListUsers"
- UserService_StatUsers_FullMethodName = "/bytebase.v1.UserService/StatUsers"
UserService_CreateUser_FullMethodName = "/bytebase.v1.UserService/CreateUser"
UserService_UpdateUser_FullMethodName = "/bytebase.v1.UserService/UpdateUser"
UserService_DeleteUser_FullMethodName = "/bytebase.v1.UserService/DeleteUser"
@@ -39,9 +38,6 @@ type UserServiceClient interface {
// List all users.
// Any authenticated user can list users.
ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error)
- // Get user stat.
- // Any authenticated user can get stat.
- StatUsers(ctx context.Context, in *StatUsersRequest, opts ...grpc.CallOption) (*StatUsersResponse, error)
// Create a user.
// When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.
// Otherwise, any unauthenticated user can create a user.
@@ -83,16 +79,6 @@ func (c *userServiceClient) ListUsers(ctx context.Context, in *ListUsersRequest,
return out, nil
}
-func (c *userServiceClient) StatUsers(ctx context.Context, in *StatUsersRequest, opts ...grpc.CallOption) (*StatUsersResponse, error) {
- cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
- out := new(StatUsersResponse)
- err := c.cc.Invoke(ctx, UserService_StatUsers_FullMethodName, in, out, cOpts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(User)
@@ -143,9 +129,6 @@ type UserServiceServer interface {
// List all users.
// Any authenticated user can list users.
ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error)
- // Get user stat.
- // Any authenticated user can get stat.
- StatUsers(context.Context, *StatUsersRequest) (*StatUsersResponse, error)
// Create a user.
// When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.
// Otherwise, any unauthenticated user can create a user.
@@ -173,9 +156,6 @@ func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserRequest)
func (UnimplementedUserServiceServer) ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListUsers not implemented")
}
-func (UnimplementedUserServiceServer) StatUsers(context.Context, *StatUsersRequest) (*StatUsersResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method StatUsers not implemented")
-}
func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserRequest) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented")
}
@@ -245,24 +225,6 @@ func _UserService_ListUsers_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
-func _UserService_StatUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(StatUsersRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(UserServiceServer).StatUsers(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: UserService_StatUsers_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(UserServiceServer).StatUsers(ctx, req.(*StatUsersRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateUserRequest)
if err := dec(in); err != nil {
@@ -350,10 +312,6 @@ var UserService_ServiceDesc = grpc.ServiceDesc{
MethodName: "ListUsers",
Handler: _UserService_ListUsers_Handler,
},
- {
- MethodName: "StatUsers",
- Handler: _UserService_StatUsers_Handler,
- },
{
MethodName: "CreateUser",
Handler: _UserService_CreateUser_Handler,
diff --git a/proto/v1/actuator_service.proto b/proto/v1/actuator_service.proto
index 0c31545c02..51fe7dd546 100644
--- a/proto/v1/actuator_service.proto
+++ b/proto/v1/actuator_service.proto
@@ -9,7 +9,9 @@ import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "v1/annotation.proto";
+import "v1/common.proto";
import "v1/setting_service.proto";
+import "v1/user_service.proto";
option go_package = "generated-go/v1";
@@ -117,4 +119,15 @@ message ActuatorInfo {
// docker flag means if the Bytebase instance is running in docker.
bool docker = 22;
+
+ message StatUser {
+ UserType user_type = 1;
+ State state = 2;
+ int32 count = 3;
+ }
+
+ repeated StatUser user_stats = 23;
+
+ int32 activated_instance_count = 24;
+ int32 total_instance_count = 25;
}
diff --git a/proto/v1/sql_service.proto b/proto/v1/sql_service.proto
index 9aa355d987..19c5ed9112 100644
--- a/proto/v1/sql_service.proto
+++ b/proto/v1/sql_service.proto
@@ -18,46 +18,48 @@ option go_package = "generated-go/v1";
service SQLService {
rpc Query(QueryRequest) returns (QueryResponse) {
option (google.api.http) = {
- post : "/v1/{name=instances/*/databases/*}:query"
- body : "*"
+ post: "/v1/{name=instances/*/databases/*}:query"
+ body: "*"
- additional_bindings : {post : "/v1/{name=instances/*}:query" body : "*"}
+ additional_bindings: {
+ post: "/v1/{name=instances/*}:query"
+ body: "*"
+ }
};
option (bytebase.v1.permission) = "bb.databases.get";
option (bytebase.v1.auth_method) = IAM;
option (bytebase.v1.audit) = true;
}
- rpc AdminExecute(stream AdminExecuteRequest)
- returns (stream AdminExecuteResponse) {
+ rpc AdminExecute(stream AdminExecuteRequest) returns (stream AdminExecuteResponse) {
// GRPC streaming / websocket requires GET method instead of POST.
- option (google.api.http) = {
- get : "/v1:adminExecute"
- };
+ option (google.api.http) = {get: "/v1:adminExecute"};
option (bytebase.v1.permission) = "bb.sql.admin";
option (bytebase.v1.auth_method) = IAM;
option (bytebase.v1.audit) = true;
}
// SearchQueryHistories searches query histories for the caller.
- rpc SearchQueryHistories(SearchQueryHistoriesRequest)
- returns (SearchQueryHistoriesResponse) {
+ rpc SearchQueryHistories(SearchQueryHistoriesRequest) returns (SearchQueryHistoriesResponse) {
option (google.api.http) = {
- post : "/v1/queryHistories:search"
- body : "*"
+ post: "/v1/queryHistories:search"
+ body: "*"
};
option (bytebase.v1.auth_method) = CUSTOM;
}
rpc Export(ExportRequest) returns (ExportResponse) {
option (google.api.http) = {
- post : "/v1/{name=instances/*/databases/*}:export"
- body : "*"
+ post: "/v1/{name=instances/*/databases/*}:export"
+ body: "*"
- additional_bindings : {post : "/v1/{name=instances/*}:export" body : "*"}
- additional_bindings : {
- post : "/v1/{name=projects/*/issues/*}:export"
- body : "*"
+ additional_bindings: {
+ post: "/v1/{name=instances/*}:export"
+ body: "*"
+ }
+ additional_bindings: {
+ post: "/v1/{name=projects/*/issues/*}:export"
+ body: "*"
}
};
option (bytebase.v1.permission) = "bb.databases.get";
@@ -67,34 +69,33 @@ service SQLService {
rpc Check(CheckRequest) returns (CheckResponse) {
option (google.api.http) = {
- post : "/v1/sql/check"
- body : "*"
+ post: "/v1/sql/check"
+ body: "*"
};
option (bytebase.v1.permission) = "bb.databases.check";
option (bytebase.v1.auth_method) = IAM;
}
- rpc ParseMyBatisMapper(ParseMyBatisMapperRequest)
- returns (ParseMyBatisMapperResponse) {
+ rpc ParseMyBatisMapper(ParseMyBatisMapperRequest) returns (ParseMyBatisMapperResponse) {
option (google.api.http) = {
- post : "/v1/sql/parseMyBatisMapper"
- body : "*"
+ post: "/v1/sql/parseMyBatisMapper"
+ body: "*"
};
option (bytebase.v1.allow_without_credential) = true;
}
rpc Pretty(PrettyRequest) returns (PrettyResponse) {
option (google.api.http) = {
- post : "/v1/sql/pretty"
- body : "*"
+ post: "/v1/sql/pretty"
+ body: "*"
};
option (bytebase.v1.allow_without_credential) = true;
}
rpc DiffMetadata(DiffMetadataRequest) returns (DiffMetadataResponse) {
option (google.api.http) = {
- post : "/v1/schemaDesign:diffMetadata"
- body : "*"
+ post: "/v1/schemaDesign:diffMetadata"
+ body: "*"
};
option (bytebase.v1.allow_without_credential) = true;
// This is a util method requiring no authentication thus no authorization.
@@ -102,8 +103,8 @@ service SQLService {
rpc AICompletion(AICompletionRequest) returns (AICompletionResponse) {
option (google.api.http) = {
- post : "/v1/sql/aiCompletion"
- body : "*"
+ post: "/v1/sql/aiCompletion"
+ body: "*"
};
option (bytebase.v1.auth_method) = CUSTOM;
}
@@ -116,7 +117,7 @@ message AdminExecuteRequest {
// Format: instances/{instance}/databases/{databaseName}
string name = 1 [
(google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type : "bytebase.com/Database"}
+ (google.api.resource_reference) = {type: "bytebase.com/Database"}
];
// The SQL statement to execute.
@@ -146,7 +147,7 @@ message QueryRequest {
// Format: instances/{instance}/databases/{databaseName}
string name = 1 [
(google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type : "bytebase.com/Database"}
+ (google.api.resource_reference) = {type: "bytebase.com/Database"}
];
// The SQL statement to execute.
@@ -223,7 +224,9 @@ message QueryResult {
// The query statement for the result.
string statement = 8;
- oneof detailed_error { PostgresError postgres_error = 9; }
+ oneof detailed_error {
+ PostgresError postgres_error = 9;
+ }
// refer https://www.postgresql.org/docs/11/protocol-error-fields.html
// for field description.
@@ -341,7 +344,7 @@ message ExportRequest {
// Format: projects/{project}/issues/{issue} for data export issue.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type : "bytebase.com/Database"}
+ (google.api.resource_reference) = {type: "bytebase.com/Database"}
];
// The SQL statement to execute.
@@ -398,7 +401,7 @@ message CheckRequest {
// Format: instances/{instance}/databases/{database}
string name = 2 [
(google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {type : "bytebase.com/Database"}
+ (google.api.resource_reference) = {type: "bytebase.com/Database"}
];
string statement = 1;
@@ -420,18 +423,20 @@ message CheckResponse {
int32 affected_rows = 2;
}
-message ParseMyBatisMapperRequest { bytes content = 1; }
+message ParseMyBatisMapperRequest {
+ bytes content = 1;
+}
-message ParseMyBatisMapperResponse { repeated string statements = 1; }
+message ParseMyBatisMapperResponse {
+ repeated string statements = 1;
+}
message DiffMetadataRequest {
// The metadata of the source schema.
- DatabaseMetadata source_metadata = 1
- [ (google.api.field_behavior) = REQUIRED ];
+ DatabaseMetadata source_metadata = 1 [(google.api.field_behavior) = REQUIRED];
// The metadata of the target schema.
- DatabaseMetadata target_metadata = 2
- [ (google.api.field_behavior) = REQUIRED ];
+ DatabaseMetadata target_metadata = 2 [(google.api.field_behavior) = REQUIRED];
DatabaseCatalog source_catalog = 5;
@@ -476,8 +481,7 @@ message SearchQueryHistoriesRequest {
message SearchQueryHistoriesResponse {
// The list of history.
- repeated QueryHistory query_histories = 1
- [ (google.api.field_behavior) = OUTPUT_ONLY ];
+ repeated QueryHistory query_histories = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// A token to retrieve next page of history.
// Pass this value in the page_token field in the subsequent call to
@@ -488,23 +492,21 @@ message SearchQueryHistoriesResponse {
message QueryHistory {
// The name for the query history.
// Format: queryHistories/{uid}
- string name = 1 [ (google.api.field_behavior) = OUTPUT_ONLY ];
+ string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// The database name to execute the query.
// Format: instances/{instance}/databases/{databaseName}
- string database = 2 [ (google.api.field_behavior) = OUTPUT_ONLY ];
+ string database = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
- string creator = 3 [ (google.api.field_behavior) = OUTPUT_ONLY ];
+ string creator = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
- google.protobuf.Timestamp create_time = 4
- [ (google.api.field_behavior) = OUTPUT_ONLY ];
+ google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
- string statement = 5 [ (google.api.field_behavior) = OUTPUT_ONLY ];
+ string statement = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
- optional string error = 6 [ (google.api.field_behavior) = OUTPUT_ONLY ];
+ optional string error = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
- google.protobuf.Duration duration = 7
- [ (google.api.field_behavior) = OUTPUT_ONLY ];
+ google.protobuf.Duration duration = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
enum Type {
TYPE_UNSPECIFIED = 0;
@@ -526,7 +528,9 @@ message AICompletionRequest {
message AICompletionResponse {
message Candidate {
message Content {
- message Part { string text = 1; }
+ message Part {
+ string text = 1;
+ }
// parts is used for a result content with multiple parts.
repeated Part parts = 1;
}
diff --git a/proto/v1/user_service.proto b/proto/v1/user_service.proto
index 13fa2b35ca..f825a28297 100644
--- a/proto/v1/user_service.proto
+++ b/proto/v1/user_service.proto
@@ -31,17 +31,6 @@ service UserService {
option (bytebase.v1.auth_method) = CUSTOM;
}
- // Get user stat.
- // Any authenticated user can get stat.
- rpc StatUsers(StatUsersRequest) returns (StatUsersResponse) {
- option (google.api.http) = {
- post: "/v1/users:stat"
- body: "*"
- };
- option (google.api.method_signature) = "parent";
- option (bytebase.v1.auth_method) = CUSTOM;
- }
-
// Create a user.
// When Disallow Signup is enabled, only the caller with bb.users.create on the workspace can create a user.
// Otherwise, any unauthenticated user can create a user.
@@ -96,18 +85,6 @@ message GetUserRequest {
];
}
-message StatUsersRequest {}
-
-message StatUsersResponse {
- message StatUser {
- UserType user_type = 1;
- State state = 2;
- int32 count = 3;
- }
-
- repeated StatUser stats = 1;
-}
-
message ListUsersRequest {
// The maximum number of users to return. The service may return fewer than
// this value.