Forum Discussion
Richard_Milner-
Nimbostratus
Aug 14, 2012Creating Profiles / available methods list on iControl?
Hi Folks, I suspect I've just missed a large chunk of the documentation, so any pointers would be handy... I've already used iControl briefly in a couple of other tools, mainly...
Richard_Milner-
Nimbostratus
Aug 15, 2012Create HTTP Profile function:
-------------------------------------------------------------------------
function Create-HTTPProfile()
Check whether a HTTP Profile exists, create it if required and set its parent profile
We also explicitly turn on the X-FORWARDED-FOR header
-------------------------------------------------------------------------
{
Param([string] $profileName, [string] $parentProfile);
$HTTPProfileArray = @()
$HTTPProfileArray = (Get-F5.iControl).LocalLBProfileHttp.get_list()
If ($HTTPProfileArray -contains $profileName) {
Write-Host "HTTP Profile: $profileName already exists" -ForegroundColor Cyan
} Else {
try {
Create LocalLBProfileMode Structs for the X-FORWARDED-FOR change
$ProfileMode = New-Object -TypeName iControl.LocalLBProfileProfileMode;
$ProfileMode.value = "PROFILE_MODE_ENABLED";
$ProfileModes = (, $ProfileMode);
Create profile
(Get-F5.iControl).LocalLBProfileHttp.create( $profileName )
Set parent profile
(Get-F5.iControl).LocalLBProfileHttp.set_default_profile( $profileName, $parentProfile )
Enable the X-FORWARDED-FOR header
(Get-F5.iControl).LocalLBProfileHttp.set_insert_xforwarded_for_header_mode( $profileName, $ProfileModes )
Write-Host "Created HTTP Profile: $profileName" -ForegroundColor Green
} catch {
Write-Host "There was an exception thrown creating HTTP Profile: $profileName" -ForegroundColor Red
$Error[0]
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects