feat!(certificates): expose full /certificates/search filter surface on Get/Search-InfisicalCertificate #6
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Get-InfisicalCertificate and Search-InfisicalCertificate now expose every filter accepted by POST /api/v1/projects/{projectId}/certificates/search: ADDED parameters (both cmdlets) - -Search free-text search across SAN/CN/cert id/serial - -ProfileId profile id array filter (Get- only previously missing) - -ApplicationId single application id (new on both) - -ApplicationIds application id array (renamed from old -ApplicationId) - -EnrollmentType api|est|acme|scep filter - -ExtendedKeyUsage e.g. codeSigning, serverAuth - -KeyAlgorithm e.g. RSA_2048, EC_prime256v1 (string[]) - -SignatureAlgorithm e.g. RSA-SHA256, ECDSA-SHA256 - -KeySize int[] key sizes in bits (e.g. 2048,4096) - -Source issued|discovered|imported - -FromDate / -ToDate created-at window - -NotAfterFrom/-NotAfterTo/-NotBeforeFrom/-NotBeforeTo - -Metadata <Hashtable> serialized as [{key,value}] entries - -ForPkiSync switch -> forPkiSync=true - -SortBy ValidateSet: notAfter, notBefore, createdAt, commonName, keyAlgorithm, status - -SortOrder ValidateSet: asc, desc INTERNAL - InfisicalCertificateSearchQuery gains ApplicationId, KeySizes, Metadata. - InfisicalCertificateSearchRequestDto gains applicationId, keySizes, metadata (new InfisicalCertificateSearchMetadataEntryDto with key/value). - BuildSearchRequest maps the new fields; BuildMetadataEntries converts Dictionary<string,string> into the API's [{key,value}] array shape. BREAKING - Search-InfisicalCertificate's -ApplicationId changed from string[] to string. Callers passing an array must switch to -ApplicationIds. TESTS - PkiEndpointRegistryTests.GetInfisicalCertificate_Cmdlet_Exposes_List_Filter_Properties extended to assert all 27 List-set parameters are present. - 216/216 tests passing.Get-InfisicalCertificatePolicy was throwing JsonSerializationException on every list/get call: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'PSInfisicalAPI.Pki.InfisicalCertificatePolicySubjectDto' because the type requires a JSON object ... Path 'certificatePolicies[0].subject', line 1, position 207. The API returns `subject` as an array of {type, allowed} entries (one per DN component: CN, O, OU, C, ...), in the same shape as `sans`. The DTO modeled it as a single object, so deserialization failed before any data ever reached the caller. CHANGES - InfisicalCertificatePolicy.Subject is now InfisicalCertificatePolicySubject[] (was a single InfisicalCertificatePolicySubject). - DTO field switched from typed InfisicalCertificatePolicySubjectDto to JToken SubjectRaw so we tolerate both array (current API) and object (defensive fallback) shapes -- same pattern as SansRaw. - Mapper gains MapSubjects(JToken) / MapSubjectObject(JToken) mirroring MapSans / MapSanObject. BREAKING - The Subject property type changed from a single object to an array. Existing consumers writing `$policy.Subject.Allowed` must update to `$policy.Subject[0].Allowed` or iterate `$policy.Subject`. In practice no caller was reachable because the cmdlet threw before returning. TESTS - 216/216 tests passing.86968c18cb93dc63d91382f99ea7d4