new postgres model (#12305)

Co-authored-by: Brian Bergeron <brberger@microsoft.com>
This commit is contained in:
Brian Bergeron
2020-09-15 14:52:04 -07:00
committed by GitHub
parent 9cf80113fc
commit f79ff99d0b
16 changed files with 156 additions and 681 deletions

View File

@@ -194,23 +194,6 @@ export function getErrorMessage(error: any): string {
return error.message ?? error;
}
/**
* Parses an instance name from the controller. An instance name will either be just its name
* e.g. myinstance or namespace_name e.g. mynamespace_my-instance.
* @param instanceName The instance name in one of the formats described
*/
export function parseInstanceName(instanceName: string | undefined): string {
instanceName = instanceName ?? '';
const parts: string[] = instanceName.split('_');
if (parts.length === 2) {
instanceName = parts[1];
}
else if (parts.length > 2) {
throw new Error(`Cannot parse resource '${instanceName}'. Acceptable formats are 'namespace_name' or 'name'.`);
}
return instanceName;
}
/**
* Parses an address into its separate ip and port values. Address must be in the form <ip>:<port>
* @param address The address to parse