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
export declare interface WapiSchema {
requested_version: string;
supported_objects: string[];
supported_versions: string[];
}TypeScriptPublic Function: GetSupportedWapiVersions
public GetSupportedWapiVersions(objIpamConnection: IpamConnection): string[] {
if (objIpamConnection.apiType === IpamApiType.WAPI) {
let arrParameter: string[] = ["Shared Session", objIpamConnection.getUserName(), objIpamConnection.getPassword()];
let objRESTAuthentication: RESTAuthentication = RESTAuthenticationManager.createAuthentication("Basic", arrParameter);
let objRESTHost: RESTHost = new RESTHost("Infoblox");
objRESTHost.authentication = objRESTAuthentication;
objRESTHost.hostVerification = false;
objRESTHost.connectionTimeout = 0;
objRESTHost.operationTimeout = 0;
objRESTHost.url = `https://${objIpamConnection.hostName}`;
objRESTHost = RESTHostManager.createTransientHostFrom(objRESTHost);
let strPath: string = `/wapi/v1.0/?_return_type=json&_schema`;
let objRESTREquest: RESTRequest = objRESTHost.createRequest("GET", strPath, null);
let objRESTResponse: RESTResponse = objRESTREquest.execute();
if (objRESTResponse.statusCode === HttpStatusCode.CODE_200_OK) {
let strContent: string = objRESTResponse.contentAsString;
let objWapiSchema: WapiSchema = JSON.parse(strContent);
let arrSupportedVersion: string[] = objWapiSchema.supported_versions;
return arrSupportedVersion;
}
else {
return [];
}
} else {
return [];
}
}TypeScriptDiscover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
