MCPcopy Create free account
hub / github.com/bytebase/bytebase / GetProjectIDPlanIDFromPlanCheckRun

Function GetProjectIDPlanIDFromPlanCheckRun

backend/common/resource_name.go:263–274  ·  view source on GitHub ↗

GetProjectIDPlanIDFromPlanCheckRun returns the project ID and plan ID from a plan check run singleton resource name. Format: projects/{project}/plans/{plan}/planCheckRun

(name string)

Source from the content-addressed store, hash-verified

261// GetProjectIDPlanIDFromPlanCheckRun returns the project ID and plan ID from a plan check run singleton resource name.
262// Format: projects/{project}/plans/{plan}/planCheckRun
263func GetProjectIDPlanIDFromPlanCheckRun(name string) (string, int64, error) {
264 // Remove the trailing "/planCheckRun" suffix
265 if !strings.HasSuffix(name, "/planCheckRun") {
266 return "", 0, errors.Errorf("invalid plan check run name %q, expected suffix /planCheckRun", name)
267 }
268 planName := strings.TrimSuffix(name, "/planCheckRun")
269 projectID, planID, err := GetProjectIDPlanID(planName)
270 if err != nil {
271 return "", 0, err
272 }
273 return projectID, planID, nil
274}
275
276// GetProjectIDPlanIDFromRolloutName returns the project ID and plan ID from a resource name.
277func GetProjectIDPlanIDFromRolloutName(name string) (string, int64, error) {

Callers 2

GetPlanCheckRunMethod · 0.92
CancelPlanCheckRunMethod · 0.92

Calls 2

GetProjectIDPlanIDFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected