diff --git a/src/operations/collections/index.ts b/src/operations/collections/index.ts index be096f0..e00780e 100644 --- a/src/operations/collections/index.ts +++ b/src/operations/collections/index.ts @@ -23,16 +23,20 @@ export class CollectionOperations { toURLSearchParams({ op: 'create', ...params }) ) const data: CollectionTypes.CollectionCreateResponse = res.data - if (!data.created) + if (!data.created) { message = `Failed to create collection: '${params.lpath}' already exists` - else message = `Successfully created collection '${params.lpath}'` + } else { + message = `Successfully created collection '${params.lpath}'` + } retData = { status: res.status, data: res.data } } catch (error) { assert(error instanceof AxiosError) message = `Failed to create collection '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -53,7 +57,9 @@ export class CollectionOperations { message = `Failed to remove collection '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -73,7 +79,9 @@ export class CollectionOperations { message = `Failed to retrieve information for collection '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -93,7 +101,9 @@ export class CollectionOperations { message = `Failed to retrieve list for collection '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -116,7 +126,9 @@ export class CollectionOperations { message = `Failed to set permission for entity '${params['entity-name']}' to '${params.permission}' on collection '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -145,7 +157,9 @@ export class CollectionOperations { }` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -168,7 +182,9 @@ export class CollectionOperations { message = `Failed to modify permissions for collection '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -191,7 +207,9 @@ export class CollectionOperations { message = `Failed to modify metadata for collection '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -212,7 +230,9 @@ export class CollectionOperations { message = `Failed to rename collection '${params['old-lpath']}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -233,7 +253,9 @@ export class CollectionOperations { message = `Failed to update mtime for collection '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } } diff --git a/src/operations/data_objects/index.ts b/src/operations/data_objects/index.ts index c38f535..b21a358 100644 --- a/src/operations/data_objects/index.ts +++ b/src/operations/data_objects/index.ts @@ -30,7 +30,9 @@ export class DataObjectOperations { message = `Failed to create or update mtime of data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -51,7 +53,9 @@ export class DataObjectOperations { message = `Failed to remove data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -74,7 +78,9 @@ export class DataObjectOperations { message = `Failed to calculate checksum for data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -96,7 +102,9 @@ export class DataObjectOperations { message = `Failed to verify checksum for data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -116,7 +124,9 @@ export class DataObjectOperations { message = `Failed to retrieve information for data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -137,7 +147,9 @@ export class DataObjectOperations { message = `Failed to rename data object '${params['old-lpath']}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -158,7 +170,9 @@ export class DataObjectOperations { message = `Failed to copy data object '${params['src-lpath']}' to '${params['dst-lpath']}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -181,7 +195,9 @@ export class DataObjectOperations { message = `Failed to replicate data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -202,7 +218,9 @@ export class DataObjectOperations { message = `Failed to trim data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -225,7 +243,9 @@ export class DataObjectOperations { message = `Failed to register physical object '${params.ppath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -246,7 +266,9 @@ export class DataObjectOperations { message = `Failed to read data object '${params.lpath}'` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -282,7 +304,9 @@ export class DataObjectOperations { message = `Failed to write to data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -305,7 +329,9 @@ export class DataObjectOperations { message = `Failed to initialize parallel write session for data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -328,7 +354,9 @@ export class DataObjectOperations { message = `Failed to shut down parallel write session: ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -351,7 +379,9 @@ export class DataObjectOperations { message = `Failed to modify metadata for data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -374,7 +404,9 @@ export class DataObjectOperations { message = `Failed to set permission for entity '${params['entity-name']}' to '${params.permission}' on data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -397,7 +429,9 @@ export class DataObjectOperations { message = `Failed to modify permissions for data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -414,17 +448,20 @@ export class DataObjectOperations { toURLSearchParams({ op: 'modify_replica', ...params }) ) // If params['replica-number'] doesn't exist, then params['resource-hierarchy'] does (or should, at least) - if (params['replica-number']) + if (params['replica-number']) { message = `Successfully modified replica number ${params['replica-number']} of data object '${params.lpath}'` - else + } else { message = `Successfully modified replica of data object '${params.lpath}' with resource hierarchy '${params['resource-hierarchy']}'` + } retData = { status: res.status, data: res.data } } catch (error) { assert(error instanceof AxiosError) message = `Failed to modify replica of data object '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } } diff --git a/src/operations/query/index.ts b/src/operations/query/index.ts index 11d16f9..402e516 100644 --- a/src/operations/query/index.ts +++ b/src/operations/query/index.ts @@ -31,7 +31,9 @@ export class QueryOperations { message = `Failed to execute genquery: ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -54,7 +56,9 @@ export class QueryOperations { message = `Failed to execute specific query '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -78,7 +82,9 @@ export class QueryOperations { message = `Failed to add specific query '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -102,7 +108,9 @@ export class QueryOperations { message = `Failed to remove specific query '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } } diff --git a/src/operations/resources/index.ts b/src/operations/resources/index.ts index d54c943..42ce594 100644 --- a/src/operations/resources/index.ts +++ b/src/operations/resources/index.ts @@ -29,7 +29,9 @@ export class ResourceOperations { message = `Failed to create resource '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -50,7 +52,9 @@ export class ResourceOperations { message = `Failed to remove resource '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -71,7 +75,9 @@ export class ResourceOperations { message = `Failed to add child '${params['child-name']}' to parent '${params['parent-name']}: ${error.message}'` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -92,7 +98,9 @@ export class ResourceOperations { message = `Failed to remove child '${params['child-name']}' from parent '${params['parent-name']}: ${error.message}'` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -113,7 +121,9 @@ export class ResourceOperations { message = `Failed to rebalance resource '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -133,7 +143,9 @@ export class ResourceOperations { message = `Failed to retrieve information for resource '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -156,7 +168,9 @@ export class ResourceOperations { message = `Failed to modify metadata of resource '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } } diff --git a/src/operations/rules/index.ts b/src/operations/rules/index.ts index 86c7e06..9642702 100644 --- a/src/operations/rules/index.ts +++ b/src/operations/rules/index.ts @@ -30,7 +30,9 @@ export class RuleOperations { message = `Failed to list rule engines: ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -54,7 +56,9 @@ export class RuleOperations { message = `Failed to execute rule: ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -78,7 +82,9 @@ export class RuleOperations { message = `Failed to remove delay rule '${params['rule-id']}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } } diff --git a/src/operations/tickets/index.ts b/src/operations/tickets/index.ts index b560eb0..9b13d23 100644 --- a/src/operations/tickets/index.ts +++ b/src/operations/tickets/index.ts @@ -32,7 +32,9 @@ export class TicketOperations { message = `Failed to create ticket at '${params.lpath}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -56,7 +58,9 @@ export class TicketOperations { message = `Failed to remove ticket '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } } diff --git a/src/operations/users_groups/index.ts b/src/operations/users_groups/index.ts index e962ea9..ae8d0cf 100644 --- a/src/operations/users_groups/index.ts +++ b/src/operations/users_groups/index.ts @@ -32,7 +32,9 @@ export class UserGroupOperations { message = `Failed to create user '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -56,7 +58,9 @@ export class UserGroupOperations { message = `Failed to remove user '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -80,7 +84,9 @@ export class UserGroupOperations { message = `Failed to set password for user '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -104,7 +110,9 @@ export class UserGroupOperations { message = `Failed to set user type of '${params.name}' to '${params['new-user-type']}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -128,7 +136,9 @@ export class UserGroupOperations { message = `Failed to create group '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -152,7 +162,9 @@ export class UserGroupOperations { message = `Failed to remove group '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -176,7 +188,9 @@ export class UserGroupOperations { message = `Failed to add user '${params.user}' to group '${params.group}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -202,7 +216,9 @@ export class UserGroupOperations { message = `Failed to remove user '${params.user}' from group '${params.group}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -222,7 +238,9 @@ export class UserGroupOperations { message = `Failed to retrieve list of users: ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -244,7 +262,9 @@ export class UserGroupOperations { message = `Failed to retrieve list of groups: ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -270,7 +290,9 @@ export class UserGroupOperations { message = `Failed to determine whether user '${params.user}' is member of group '${params.group}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -293,7 +315,9 @@ export class UserGroupOperations { message = `Failed to retrieve information for '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -319,7 +343,9 @@ export class UserGroupOperations { message = `Failed to modify metadata of '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } } diff --git a/src/operations/zones/index.ts b/src/operations/zones/index.ts index 361d4bd..c8208fb 100644 --- a/src/operations/zones/index.ts +++ b/src/operations/zones/index.ts @@ -32,7 +32,9 @@ export class ZoneOperations { message = `Failed to add zone '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -56,7 +58,9 @@ export class ZoneOperations { message = `Failed to remove zone '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -80,7 +84,9 @@ export class ZoneOperations { message = `Failed to modify zone '${params.name}': ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } @@ -100,7 +106,9 @@ export class ZoneOperations { message = `Failed to retrieve zone report: ${error.message}` retData = { status: error.response?.status!, data: null } } - if (this.debug) console.log(message) + if (this.debug) { + console.log(message) + } return retData } }