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: update plan api comment (#13063)
Danny Xu122d3026b491
diff --git a/backend/api/v1/plan_service.go b/backend/api/v1/plan_service.goindex 961278630a..39d58c8f8b 100644--- a/backend/api/v1/plan_service.go+++ b/backend/api/v1/plan_service.go@@ -263,23 +263,23 @@ func (s *PlanService) UpdatePlan(ctx context.Context, request *v1pb.UpdatePlanReif !ok {return nil, status.Errorf(codes.Internal, "user not found")}- planID, err := common.GetPlanID(request.Plan.Name)+ projectID, planID, err := common.GetProjectIDPlanID(request.Plan.Name)if err != nil {return nil, status.Errorf(codes.Internal, err.Error())}- oldPlan, err := s.store.GetPlan(ctx, &store.FindPlanMessage{UID: &planID})+ project, err := s.store.GetProjectV2(ctx, &store.FindProjectMessage{ResourceID: &projectID})if err != nil {- return nil, status.Errorf(codes.Internal, "failed to get plan %q: %v", request.Plan.Name, err)+ return nil, status.Errorf(codes.Internal, "failed to get project %q, err: %v", projectID, err)}- if oldPlan == nil {- return nil, status.Errorf(codes.NotFound, "plan %q not found", request.Plan.Name)+ if project == nil {+ return nil, status.Errorf(codes.NotFound, "project %q not found", projectID)}- project, err := s.store.GetProjectV2(ctx, &store.FindProjectMessage{ResourceID: &oldPlan.ProjectID})+ oldPlan, err := s.store.GetPlan(ctx, &store.FindPlanMessage{ProjectID: &projectID, UID: &planID})if err != nil {- return nil, status.Errorf(codes.Internal, "failed to get project %q, err: %v", oldPlan.ProjectID, err)+ return nil, status.Errorf(codes.Internal, "failed to get plan %q: %v", request.Plan.Name, err)}- if project == nil {- return nil, status.Errorf(codes.NotFound, "project %q not found", oldPlan.ProjectID)+ if oldPlan == nil {+ return nil, status.Errorf(codes.NotFound, "plan %q not found", request.Plan.Name)}ok, err = func() (bool, error) {diff --git a/frontend/src/types/proto/v1/plan_service.ts b/frontend/src/types/proto/v1/plan_service.tsindex 8988d10570..6ffc8dc8e5 100644--- a/frontend/src/types/proto/v1/plan_service.ts+++ b/frontend/src/types/proto/v1/plan_service.ts@@ -3651,6 +3651,7 @@ export const PlanServiceDefinition = {},},},+ /** Search for plans that the caller has the bb.plans.get permission on and also satisfy the specified filter & query. */searchPlans: {name: "SearchPlans",requestType: SearchPlansRequest,@@ -3764,6 +3765,10 @@ export const PlanServiceDefinition = {},},},+ /**+ * UpdatePlan updates the plan.+ * The plan creator and the user with bb.plans.update permission on the project can update the plan.+ */updatePlan: {name: "UpdatePlan",requestType: UpdatePlanRequest,diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex d5672bdce2..b9dba49d4e 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -5070,6 +5070,9 @@ paths:patch:tags:- PlanService+ description: |-+ UpdatePlan updates the plan.+ The plan creator and the user with bb.plans.update permission on the project can update the plan.operationId: PlanService_UpdatePlanparameters:- name: project@@ -5238,6 +5241,7 @@ paths:get:tags:- PlanService+ description: Search for plans that the caller has the bb.plans.get permission on and also satisfy the specified filter & query.operationId: PlanService_SearchPlansparameters:- name: projectdiff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 625eca2d5f..7aa53f73fc 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -6854,9 +6854,9 @@ Type is the database change type.| ----------- | ------------ | ------------- | ------------|| GetPlan | [GetPlanRequest](#bytebase-v1-GetPlanRequest) | [Plan](#bytebase-v1-Plan) | || ListPlans | [ListPlansRequest](#bytebase-v1-ListPlansRequest) | [ListPlansResponse](#bytebase-v1-ListPlansResponse) | |-| SearchPlans | [SearchPlansRequest](#bytebase-v1-SearchPlansRequest) | [SearchPlansResponse](#bytebase-v1-SearchPlansResponse) | |+| SearchPlans | [SearchPlansRequest](#bytebase-v1-SearchPlansRequest) | [SearchPlansResponse](#bytebase-v1-SearchPlansResponse) | Search for plans that the caller has the bb.plans.get permission on and also satisfy the specified filter & query. || CreatePlan | [CreatePlanRequest](#bytebase-v1-CreatePlanRequest) | [Plan](#bytebase-v1-Plan) | |-| UpdatePlan | [UpdatePlanRequest](#bytebase-v1-UpdatePlanRequest) | [Plan](#bytebase-v1-Plan) | |+| UpdatePlan | [UpdatePlanRequest](#bytebase-v1-UpdatePlanRequest) | [Plan](#bytebase-v1-Plan) | UpdatePlan updates the plan. The plan creator and the user with bb.plans.update permission on the project can update the plan. || ListPlanCheckRuns | [ListPlanCheckRunsRequest](#bytebase-v1-ListPlanCheckRunsRequest) | [ListPlanCheckRunsResponse](#bytebase-v1-ListPlanCheckRunsResponse) | || RunPlanChecks | [RunPlanChecksRequest](#bytebase-v1-RunPlanChecksRequest) | [RunPlanChecksResponse](#bytebase-v1-RunPlanChecksResponse) | || BatchCancelPlanCheckRuns | [BatchCancelPlanCheckRunsRequest](#bytebase-v1-BatchCancelPlanCheckRunsRequest) | [BatchCancelPlanCheckRunsResponse](#bytebase-v1-BatchCancelPlanCheckRunsResponse) | |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 99c295be32..963e040b95 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -19348,7 +19348,7 @@ Format: projects/{project}/plans/{plan} </p></td><td>SearchPlans</td><td><a href="#bytebase.v1.SearchPlansRequest">SearchPlansRequest</a></td><td><a href="#bytebase.v1.SearchPlansResponse">SearchPlansResponse</a></td>- <td><p></p></td>+ <td><p>Search for plans that the caller has the bb.plans.get permission on and also satisfy the specified filter & query.</p></td></tr><tr>@@ -19362,7 +19362,8 @@ Format: projects/{project}/plans/{plan} </p></td><td>UpdatePlan</td><td><a href="#bytebase.v1.UpdatePlanRequest">UpdatePlanRequest</a></td><td><a href="#bytebase.v1.Plan">Plan</a></td>- <td><p></p></td>+ <td><p>UpdatePlan updates the plan.+The plan creator and the user with bb.plans.update permission on the project can update the plan.</p></td></tr><tr>diff --git a/proto/generated-go/v1/plan_service_grpc.pb.go b/proto/generated-go/v1/plan_service_grpc.pb.goindex 2c054b989a..90fed8b90f 100644--- a/proto/generated-go/v1/plan_service_grpc.pb.go+++ b/proto/generated-go/v1/plan_service_grpc.pb.go@@ -35,8 +35,11 @@ const (type PlanServiceClient interface {GetPlan(ctx context.Context, in *GetPlanRequest, opts ...grpc.CallOption) (*Plan, error)ListPlans(ctx context.Context, in *ListPlansRequest, opts ...grpc.CallOption) (*ListPlansResponse, error)+ // Search for plans that the caller has the bb.plans.get permission on and also satisfy the specified filter & query.SearchPlans(ctx context.Context, in *SearchPlansRequest, opts ...grpc.CallOption) (*SearchPlansResponse, error)CreatePlan(ctx context.Context, in *CreatePlanRequest, opts ...grpc.CallOption) (*Plan, error)+ // UpdatePlan updates the plan.+ // The plan creator and the user with bb.plans.update permission on the project can update the plan.UpdatePlan(ctx context.Context, in *UpdatePlanRequest, opts ...grpc.CallOption) (*Plan, error)ListPlanCheckRuns(ctx context.Context, in *ListPlanCheckRunsRequest, opts ...grpc.CallOption) (*ListPlanCheckRunsResponse, error)RunPlanChecks(ctx context.Context, in *RunPlanChecksRequest, opts ...grpc.CallOption) (*RunPlanChecksResponse, error)@@ -137,8 +140,11 @@ func (c *planServiceClient) BatchCancelPlanCheckRuns(ctx context.Context, in *Batype PlanServiceServer interface {GetPlan(context.Context, *GetPlanRequest) (*Plan, error)ListPlans(context.Context, *ListPlansRequest) (*ListPlansResponse, error)+ // Search for plans that the caller has the bb.plans.get permission on and also satisfy the specified filter & query.SearchPlans(context.Context, *SearchPlansRequest) (*SearchPlansResponse, error)CreatePlan(context.Context, *CreatePlanRequest) (*Plan, error)+ // UpdatePlan updates the plan.+ // The plan creator and the user with bb.plans.update permission on the project can update the plan.UpdatePlan(context.Context, *UpdatePlanRequest) (*Plan, error)ListPlanCheckRuns(context.Context, *ListPlanCheckRunsRequest) (*ListPlanCheckRunsResponse, error)RunPlanChecks(context.Context, *RunPlanChecksRequest) (*RunPlanChecksResponse, error)diff --git a/proto/v1/plan_service.proto b/proto/v1/plan_service.protoindex 81bd909cd1..14201b3128 100644--- a/proto/v1/plan_service.proto+++ b/proto/v1/plan_service.proto@@ -29,6 +29,7 @@ service PlanService {option (bytebase.v1.auth_method) = IAM;}+ // Search for plans that the caller has the bb.plans.get permission on and also satisfy the specified filter & query.rpc SearchPlans(SearchPlansRequest) returns (SearchPlansResponse) {option (google.api.http) = {get: "/v1/{parent=projects/*}/plans:search"};option (google.api.method_signature) = "parent";@@ -46,6 +47,8 @@ service PlanService {option (bytebase.v1.auth_method) = IAM;}+ // UpdatePlan updates the plan.+ // The plan creator and the user with bb.plans.update permission on the project can update the plan.rpc UpdatePlan(UpdatePlanRequest) returns (Plan) {option (google.api.http) = {patch: "/v1/{plan.name=projects/*/plans/*}"