-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function to use 'HEAD' for 'Certificates' call #12
Comments
This sounds like a simple change, but unfortunately it's not. It's easy enough to add 'Head' to the list of allowable values for 'Method', but as the module is based around Invoke-RestMethod, we don't get the headers. I'll need to update a bit of |
Yeah, I discovered it wasn't simple after just trying to add that verb to |
Sounds like you've done some of the work already. Don't hesitate to submit a pull request next time :) Looks like a Get method returns the count in the header as well as Head. Is there a performance impact in using Get for everything? |
I keep intending to submit a PR for the The docs say: GET Certificates only returns X.509 certificate values when there is an actual X.509 certificate in Secret Store for the certificate object. If you want the response to return just the total number of matches, use HEAD Certificates instead. |
Thanks for the info. I'll go with 'head' for the count. As for performing a PR, it's pretty easy and I can help along the way. Here's a good tutorial if you happen to use vscode as I do. |
Basics are here, https://github.com/gdbarron/VenafiPS/tree/get-cert-count. The parameter is |
Sorry, been really hectic last couple of days and only just able to look at this now. |
Okay, ran a quick test and in general things seem to be working. It's assembling the query and a simple HEAD call Method Head |
Nevermind, that was my typo! I used '/' instead of '' in the path I was feeding it. Once I changed it, this worked fine. |
in release v3.1.0 |
Think this has caused a bug. You can run this but when you add a common name filter. It throws an error. I am on my phone now but will add the error later. |
Summary of the new feature/enhancement
Currently the Certificates call is used in Find-Certificates which uses the GET method. Additionally available is the 'HEAD' method, which uses the same attributes and status filters as the GET method, but instead returns the number of certificates that matches the filtered criteria in the 'X-Record-Count' header.
This would be useful for situations that simply a count of certificates is needed, for example 'how many certificates were created after 'x' date' or 'how many certificates are currently in error'.
I have attempted to copy the Find-Certificates function into my script and alter it to use HEAD, but I get the error;
Cannot validate argument on parameter 'Method'. The argument "Head" does not belong to the set "Get,Post,Patch,Put,Delete" specified by the
ValidateSet attribute. Supply an argument that is in the set and then try the command again.
The text was updated successfully, but these errors were encountered: