Загрузить файл как iFile с помощью iControl

Есть ли способ обновить содержимое существующего iFile? Я не видел способа обновить содержимое. Итак, я начал смотреть на удаление и создание файла, загрузив локальный файл в BigIP с помощью iControl. Я понимаю, что нужно использовать два объекта - iFileFile и затем iFile в этом порядке.

Может кто-нибудь, пожалуйста, предоставьте использование для этого? Ниже я начал с того, что получил ошибку ниже. Каковы будут правильные параметры для iFileFile.create(), если у меня есть файл с именем random_key_file1 в том же месте, что и скрипт powershell? После создания объекта iFileFile, как я могу использовать то же самое в iFile.create().

Ниже ссылки имеют документацию, но отсутствуют примеры использования: https://devcentral.f5.com/wiki/iControl.LocalLB__iFile__create.ashx https://devcentral.f5.com/wiki/iControl.LocalLB__iFileFile__create.ashx

Ценю помощь.

Add-PSSnapIn iControlSnapIn

$conn = Initialize-F5.iControl -HostName $hostName -Username $username -Password $password
if($conn) {

    Try
    {
        Write-Output "Connected to load balancer - $hostName"
        $ic = Get-F5.iControl
        $iFileFileObjectNames = @("file1")
        $filePaths = @("random_key_file1")
        $ic.LocalLBiFileFile.create($iFileFileObjectNames,$filePaths)
        Write-Output ("file created")
    }
    Catch
    {
        Write-Output($error[0]|format-list -force)
    }
}   
else
{
    Write-Error "Connection to loadbalancer failed"
}

ОШИБКА

Exception             : System.Management.Automation.MethodInvocationException: Exception calling "create" with "2"
                        argument(s): "Exception caught in LocalLB::urn:iControl:LocalLB/iFileFile::create()
                        Common::InvalidArgument
                        " ---> System.Web.Services.Protocols.SoapHeaderException: Exception caught in
                        LocalLB::urn:iControl:LocalLB/iFileFile::create()
                        Common::InvalidArgument

                           at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
                        message, WebResponse response, Stream responseStream, Boolean asyncCall)
                           at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[]
                        parameters)
                           at CallSite.Target(Closure , CallSite , Object , Object , Object )
                           --- End of inner exception stack trace ---
                           at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext
                        funcContext, Exception exception)
                           at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame
                        frame)
                           at
                        System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
                        frame)
                           at
                        System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
                        frame)
TargetObject          :
CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : SoapHeaderException
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, D:\test.ps1: line 35
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
PSMessageDetails      :
Answer this Question  0

0 ответов

Другие вопросы по тегам