To use this function add it to the class library file named OrchestratorService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: OrchestratorService.ts
Description: Orchestrator Function to add REST Operations to a REST Host
Function RESTOperationCreate2
public RESTOperationCreate2(objProperties: Properties, objRESTHost: RESTHost): void {
let arrPropertiesKey: string[] = objProperties.keys;
let arrRESTOperationName: string[] = objRESTHost.getOperations();
arrRESTOperationName.forEach((strRESTOperationName: string): void => {
arrPropertiesKey.forEach((strPropertiesKey: string): void => {
let objRESTOperation: RESTOperation = objRESTHost.getOperation(strRESTOperationName);
//@ts-ignore
if (strPropertiesKey === objRESTOperation.name) {
objProperties.remove(strPropertiesKey);
}
});
});
arrPropertiesKey = objProperties.keys;
arrPropertiesKey.forEach((strPropertiesKey: string): void => {
let arrKey: string[] = strPropertiesKey.split('_');
let strMethod: string = arrKey[0];
let strName: string = arrKey[1];
let strTemplateURL = objProperties.get(strPropertiesKey);
let objRESTOperation: RESTOperation = new RESTOperation(strName);
//@ts-ignore
objRESTOperation.method = strMethod;
//@ts-ignore
objRESTOperation.urlTemplate = strTemplateURL;
//@ts-ignore
objRESTOperation.defaultContentType = "application/json";
objRESTOperation = objRESTHost.addOperation(objRESTOperation);
RESTHostManager.updateHost(objRESTHost);
});
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
