Forum Discussion
proxicon
Altostratus
Aug 23, 2022Create a IFile {system level} via API - Powershell
Hi All, Attempting the following: 1: Create iFile system level 2: Update existing iRule-> iFile referance the the file uploaded in step 1. Im getting stuck at step 1, any assistance creatly appre...
- Aug 24, 2022
Found my fault... JRahm & Patrik_Jonsson this was after my long reply to your other post JRahm (and yes it works on a POST method)... I had the file name in the URL overload specified on the initial create request, it should not be in there...
so this..$File_Name = 'MyFile' $url = "{0}{1}{2}" -f $big_ip, "/mgmt/tm/sys/file/ifile/",$File_Name $headers = @{ 'Content-Type' = 'application/json' 'X-F5-Auth-Token' = $token } $body = @{ 'name' = $File_Name 'source-path' = "file:/var/config/rest/downloads/$File_Name" } | ConvertTo-Json -Compress $result = Invoke-RestMethod -Method post -Uri $url -Headers $headers -Body $body
needs to be:$File_Name = 'MyFile' $url = "{0}{1}" -f $big_ip, "/mgmt/tm/sys/file/ifile/" $headers = @{ 'Content-Type' = 'application/json' 'X-F5-Auth-Token' = $token } $body = @{ 'name' = $File_Name 'source-path' = "file:/var/config/rest/downloads/$File_Name" } | ConvertTo-Json -Compress $result = Invoke-RestMethod -Method post -Uri $url -Headers $headers -Body $body
without the file name in the initial overload.
Hope this helps some future person 🙂
Off to the next challange.
Bonus: Retyped to splat (overload definition) - because why not.# Create a IFile {system level} $File_Name = 'MyFile' $Uri = "{0}{1}" -f $big_ip, "/mgmt/tm/sys/file/ifile/" # Construct overload definition $Param_InvokeRestMethod = @{ headers = @{ 'Content-Type' = 'application/json' 'X-F5-Auth-Token' = $token } body = @{ 'name' = $File_Name 'source-path' = "file:/var/config/rest/downloads/$File_Name" } | ConvertTo-Json -Compress Method = 'post' Uri = $Uri } # Post & capture result $result = Invoke-RestMethod @Param_InvokeRestMethod
Fiko_29923
Nimbostratus
Jun 27, 2011Hi, I have some concern regarding connection which enter the BIG-IP and trigger the irule
I'm using variable for the url and in response event will check the url and insert javascript.
The problem is when more than one connection occurs at the same time. How the variable will be set?
I know there will be time difference even only 0.0001 or so but in this case what if both connection enter virtual server at the same time. Does it will effect the variable set or not?
i modified the irule into this
when HTTP_REQUEST {
set ::url [HTTP::host][HTTP::uri]
}
when HTTP_RESPONSE {
if { $::url equals "192.168.0.202/index.jsp" } {
STREAM::expression "change page content here";
STREAM::enable;
}
}
when STREAM_MATCHED {
STREAM::disable
}
or is there any other way to check the url in response without using variables?
thanks
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