GetProjectIDPlanID returns the project ID and plan ID from a resource name.
(name string)
| 230 | |
| 231 | // GetProjectIDPlanID returns the project ID and plan ID from a resource name. |
| 232 | func GetProjectIDPlanID(name string) (string, int64, error) { |
| 233 | tokens, err := GetNameParentTokens(name, ProjectNamePrefix, PlanPrefix) |
| 234 | if err != nil { |
| 235 | return "", 0, err |
| 236 | } |
| 237 | planID, err := strconv.ParseInt(tokens[1], 10, 64) |
| 238 | if err != nil { |
| 239 | return "", 0, errors.Errorf("invalid plan ID %q", tokens[1]) |
| 240 | } |
| 241 | return tokens[0], planID, nil |
| 242 | } |
| 243 | |
| 244 | // GetProjectIDPlanIDPlanCheckRunID returns the project ID, plan ID and plan check run ID from a resource name. |
| 245 | func GetProjectIDPlanIDPlanCheckRunID(name string) (string, int64, int64, error) { |