To use this function add it to the class library file named PluginAVIService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: PluginAVIService.ts
Description: Orchestrator Function to Update an AVI Virtual Service.
Private Function: AviVirtualServiceUpdate
public AviVirtualServiceUpdate(objAviWorkflowRuntime: AviWorkflowRuntime, strAviCloud: string = "Default-Cloud", strTenant: string = "admin", strName: string, strDescription: string, strVirtualServiceUUID: string, strSSLKeyAndCertificateName: string, intMaxCpsPerClient: number, strIncludeURL: string, strExcludeURL: string, strAnalyticsProfileName: string, strApplicationProfile: "TCP" | "UDP" | "HTTP" | "HTTPS", strPoolName: string, strPoolGroupName: string, strClientIpAddr: string = "", strStringGroupName: string = "", strClientInsights: string = "", intClientDuration: number, intNonSignificantLogDuration: number, intMetricsRealtimeUpdateDuration: number, intNonSignificantLogThrottle: number, intPort: number, blnUdfLogThrottle: boolean = false, blnNonSignificantLogs: boolean = false, blnMetricsRealtimeUpdate: boolean = false, blnSignificantLogThrottle: boolean = false, blnLogAllClientHeaders: boolean = false, blnEnabledClientLog: boolean = false, blnEnableHttp2: boolean = false, blnEnableSSL: boolean = false, blnEnableAuthgw: boolean, blnEnableRhiSnat: boolean, blnUseVipAsSnat: boolean, blnEnableSni: boolean, blnIgnPoolNetReach: boolean, blnUseBridgeIpAsVip: boolean, blnAllowInvalidClientCert: boolean, blnScaleoutEcmp: boolean, blnTrafficEnabled: boolean, blnAddClientLogFliter: boolean): AviWorkflowRuntime {
let objInsightsSampling: any = {
"client_ip": {
"addrs": [{
"type": "V4",
"addr": strClientIpAddr
}],
"match_criteria": "IS_IN",
},
"sample_uris": {},
"skip_uris": {}
}
if (strIncludeURL) {
objInsightsSampling.sample_uris = {
"match_criteria": "BEGINS_WITH",
"match_str": [strIncludeURL],
};
}
if (strExcludeURL) {
objInsightsSampling.skip_uris = {
"match_criteria": "BEGINS_WITH",
"match_str": [strExcludeURL],
};
}
let arrLogFilter: any[] = [];
if (blnAddClientLogFliter) {
let objLogFilter: any = {
"index": 1,
"client_ip": {
"addrs": [
{
"type": "V4",
"addr": strClientIpAddr
}
],
"match_criteria": "BEGINS_WITH"
},
"name": "Filter 1",
"enabled": blnEnabledClientLog,
"uri": {
"string_group_refs": [
"/api/stringgroup?name" + strStringGroupName
],
"match_criteria": "CONTAINS"
},
"duration": intClientDuration,
"all_headers": blnLogAllClientHeaders
};
arrLogFilter.push(objLogFilter);
}
if (strAnalyticsProfileName) {
let objAnalytics = {
"all_headers": blnLogAllClientHeaders,
"client_insights": strClientInsights,
"client_log_filters": arrLogFilter,
"client_insights_sampling": objInsightsSampling,
"significant_log_throttle": blnSignificantLogThrottle,
"udf_log_throttle": blnUdfLogThrottle,
"full_client_logs": {},
"metrics_realtime_update": {}
}
if (blnNonSignificantLogs === true) {
objAnalytics.full_client_logs = {
"duration": intNonSignificantLogDuration,
"throttle": intNonSignificantLogThrottle,
"enabled": blnNonSignificantLogs
}
}
if (blnMetricsRealtimeUpdate === true) {
objAnalytics.metrics_realtime_update = {
"duration": intMetricsRealtimeUpdateDuration,
"enabled": blnMetricsRealtimeUpdate
}
}
}
let strApplicationProfileName: string;
let strNetworkProfileName: string;
let strSSLProfileName: string;
switch (strApplicationProfile) {
case "TCP":
strApplicationProfileName = "System-L4-Application";
strNetworkProfileName = "System-TCP-Fast-Path";
strSSLProfileName = "";
case "UDP":
strApplicationProfileName = "System-L4-Application";
strNetworkProfileName = "System-UDP-Fast-Path";
strSSLProfileName = "";
case "HTTP":
strApplicationProfileName = "System-HTTP";
strNetworkProfileName = "System-TCP-Proxy";
strSSLProfileName = "";
case "HTTPS":
strApplicationProfileName = "System-Secure-HTTP";
strNetworkProfileName = "name=System-TCP-Proxy";
strSSLProfileName = "System-Standard";
}
let objAviService: AviService = this.AviServiceBuild(intPort, blnEnableHttp2, blnEnableSSL);
let arrAviService: AviService[] = [];
arrAviService.push(objAviService);
let objAviVirtualService: AviVirtualService = this.AviVirtualServiceBuild(strVirtualServiceUUID, strName, strDescription, strTenant, strAviCloud, arrAviService, intMaxCpsPerClient, strPoolName, strPoolGroupName, strAnalyticsProfileName, strSSLProfileName, strApplicationProfileName, strSSLKeyAndCertificateName, strNetworkProfileName, blnEnableAuthgw, blnEnableRhiSnat, blnUseVipAsSnat, blnEnableSni, blnIgnPoolNetReach, blnUseBridgeIpAsVip, blnAllowInvalidClientCert, blnScaleoutEcmp, blnTrafficEnabled);
let objAviVroClient: AviVroClient = objAviWorkflowRuntime.getAviVroClient();
objAviVroClient.addObject(objAviVirtualService, objAviWorkflowRuntime.getWorkflowId(), strTenant);
return objAviWorkflowRuntime;
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
