Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: migrate backup setting (#6516)
ecmadao50ad0868b51f
diff --git a/backend/api/v1/acl_config.go b/backend/api/v1/acl_config.goindex 37be7f3be2..b036af83bd 100644--- a/backend/api/v1/acl_config.go+++ b/backend/api/v1/acl_config.go@@ -15,6 +15,7 @@ var ownerAndDBAMethods = map[string]bool{"EnvironmentService/UpdateEnvironment": true,"EnvironmentService/DeleteEnvironment": true,"EnvironmentService/UndeleteEnvironment": true,+ "EnvironmentService/UpdateBackupSetting": true,"InstanceService/CreateInstance": true,"InstanceService/UpdateInstance": true,"InstanceService/DeleteInstance": true,diff --git a/backend/api/v1/environment_service.go b/backend/api/v1/environment_service.goindex e4a0eaa71c..d2fcffced0 100644--- a/backend/api/v1/environment_service.go+++ b/backend/api/v1/environment_service.go@@ -180,6 +180,27 @@ func (s *EnvironmentService) UndeleteEnvironment(ctx context.Context, request *vreturn convertToEnvironment(environment), nil}+// UpdateBackupSetting updates the backup setting for an environment.+func (s *EnvironmentService) UpdateBackupSetting(ctx context.Context, request *v1pb.UpdateEnvironmentBackupSettingRequest) (*v1pb.EnvironmentBackupSetting, error) {+ environmentName, err := trimSuffix(request.Setting.Name, backupSettingSuffix)+ if err != nil {+ return nil, status.Errorf(codes.InvalidArgument, err.Error())+ }+ environment, err := s.getEnvironmentMessage(ctx, environmentName)+ if err != nil {+ return nil, err+ }++ if err := s.store.UpdateBackupSettingsForEnvironmentV2(ctx, environment.ResourceID, request.Setting.Enabled, ctx.Value(common.PrincipalIDContextKey).(int)); err != nil {+ if common.ErrorCode(err) == common.Invalid {+ return nil, status.Errorf(codes.InvalidArgument, "invalid backup setting: %v", err.Error())+ }+ return nil, status.Errorf(codes.Internal, "failed to set backup setting: %v", err.Error())+ }++ return request.Setting, nil+}+func (s *EnvironmentService) getEnvironmentMessage(ctx context.Context, name string) (*store.EnvironmentMessage, error) {environmentID, err := getEnvironmentID(name)if err != nil {diff --git a/backend/server/acl_casbin_policy_dba.csv b/backend/server/acl_casbin_policy_dba.csvindex 77ae443649..a355e733e9 100644--- a/backend/server/acl_casbin_policy_dba.csv+++ b/backend/server/acl_casbin_policy_dba.csv@@ -28,7 +28,6 @@ p, DBA, /environment, GETp, DBA, /environment/{environmentID}, GETp, DBA, /environment/{environmentID}, PATCHp, DBA, /environment/{environmentID}, DELETE-p, DBA, /environment/{environmentID}/backup-setting, PATCHp, DBA, /policy, GETp, DBA, /policy/{resourceType}/{resourceID}, GETp, DBA, /policy/{resourceType}/{resourceID}, PATCHdiff --git a/backend/server/acl_casbin_policy_owner.csv b/backend/server/acl_casbin_policy_owner.csvindex 0c9ccfa7ca..15af86e12d 100644--- a/backend/server/acl_casbin_policy_owner.csv+++ b/backend/server/acl_casbin_policy_owner.csv@@ -31,7 +31,6 @@ p, OWNER, /environment, GETp, OWNER, /environment/{environmentID}, GETp, OWNER, /environment/{environmentID}, PATCHp, OWNER, /environment/{environmentID}, DELETE-p, OWNER, /environment/{environmentID}/backup-setting, PATCHp, OWNER, /policy, GETp, OWNER, /policy/{resourceType}/{resourceID}, GETp, OWNER, /policy/{resourceType}/{resourceID}, PATCHdiff --git a/backend/server/environment.go b/backend/server/environment.godeleted file mode 100644index 87ddc97e52..0000000000--- a/backend/server/environment.go+++ /dev/null@@ -1,42 +0,0 @@-package server--import (- "fmt"- "net/http"- "strconv"-- "github.com/google/jsonapi"- "github.com/labstack/echo/v4"-- "github.com/bytebase/bytebase/backend/common"- api "github.com/bytebase/bytebase/backend/legacyapi"-)--func (s *Server) registerEnvironmentRoutes(g *echo.Group) {- g.PATCH("/environment/:environmentID/backup-setting", func(c echo.Context) error {- ctx := c.Request().Context()- envID, err := strconv.Atoi(c.Param("environmentID"))- if err != nil {- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("environmentID"))).SetInternal(err)- }-- backupSettingUpsert := &api.BackupSettingUpsert{- EnvironmentID: envID,- UpdaterID: c.Get(getPrincipalIDContextKey()).(int),- }- if err := jsonapi.UnmarshalPayload(c.Request().Body, backupSettingUpsert); err != nil {- return echo.NewHTTPError(http.StatusBadRequest, "Malformed set backup setting request").SetInternal(err)- }-- if err := s.store.UpdateBackupSettingsInEnvironment(ctx, backupSettingUpsert); err != nil {- if common.ErrorCode(err) == common.Invalid {- return echo.NewHTTPError(http.StatusBadRequest, "Invalid backup setting").SetInternal(err)- }- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to set backup setting").SetInternal(err)- }-- c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- c.Response().WriteHeader(http.StatusOK)- return nil- })-}diff --git a/backend/server/server.go b/backend/server/server.goindex ac32fb5ab4..33f78c8612 100644--- a/backend/server/server.go+++ b/backend/server/server.go@@ -512,7 +512,6 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {})s.registerOAuthRoutes(apiGroup)s.registerProjectRoutes(apiGroup)- s.registerEnvironmentRoutes(apiGroup)s.registerDatabaseRoutes(apiGroup)s.registerIssueRoutes(apiGroup)s.registerIssueSubscriberRoutes(apiGroup)diff --git a/backend/store/backup.go b/backend/store/backup.goindex f2b53a770e..3fe784d4af 100644--- a/backend/store/backup.go+++ b/backend/store/backup.go@@ -63,35 +63,6 @@ func (s *Store) UpsertBackupSetting(ctx context.Context, upsert *api.BackupSettireturn backupSettingRaw.toBackupSetting(), nil}-// UpdateBackupSettingsInEnvironment upserts an instance of backup setting.-func (s *Store) UpdateBackupSettingsInEnvironment(ctx context.Context, upsert *api.BackupSettingUpsert) error {- if err := s.validateBackupSettingUpsert(ctx, upsert); err != nil {- return err- }- tx, err := s.db.BeginTx(ctx, nil)- if err != nil {- return err- }- defer tx.Rollback()-- stmt := `- UPDATE backup_setting- SET enabled = $1- WHERE id IN (- SELECT backup_setting.id- FROM backup_setting- INNER JOIN db ON backup_setting.database_id = db.id- INNER JOIN instance ON db.instance_id = instance.id- INNER JOIN environment ON instance.environment_id = environment.id- WHERE environment.id = $2- );- `- if _, err := tx.ExecContext(ctx, stmt, upsert.Enabled, upsert.EnvironmentID); err != nil {- return err- }- return tx.Commit()-}-// FindBackupSettingsMatch finds a list of backup setting instances with match conditions.func (s *Store) FindBackupSettingsMatch(ctx context.Context, match *api.BackupSettingsMatch) ([]*api.BackupSetting, error) {backupSettingRawList, err := s.findBackupSettingsMatchImpl(ctx, match)@@ -492,6 +463,34 @@ func (s *Store) UpsertBackupSettingV2(ctx context.Context, principalUID int, upsreturn &backupSetting, nil}+// UpdateBackupSettingsForEnvironmentV2 upserts an instance of backup setting.+func (s *Store) UpdateBackupSettingsForEnvironmentV2(ctx context.Context, environmentID string, enabled bool, updaterID int) error {+ tx, err := s.db.BeginTx(ctx, nil)+ if err != nil {+ return err+ }+ defer tx.Rollback()++ stmt := `+ UPDATE backup_setting+ SET+ updater_id = $1,+ enabled = $2+ WHERE id IN (+ SELECT backup_setting.id+ FROM backup_setting+ INNER JOIN db ON backup_setting.database_id = db.id+ INNER JOIN instance ON db.instance_id = instance.id+ INNER JOIN environment ON instance.environment_id = environment.id+ WHERE environment.resource_id = $3+ );+ `+ if _, err := tx.ExecContext(ctx, stmt, updaterID, enabled, environmentID); err != nil {+ return err+ }+ return tx.Commit()+}+// ListBackupSettingV2 finds the backup setting.func (s *Store) ListBackupSettingV2(ctx context.Context, find *FindBackupSettingMessage) ([]*BackupSettingMessage, error) {tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})diff --git a/frontend/src/components/DatabaseBackup/DatabaseBackupSettingForm.vue b/frontend/src/components/DatabaseBackup/DatabaseBackupSettingForm.vueindex 2513e98150..5692fbcc95 100644--- a/frontend/src/components/DatabaseBackup/DatabaseBackupSettingForm.vue+++ b/frontend/src/components/DatabaseBackup/DatabaseBackupSettingForm.vue@@ -1,167 +1,169 @@<template>- <div class="w-[30rem] max-w-full flex flex-col items-center">- <div class="py-0.5 space-y-6">- <div class="flex flex-col gap-y-2">- <label class="textlabel">- {{ $t("database.backup-setting.form.schedule") }}- </label>- <NPopover- trigger="manual"- :show="state.showBackupPolicyEnforcement"- :show-arrow="false"- placement="bottom-start"- >- <template #trigger>- <div class="flex items-center gap-x-2 text-sm">- <label- v-for="schedule in PLAN_SCHEDULES"- :key="schedule"- class="flex items-center gap-x-2"- :class="- !isAllowedScheduleByPolicy(schedule) &&- 'opacity-50 cursor-not-allowed'- "- @click="setSchedule(schedule)"- >- <input- type="radio"- :value="schedule"- :checked="schedule === checkedSchedule"- :disabled="!isAllowedScheduleByPolicy(schedule)"- />- <span>{{ nameOfSchedule(schedule) }}</span>- </label>- </div>- </template>-- <router-link- class="normal-link text-sm"- :to="`/environment/${database.instanceEntity.environmentEntity.uid}`"+ <DrawerContent :title="$t('database.automatic-backup')">+ <div class="max-w-full flex flex-col items-center">+ <div class="py-0.5 space-y-6">+ <div class="flex flex-col gap-y-2">+ <label class="textlabel">+ {{ $t("database.backup-setting.form.schedule") }}+ </label>+ <NPopover+ trigger="manual"+ :show="state.showBackupPolicyEnforcement"+ :show-arrow="false"+ placement="bottom-start">- {{- $t("database.backuppolicy-backup-enforced-and-cant-be-disabled", [+ <template #trigger>+ <div class="flex items-center gap-x-2 text-sm">+ <label+ v-for="schedule in PLAN_SCHEDULES"+ :key="schedule"+ class="flex items-center gap-x-2"+ :class="+ !isAllowedScheduleByPolicy(schedule) &&+ 'opacity-50 cursor-not-allowed'+ "+ @click="setSchedule(schedule)"+ >+ <input+ type="radio"+ :value="schedule"+ :checked="schedule === checkedSchedule"+ :disabled="!isAllowedScheduleByPolicy(schedule)"+ />+ <span>{{ nameOfSchedule(schedule) }}</span>+ </label>+ </div>+ </template>++ <router-link+ class="normal-link text-sm"+ :to="`/environment/${database.instanceEntity.environmentEntity.uid}`"+ >+ {{$t(- `database.backup-policy.${backupPlanScheduleToJSON(- backupPolicy- )}`- ),- ])- }}- </router-link>- </NPopover>- </div>+ "database.backuppolicy-backup-enforced-and-cant-be-disabled",+ [+ $t(+ `database.backup-policy.${backupPlanScheduleToJSON(+ backupPolicy+ )}`+ ),+ ]+ )+ }}+ </router-link>+ </NPopover>+ </div>- <div- v-if="checkedSchedule === BackupPlanSchedule.WEEKLY"- class="flex flex-col gap-y-2"- >- <label class="textlabel">- {{ $t("database.backup-setting.form.day-of-week") }}- </label>- <div class="w-[16rem]">- <BBSelect- :selected-item="- localFromUTC(state.setting.hour, state.setting.dayOfWeek)- .dayOfWeek- "- :item-list="AVAILABLE_DAYS_OF_WEEK"- @select-item="setDayOfWeek"- >- <template #menuItem="{ item: day }">- {{ nameOfDay(day) }}- </template>- </BBSelect>+ <div+ v-if="checkedSchedule === BackupPlanSchedule.WEEKLY"+ class="flex flex-col gap-y-2"+ >+ <label class="textlabel">+ {{ $t("database.backup-setting.form.day-of-week") }}+ </label>+ <div class="w-[16rem]">+ <BBSelect+ :selected-item="+ localFromUTC(state.setting.hour, state.setting.dayOfWeek)+ .dayOfWeek+ "+ :item-list="AVAILABLE_DAYS_OF_WEEK"+ @select-item="setDayOfWeek"+ >+ <template #menuItem="{ item: day }">+ {{ nameOfDay(day) }}+ </template>+ </BBSelect>+ </div></div>- </div>- <div- v-if="- checkedSchedule === BackupPlanSchedule.WEEKLY ||- checkedSchedule === BackupPlanSchedule.DAILY- "- class="flex flex-col gap-y-2"- >- <label class="textlabel">- <span>- {{ $t("database.backup-setting.form.time-of-day") }}- </span>- <span class="ml-1 textinfolabel">- ({{ Intl.DateTimeFormat().resolvedOptions().timeZone }})- </span>- </label>- <div class="w-[16rem]">- <BBSelect- :selected-item="- localFromUTC(state.setting.hour, state.setting.dayOfWeek).hour- "- :item-list="AVAILABLE_HOURS_OF_DAY"- @select-item="setHour"- >- <template #menuItem="{ item: hour }">- {{ nameOfHour(hour) }}- </template>- </BBSelect>+ <div+ v-if="+ checkedSchedule === BackupPlanSchedule.WEEKLY ||+ checkedSchedule === BackupPlanSchedule.DAILY+ "+ class="flex flex-col gap-y-2"+ >+ <label class="textlabel">+ <span>+ {{ $t("database.backup-setting.form.time-of-day") }}+ </span>+ <span class="ml-1 textinfolabel">+ ({{ Intl.DateTimeFormat().resolvedOptions().timeZone }})+ </span>+ </label>+ <div class="w-[16rem]">+ <BBSelect+ :selected-item="+ localFromUTC(state.setting.hour, state.setting.dayOfWeek).hour+ "+ :item-list="AVAILABLE_HOURS_OF_DAY"+ @select-item="setHour"+ >+ <template #menuItem="{ item: hour }">+ {{ nameOfHour(hour) }}+ </template>+ </BBSelect>+ </div>+ </div>++ <div+ v-if="+ checkedSchedule === BackupPlanSchedule.WEEKLY ||+ checkedSchedule === BackupPlanSchedule.DAILY+ "+ class="flex flex-col gap-y-2"+ >+ <label class="textlabel">+ {{ $t("database.backup-setting.form.retention-period") }}+ </label>+ <div class="w-[16rem]">+ <input+ type="number"+ class="textfield w-full hide-ticker"+ :placeholder="String(DEFAULT_BACKUP_RETENTION_PERIOD_DAYS)"+ :value="retentionPeriodDaysInputValue"+ @input="(e: any) => setRetentionPeriodDays(e.target.value)"+ />+ </div></div></div><div- v-if="- checkedSchedule === BackupPlanSchedule.WEEKLY ||- checkedSchedule === BackupPlanSchedule.DAILY- "- class="flex flex-col gap-y-2"+ class="w-full mt-5 pt-4 flex justify-end border-t border-block-border">- <label class="textlabel">- {{ $t("database.backup-setting.form.retention-period") }}- </label>- <div class="w-[16rem]">- <input- type="number"- class="textfield w-full hide-ticker"- :placeholder="String(DEFAULT_BACKUP_RETENTION_PERIOD_DAYS)"- :value="retentionPeriodDaysInputValue"- @input="(e: any) => setRetentionPeriodDays(e.target.value)"- />- </div>+ <button+ type="button"+ class="btn-normal py-2 px-4"+ @click.prevent="$emit('cancel')"+ >+ {{ $t("common.cancel") }}+ </button>+ <button+ class="btn-primary ml-3 inline-flex justify-center py-2 px-4"+ :disabled="!isValid"+ @click.prevent="handleSave"+ >+ {{ $t("common.save") }}+ </button></div>- </div>- <div class="w-full mt-5 pt-4 flex justify-end border-t border-block-border">- <button- type="button"- class="btn-normal py-2 px-4"- @click.prevent="$emit('cancel')"- >- {{ $t("common.cancel") }}- </button>- <button- class="btn-primary ml-3 inline-flex justify-center py-2 px-4"- :disabled="!isValid"- @click.prevent="handleSave"+ <div+ v-if="state.loading"+ class="absolute inset-0 z-10 bg-white/70 flex items-center justify-center rounded-lg">- {{ $t("common.save") }}- </button>- </div>-- <div- v-if="state.loading"- class="absolute inset-0 z-10 bg-white/70 flex items-center justify-center rounded-lg"- >- <BBSpin />+ <BBSpin />+ </div></div>- </div>+ </DrawerContent></template><script lang="ts" setup>import { computed, PropType, reactive, watch } from "vue";import { useI18n } from "vue-i18n";import { NPopover } from "naive-ui";-import {- BackupSetting,- BackupSettingUpsert,- ComposedDatabase,- unknown,-} from "@/types";+import { ComposedDatabase, unknown } from "@/types";import {AVAILABLE_DAYS_OF_WEEK,AVAILABLE_HOURS_OF_DAY,@@ -171,13 +173,21 @@ import {localFromUTC,localToUTC,parseScheduleFromBackupSetting,- BackupSettingEdit,} from "./utils";-import { pushNotification, useLegacyBackupStore } from "@/store";+import { pushNotification, useBackupV1Store } from "@/store";import {BackupPlanSchedule,backupPlanScheduleToJSON,} from "@/types/proto/v1/org_policy_service";+import { BackupSetting } from "@/types/proto/v1/database_service";+import { DrawerContent } from "@/components/v2";++interface BackupSettingEdit {+ enabled: boolean;+ dayOfWeek: number;+ hour: number;+ retentionPeriodTs: number;+}type LocalState = {setting: BackupSettingEdit;@@ -211,13 +221,14 @@ const emit = defineEmits<{(event: "update", setting: BackupSetting): void;}>();+const backupStore = useBackupV1Store();+const state = reactive<LocalState>({setting: extractEditValue(props.backupSetting),showBackupPolicyEnforcement: false,loading: false,});-const backupStore = useLegacyBackupStore();const { t } = useI18n();const allowDisableAutoBackup = computed(() => {@@ -243,7 +254,13 @@ watch();const checkedSchedule = computed((): BackupPlanSchedule => {- return parseScheduleFromBackupSetting(state.setting);+ return parseScheduleFromBackupSetting(+ backupStore.buildSimpleSchedule({+ enabled: state.setting.enabled,+ hourOfDay: state.setting.hour,+ dayOfWeek: state.setting.dayOfWeek,+ })+ );});const retentionPeriodDaysInputValue = computed((): string => {@@ -277,15 +294,20 @@ const handleSave = async () => {setting.retentionPeriodTs = DEFAULT_BACKUP_RETENTION_PERIOD_TS;}- const newBackupSetting: BackupSettingUpsert = {- databaseId: Number(props.database.uid),- ...setting,- hookUrl: props.backupSetting.hookUrl, // won't modify hookUrl- };try {state.loading = true;const updatedBackupSetting = await backupStore.upsertBackupSetting({- newBackupSetting,+ name: `${props.database.name}/backupSetting`,+ cronSchedule: backupStore.buildSimpleSchedule({+ enabled: setting.enabled,+ hourOfDay: setting.hour,+ dayOfWeek: setting.dayOfWeek,+ }),+ hookUrl: props.backupSetting.hookUrl,+ backupRetainDuration: {+ seconds: setting.retentionPeriodTs,+ nanos: 0,+ },});const action = setting.enabled@@ -385,11 +407,12 @@ function setRetentionPeriodDays(input: string) {}function extractEditValue(backupSetting: BackupSetting): BackupSettingEdit {+ const schedule = backupStore.parseBackupSchedule(backupSetting.cronSchedule);return {- enabled: backupSetting.enabled,- dayOfWeek: backupSetting.dayOfWeek,- hour: backupSetting.hour,- retentionPeriodTs: backupSetting.retentionPeriodTs,+ enabled: backupSetting.cronSchedule !== "",+ dayOfWeek: schedule.dayOfWeek,+ hour: schedule.hourOfDay,+ retentionPeriodTs: backupSetting.backupRetainDuration?.seconds ?? 0,};}diff --git a/frontend/src/components/DatabaseBackup/utils.ts b/frontend/src/components/DatabaseBackup/utils.tsindex 718bcaa7df..c628ea9a15 100644--- a/frontend/src/components/DatabaseBackup/utils.ts+++ b/frontend/src/components/DatabaseBackup/utils.ts@@ -1,11 +1,5 @@-import { BackupSetting } from "@/types";import { BackupPlanSchedule } from "@/types/proto/v1/org_policy_service";-export type BackupSettingEdit = Pick<- BackupSetting,- "enabled" | "dayOfWeek" | "hour" | "retentionPeriodTs"->;-export const PLAN_SCHEDULES: BackupPlanSchedule[] = [BackupPlanSchedule.UNSET,BackupPlanSchedule.WEEKLY,@@ -20,10 +14,14 @@ export const DEFAULT_BACKUP_RETENTION_PERIOD_TS =DEFAULT_BACKUP_RETENTION_PERIOD_DAYS * 3600 * 24; // 7 daysexport function parseScheduleFromBackupSetting(- backupSetting: BackupSettingEdit+ cronSchedule: string): BackupPlanSchedule {- if (!backupSetting.enabled) return BackupPlanSchedule.UNSET;- if (backupSetting.dayOfWeek === -1) return BackupPlanSchedule.DAILY;+ if (cronSchedule == "") return BackupPlanSchedule.UNSET;+ const sections = cronSchedule.split(" ");+ if (sections.length !== 5) {+ return BackupPlanSchedule.UNSET;+ }+ if (sections[4] === "*") return BackupPlanSchedule.DAILY;return BackupPlanSchedule.WEEKLY;}diff --git a/frontend/src/components/DatabaseBackupPanel.vue b/frontend/src/components/DatabaseBackupPanel.vueindex 339de6a823..3b23e8dc0b 100644--- a/frontend/src/components/DatabaseBackupPanel.vue+++ b/frontend/src/components/DatabaseBackupPanel.vue@@ -128,9 +128,8 @@/></div>- <BBModal- v-if="state.showBackupSettingModal"- :title="$t('database.automatic-backup')"+ <Drawer+ :show="state.showBackupSettingModal"@close="state.showBackupSettingModal = false"><DatabaseBackupSettingForm@@ -141,7 +140,7 @@@cancel="state.showBackupSettingModal = false"@update="updateBackupSetting"/>- </BBModal>+ </Drawer><BBModalv-if="state.showCreateBackupModal"@@ -175,19 +174,15 @@ import { isEqual } from "lodash-es";import { useI18n } from "vue-i18n";import {- BackupSetting,ComposedDatabase,NORMAL_POLL_INTERVAL,POLL_JITTER,MINIMUM_POLL_INTERVAL,- UNKNOWN_ID,- BackupSettingUpsert,} from "@/types";import DatabaseBackupCreateForm from "@/components/DatabaseBackupCreateForm.vue";import PITRRestoreButton from "@/components/DatabaseDetail/PITRRestoreButton.vue";import {pushNotification,- useLegacyBackupStore,useBackupV1Store,useGracefulRequest,} from "@/store";@@ -209,9 +204,11 @@ import {import { instanceV1HasBackupRestore } from "@/utils";import {Backup,+ BackupSetting,Backup_BackupState,Backup_BackupType,} from "@/types/proto/v1/database_service";+import { Drawer } from "@/components/v2";interface LocalState {showCreateBackupModal: boolean;@@ -241,7 +238,6 @@ const props = defineProps({},});-const legacyBackupStore = useLegacyBackupStore();const backupStore = useBackupV1Store();const policyV1Store = usePolicyV1Store();const { t } = useI18n();@@ -282,10 +278,12 @@ const prepareBackupPolicy = () => {watchEffect(prepareBackupPolicy);const assignBackupSetting = (backupSetting: BackupSetting) => {- state.autoBackupEnabled = backupSetting.enabled;- state.autoBackupHour = backupSetting.hour;- state.autoBackupDayOfWeek = backupSetting.dayOfWeek;- state.autoBackupRetentionPeriodTs = backupSetting.retentionPeriodTs;+ const schedule = backupStore.parseBackupSchedule(backupSetting.cronSchedule);+ state.autoBackupEnabled = backupSetting.cronSchedule !== "";+ state.autoBackupHour = schedule.hourOfDay;+ state.autoBackupDayOfWeek = schedule.dayOfWeek;+ state.autoBackupRetentionPeriodTs =+ backupSetting.backupRetainDuration?.seconds ?? 0;state.autoBackupHookUrl = backupSetting.hookUrl;state.autoBackupUpdatedHookUrl = backupSetting.hookUrl;@@ -374,7 +372,9 @@ const backupPolicy = computed((): BackupPlanSchedule => {const hasBackupPolicyViolation = computed((): boolean => {if (!state.backupSetting) return false;if (!backupPolicy.value) return false;- const schedule = parseScheduleFromBackupSetting(state.backupSetting);+ const schedule = parseScheduleFromBackupSetting(+ state.backupSetting.cronSchedule+ );return levelOfSchedule(schedule) < levelOfSchedule(backupPolicy.value);});@@ -427,11 +427,10 @@ const pollBackups = (interval: number) => {};const prepareBackupSetting = () => {- legacyBackupStore- .fetchBackupSettingByDatabaseId(Number(props.database.uid))- .then((backupSetting: BackupSetting) => {- // UNKNOWN_ID means database does not have backup setting and we should NOT overwrite the default setting.- if (backupSetting.id != UNKNOWN_ID) {+ backupStore+ .fetchBackupSetting(props.database.name)+ .then((backupSetting: BackupSetting | undefined) => {+ if (backupSetting) {assignBackupSetting(backupSetting);}});@@ -440,17 +439,19 @@ const prepareBackupSetting = () => {onBeforeMount(prepareBackupSetting);const updateBackupHookUrl = () => {- const newBackupSetting: BackupSettingUpsert = {- databaseId: Number(props.database.uid),- enabled: state.autoBackupEnabled,- hour: state.autoBackupHour,- dayOfWeek: state.autoBackupDayOfWeek,- retentionPeriodTs: state.autoBackupRetentionPeriodTs,- hookUrl: state.autoBackupUpdatedHookUrl,- };- legacyBackupStore+ backupStore.upsertBackupSetting({- newBackupSetting: newBackupSetting,+ name: `${props.database.name}/backupSetting`,+ cronSchedule: backupStore.buildSimpleSchedule({+ enabled: state.autoBackupEnabled,+ hourOfDay: state.autoBackupHour,+ dayOfWeek: state.autoBackupDayOfWeek,+ }),+ hookUrl: state.autoBackupUpdatedHookUrl,+ backupRetainDuration: {+ seconds: state.autoBackupRetentionPeriodTs,+ nanos: 0,+ },}).then((backupSetting: BackupSetting) => {assignBackupSetting(backupSetting);diff --git a/frontend/src/store/modules/backup.ts b/frontend/src/store/modules/backup.tsdeleted file mode 100644index 86887d456b..0000000000--- a/frontend/src/store/modules/backup.ts+++ /dev/null@@ -1,116 +0,0 @@-import { defineStore } from "pinia";-import axios from "axios";-import {- Backup,- BackupSetting,- BackupSettingState,- BackupSettingUpsert,- BackupState,- DatabaseId,- ResourceObject,- unknown,-} from "@/types";--export function convertBackup(- backup: ResourceObject,- includedList: ResourceObject[]-): Backup {- return {- ...(backup.attributes as Omit<Backup, "id">),- id: parseInt(backup.id),- };-}--function convertBackupSetting(- backupSetting: ResourceObject,- includedList: ResourceObject[]-): BackupSetting {- return {- ...(backupSetting.attributes as Omit<BackupSetting, "id">),- id: parseInt(backupSetting.id),- };-}--export const useLegacyBackupStore = defineStore("backup", {- state: (): BackupState & BackupSettingState => ({- backupList: new Map(),- backupSetting: new Map(),- }),-- actions: {- convert(backup: ResourceObject, includedList: ResourceObject[]): Backup {- return convertBackup(backup, includedList || []);- },- backupSettingByDatabaseId(databaseId: DatabaseId): BackupSetting {- return (- this.backupSetting.get(databaseId) ||- (unknown("BACKUP_SETTING") as BackupSetting)- );- },-- upsertBackupSettingByDatabaseId({- databaseId,- backupSetting,- }: {- databaseId: DatabaseId;- backupSetting: BackupSetting;- }) {- this.backupSetting.set(databaseId, backupSetting);- },-- async fetchBackupSettingByDatabaseId(databaseId: DatabaseId) {- const data = (- await axios.get(`/api/database/${databaseId}/backup-setting`)- ).data;- const backupSetting: BackupSetting = convertBackupSetting(- data.data,- data.included- );-- this.upsertBackupSettingByDatabaseId({ databaseId, backupSetting });- return backupSetting;- },-- async upsertBackupSetting({- newBackupSetting,- }: {- newBackupSetting: BackupSettingUpsert;- }) {- const data = (- await axios.patch(- `/api/database/${newBackupSetting.databaseId}/backup-setting`,- {- data: {- type: "BackupSettingUpsert",- attributes: newBackupSetting,- },- }- )- ).data;- const updatedBackupSetting: BackupSetting = convertBackupSetting(- data.data,- data.included- );-- this.upsertBackupSettingByDatabaseId({- databaseId: newBackupSetting.databaseId,- backupSetting: updatedBackupSetting,- });-- return updatedBackupSetting;- },-- async upsertBackupSettingByEnvironmentId(- environmentId: string,- backupSettingUpsert: Omit<BackupSettingUpsert, "databaseId">- ) {- const url = `/api/environment/${environmentId}/backup-setting`;- await axios.patch(url, {- data: {- type: "backupSettingUpsert",- attributes: backupSettingUpsert,- },- });- },- },-});diff --git a/frontend/src/store/modules/index.ts b/frontend/src/store/modules/index.tsindex b5b17ff3ca..6de017e739 100644--- a/frontend/src/store/modules/index.ts+++ b/frontend/src/store/modules/index.ts@@ -2,7 +2,6 @@ export * from "./activity";export * from "./anomaly";export * from "./auditLog";export * from "./auth";-export * from "./backup";export * from "./bookmark";export * from "./command";export * from "./database";diff --git a/frontend/src/store/modules/v1/backup.ts b/frontend/src/store/modules/v1/backup.tsindex a72adf28d2..514674ad88 100644--- a/frontend/src/store/modules/v1/backup.ts+++ b/frontend/src/store/modules/v1/backup.ts@@ -1,8 +1,13 @@import { defineStore } from "pinia";import { computed, reactive, unref, watch } from "vue";-import { databaseServiceClient } from "@/grpcweb";-import { Backup, ListBackupsRequest } from "@/types/proto/v1/database_service";+import { databaseServiceClient, environmentServiceClient } from "@/grpcweb";+import {+ Backup,+ BackupSetting,+ ListBackupsRequest,+} from "@/types/proto/v1/database_service";+import { EnvironmentBackupSetting } from "@/types/proto/v1/environment_service";import { MaybeRef } from "@/types";import { useAuthStore } from "../auth";@@ -40,7 +45,81 @@ export const useBackupV1Store = defineStore("backup_v1", () => {return created;};- return { backupListByDatabase, fetchBackupList, createBackup };+ const fetchBackupSetting = async (databaseName: string) => {+ try {+ const backupSetting = await databaseServiceClient.getBackupSetting({+ name: `${databaseName}/backupSetting`,+ });+ return backupSetting;+ } catch {+ return;+ }+ };++ const upsertBackupSetting = async (backupSetting: BackupSetting) => {+ const updated = await databaseServiceClient.updateBackupSetting({+ setting: backupSetting,+ });+ return updated;+ };++ const upsertEnvironmentBackupSetting = async (+ backupSetting: EnvironmentBackupSetting+ ) => {+ await environmentServiceClient.updateBackupSetting({+ setting: backupSetting,+ });+ };++ const parseBackupSchedule = (+ schedule: string+ ): {+ hourOfDay: number;+ dayOfWeek: number;+ } => {+ const sections = schedule.split(" ");+ if (sections.length !== 5) {+ return {+ hourOfDay: 0,+ dayOfWeek: -1,+ };+ }+ const hourOfDay = Number(sections[1]);+ const dayOfWeek = sections[4] === "*" ? -1 : Number(sections[4]);+ return {+ hourOfDay,+ dayOfWeek,+ };+ };++ const buildSimpleSchedule = ({+ enabled,+ hourOfDay,+ dayOfWeek,+ }: {+ enabled: boolean;+ hourOfDay: number;+ dayOfWeek: number;+ }): string => {+ if (!enabled) {+ return "";+ }+ if (dayOfWeek === -1) {+ return `0 ${hourOfDay} * * *`;+ }+ return `0 ${hourOfDay} * * ${dayOfWeek}`;+ };++ return {+ backupListByDatabase,+ fetchBackupList,+ createBackup,+ fetchBackupSetting,+ upsertBackupSetting,+ upsertEnvironmentBackupSetting,+ parseBackupSchedule,+ buildSimpleSchedule,+ };});export const useBackupListByDatabaseName = (name: MaybeRef<string>) => {diff --git a/frontend/src/types/backup.ts b/frontend/src/types/backup.tsindex 727db3f3e9..6d82365e81 100644--- a/frontend/src/types/backup.ts+++ b/frontend/src/types/backup.ts@@ -47,15 +47,3 @@ export type BackupSetting = {retentionPeriodTs: number;hookUrl: string;};--export type BackupSettingUpsert = {- // Related fields- databaseId: DatabaseId;-- // Domain specific fields- enabled: boolean;- hour: number;- dayOfWeek: number;- retentionPeriodTs: number;- hookUrl: string;-};diff --git a/frontend/src/types/proto/v1/database_service.ts b/frontend/src/types/proto/v1/database_service.tsindex a5ae6f3c8f..117d133b1e 100644--- a/frontend/src/types/proto/v1/database_service.ts+++ b/frontend/src/types/proto/v1/database_service.ts@@ -456,7 +456,7 @@ export interface DatabaseSchema {export interface BackupSetting {/*** The name of the database backup setting.- * Format: instances/{instance}/databases/{database}/backupSettings+ * Format: instances/{instance}/databases/{database}/backupSetting*/name: string;/**diff --git a/frontend/src/types/proto/v1/environment_service.ts b/frontend/src/types/proto/v1/environment_service.tsindex caec28b4d1..353f967ba6 100644--- a/frontend/src/types/proto/v1/environment_service.ts+++ b/frontend/src/types/proto/v1/environment_service.ts@@ -139,6 +139,20 @@ export interface Environment {tier: EnvironmentTier;}+export interface UpdateEnvironmentBackupSettingRequest {+ /** The environment backup setting to update. */+ setting?: EnvironmentBackupSetting;+}++export interface EnvironmentBackupSetting {+ /**+ * The name of the environment backup setting.+ * Format: environments/{environment}/backupSetting+ */+ name: string;+ enabled: boolean;+}+function createBaseGetEnvironmentRequest(): GetEnvironmentRequest {return { name: "" };}@@ -739,6 +753,136 @@ export const Environment = {},};+function createBaseUpdateEnvironmentBackupSettingRequest(): UpdateEnvironmentBackupSettingRequest {+ return { setting: undefined };+}++export const UpdateEnvironmentBackupSettingRequest = {+ encode(message: UpdateEnvironmentBackupSettingRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.setting !== undefined) {+ EnvironmentBackupSetting.encode(message.setting, writer.uint32(10).fork()).ldelim();+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): UpdateEnvironmentBackupSettingRequest {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseUpdateEnvironmentBackupSettingRequest();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.setting = EnvironmentBackupSetting.decode(reader, reader.uint32());+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): UpdateEnvironmentBackupSettingRequest {+ return { setting: isSet(object.setting) ? EnvironmentBackupSetting.fromJSON(object.setting) : undefined };+ },++ toJSON(message: UpdateEnvironmentBackupSettingRequest): unknown {+ const obj: any = {};+ message.setting !== undefined &&+ (obj.setting = message.setting ? EnvironmentBackupSetting.toJSON(message.setting) : undefined);+ return obj;+ },++ create(base?: DeepPartial<UpdateEnvironmentBackupSettingRequest>): UpdateEnvironmentBackupSettingRequest {+ return UpdateEnvironmentBackupSettingRequest.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<UpdateEnvironmentBackupSettingRequest>): UpdateEnvironmentBackupSettingRequest {+ const message = createBaseUpdateEnvironmentBackupSettingRequest();+ message.setting = (object.setting !== undefined && object.setting !== null)+ ? EnvironmentBackupSetting.fromPartial(object.setting)+ : undefined;+ return message;+ },+};++function createBaseEnvironmentBackupSetting(): EnvironmentBackupSetting {+ return { name: "", enabled: false };+}++export const EnvironmentBackupSetting = {+ encode(message: EnvironmentBackupSetting, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {+ if (message.name !== "") {+ writer.uint32(10).string(message.name);+ }+ if (message.enabled === true) {+ writer.uint32(16).bool(message.enabled);+ }+ return writer;+ },++ decode(input: _m0.Reader | Uint8Array, length?: number): EnvironmentBackupSetting {+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);+ let end = length === undefined ? reader.len : reader.pos + length;+ const message = createBaseEnvironmentBackupSetting();+ while (reader.pos < end) {+ const tag = reader.uint32();+ switch (tag >>> 3) {+ case 1:+ if (tag !== 10) {+ break;+ }++ message.name = reader.string();+ continue;+ case 2:+ if (tag !== 16) {+ break;+ }++ message.enabled = reader.bool();+ continue;+ }+ if ((tag & 7) === 4 || tag === 0) {+ break;+ }+ reader.skipType(tag & 7);+ }+ return message;+ },++ fromJSON(object: any): EnvironmentBackupSetting {+ return {+ name: isSet(object.name) ? String(object.name) : "",+ enabled: isSet(object.enabled) ? Boolean(object.enabled) : false,+ };+ },++ toJSON(message: EnvironmentBackupSetting): unknown {+ const obj: any = {};+ message.name !== undefined && (obj.name = message.name);+ message.enabled !== undefined && (obj.enabled = message.enabled);+ return obj;+ },++ create(base?: DeepPartial<EnvironmentBackupSetting>): EnvironmentBackupSetting {+ return EnvironmentBackupSetting.fromPartial(base ?? {});+ },++ fromPartial(object: DeepPartial<EnvironmentBackupSetting>): EnvironmentBackupSetting {+ const message = createBaseEnvironmentBackupSetting();+ message.name = object.name ?? "";+ message.enabled = object.enabled ?? false;+ return message;+ },+};+export type EnvironmentServiceDefinition = typeof EnvironmentServiceDefinition;export const EnvironmentServiceDefinition = {name: "EnvironmentService",@@ -1046,6 +1190,80 @@ export const EnvironmentServiceDefinition = {},},},+ updateBackupSetting: {+ name: "UpdateBackupSetting",+ requestType: UpdateEnvironmentBackupSettingRequest,+ requestStream: false,+ responseType: EnvironmentBackupSetting,+ responseStream: false,+ options: {+ _unknownFields: {+ 578365826: [+ new Uint8Array([+ 58,+ 58,+ 7,+ 115,+ 101,+ 116,+ 116,+ 105,+ 110,+ 103,+ 50,+ 47,+ 47,+ 118,+ 49,+ 47,+ 123,+ 115,+ 101,+ 116,+ 116,+ 105,+ 110,+ 103,+ 46,+ 110,+ 97,+ 109,+ 101,+ 61,+ 101,+ 110,+ 118,+ 105,+ 114,+ 111,+ 110,+ 109,+ 101,+ 110,+ 116,+ 115,+ 47,+ 42,+ 47,+ 98,+ 97,+ 99,+ 107,+ 117,+ 112,+ 83,+ 101,+ 116,+ 116,+ 105,+ 110,+ 103,+ 125,+ ]),+ ],+ },+ },+ },},} as const;@@ -1074,6 +1292,10 @@ export interface EnvironmentServiceImplementation<CallContextExt = {}> {request: UndeleteEnvironmentRequest,context: CallContext & CallContextExt,): Promise<DeepPartial<Environment>>;+ updateBackupSetting(+ request: UpdateEnvironmentBackupSettingRequest,+ context: CallContext & CallContextExt,+ ): Promise<DeepPartial<EnvironmentBackupSetting>>;}export interface EnvironmentServiceClient<CallOptionsExt = {}> {@@ -1101,6 +1323,10 @@ export interface EnvironmentServiceClient<CallOptionsExt = {}> {request: DeepPartial<UndeleteEnvironmentRequest>,options?: CallOptions & CallOptionsExt,): Promise<Environment>;+ updateBackupSetting(+ request: DeepPartial<UpdateEnvironmentBackupSettingRequest>,+ options?: CallOptions & CallOptionsExt,+ ): Promise<EnvironmentBackupSetting>;}type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;diff --git a/frontend/src/types/store.ts b/frontend/src/types/store.tsindex be059ce0e1..9e3e8f86d5 100644--- a/frontend/src/types/store.ts+++ b/frontend/src/types/store.ts@@ -1,6 +1,6 @@import { MigrationHistoryId, QueryHistory, OnboardingGuideType } from ".";import { Activity } from "./activity";-import { Backup, BackupSetting } from "./backup";+import { Backup } from "./backup";import { Bookmark } from "./bookmark";import { Command } from "./common";import { Database } from "./database";@@ -104,10 +104,6 @@ export interface BackupState {backupList: Map<DatabaseId, Backup[]>;}-export interface BackupSettingState {- backupSetting: Map<DatabaseId, BackupSetting>;-}-export interface VCSState {vcsById: Map<VCSId, VCS>;}diff --git a/frontend/src/views/EnvironmentDetail.vue b/frontend/src/views/EnvironmentDetail.vueindex 037edd32fb..449f513567 100644--- a/frontend/src/views/EnvironmentDetail.vue+++ b/frontend/src/views/EnvironmentDetail.vue@@ -57,7 +57,7 @@ import { useRouter } from "vue-router";import ArchiveBanner from "@/components/ArchiveBanner.vue";import EnvironmentForm from "@/components/EnvironmentForm.vue";import { environmentV1Slug, idFromSlug } from "@/utils";-import { hasFeature, pushNotification, useLegacyBackupStore } from "@/store";+import { hasFeature, pushNotification, useBackupV1Store } from "@/store";import BBModal from "@/bbkit/BBModal.vue";import {usePolicyV1Store,@@ -106,7 +106,7 @@ const emit = defineEmits(["archive"]);const environmentV1Store = useEnvironmentV1Store();const policyV1Store = usePolicyV1Store();-const backupStore = useLegacyBackupStore();+const backupStore = useBackupV1Store();const router = useRouter();const { t } = useI18n();@@ -299,12 +299,9 @@ const disableAutoBackupContent = computed(() => {});const disableEnvironmentAutoBackup = async () => {- await backupStore.upsertBackupSettingByEnvironmentId(state.environment.uid, {+ await backupStore.upsertEnvironmentBackupSetting({+ name: `${state.environment.name}/backupSetting`,enabled: false,- hour: 0,- dayOfWeek: 0,- retentionPeriodTs: 0,- hookUrl: "",});success();state.showDisableAutoBackupModal = false;diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 307bba2cf8..c36ec65b70 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -143,10 +143,12 @@- [CreateEnvironmentRequest](#bytebase-v1-CreateEnvironmentRequest)- [DeleteEnvironmentRequest](#bytebase-v1-DeleteEnvironmentRequest)- [Environment](#bytebase-v1-Environment)+ - [EnvironmentBackupSetting](#bytebase-v1-EnvironmentBackupSetting)- [GetEnvironmentRequest](#bytebase-v1-GetEnvironmentRequest)- [ListEnvironmentsRequest](#bytebase-v1-ListEnvironmentsRequest)- [ListEnvironmentsResponse](#bytebase-v1-ListEnvironmentsResponse)- [UndeleteEnvironmentRequest](#bytebase-v1-UndeleteEnvironmentRequest)+ - [UpdateEnvironmentBackupSettingRequest](#bytebase-v1-UpdateEnvironmentBackupSettingRequest)- [UpdateEnvironmentRequest](#bytebase-v1-UpdateEnvironmentRequest)- [EnvironmentTier](#bytebase-v1-EnvironmentTier)@@ -1577,7 +1579,7 @@ BackupSetting is the setting for database backup.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the database backup setting. Format: instances/{instance}/databases/{database}/backupSettings |+| name | [string](#string) | | The name of the database backup setting. Format: instances/{instance}/databases/{database}/backupSetting || backup_retain_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The default maximum age of a Backup created via this BackupPlan. If specified, a Backup will be automatically deleted after its age reaches. If not specified, Backups created under this BackupPlan will be deleted after 7 DAYS. It will be rounded up to the number of days. || cron_schedule | [string](#string) | | Cron(https://wikipedia.com/wiki/cron) string that defines a repeating schedule for creating Backups. Support hour of day, day of week. (UTC time)@@ -2567,6 +2569,22 @@ This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. |+<a name="bytebase-v1-EnvironmentBackupSetting"></a>++### EnvironmentBackupSetting++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| name | [string](#string) | | The name of the environment backup setting. Format: environments/{environment}/backupSetting |+| enabled | [bool](#bool) | | |++++++<a name="bytebase-v1-GetEnvironmentRequest"></a>### GetEnvironmentRequest@@ -2632,6 +2650,21 @@ When paginating, all other parameters provided to `ListEnvironments` must match+<a name="bytebase-v1-UpdateEnvironmentBackupSettingRequest"></a>++### UpdateEnvironmentBackupSettingRequest++++| Field | Type | Label | Description |+| ----- | ---- | ----- | ----------- |+| setting | [EnvironmentBackupSetting](#bytebase-v1-EnvironmentBackupSetting) | | The environment backup setting to update. |++++++<a name="bytebase-v1-UpdateEnvironmentRequest"></a>### UpdateEnvironmentRequest@@ -2682,6 +2715,7 @@ The environment's `name` field is used to identify the environment to update| UpdateEnvironment | [UpdateEnvironmentRequest](#bytebase-v1-UpdateEnvironmentRequest) | [Environment](#bytebase-v1-Environment) | || DeleteEnvironment | [DeleteEnvironmentRequest](#bytebase-v1-DeleteEnvironmentRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | || UndeleteEnvironment | [UndeleteEnvironmentRequest](#bytebase-v1-UndeleteEnvironmentRequest) | [Environment](#bytebase-v1-Environment) | |+| UpdateBackupSetting | [UpdateEnvironmentBackupSettingRequest](#bytebase-v1-UpdateEnvironmentBackupSettingRequest) | [EnvironmentBackupSetting](#bytebase-v1-EnvironmentBackupSetting) | |diff --git a/proto/generated-go/v1/database_service.pb.go b/proto/generated-go/v1/database_service.pb.goindex dfcc5248fe..dd715a79bc 100644--- a/proto/generated-go/v1/database_service.pb.go+++ b/proto/generated-go/v1/database_service.pb.go@@ -2334,7 +2334,7 @@ type BackupSetting struct {unknownFields protoimpl.UnknownFields// The name of the database backup setting.- // Format: instances/{instance}/databases/{database}/backupSettings+ // Format: instances/{instance}/databases/{database}/backupSettingName string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`// The default maximum age of a Backup created via this BackupPlan.// If specified, a Backup will be automatically deleted after its age reaches.diff --git a/proto/generated-go/v1/environment_service.pb.go b/proto/generated-go/v1/environment_service.pb.goindex bd47b38aa2..dfce272633 100644--- a/proto/generated-go/v1/environment_service.pb.go+++ b/proto/generated-go/v1/environment_service.pb.go@@ -561,6 +561,111 @@ func (x *Environment) GetTier() EnvironmentTier {return EnvironmentTier_ENVIRONMENT_TIER_UNSPECIFIED}+type UpdateEnvironmentBackupSettingRequest struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The environment backup setting to update.+ Setting *EnvironmentBackupSetting `protobuf:"bytes,1,opt,name=setting,proto3" json:"setting,omitempty"`+}++func (x *UpdateEnvironmentBackupSettingRequest) Reset() {+ *x = UpdateEnvironmentBackupSettingRequest{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_environment_service_proto_msgTypes[8]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *UpdateEnvironmentBackupSettingRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*UpdateEnvironmentBackupSettingRequest) ProtoMessage() {}++func (x *UpdateEnvironmentBackupSettingRequest) ProtoReflect() protoreflect.Message {+ mi := &file_v1_environment_service_proto_msgTypes[8]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use UpdateEnvironmentBackupSettingRequest.ProtoReflect.Descriptor instead.+func (*UpdateEnvironmentBackupSettingRequest) Descriptor() ([]byte, []int) {+ return file_v1_environment_service_proto_rawDescGZIP(), []int{8}+}++func (x *UpdateEnvironmentBackupSettingRequest) GetSetting() *EnvironmentBackupSetting {+ if x != nil {+ return x.Setting+ }+ return nil+}++type EnvironmentBackupSetting struct {+ state protoimpl.MessageState+ sizeCache protoimpl.SizeCache+ unknownFields protoimpl.UnknownFields++ // The name of the environment backup setting.+ // Format: environments/{environment}/backupSetting+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`+ Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"`+}++func (x *EnvironmentBackupSetting) Reset() {+ *x = EnvironmentBackupSetting{}+ if protoimpl.UnsafeEnabled {+ mi := &file_v1_environment_service_proto_msgTypes[9]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+ }+}++func (x *EnvironmentBackupSetting) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*EnvironmentBackupSetting) ProtoMessage() {}++func (x *EnvironmentBackupSetting) ProtoReflect() protoreflect.Message {+ mi := &file_v1_environment_service_proto_msgTypes[9]+ if protoimpl.UnsafeEnabled && x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use EnvironmentBackupSetting.ProtoReflect.Descriptor instead.+func (*EnvironmentBackupSetting) Descriptor() ([]byte, []int) {+ return file_v1_environment_service_proto_rawDescGZIP(), []int{9}+}++func (x *EnvironmentBackupSetting) GetName() string {+ if x != nil {+ return x.Name+ }+ return ""+}++func (x *EnvironmentBackupSetting) GetEnabled() bool {+ if x != nil {+ return x.Enabled+ }+ return false+}+var File_v1_environment_service_proto protoreflect.FileDescriptorvar file_v1_environment_service_proto_rawDesc = []byte{@@ -633,66 +738,89 @@ var file_v1_environment_service_proto_rawDesc = []byte{0x30, 0x0a, 0x04, 0x74, 0x69, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e,0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x76, 0x69,0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x65, 0x72, 0x52, 0x04, 0x74, 0x69, 0x65,- 0x72, 0x2a, 0x53, 0x0a, 0x0f, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74,- 0x54, 0x69, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x1c, 0x45, 0x4e, 0x56, 0x49, 0x52, 0x4f, 0x4e, 0x4d,- 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x49, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49,- 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x52, 0x4f, 0x54, 0x45, 0x43,- 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x50, 0x52, 0x4f, 0x54, 0x45,- 0x43, 0x54, 0x45, 0x44, 0x10, 0x02, 0x32, 0xc1, 0x06, 0x0a, 0x12, 0x45, 0x6e, 0x76, 0x69, 0x72,- 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x78, 0x0a,- 0x0e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12,- 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,- 0x74, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75,- 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,- 0x31, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x28, 0xda,- 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x76,- 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,- 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x7c, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x45,- 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x24, 0x2e, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e,- 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,- 0x74, 0x1a, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73,- 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4,- 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,- 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x7e, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45,- 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x2e, 0x62, 0x79, 0x74,- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45,- 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,- 0x74, 0x1a, 0x18, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x28, 0xda, 0x41, 0x00,- 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,- 0x65, 0x6e, 0x74, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,- 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0xaa, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,- 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x2e, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,- 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,- 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,- 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x54, 0xda, 0x41,- 0x17, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2c, 0x75, 0x70, 0x64,- 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x3a, 0x0b,- 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x32, 0x25, 0x2f, 0x76, 0x31,- 0x2f, 0x7b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x6e, 0x61,- 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f,- 0x2a, 0x7d, 0x12, 0x7c, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69,- 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,- 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69,- 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,- 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,- 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x28, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82,- 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x2a, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,+ 0x72, 0x22, 0x6d, 0x0a, 0x25, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72,+ 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x65, 0x74, 0x74,+ 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x44, 0x0a, 0x07, 0x73, 0x65,+ 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f,+ 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x65, 0x74, 0x74, 0x69,+ 0x6e, 0x67, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,+ 0x22, 0x48, 0x0a, 0x18, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x42,+ 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04,+ 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,+ 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,+ 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x2a, 0x53, 0x0a, 0x0f, 0x45, 0x6e,+ 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x65, 0x72, 0x12, 0x20, 0x0a,+ 0x1c, 0x45, 0x4e, 0x56, 0x49, 0x52, 0x4f, 0x4e, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x49, 0x45,+ 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12,+ 0x0d, 0x0a, 0x09, 0x50, 0x52, 0x4f, 0x54, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0f,+ 0x0a, 0x0b, 0x55, 0x4e, 0x50, 0x52, 0x4f, 0x54, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x02, 0x32,+ 0xf6, 0x07, 0x0a, 0x12, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x53,+ 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x78, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x76,+ 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f,+ 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x62,+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72,+ 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x28, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82,+ 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d,- 0x12, 0x87, 0x01, 0x0a, 0x13, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x76,- 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x27, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45,- 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,- 0x74, 0x1a, 0x18, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,- 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x2d, 0x82, 0xd3, 0xe4,- 0x93, 0x02, 0x27, 0x3a, 0x01, 0x2a, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d,- 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a,- 0x7d, 0x3a, 0x75, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65,- 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70,- 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x12, 0x7c, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,+ 0x65, 0x6e, 0x74, 0x73, 0x12, 0x24, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,+ 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65,+ 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x76,+ 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,+ 0x65, 0x22, 0x1b, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76,+ 0x31, 0x2f, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x7e,+ 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,+ 0x65, 0x6e, 0x74, 0x12, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,+ 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,+ 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,+ 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x28, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a,+ 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x10, 0x2f, 0x76,+ 0x31, 0x2f, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0xaa,+ 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,+ 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e,+ 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,+ 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f,+ 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x54, 0xda, 0x41, 0x17, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f,+ 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73,+ 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x3a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,+ 0x6d, 0x65, 0x6e, 0x74, 0x32, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x65, 0x6e, 0x76, 0x69, 0x72,+ 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69,+ 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x7c, 0x0a, 0x11, 0x44,+ 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74,+ 0x12, 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44,+ 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74,+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22,+ 0x28, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x2a, 0x19,+ 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f,+ 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x87, 0x01, 0x0a, 0x13, 0x55, 0x6e,+ 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,+ 0x74, 0x12, 0x27, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,+ 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d,+ 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x62, 0x79, 0x74,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,+ 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x01, 0x2a, 0x22,+ 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72,+ 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x3a, 0x75, 0x6e, 0x64, 0x65, 0x6c,+ 0x65, 0x74, 0x65, 0x12, 0xb2, 0x01, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x61,+ 0x63, 0x6b, 0x75, 0x70, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x32, 0x2e, 0x62, 0x79,+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,+ 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x75,+ 0x70, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,+ 0x25, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e,+ 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x53,+ 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3a, 0x3a, 0x07,+ 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x2f, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x73, 0x65,+ 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x65, 0x6e, 0x76, 0x69, 0x72,+ 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70,+ 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x7d, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65,+ 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,+ 0x74, 0x6f, 0x33,}var (@@ -708,45 +836,50 @@ func file_v1_environment_service_proto_rawDescGZIP() []byte {}var file_v1_environment_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)-var file_v1_environment_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)+var file_v1_environment_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)var file_v1_environment_service_proto_goTypes = []interface{}{- (EnvironmentTier)(0), // 0: bytebase.v1.EnvironmentTier- (*GetEnvironmentRequest)(nil), // 1: bytebase.v1.GetEnvironmentRequest- (*ListEnvironmentsRequest)(nil), // 2: bytebase.v1.ListEnvironmentsRequest- (*ListEnvironmentsResponse)(nil), // 3: bytebase.v1.ListEnvironmentsResponse- (*CreateEnvironmentRequest)(nil), // 4: bytebase.v1.CreateEnvironmentRequest- (*UpdateEnvironmentRequest)(nil), // 5: bytebase.v1.UpdateEnvironmentRequest- (*DeleteEnvironmentRequest)(nil), // 6: bytebase.v1.DeleteEnvironmentRequest- (*UndeleteEnvironmentRequest)(nil), // 7: bytebase.v1.UndeleteEnvironmentRequest- (*Environment)(nil), // 8: bytebase.v1.Environment- (*fieldmaskpb.FieldMask)(nil), // 9: google.protobuf.FieldMask- (State)(0), // 10: bytebase.v1.State- (*emptypb.Empty)(nil), // 11: google.protobuf.Empty+ (EnvironmentTier)(0), // 0: bytebase.v1.EnvironmentTier+ (*GetEnvironmentRequest)(nil), // 1: bytebase.v1.GetEnvironmentRequest+ (*ListEnvironmentsRequest)(nil), // 2: bytebase.v1.ListEnvironmentsRequest+ (*ListEnvironmentsResponse)(nil), // 3: bytebase.v1.ListEnvironmentsResponse+ (*CreateEnvironmentRequest)(nil), // 4: bytebase.v1.CreateEnvironmentRequest+ (*UpdateEnvironmentRequest)(nil), // 5: bytebase.v1.UpdateEnvironmentRequest+ (*DeleteEnvironmentRequest)(nil), // 6: bytebase.v1.DeleteEnvironmentRequest+ (*UndeleteEnvironmentRequest)(nil), // 7: bytebase.v1.UndeleteEnvironmentRequest+ (*Environment)(nil), // 8: bytebase.v1.Environment+ (*UpdateEnvironmentBackupSettingRequest)(nil), // 9: bytebase.v1.UpdateEnvironmentBackupSettingRequest+ (*EnvironmentBackupSetting)(nil), // 10: bytebase.v1.EnvironmentBackupSetting+ (*fieldmaskpb.FieldMask)(nil), // 11: google.protobuf.FieldMask+ (State)(0), // 12: bytebase.v1.State+ (*emptypb.Empty)(nil), // 13: google.protobuf.Empty}var file_v1_environment_service_proto_depIdxs = []int32{8, // 0: bytebase.v1.ListEnvironmentsResponse.environments:type_name -> bytebase.v1.Environment8, // 1: bytebase.v1.CreateEnvironmentRequest.environment:type_name -> bytebase.v1.Environment8, // 2: bytebase.v1.UpdateEnvironmentRequest.environment:type_name -> bytebase.v1.Environment- 9, // 3: bytebase.v1.UpdateEnvironmentRequest.update_mask:type_name -> google.protobuf.FieldMask- 10, // 4: bytebase.v1.Environment.state:type_name -> bytebase.v1.State+ 11, // 3: bytebase.v1.UpdateEnvironmentRequest.update_mask:type_name -> google.protobuf.FieldMask+ 12, // 4: bytebase.v1.Environment.state:type_name -> bytebase.v1.State0, // 5: bytebase.v1.Environment.tier:type_name -> bytebase.v1.EnvironmentTier- 1, // 6: bytebase.v1.EnvironmentService.GetEnvironment:input_type -> bytebase.v1.GetEnvironmentRequest- 2, // 7: bytebase.v1.EnvironmentService.ListEnvironments:input_type -> bytebase.v1.ListEnvironmentsRequest- 4, // 8: bytebase.v1.EnvironmentService.CreateEnvironment:input_type -> bytebase.v1.CreateEnvironmentRequest- 5, // 9: bytebase.v1.EnvironmentService.UpdateEnvironment:input_type -> bytebase.v1.UpdateEnvironmentRequest- 6, // 10: bytebase.v1.EnvironmentService.DeleteEnvironment:input_type -> bytebase.v1.DeleteEnvironmentRequest- 7, // 11: bytebase.v1.EnvironmentService.UndeleteEnvironment:input_type -> bytebase.v1.UndeleteEnvironmentRequest- 8, // 12: bytebase.v1.EnvironmentService.GetEnvironment:output_type -> bytebase.v1.Environment- 3, // 13: bytebase.v1.EnvironmentService.ListEnvironments:output_type -> bytebase.v1.ListEnvironmentsResponse- 8, // 14: bytebase.v1.EnvironmentService.CreateEnvironment:output_type -> bytebase.v1.Environment- 8, // 15: bytebase.v1.EnvironmentService.UpdateEnvironment:output_type -> bytebase.v1.Environment- 11, // 16: bytebase.v1.EnvironmentService.DeleteEnvironment:output_type -> google.protobuf.Empty- 8, // 17: bytebase.v1.EnvironmentService.UndeleteEnvironment:output_type -> bytebase.v1.Environment- 12, // [12:18] is the sub-list for method output_type- 6, // [6:12] is the sub-list for method input_type- 6, // [6:6] is the sub-list for extension type_name- 6, // [6:6] is the sub-list for extension extendee- 0, // [0:6] is the sub-list for field type_name+ 10, // 6: bytebase.v1.UpdateEnvironmentBackupSettingRequest.setting:type_name -> bytebase.v1.EnvironmentBackupSetting+ 1, // 7: bytebase.v1.EnvironmentService.GetEnvironment:input_type -> bytebase.v1.GetEnvironmentRequest+ 2, // 8: bytebase.v1.EnvironmentService.ListEnvironments:input_type -> bytebase.v1.ListEnvironmentsRequest+ 4, // 9: bytebase.v1.EnvironmentService.CreateEnvironment:input_type -> bytebase.v1.CreateEnvironmentRequest+ 5, // 10: bytebase.v1.EnvironmentService.UpdateEnvironment:input_type -> bytebase.v1.UpdateEnvironmentRequest+ 6, // 11: bytebase.v1.EnvironmentService.DeleteEnvironment:input_type -> bytebase.v1.DeleteEnvironmentRequest+ 7, // 12: bytebase.v1.EnvironmentService.UndeleteEnvironment:input_type -> bytebase.v1.UndeleteEnvironmentRequest+ 9, // 13: bytebase.v1.EnvironmentService.UpdateBackupSetting:input_type -> bytebase.v1.UpdateEnvironmentBackupSettingRequest+ 8, // 14: bytebase.v1.EnvironmentService.GetEnvironment:output_type -> bytebase.v1.Environment+ 3, // 15: bytebase.v1.EnvironmentService.ListEnvironments:output_type -> bytebase.v1.ListEnvironmentsResponse+ 8, // 16: bytebase.v1.EnvironmentService.CreateEnvironment:output_type -> bytebase.v1.Environment+ 8, // 17: bytebase.v1.EnvironmentService.UpdateEnvironment:output_type -> bytebase.v1.Environment+ 13, // 18: bytebase.v1.EnvironmentService.DeleteEnvironment:output_type -> google.protobuf.Empty+ 8, // 19: bytebase.v1.EnvironmentService.UndeleteEnvironment:output_type -> bytebase.v1.Environment+ 10, // 20: bytebase.v1.EnvironmentService.UpdateBackupSetting:output_type -> bytebase.v1.EnvironmentBackupSetting+ 14, // [14:21] is the sub-list for method output_type+ 7, // [7:14] 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_environment_service_proto_init() }@@ -852,6 +985,30 @@ func file_v1_environment_service_proto_init() {return nil}}+ file_v1_environment_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*UpdateEnvironmentBackupSettingRequest); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }+ file_v1_environment_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {+ switch v := v.(*EnvironmentBackupSetting); i {+ case 0:+ return &v.state+ case 1:+ return &v.sizeCache+ case 2:+ return &v.unknownFields+ default:+ return nil+ }+ }}type x struct{}out := protoimpl.TypeBuilder{@@ -859,7 +1016,7 @@ func file_v1_environment_service_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: file_v1_environment_service_proto_rawDesc,NumEnums: 1,- NumMessages: 8,+ NumMessages: 10,NumExtensions: 0,NumServices: 1,},diff --git a/proto/generated-go/v1/environment_service.pb.gw.go b/proto/generated-go/v1/environment_service.pb.gw.goindex c80b32e66f..8b0bcdae74 100644--- a/proto/generated-go/v1/environment_service.pb.gw.go+++ b/proto/generated-go/v1/environment_service.pb.gw.go@@ -391,6 +391,74 @@ func local_request_EnvironmentService_UndeleteEnvironment_0(ctx context.Context,}+func request_EnvironmentService_UpdateBackupSetting_0(ctx context.Context, marshaler runtime.Marshaler, client EnvironmentServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq UpdateEnvironmentBackupSettingRequest+ var metadata runtime.ServerMetadata++ newReader, berr := utilities.IOReaderFactory(req.Body)+ if berr != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)+ }+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Setting); err != nil && err != io.EOF {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }++ var (+ val string+ ok bool+ err error+ _ = err+ )++ val, ok = pathParams["setting.name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "setting.name")+ }++ err = runtime.PopulateFieldFromPath(&protoReq, "setting.name", val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "setting.name", err)+ }++ msg, err := client.UpdateBackupSetting(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))+ return msg, metadata, err++}++func local_request_EnvironmentService_UpdateBackupSetting_0(ctx context.Context, marshaler runtime.Marshaler, server EnvironmentServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {+ var protoReq UpdateEnvironmentBackupSettingRequest+ var metadata runtime.ServerMetadata++ newReader, berr := utilities.IOReaderFactory(req.Body)+ if berr != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)+ }+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Setting); err != nil && err != io.EOF {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)+ }++ var (+ val string+ ok bool+ err error+ _ = err+ )++ val, ok = pathParams["setting.name"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "setting.name")+ }++ err = runtime.PopulateFieldFromPath(&protoReq, "setting.name", val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "setting.name", err)+ }++ msg, err := server.UpdateBackupSetting(ctx, &protoReq)+ return msg, metadata, err++}+// RegisterEnvironmentServiceHandlerServer registers the http handlers for service EnvironmentService to "mux".// UnaryRPC :call EnvironmentServiceServer directly.// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.@@ -547,6 +615,31 @@ func RegisterEnvironmentServiceHandlerServer(ctx context.Context, mux *runtime.S})+ mux.Handle("PATCH", pattern_EnvironmentService_UpdateBackupSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ var stream runtime.ServerTransportStream+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ var err error+ var annotatedContext context.Context+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/UpdateBackupSetting", runtime.WithHTTPPathPattern("/v1/{setting.name=environments/*/backupSetting}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := local_request_EnvironmentService_UpdateBackupSetting_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_EnvironmentService_UpdateBackupSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)++ })+return nil}@@ -720,6 +813,28 @@ func RegisterEnvironmentServiceHandlerClient(ctx context.Context, mux *runtime.S})+ mux.Handle("PATCH", pattern_EnvironmentService_UpdateBackupSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {+ ctx, cancel := context.WithCancel(req.Context())+ defer cancel()+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)+ var err error+ var annotatedContext context.Context+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.EnvironmentService/UpdateBackupSetting", runtime.WithHTTPPathPattern("/v1/{setting.name=environments/*/backupSetting}"))+ if err != nil {+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)+ return+ }+ resp, md, err := request_EnvironmentService_UpdateBackupSetting_0(annotatedContext, inboundMarshaler, client, req, pathParams)+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)+ if err != nil {+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)+ return+ }++ forward_EnvironmentService_UpdateBackupSetting_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)++ })+return nil}@@ -735,6 +850,8 @@ var (pattern_EnvironmentService_DeleteEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "environments", "name"}, ""))pattern_EnvironmentService_UndeleteEnvironment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "environments", "name"}, "undelete"))++ pattern_EnvironmentService_UpdateBackupSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 4, 3, 5, 3}, []string{"v1", "environments", "backupSetting", "setting.name"}, "")))var (@@ -749,4 +866,6 @@ var (forward_EnvironmentService_DeleteEnvironment_0 = runtime.ForwardResponseMessageforward_EnvironmentService_UndeleteEnvironment_0 = runtime.ForwardResponseMessage++ forward_EnvironmentService_UpdateBackupSetting_0 = runtime.ForwardResponseMessage)diff --git a/proto/generated-go/v1/environment_service_grpc.pb.go b/proto/generated-go/v1/environment_service_grpc.pb.goindex d1a8972507..98ecf0a405 100644--- a/proto/generated-go/v1/environment_service_grpc.pb.go+++ b/proto/generated-go/v1/environment_service_grpc.pb.go@@ -26,6 +26,7 @@ const (EnvironmentService_UpdateEnvironment_FullMethodName = "/bytebase.v1.EnvironmentService/UpdateEnvironment"EnvironmentService_DeleteEnvironment_FullMethodName = "/bytebase.v1.EnvironmentService/DeleteEnvironment"EnvironmentService_UndeleteEnvironment_FullMethodName = "/bytebase.v1.EnvironmentService/UndeleteEnvironment"+ EnvironmentService_UpdateBackupSetting_FullMethodName = "/bytebase.v1.EnvironmentService/UpdateBackupSetting")// EnvironmentServiceClient is the client API for EnvironmentService service.@@ -38,6 +39,7 @@ type EnvironmentServiceClient interface {UpdateEnvironment(ctx context.Context, in *UpdateEnvironmentRequest, opts ...grpc.CallOption) (*Environment, error)DeleteEnvironment(ctx context.Context, in *DeleteEnvironmentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)UndeleteEnvironment(ctx context.Context, in *UndeleteEnvironmentRequest, opts ...grpc.CallOption) (*Environment, error)+ UpdateBackupSetting(ctx context.Context, in *UpdateEnvironmentBackupSettingRequest, opts ...grpc.CallOption) (*EnvironmentBackupSetting, error)}type environmentServiceClient struct {@@ -102,6 +104,15 @@ func (c *environmentServiceClient) UndeleteEnvironment(ctx context.Context, in *return out, nil}+func (c *environmentServiceClient) UpdateBackupSetting(ctx context.Context, in *UpdateEnvironmentBackupSettingRequest, opts ...grpc.CallOption) (*EnvironmentBackupSetting, error) {+ out := new(EnvironmentBackupSetting)+ err := c.cc.Invoke(ctx, EnvironmentService_UpdateBackupSetting_FullMethodName, in, out, opts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}+// EnvironmentServiceServer is the server API for EnvironmentService service.// All implementations must embed UnimplementedEnvironmentServiceServer// for forward compatibility@@ -112,6 +123,7 @@ type EnvironmentServiceServer interface {UpdateEnvironment(context.Context, *UpdateEnvironmentRequest) (*Environment, error)DeleteEnvironment(context.Context, *DeleteEnvironmentRequest) (*emptypb.Empty, error)UndeleteEnvironment(context.Context, *UndeleteEnvironmentRequest) (*Environment, error)+ UpdateBackupSetting(context.Context, *UpdateEnvironmentBackupSettingRequest) (*EnvironmentBackupSetting, error)mustEmbedUnimplementedEnvironmentServiceServer()}@@ -137,6 +149,9 @@ func (UnimplementedEnvironmentServiceServer) DeleteEnvironment(context.Context,func (UnimplementedEnvironmentServiceServer) UndeleteEnvironment(context.Context, *UndeleteEnvironmentRequest) (*Environment, error) {return nil, status.Errorf(codes.Unimplemented, "method UndeleteEnvironment not implemented")}+func (UnimplementedEnvironmentServiceServer) UpdateBackupSetting(context.Context, *UpdateEnvironmentBackupSettingRequest) (*EnvironmentBackupSetting, error) {+ return nil, status.Errorf(codes.Unimplemented, "method UpdateBackupSetting not implemented")+}func (UnimplementedEnvironmentServiceServer) mustEmbedUnimplementedEnvironmentServiceServer() {}// UnsafeEnvironmentServiceServer may be embedded to opt out of forward compatibility for this service.@@ -258,6 +273,24 @@ func _EnvironmentService_UndeleteEnvironment_Handler(srv interface{}, ctx contexreturn interceptor(ctx, in, info, handler)}+func _EnvironmentService_UpdateBackupSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(UpdateEnvironmentBackupSettingRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(EnvironmentServiceServer).UpdateBackupSetting(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: EnvironmentService_UpdateBackupSetting_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(EnvironmentServiceServer).UpdateBackupSetting(ctx, req.(*UpdateEnvironmentBackupSettingRequest))+ }+ return interceptor(ctx, in, info, handler)+}+// EnvironmentService_ServiceDesc is the grpc.ServiceDesc for EnvironmentService service.// It's only intended for direct use with grpc.RegisterService,// and not to be introspected or modified (even as a copy)@@ -289,6 +322,10 @@ var EnvironmentService_ServiceDesc = grpc.ServiceDesc{MethodName: "UndeleteEnvironment",Handler: _EnvironmentService_UndeleteEnvironment_Handler,},+ {+ MethodName: "UpdateBackupSetting",+ Handler: _EnvironmentService_UpdateBackupSetting_Handler,+ },},Streams: []grpc.StreamDesc{},Metadata: "v1/environment_service.proto",diff --git a/proto/v1/database_service.proto b/proto/v1/database_service.protoindex 2d43610603..4f96725213 100644--- a/proto/v1/database_service.proto+++ b/proto/v1/database_service.proto@@ -519,7 +519,7 @@ message DatabaseSchema {// BackupSetting is the setting for database backup.message BackupSetting {// The name of the database backup setting.- // Format: instances/{instance}/databases/{database}/backupSettings+ // Format: instances/{instance}/databases/{database}/backupSettingstring name = 1;// The default maximum age of a Backup created via this BackupPlan.diff --git a/proto/v1/environment_service.proto b/proto/v1/environment_service.protoindex 6abd959a5c..4631e71f56 100644--- a/proto/v1/environment_service.proto+++ b/proto/v1/environment_service.proto@@ -49,6 +49,13 @@ service EnvironmentService {body: "*"};}++ rpc UpdateBackupSetting(UpdateEnvironmentBackupSettingRequest) returns (EnvironmentBackupSetting) {+ option (google.api.http) = {+ patch: "/v1/{setting.name=environments/*/backupSetting}"+ body: "setting"+ };+ }}message GetEnvironmentRequest {@@ -141,3 +148,16 @@ enum EnvironmentTier {PROTECTED = 1;UNPROTECTED = 2;}++message UpdateEnvironmentBackupSettingRequest {+ // The environment backup setting to update.+ EnvironmentBackupSetting setting = 1 [(google.api.field_behavior) = REQUIRED];+}++message EnvironmentBackupSetting {+ // The name of the environment backup setting.+ // Format: environments/{environment}/backupSetting+ string name = 1;++ bool enabled = 2;+}