1 Rookie

 • 

16 Posts

March 14th, 2024 16:50

@Alptech Expert​ Thanks, that is pretty much what I am doing via Powershell subset of script:

$newclient="new_server"

$exportpath="/ifs/blah/blah"

$zone="nfs"

# create base for cluster Uri

$baseNFSurl = 'https://'+$Clustersname+/platform/16/protocols/nfs/exports/'

$Getexportinfourl=$baseNFSurl+"?path="+$exportpath+"&zone="+$zone

 

$nfsexportdata=Invoke-RestMethod -Uri $Getexportinfourl -Method Get -Headers $headers

$exportid=$nfsexportdata.exports.id

$clientlist=New-Object System.Collections.ArrayList

foreach($client in $nfsexportdata.exports.clients){

    $clientlist.add($client)

}

$clientlist.add($newclient)

$Body=@{}

$Body.add("clients",$clientlist)

 

#replace clients

$modnfsurl=$baseNFSurl+$exportid+"/?zone="+$zone

Invoke-RestMethod -uri $modnfsurl -Method "PUT" -Headers $headers -body ($Body|convertto-json)

No Events found!

Top