To use this function add it to the class library file named InfobloxService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: InfobloxService.ts
Description: Orchestrator Function to Get Supported WAPI Versions using the Infoblox Plugin.
Type / Interface Definition: WapiSchema
exportdeclareinterfaceWapiSchema{
requested_version:string;
supported_objects:string[];
supported_versions:string[];
}TypeScriptPublic Function: GetSupportedWapiVersions
publicGetSupportedWapiVersions(objIpamConnection:IpamConnection):string[]{
if (objIpamConnection.apiType===IpamApiType.WAPI){
letarrParameter:string[]= ["Shared Session",objIpamConnection.getUserName(),objIpamConnection.getPassword()];
letobjRESTAuthentication:RESTAuthentication=RESTAuthenticationManager.createAuthentication("Basic",arrParameter);
letobjRESTHost:RESTHost=newRESTHost("Infoblox");
objRESTHost.authentication=objRESTAuthentication;
objRESTHost.hostVerification=false;
objRESTHost.connectionTimeout=0;
objRESTHost.operationTimeout=0;
objRESTHost.url=`https://${objIpamConnection.hostName}`;
letstrPath:string=`/wapi/v1.0/?_return_type=json&_schema`;
objRESTHost=RESTHostManager.createTransientHostFrom(objRESTHost);
letobjRESTREquest:RESTRequest=objRESTHost.createRequest("GET",strPath,null);
letobjRESTResponse:RESTResponse=objRESTREquest.execute();
if (objRESTResponse.statusCode===HttpStatusCode.CODE_200_OK){
letstrContent:string=objRESTResponse.contentAsString;
letobjWapiSchema:WapiSchema=JSON.parse(strContent);
letarrSupportedVersion:string[]=objWapiSchema.supported_versions;
returnarrSupportedVersion;
}
else{
return [];
}
}else{
return [];
}
}TypeScriptDiscover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
