@itentialopensource/adapter-netbox 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/adapter.js +815 -0
- package/entities/Dcim/action.json +182 -0
- package/entities/Dcim/mockdatafiles/getDcimLocations-default.json +688 -0
- package/entities/Dcim/schema.json +82 -19
- package/package.json +1 -1
- package/pronghorn.json +2642 -642
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +7 -7
- package/test/integration/adapterTestIntegration.js +253 -0
- package/test/unit/adapterTestUnit.js +261 -0
package/adapter.js
CHANGED
|
@@ -32902,6 +32902,821 @@ This request will yield a base64-encoded session key to be included in an `X-Ses
|
|
|
32902
32902
|
return callback(null, errorObj);
|
|
32903
32903
|
}
|
|
32904
32904
|
}
|
|
32905
|
+
|
|
32906
|
+
/**
|
|
32907
|
+
* @function getDcimLocations
|
|
32908
|
+
* @pronghornType method
|
|
32909
|
+
* @name getDcimLocations
|
|
32910
|
+
* @summary Overrides ListModelMixin to allow processing ExportTemplates.
|
|
32911
|
+
*
|
|
32912
|
+
* @param {string} [id] - id param
|
|
32913
|
+
* @param {string} [name] - name param
|
|
32914
|
+
* @param {string} [slug] - slug param
|
|
32915
|
+
* @param {string} [description] - description param
|
|
32916
|
+
* @param {string} [tenantGroupId] - tenantGroupId param
|
|
32917
|
+
* @param {string} [tenantGroup] - tenantGroup param
|
|
32918
|
+
* @param {string} [tenantId] - tenantId param
|
|
32919
|
+
* @param {string} [tenant] - tenant param
|
|
32920
|
+
* @param {string} [contact] - contact param
|
|
32921
|
+
* @param {string} [contactRole] - contactRole param
|
|
32922
|
+
* @param {string} [contactGroup] - contactGroup param
|
|
32923
|
+
* @param {string} [created] - created param
|
|
32924
|
+
* @param {string} [createdGte] - createdGte param
|
|
32925
|
+
* @param {string} [createdLte] - createdLte param
|
|
32926
|
+
* @param {string} [lastUpdated] - lastUpdated param
|
|
32927
|
+
* @param {string} [lastUpdatedGte] - lastUpdatedGte param
|
|
32928
|
+
* @param {string} [lastUpdatedLte] - lastUpdatedLte param
|
|
32929
|
+
* @param {string} [q] - q param
|
|
32930
|
+
* @param {string} [tag] - tag param
|
|
32931
|
+
* @param {string} [regionId] - regionId param
|
|
32932
|
+
* @param {string} [region] - region param
|
|
32933
|
+
* @param {string} [siteGroupId] - siteGroupId param
|
|
32934
|
+
* @param {string} [siteGroup] - siteGroup param
|
|
32935
|
+
* @param {string} [siteId] - siteId param
|
|
32936
|
+
* @param {string} [site] - site param
|
|
32937
|
+
* @param {string} [parentId] - parentId param
|
|
32938
|
+
* @param {string} [parent] - parent param
|
|
32939
|
+
* @param {string} [idN] - idN param
|
|
32940
|
+
* @param {string} [idLte] - idLte param
|
|
32941
|
+
* @param {string} [idLt] - idLt param
|
|
32942
|
+
* @param {string} [idGte] - idGte param
|
|
32943
|
+
* @param {string} [idGt] - idGt param
|
|
32944
|
+
* @param {string} [nameN] - nameN param
|
|
32945
|
+
* @param {string} [nameIc] - nameIc param
|
|
32946
|
+
* @param {string} [nameNic] - nameNic param
|
|
32947
|
+
* @param {string} [nameIew] - nameIew param
|
|
32948
|
+
* @param {string} [nameNiew] - nameNiew param
|
|
32949
|
+
* @param {string} [nameIsw] - nameIsw param
|
|
32950
|
+
* @param {string} [nameNisw] - nameNisw param
|
|
32951
|
+
* @param {string} [nameIe] - nameIe param
|
|
32952
|
+
* @param {string} [nameNie] - nameNie param
|
|
32953
|
+
* @param {string} [slugN] - slugN param
|
|
32954
|
+
* @param {string} [slugIc] - slugIc param
|
|
32955
|
+
* @param {string} [slugNic] - slugNic param
|
|
32956
|
+
* @param {string} [slugIew] - slugIew param
|
|
32957
|
+
* @param {string} [slugNiew] - slugNiew param
|
|
32958
|
+
* @param {string} [slugIsw] - slugIsw param
|
|
32959
|
+
* @param {string} [slugNisw] - slugNisw param
|
|
32960
|
+
* @param {string} [slugIe] - slugIe param
|
|
32961
|
+
* @param {string} [slugNie] - slugNie param
|
|
32962
|
+
* @param {string} [descriptionN] - descriptionN param
|
|
32963
|
+
* @param {string} [descriptionIc] - descriptionIc param
|
|
32964
|
+
* @param {string} [descriptionNic] - descriptionNic param
|
|
32965
|
+
* @param {string} [descriptionIew] - descriptionIew param
|
|
32966
|
+
* @param {string} [descriptionNiew] - descriptionNiew param
|
|
32967
|
+
* @param {string} [descriptionIsw] - descriptionIsw param
|
|
32968
|
+
* @param {string} [descriptionNisw] - descriptionNisw param
|
|
32969
|
+
* @param {string} [descriptionIe] - descriptionIe param
|
|
32970
|
+
* @param {string} [descriptionNie] - descriptionNie param
|
|
32971
|
+
* @param {string} [tenantGroupIdN] - tenantGroupIdN param
|
|
32972
|
+
* @param {string} [tenantGroupN] - tenantGroupN param
|
|
32973
|
+
* @param {string} [tenantIdN] - tenantIdN param
|
|
32974
|
+
* @param {string} [tenantN] - tenantN param
|
|
32975
|
+
* @param {string} [contactN] - contactN param
|
|
32976
|
+
* @param {string} [contactRoleN] - contactRoleN param
|
|
32977
|
+
* @param {string} [contactGroupN] - contactGroupN param
|
|
32978
|
+
* @param {string} [tagN] - tagN param
|
|
32979
|
+
* @param {string} [regionIdN] - regionIdN param
|
|
32980
|
+
* @param {string} [regionN] - regionN param
|
|
32981
|
+
* @param {string} [siteGroupIdN] - siteGroupIdN param
|
|
32982
|
+
* @param {string} [siteGroupN] - siteGroupN param
|
|
32983
|
+
* @param {string} [siteIdN] - siteIdN param
|
|
32984
|
+
* @param {string} [siteN] - siteN param
|
|
32985
|
+
* @param {string} [parentIdN] - parentIdN param
|
|
32986
|
+
* @param {string} [parentN] - parentN param
|
|
32987
|
+
* @param {number} [limit] - Number of results to return per page.
|
|
32988
|
+
* @param {number} [offset] - The initial index from which to return the results.
|
|
32989
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
32990
|
+
* @return {object} results - An object containing the response of the action
|
|
32991
|
+
*
|
|
32992
|
+
* @route {POST} /getDcimLocations
|
|
32993
|
+
* @roles admin
|
|
32994
|
+
* @task true
|
|
32995
|
+
*/
|
|
32996
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
32997
|
+
getDcimLocations(id, name, slug, description, tenantGroupId, tenantGroup, tenantId, tenant, contact, contactRole, contactGroup, created, createdGte, createdLte, lastUpdated, lastUpdatedGte, lastUpdatedLte, q, tag, regionId, region, siteGroupId, siteGroup, siteId, site, parentId, parent, idN, idLte, idLt, idGte, idGt, nameN, nameIc, nameNic, nameIew, nameNiew, nameIsw, nameNisw, nameIe, nameNie, slugN, slugIc, slugNic, slugIew, slugNiew, slugIsw, slugNisw, slugIe, slugNie, descriptionN, descriptionIc, descriptionNic, descriptionIew, descriptionNiew, descriptionIsw, descriptionNisw, descriptionIe, descriptionNie, tenantGroupIdN, tenantGroupN, tenantIdN, tenantN, contactN, contactRoleN, contactGroupN, tagN, regionIdN, regionN, siteGroupIdN, siteGroupN, siteIdN, siteN, parentIdN, parentN, limit, offset, callback) {
|
|
32998
|
+
const meth = 'adapter-getDcimLocations';
|
|
32999
|
+
const origin = `${this.id}-${meth}`;
|
|
33000
|
+
log.trace(origin);
|
|
33001
|
+
|
|
33002
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
33003
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
33004
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33005
|
+
return callback(null, errorObj);
|
|
33006
|
+
}
|
|
33007
|
+
|
|
33008
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
33009
|
+
|
|
33010
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
33011
|
+
const queryParamsAvailable = { id, name, slug, description, tenantGroupId, tenantGroup, tenantId, tenant, contact, contactRole, contactGroup, created, createdGte, createdLte, lastUpdated, lastUpdatedGte, lastUpdatedLte, q, tag, regionId, region, siteGroupId, siteGroup, siteId, site, parentId, parent, idN, idLte, idLt, idGte, idGt, nameN, nameIc, nameNic, nameIew, nameNiew, nameIsw, nameNisw, nameIe, nameNie, slugN, slugIc, slugNic, slugIew, slugNiew, slugIsw, slugNisw, slugIe, slugNie, descriptionN, descriptionIc, descriptionNic, descriptionIew, descriptionNiew, descriptionIsw, descriptionNisw, descriptionIe, descriptionNie, tenantGroupIdN, tenantGroupN, tenantIdN, tenantN, contactN, contactRoleN, contactGroupN, tagN, regionIdN, regionN, siteGroupIdN, siteGroupN, siteIdN, siteN, parentIdN, parentN, limit, offset };
|
|
33012
|
+
const queryParams = {};
|
|
33013
|
+
const pathVars = [];
|
|
33014
|
+
const bodyVars = {};
|
|
33015
|
+
|
|
33016
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
33017
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
33018
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
33019
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
33020
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
33021
|
+
}
|
|
33022
|
+
});
|
|
33023
|
+
|
|
33024
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
33025
|
+
// see adapter code documentation for more information on the request object's fields
|
|
33026
|
+
const reqObj = {
|
|
33027
|
+
payload: bodyVars,
|
|
33028
|
+
uriPathVars: pathVars,
|
|
33029
|
+
uriQuery: queryParams
|
|
33030
|
+
};
|
|
33031
|
+
|
|
33032
|
+
try {
|
|
33033
|
+
// Make the call -
|
|
33034
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
33035
|
+
return this.requestHandlerInst.identifyRequest('Dcim', 'getDcimLocations', reqObj, true, (irReturnData, irReturnError) => {
|
|
33036
|
+
// if we received an error or their is no response on the results
|
|
33037
|
+
// return an error
|
|
33038
|
+
if (irReturnError) {
|
|
33039
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
33040
|
+
return callback(null, irReturnError);
|
|
33041
|
+
}
|
|
33042
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
33043
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDcimLocations'], null, null, null);
|
|
33044
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33045
|
+
return callback(null, errorObj);
|
|
33046
|
+
}
|
|
33047
|
+
|
|
33048
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
33049
|
+
// return the response
|
|
33050
|
+
return callback(irReturnData, null);
|
|
33051
|
+
});
|
|
33052
|
+
} catch (ex) {
|
|
33053
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
33054
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33055
|
+
return callback(null, errorObj);
|
|
33056
|
+
}
|
|
33057
|
+
}
|
|
33058
|
+
|
|
33059
|
+
/**
|
|
33060
|
+
* @function postDcimLocations
|
|
33061
|
+
* @pronghornType method
|
|
33062
|
+
* @name postDcimLocations
|
|
33063
|
+
* @summary dcim_locations_create
|
|
33064
|
+
*
|
|
33065
|
+
* @param {object} data - data param
|
|
33066
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
33067
|
+
* @return {object} results - An object containing the response of the action
|
|
33068
|
+
*
|
|
33069
|
+
* @route {POST} /postDcimLocations
|
|
33070
|
+
* @roles admin
|
|
33071
|
+
* @task true
|
|
33072
|
+
*/
|
|
33073
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
33074
|
+
postDcimLocations(data, callback) {
|
|
33075
|
+
const meth = 'adapter-postDcimLocations';
|
|
33076
|
+
const origin = `${this.id}-${meth}`;
|
|
33077
|
+
log.trace(origin);
|
|
33078
|
+
|
|
33079
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
33080
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
33081
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33082
|
+
return callback(null, errorObj);
|
|
33083
|
+
}
|
|
33084
|
+
|
|
33085
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
33086
|
+
if (data === undefined || data === null || data === '') {
|
|
33087
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['data'], null, null, null);
|
|
33088
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33089
|
+
return callback(null, errorObj);
|
|
33090
|
+
}
|
|
33091
|
+
|
|
33092
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
33093
|
+
const queryParamsAvailable = {};
|
|
33094
|
+
const queryParams = {};
|
|
33095
|
+
const pathVars = [];
|
|
33096
|
+
const bodyVars = data;
|
|
33097
|
+
|
|
33098
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
33099
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
33100
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
33101
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
33102
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
33103
|
+
}
|
|
33104
|
+
});
|
|
33105
|
+
|
|
33106
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
33107
|
+
// see adapter code documentation for more information on the request object's fields
|
|
33108
|
+
const reqObj = {
|
|
33109
|
+
payload: bodyVars,
|
|
33110
|
+
uriPathVars: pathVars,
|
|
33111
|
+
uriQuery: queryParams
|
|
33112
|
+
};
|
|
33113
|
+
|
|
33114
|
+
try {
|
|
33115
|
+
// Make the call -
|
|
33116
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
33117
|
+
return this.requestHandlerInst.identifyRequest('Dcim', 'postDcimLocations', reqObj, true, (irReturnData, irReturnError) => {
|
|
33118
|
+
// if we received an error or their is no response on the results
|
|
33119
|
+
// return an error
|
|
33120
|
+
if (irReturnError) {
|
|
33121
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
33122
|
+
return callback(null, irReturnError);
|
|
33123
|
+
}
|
|
33124
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
33125
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postDcimLocations'], null, null, null);
|
|
33126
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33127
|
+
return callback(null, errorObj);
|
|
33128
|
+
}
|
|
33129
|
+
|
|
33130
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
33131
|
+
// return the response
|
|
33132
|
+
return callback(irReturnData, null);
|
|
33133
|
+
});
|
|
33134
|
+
} catch (ex) {
|
|
33135
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
33136
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33137
|
+
return callback(null, errorObj);
|
|
33138
|
+
}
|
|
33139
|
+
}
|
|
33140
|
+
|
|
33141
|
+
/**
|
|
33142
|
+
* @function putDcimLocations
|
|
33143
|
+
* @pronghornType method
|
|
33144
|
+
* @name putDcimLocations
|
|
33145
|
+
* @summary dcim_locations_bulk_update
|
|
33146
|
+
*
|
|
33147
|
+
* @param {object} data - data param
|
|
33148
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
33149
|
+
* @return {object} results - An object containing the response of the action
|
|
33150
|
+
*
|
|
33151
|
+
* @route {POST} /putDcimLocations
|
|
33152
|
+
* @roles admin
|
|
33153
|
+
* @task true
|
|
33154
|
+
*/
|
|
33155
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
33156
|
+
putDcimLocations(data, callback) {
|
|
33157
|
+
const meth = 'adapter-putDcimLocations';
|
|
33158
|
+
const origin = `${this.id}-${meth}`;
|
|
33159
|
+
log.trace(origin);
|
|
33160
|
+
|
|
33161
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
33162
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
33163
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33164
|
+
return callback(null, errorObj);
|
|
33165
|
+
}
|
|
33166
|
+
|
|
33167
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
33168
|
+
if (data === undefined || data === null || data === '') {
|
|
33169
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['data'], null, null, null);
|
|
33170
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33171
|
+
return callback(null, errorObj);
|
|
33172
|
+
}
|
|
33173
|
+
|
|
33174
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
33175
|
+
const queryParamsAvailable = {};
|
|
33176
|
+
const queryParams = {};
|
|
33177
|
+
const pathVars = [];
|
|
33178
|
+
const bodyVars = data;
|
|
33179
|
+
|
|
33180
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
33181
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
33182
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
33183
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
33184
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
33185
|
+
}
|
|
33186
|
+
});
|
|
33187
|
+
|
|
33188
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
33189
|
+
// see adapter code documentation for more information on the request object's fields
|
|
33190
|
+
const reqObj = {
|
|
33191
|
+
payload: bodyVars,
|
|
33192
|
+
uriPathVars: pathVars,
|
|
33193
|
+
uriQuery: queryParams
|
|
33194
|
+
};
|
|
33195
|
+
|
|
33196
|
+
try {
|
|
33197
|
+
// Make the call -
|
|
33198
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
33199
|
+
return this.requestHandlerInst.identifyRequest('Dcim', 'putDcimLocations', reqObj, false, (irReturnData, irReturnError) => {
|
|
33200
|
+
// if we received an error or their is no response on the results
|
|
33201
|
+
// return an error
|
|
33202
|
+
if (irReturnError) {
|
|
33203
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
33204
|
+
return callback(null, irReturnError);
|
|
33205
|
+
}
|
|
33206
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
33207
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['putDcimLocations'], null, null, null);
|
|
33208
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33209
|
+
return callback(null, errorObj);
|
|
33210
|
+
}
|
|
33211
|
+
|
|
33212
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
33213
|
+
// return the response
|
|
33214
|
+
return callback(irReturnData, null);
|
|
33215
|
+
});
|
|
33216
|
+
} catch (ex) {
|
|
33217
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
33218
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33219
|
+
return callback(null, errorObj);
|
|
33220
|
+
}
|
|
33221
|
+
}
|
|
33222
|
+
|
|
33223
|
+
/**
|
|
33224
|
+
* @function patchDcimLocations
|
|
33225
|
+
* @pronghornType method
|
|
33226
|
+
* @name patchDcimLocations
|
|
33227
|
+
* @summary dcim_locations_bulk_partial_update
|
|
33228
|
+
*
|
|
33229
|
+
* @param {object} data - data param
|
|
33230
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
33231
|
+
* @return {object} results - An object containing the response of the action
|
|
33232
|
+
*
|
|
33233
|
+
* @route {POST} /patchDcimLocations
|
|
33234
|
+
* @roles admin
|
|
33235
|
+
* @task true
|
|
33236
|
+
*/
|
|
33237
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
33238
|
+
patchDcimLocations(data, callback) {
|
|
33239
|
+
const meth = 'adapter-patchDcimLocations';
|
|
33240
|
+
const origin = `${this.id}-${meth}`;
|
|
33241
|
+
log.trace(origin);
|
|
33242
|
+
|
|
33243
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
33244
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
33245
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33246
|
+
return callback(null, errorObj);
|
|
33247
|
+
}
|
|
33248
|
+
|
|
33249
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
33250
|
+
if (data === undefined || data === null || data === '') {
|
|
33251
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['data'], null, null, null);
|
|
33252
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33253
|
+
return callback(null, errorObj);
|
|
33254
|
+
}
|
|
33255
|
+
|
|
33256
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
33257
|
+
const queryParamsAvailable = {};
|
|
33258
|
+
const queryParams = {};
|
|
33259
|
+
const pathVars = [];
|
|
33260
|
+
const bodyVars = data;
|
|
33261
|
+
|
|
33262
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
33263
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
33264
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
33265
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
33266
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
33267
|
+
}
|
|
33268
|
+
});
|
|
33269
|
+
|
|
33270
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
33271
|
+
// see adapter code documentation for more information on the request object's fields
|
|
33272
|
+
const reqObj = {
|
|
33273
|
+
payload: bodyVars,
|
|
33274
|
+
uriPathVars: pathVars,
|
|
33275
|
+
uriQuery: queryParams
|
|
33276
|
+
};
|
|
33277
|
+
|
|
33278
|
+
try {
|
|
33279
|
+
// Make the call -
|
|
33280
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
33281
|
+
return this.requestHandlerInst.identifyRequest('Dcim', 'patchDcimLocations', reqObj, false, (irReturnData, irReturnError) => {
|
|
33282
|
+
// if we received an error or their is no response on the results
|
|
33283
|
+
// return an error
|
|
33284
|
+
if (irReturnError) {
|
|
33285
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
33286
|
+
return callback(null, irReturnError);
|
|
33287
|
+
}
|
|
33288
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
33289
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['patchDcimLocations'], null, null, null);
|
|
33290
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33291
|
+
return callback(null, errorObj);
|
|
33292
|
+
}
|
|
33293
|
+
|
|
33294
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
33295
|
+
// return the response
|
|
33296
|
+
return callback(irReturnData, null);
|
|
33297
|
+
});
|
|
33298
|
+
} catch (ex) {
|
|
33299
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
33300
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33301
|
+
return callback(null, errorObj);
|
|
33302
|
+
}
|
|
33303
|
+
}
|
|
33304
|
+
|
|
33305
|
+
/**
|
|
33306
|
+
* @function deleteDcimLocations
|
|
33307
|
+
* @pronghornType method
|
|
33308
|
+
* @name deleteDcimLocations
|
|
33309
|
+
* @summary dcim_locations_bulk_delete
|
|
33310
|
+
*
|
|
33311
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
33312
|
+
* @return {object} results - An object containing the response of the action
|
|
33313
|
+
*
|
|
33314
|
+
* @route {GET} /deleteDcimLocations
|
|
33315
|
+
* @roles admin
|
|
33316
|
+
* @task true
|
|
33317
|
+
*/
|
|
33318
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
33319
|
+
deleteDcimLocations(callback) {
|
|
33320
|
+
const meth = 'adapter-deleteDcimLocations';
|
|
33321
|
+
const origin = `${this.id}-${meth}`;
|
|
33322
|
+
log.trace(origin);
|
|
33323
|
+
|
|
33324
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
33325
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
33326
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33327
|
+
return callback(null, errorObj);
|
|
33328
|
+
}
|
|
33329
|
+
|
|
33330
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
33331
|
+
|
|
33332
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
33333
|
+
const queryParamsAvailable = {};
|
|
33334
|
+
const queryParams = {};
|
|
33335
|
+
const pathVars = [];
|
|
33336
|
+
const bodyVars = {};
|
|
33337
|
+
|
|
33338
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
33339
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
33340
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
33341
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
33342
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
33343
|
+
}
|
|
33344
|
+
});
|
|
33345
|
+
|
|
33346
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
33347
|
+
// see adapter code documentation for more information on the request object's fields
|
|
33348
|
+
const reqObj = {
|
|
33349
|
+
payload: bodyVars,
|
|
33350
|
+
uriPathVars: pathVars,
|
|
33351
|
+
uriQuery: queryParams
|
|
33352
|
+
};
|
|
33353
|
+
|
|
33354
|
+
try {
|
|
33355
|
+
// Make the call -
|
|
33356
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
33357
|
+
return this.requestHandlerInst.identifyRequest('Dcim', 'deleteDcimLocations', reqObj, false, (irReturnData, irReturnError) => {
|
|
33358
|
+
// if we received an error or their is no response on the results
|
|
33359
|
+
// return an error
|
|
33360
|
+
if (irReturnError) {
|
|
33361
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
33362
|
+
return callback(null, irReturnError);
|
|
33363
|
+
}
|
|
33364
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
33365
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteDcimLocations'], null, null, null);
|
|
33366
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33367
|
+
return callback(null, errorObj);
|
|
33368
|
+
}
|
|
33369
|
+
|
|
33370
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
33371
|
+
// return the response
|
|
33372
|
+
return callback(irReturnData, null);
|
|
33373
|
+
});
|
|
33374
|
+
} catch (ex) {
|
|
33375
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
33376
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33377
|
+
return callback(null, errorObj);
|
|
33378
|
+
}
|
|
33379
|
+
}
|
|
33380
|
+
|
|
33381
|
+
/**
|
|
33382
|
+
* @function getDcimLocationsId
|
|
33383
|
+
* @pronghornType method
|
|
33384
|
+
* @name getDcimLocationsId
|
|
33385
|
+
* @summary dcim_locations_read
|
|
33386
|
+
*
|
|
33387
|
+
* @param {number} id - A unique integer value identifying this location.
|
|
33388
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
33389
|
+
* @return {object} results - An object containing the response of the action
|
|
33390
|
+
*
|
|
33391
|
+
* @route {POST} /getDcimLocationsId
|
|
33392
|
+
* @roles admin
|
|
33393
|
+
* @task true
|
|
33394
|
+
*/
|
|
33395
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
33396
|
+
getDcimLocationsId(id, callback) {
|
|
33397
|
+
const meth = 'adapter-getDcimLocationsId';
|
|
33398
|
+
const origin = `${this.id}-${meth}`;
|
|
33399
|
+
log.trace(origin);
|
|
33400
|
+
|
|
33401
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
33402
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
33403
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33404
|
+
return callback(null, errorObj);
|
|
33405
|
+
}
|
|
33406
|
+
|
|
33407
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
33408
|
+
if (id === undefined || id === null || id === '') {
|
|
33409
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
|
|
33410
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33411
|
+
return callback(null, errorObj);
|
|
33412
|
+
}
|
|
33413
|
+
|
|
33414
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
33415
|
+
const queryParamsAvailable = {};
|
|
33416
|
+
const queryParams = {};
|
|
33417
|
+
const pathVars = [id];
|
|
33418
|
+
const bodyVars = {};
|
|
33419
|
+
|
|
33420
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
33421
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
33422
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
33423
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
33424
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
33425
|
+
}
|
|
33426
|
+
});
|
|
33427
|
+
|
|
33428
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
33429
|
+
// see adapter code documentation for more information on the request object's fields
|
|
33430
|
+
const reqObj = {
|
|
33431
|
+
payload: bodyVars,
|
|
33432
|
+
uriPathVars: pathVars,
|
|
33433
|
+
uriQuery: queryParams
|
|
33434
|
+
};
|
|
33435
|
+
|
|
33436
|
+
try {
|
|
33437
|
+
// Make the call -
|
|
33438
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
33439
|
+
return this.requestHandlerInst.identifyRequest('Dcim', 'getDcimLocationsId', reqObj, true, (irReturnData, irReturnError) => {
|
|
33440
|
+
// if we received an error or their is no response on the results
|
|
33441
|
+
// return an error
|
|
33442
|
+
if (irReturnError) {
|
|
33443
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
33444
|
+
return callback(null, irReturnError);
|
|
33445
|
+
}
|
|
33446
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
33447
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDcimLocationsId'], null, null, null);
|
|
33448
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33449
|
+
return callback(null, errorObj);
|
|
33450
|
+
}
|
|
33451
|
+
|
|
33452
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
33453
|
+
// return the response
|
|
33454
|
+
return callback(irReturnData, null);
|
|
33455
|
+
});
|
|
33456
|
+
} catch (ex) {
|
|
33457
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
33458
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33459
|
+
return callback(null, errorObj);
|
|
33460
|
+
}
|
|
33461
|
+
}
|
|
33462
|
+
|
|
33463
|
+
/**
|
|
33464
|
+
* @function putDcimLocationsId
|
|
33465
|
+
* @pronghornType method
|
|
33466
|
+
* @name putDcimLocationsId
|
|
33467
|
+
* @summary dcim_locations_update
|
|
33468
|
+
*
|
|
33469
|
+
* @param {number} id - A unique integer value identifying this location.
|
|
33470
|
+
* @param {object} data - data param
|
|
33471
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
33472
|
+
* @return {object} results - An object containing the response of the action
|
|
33473
|
+
*
|
|
33474
|
+
* @route {POST} /putDcimLocationsId
|
|
33475
|
+
* @roles admin
|
|
33476
|
+
* @task true
|
|
33477
|
+
*/
|
|
33478
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
33479
|
+
putDcimLocationsId(id, data, callback) {
|
|
33480
|
+
const meth = 'adapter-putDcimLocationsId';
|
|
33481
|
+
const origin = `${this.id}-${meth}`;
|
|
33482
|
+
log.trace(origin);
|
|
33483
|
+
|
|
33484
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
33485
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
33486
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33487
|
+
return callback(null, errorObj);
|
|
33488
|
+
}
|
|
33489
|
+
|
|
33490
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
33491
|
+
if (id === undefined || id === null || id === '') {
|
|
33492
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
|
|
33493
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33494
|
+
return callback(null, errorObj);
|
|
33495
|
+
}
|
|
33496
|
+
if (data === undefined || data === null || data === '') {
|
|
33497
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['data'], null, null, null);
|
|
33498
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33499
|
+
return callback(null, errorObj);
|
|
33500
|
+
}
|
|
33501
|
+
|
|
33502
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
33503
|
+
const queryParamsAvailable = {};
|
|
33504
|
+
const queryParams = {};
|
|
33505
|
+
const pathVars = [id];
|
|
33506
|
+
const bodyVars = data;
|
|
33507
|
+
|
|
33508
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
33509
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
33510
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
33511
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
33512
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
33513
|
+
}
|
|
33514
|
+
});
|
|
33515
|
+
|
|
33516
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
33517
|
+
// see adapter code documentation for more information on the request object's fields
|
|
33518
|
+
const reqObj = {
|
|
33519
|
+
payload: bodyVars,
|
|
33520
|
+
uriPathVars: pathVars,
|
|
33521
|
+
uriQuery: queryParams
|
|
33522
|
+
};
|
|
33523
|
+
|
|
33524
|
+
try {
|
|
33525
|
+
// Make the call -
|
|
33526
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
33527
|
+
return this.requestHandlerInst.identifyRequest('Dcim', 'putDcimLocationsId', reqObj, false, (irReturnData, irReturnError) => {
|
|
33528
|
+
// if we received an error or their is no response on the results
|
|
33529
|
+
// return an error
|
|
33530
|
+
if (irReturnError) {
|
|
33531
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
33532
|
+
return callback(null, irReturnError);
|
|
33533
|
+
}
|
|
33534
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
33535
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['putDcimLocationsId'], null, null, null);
|
|
33536
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33537
|
+
return callback(null, errorObj);
|
|
33538
|
+
}
|
|
33539
|
+
|
|
33540
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
33541
|
+
// return the response
|
|
33542
|
+
return callback(irReturnData, null);
|
|
33543
|
+
});
|
|
33544
|
+
} catch (ex) {
|
|
33545
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
33546
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33547
|
+
return callback(null, errorObj);
|
|
33548
|
+
}
|
|
33549
|
+
}
|
|
33550
|
+
|
|
33551
|
+
/**
|
|
33552
|
+
* @function patchDcimLocationsId
|
|
33553
|
+
* @pronghornType method
|
|
33554
|
+
* @name patchDcimLocationsId
|
|
33555
|
+
* @summary dcim_locations_partial_update
|
|
33556
|
+
*
|
|
33557
|
+
* @param {number} id - A unique integer value identifying this location.
|
|
33558
|
+
* @param {object} data - data param
|
|
33559
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
33560
|
+
* @return {object} results - An object containing the response of the action
|
|
33561
|
+
*
|
|
33562
|
+
* @route {POST} /patchDcimLocationsId
|
|
33563
|
+
* @roles admin
|
|
33564
|
+
* @task true
|
|
33565
|
+
*/
|
|
33566
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
33567
|
+
patchDcimLocationsId(id, data, callback) {
|
|
33568
|
+
const meth = 'adapter-patchDcimLocationsId';
|
|
33569
|
+
const origin = `${this.id}-${meth}`;
|
|
33570
|
+
log.trace(origin);
|
|
33571
|
+
|
|
33572
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
33573
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
33574
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33575
|
+
return callback(null, errorObj);
|
|
33576
|
+
}
|
|
33577
|
+
|
|
33578
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
33579
|
+
if (id === undefined || id === null || id === '') {
|
|
33580
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
|
|
33581
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33582
|
+
return callback(null, errorObj);
|
|
33583
|
+
}
|
|
33584
|
+
if (data === undefined || data === null || data === '') {
|
|
33585
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['data'], null, null, null);
|
|
33586
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33587
|
+
return callback(null, errorObj);
|
|
33588
|
+
}
|
|
33589
|
+
|
|
33590
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
33591
|
+
const queryParamsAvailable = {};
|
|
33592
|
+
const queryParams = {};
|
|
33593
|
+
const pathVars = [id];
|
|
33594
|
+
const bodyVars = data;
|
|
33595
|
+
|
|
33596
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
33597
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
33598
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
33599
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
33600
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
33601
|
+
}
|
|
33602
|
+
});
|
|
33603
|
+
|
|
33604
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
33605
|
+
// see adapter code documentation for more information on the request object's fields
|
|
33606
|
+
const reqObj = {
|
|
33607
|
+
payload: bodyVars,
|
|
33608
|
+
uriPathVars: pathVars,
|
|
33609
|
+
uriQuery: queryParams
|
|
33610
|
+
};
|
|
33611
|
+
|
|
33612
|
+
try {
|
|
33613
|
+
// Make the call -
|
|
33614
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
33615
|
+
return this.requestHandlerInst.identifyRequest('Dcim', 'patchDcimLocationsId', reqObj, false, (irReturnData, irReturnError) => {
|
|
33616
|
+
// if we received an error or their is no response on the results
|
|
33617
|
+
// return an error
|
|
33618
|
+
if (irReturnError) {
|
|
33619
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
33620
|
+
return callback(null, irReturnError);
|
|
33621
|
+
}
|
|
33622
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
33623
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['patchDcimLocationsId'], null, null, null);
|
|
33624
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33625
|
+
return callback(null, errorObj);
|
|
33626
|
+
}
|
|
33627
|
+
|
|
33628
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
33629
|
+
// return the response
|
|
33630
|
+
return callback(irReturnData, null);
|
|
33631
|
+
});
|
|
33632
|
+
} catch (ex) {
|
|
33633
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
33634
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33635
|
+
return callback(null, errorObj);
|
|
33636
|
+
}
|
|
33637
|
+
}
|
|
33638
|
+
|
|
33639
|
+
/**
|
|
33640
|
+
* @function deleteDcimLocationsId
|
|
33641
|
+
* @pronghornType method
|
|
33642
|
+
* @name deleteDcimLocationsId
|
|
33643
|
+
* @summary dcim_locations_delete
|
|
33644
|
+
*
|
|
33645
|
+
* @param {number} id - A unique integer value identifying this location.
|
|
33646
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
33647
|
+
* @return {object} results - An object containing the response of the action
|
|
33648
|
+
*
|
|
33649
|
+
* @route {POST} /deleteDcimLocationsId
|
|
33650
|
+
* @roles admin
|
|
33651
|
+
* @task true
|
|
33652
|
+
*/
|
|
33653
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
33654
|
+
deleteDcimLocationsId(id, callback) {
|
|
33655
|
+
const meth = 'adapter-deleteDcimLocationsId';
|
|
33656
|
+
const origin = `${this.id}-${meth}`;
|
|
33657
|
+
log.trace(origin);
|
|
33658
|
+
|
|
33659
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
33660
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
33661
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33662
|
+
return callback(null, errorObj);
|
|
33663
|
+
}
|
|
33664
|
+
|
|
33665
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
33666
|
+
if (id === undefined || id === null || id === '') {
|
|
33667
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
|
|
33668
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33669
|
+
return callback(null, errorObj);
|
|
33670
|
+
}
|
|
33671
|
+
|
|
33672
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
33673
|
+
const queryParamsAvailable = {};
|
|
33674
|
+
const queryParams = {};
|
|
33675
|
+
const pathVars = [id];
|
|
33676
|
+
const bodyVars = {};
|
|
33677
|
+
|
|
33678
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
33679
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
33680
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
33681
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
33682
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
33683
|
+
}
|
|
33684
|
+
});
|
|
33685
|
+
|
|
33686
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
33687
|
+
// see adapter code documentation for more information on the request object's fields
|
|
33688
|
+
const reqObj = {
|
|
33689
|
+
payload: bodyVars,
|
|
33690
|
+
uriPathVars: pathVars,
|
|
33691
|
+
uriQuery: queryParams
|
|
33692
|
+
};
|
|
33693
|
+
|
|
33694
|
+
try {
|
|
33695
|
+
// Make the call -
|
|
33696
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
33697
|
+
return this.requestHandlerInst.identifyRequest('Dcim', 'deleteDcimLocationsId', reqObj, false, (irReturnData, irReturnError) => {
|
|
33698
|
+
// if we received an error or their is no response on the results
|
|
33699
|
+
// return an error
|
|
33700
|
+
if (irReturnError) {
|
|
33701
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
33702
|
+
return callback(null, irReturnError);
|
|
33703
|
+
}
|
|
33704
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
33705
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteDcimLocationsId'], null, null, null);
|
|
33706
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33707
|
+
return callback(null, errorObj);
|
|
33708
|
+
}
|
|
33709
|
+
|
|
33710
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
33711
|
+
// return the response
|
|
33712
|
+
return callback(irReturnData, null);
|
|
33713
|
+
});
|
|
33714
|
+
} catch (ex) {
|
|
33715
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
33716
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
33717
|
+
return callback(null, errorObj);
|
|
33718
|
+
}
|
|
33719
|
+
}
|
|
32905
33720
|
}
|
|
32906
33721
|
|
|
32907
33722
|
module.exports = Netbox;
|