-export function getResourceKind(itemKind: string) {
- switch (itemKind) {
- case "arvados#project":
- case "arvados#group":
- return ResourceKind.PROJECT;
- case "arvados#collection":
+export enum ResourceObjectType {
+ API_CLIENT_AUTHORIZATION = 'gj3su',
+ COLLECTION = '4zz18',
+ CONTAINER = 'dz642',
+ CONTAINER_REQUEST = 'xvhdp',
+ GROUP = 'j7d0g',
+ LOG = '57u5n',
+ REPOSITORY = 's0uqq',
+ USER = 'tpzed',
+ VIRTUAL_MACHINE = '2x53u',
+ WORKFLOW = '7fd4e',
+ SSH_KEY = 'fngyi',
+ KEEP_SERVICE = 'bi6l4',
+ NODE = '7ekkf'
+}
+
+export const RESOURCE_UUID_PATTERN = '.{5}-.{5}-.{15}';
+export const RESOURCE_UUID_REGEX = new RegExp(RESOURCE_UUID_PATTERN);
+
+export const isResourceUuid = (uuid: string) =>
+ RESOURCE_UUID_REGEX.test(uuid);
+
+export const extractUuidObjectType = (uuid: string) => {
+ const match = RESOURCE_UUID_REGEX.exec(uuid);
+ return match
+ ? match[0].split('-')[1]
+ : undefined;
+};
+
+export const extractUuidKind = (uuid: string = '') => {
+ const objectType = extractUuidObjectType(uuid);
+ switch (objectType) {
+ case ResourceObjectType.USER:
+ return ResourceKind.USER;
+ case ResourceObjectType.GROUP:
+ return ResourceKind.GROUP;
+ case ResourceObjectType.COLLECTION: