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

Function GetInstanceDatabaseID

action/common/resource_name.go:28–35  ·  view source on GitHub ↗

GetInstanceDatabaseID returns the instance ID and database ID from a resource name.

(name string)

Source from the content-addressed store, hash-verified

26
27// GetInstanceDatabaseID returns the instance ID and database ID from a resource name.
28func GetInstanceDatabaseID(name string) (string, string, error) {
29 // the instance request should be instances/{instance-id}/databases/{database-id}
30 tokens, err := GetNameParentTokens(name, InstanceNamePrefix, DatabaseIDPrefix)
31 if err != nil {
32 return "", "", err
33 }
34 return tokens[0], tokens[1], nil
35}
36
37// GetNameParentTokens returns the tokens from a resource name.
38func GetNameParentTokens(name string, tokenPrefixes ...string) ([]string, error) {

Callers 1

validateTargetsFunction · 0.92

Calls 1

GetNameParentTokensFunction · 0.70

Tested by

no test coverage detected