itglue / powershellwrapper

This PowerShell module acts as a wrapper for the IT Glue API.
Apache License 2.0
120 stars 51 forks source link

Enhancement - filter configurations and passwords for archived entries #123

Closed RaavStormfang closed 1 year ago

RaavStormfang commented 3 years ago

recently the api updated to allow filtering configurations and passwords for archived entries. either for or against.

I've tested this out with great success on my side and used it to archive over 3000 stale RMM entries from automate, pulling only configurations that have the status of 'AUTOMATE_INACTIVE' and not archived already. its been great, and has allowed me to avoid several loops in a script, keeping it far cleaner than it otherwise would have been with pagination.

thess changes have been inserted into Configurations.ps1 under the get-itglueconfigurations function

    [Parameter(ParameterSetName = 'index')]
    [Parameter(ParameterSetName = 'index_rmm')]
    [Parameter(ParameterSetName = 'index_psa')]
    [Parameter(ParameterSetName = 'index_rmm_psa')]
    [Nullable[bool]]$filter_archived = $null,

and

    if ($filter_archived) {
        $body += @{'filter[archived]' = $filter_archived}
    }

Here are the changes for Passwords.ps1 under the get-itgluepasswords function

    [Parameter(ParameterSetName = 'index')]
    [Nullable[bool]]$filter_archived = $null,

and

    if ($filter_archived) {$body += @{'filter[archived]' = $filter_archived}
    }

I didn't see a great spot for them, so i just threw them under $filter_name everywhere.

everything seems to work alright. was wondering if I could create a branch for you to take a look at, or if you could implement this feature yourself

adrianwells commented 3 years ago

@jswartz8472 thank you for sharing. Yes, if you are willing to submit it that will be helpful.

RaavStormfang commented 3 years ago

pull request 126 created. made a fork

davidhaymond commented 1 year ago

This issue is resolved by PR #126 and should be closed.

adrianwells commented 1 year ago

Closing per @davidhaymond's comment. Thanks.