GetInstanceID returns the instance ID from a resource name.
(name string)
| 138 | |
| 139 | // GetInstanceID returns the instance ID from a resource name. |
| 140 | func GetInstanceID(name string) (string, error) { |
| 141 | // the instance request should be instances/{instance-id} |
| 142 | tokens, err := GetNameParentTokens(name, InstanceNamePrefix) |
| 143 | if err != nil { |
| 144 | return "", err |
| 145 | } |
| 146 | return tokens[0], nil |
| 147 | } |
| 148 | |
| 149 | // GetInstanceDatabaseID returns the instance ID and database ID from a resource name. |
| 150 | func GetInstanceDatabaseID(name string) (string, string, error) { |