Skip to content

Commit

Permalink
Add get-fogversion #10 - Updated dynamic params to be contextual to t…
Browse files Browse the repository at this point in the history
…he version
  • Loading branch information
darksidemilk committed Aug 18, 2024
1 parent 0d249b2 commit 7e23f85
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
36 changes: 25 additions & 11 deletions FogApi/Private/Get-DynmicParam.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,31 @@ the position to put the dynamic parameter in

$attributeCollection.Add($attributes)

$coreObjects = @(
"clientupdater", "dircleaner", "greenfog", "group", "groupassociation",
"history", "hookevent", "host", "hostautologout", "hostscreensetting", "image",
"imageassociation", "imagepartitiontype", "imagetype", "imaginglog", "inventory", "ipxe",
"keysequence", "macaddressassociation", "module", "moduleassociation", "multicastsession",
"multicastsessionassociation", "nodefailure", "notifyevent", "os", "oui", "plugin",
"powermanagement", "printer", "printerassociation", "pxemenuoptions", "scheduledtask",
"service", "setting", "snapin", "snapinassociation", "snapingroupassociation", "snapinjob",
"snapintask", "storagegroup", "storagenode", "task", "tasklog", "taskstate", "tasktype",
"unisearch", "user", "usercleanup", "usertracking", "virus"
);
if ((Get-FogVersion) -like '1.6*') {
$coreObjects = @(
"group", "groupassociation", "history", "hookevent", "host", "hostautologout",
"hostscreensetting", "image", "imageassociation", "imagepartitiontype", "imagetype",
"imaginglog", "inventory", "ipxe", "keysequence", "macaddressassociation", "module",
"moduleassociation", "multicastsession", "multicastsessionassociation", "nodefailure",
"notifyevent", "os", "oui", "plugin", "powermanagement", "printer", "printerassociation",
"pxemenuoptions", "scheduledtask", "setting", "snapin", "snapinassociation",
"snapingroupassociation", "snapinjob", "snapintask", "storagegroup", "storagenode", "task",
"tasklog", "taskstate", "tasktype", "unisearch", "user", "usertracking", "setting", "user"
);
} else {
$coreObjects = @(
"clientupdater", "dircleaner", "greenfog", "group", "groupassociation",
"history", "hookevent", "host", "hostautologout", "hostscreensetting", "image",
"imageassociation", "imagepartitiontype", "imagetype", "imaginglog", "inventory", "ipxe",
"keysequence", "macaddressassociation", "module", "moduleassociation", "multicastsession",
"multicastsessionassociation", "nodefailure", "notifyevent", "os", "oui", "plugin",
"powermanagement", "printer", "printerassociation", "pxemenuoptions", "scheduledtask",
"service", "setting", "snapin", "snapinassociation", "snapingroupassociation", "snapinjob",
"snapintask", "storagegroup", "storagenode", "task", "tasklog", "taskstate", "tasktype",
"unisearch", "user", "usercleanup", "usertracking", "virus"
);
}

$coreTaskObjects = @("group", "host", "multicastsession", "scheduledtask", "snapinjob", "snapintask", "task");
$coreActiveTaskObjects = @("multicastsession", "powermanagement", "scheduledtask", "snapinjob", "snapintask", "task");
}
Expand Down
3 changes: 3 additions & 0 deletions FogApi/Public/Find-FogObject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ function Find-FogObject {
$paramDict | ForEach-Object { New-Variable -Name $_.Keys -Value $($_.Values.Value);}
# $paramDict;
Write-Verbose "Building uri and api call for $($paramDict.keys) $($paramDict.values.value)";
if (($null -eq $coreObject) -and (Get-FogVersion -like '1.6*')) {
$coreObject = "unisearch";
}
switch ($type) {
search {
if ($coreObject -ne "unisearch") {
Expand Down

0 comments on commit 7e23f85

Please sign in to comment.