feat(certificate-authority): declarative Weekly schedule variant (fixes #185 via SDK bump)#187
Open
spbsoluble wants to merge 4 commits into
Open
feat(certificate-authority): declarative Weekly schedule variant (fixes #185 via SDK bump)#187spbsoluble wants to merge 4 commits into
spbsoluble wants to merge 4 commits into
Conversation
SystemDayOfWeek.UnmarshalJSON now accepts a day-name string (e.g. "Monday") in addition to the original integer form. Command v25.5 sends a Weekly schedule's Days as day-name strings, which the previously-vendored SDK failed to deserialize at all, causing Read to fail outright on any CA with a live Weekly schedule (#185).
Extends full_scan/incremental_scan/threshold_check schedules with a third mutually-exclusive variant alongside the existing Interval and Daily representations: *_weekly_days (a list of exact, case-sensitive day names) and *_weekly_time (the same UTC "HH:MM:SS" format as *_daily_time). The two are co-required -- declaring one without the other is rejected at plan time -- and declaring any one of Interval/Daily/Weekly for a schedule implicitly clears the others. - pairedVariantModifier (attribute_contract.go) generalizes from a fixed sibling to a variadic list of sibling attribute names, so a variant made of more than one attribute (weekly's days+time) can list every OTHER variant's attribute(s) as its siblings without including its own co-attribute. - buildSchedule/scheduleToState now build and parse the Weekly wire shape (Days []SystemDayOfWeek, Time), sorting Days by enum value on read for stable, deterministic ordering. - validateCAScheduleAttributes enforces the three-way exclusivity, the weekly co-required pair, valid day names, and the weekly clear sentinel ([] + ""). - preserveCAUpdateFields, applyUndeclaredScheduleFallback, and keepScheduleSentinels extend to treat the weekly pair the same as the existing interval/daily attributes for preservation, read-modify- write fallback, and sentinel stability.
- TestUnitCAWeeklyScheduleDayNameStringsDeserialize: wire-level regression for #185 -- a GET response with Days as day-name strings (exactly as Command v25.5 sends) failed to even deserialize before the SDK bump; verified red against keyfactor-go-client-sdk v24.1.1 and green against v24.1.2-rc.0. - Round trip, sentinel clear/build, and mismatched-pair coverage for buildSchedule/scheduleToState. - Variant-switch coverage for all four Weekly<->Interval/Daily combinations, mirroring the existing Interval<->Daily regression test shape. - Framework-realistic Update() test for the weekly clear sentinel and a Read-path drift-over-sentinel test. - ValidateConfig coverage: co-required pair, invalid/lowercase day names, mismatched sentinel pair, three-way conflicts with Interval and Daily, and the valid weekly-alone/clear-sentinel cases. - Two generic attribute_contract_test.go cases proving pairedWith's three-way generalization (declaring the second-listed sibling in a group, not just the first, plans this attribute Null). Also update the existing preserveCAUpdateFields/allNull test fixtures to spell out the new weekly attributes as explicit Null (a Go zero-value types.List{}/types.String{} is a known non-null empty value, not Null, and would otherwise spuriously look "declared").
- Regenerate docs/resources/certificate_authority.md via `tfplugindocs generate` (run from a terraform-provider-keyfactor- named path, since the tool infers the provider name and page-title suffix from the working directory). - Add a commented weekly-schedule example to examples/resources/keyfactor_certificate_authority/resource.tf. - CHANGELOG: document the new *_weekly_days/*_weekly_time attributes and the #185 fix (keyfactor-go-client-sdk day-name deserialization).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #186 (which stacks on #184); merge those first — this diff is only the last four commits. Closes #185.
What
keyfactor_certificate_authority's three schedules (full_scan,incremental_scan,threshold_check) can now be managed declaratively as a Weekly schedule, alongside the existing interval and daily variants:Sunday–Saturday), validated at plan time; the time uses the same"HH:MM:SS"UTC format as the daily variant.weekly_days = []+weekly_time = ""is the declarative clear sentinel, consistent with the0/""sentinels for the other variants; the omit=unmanaged/GET-before-PUT preservation contract is unchanged, and switching variants nulls the old variant truthfully instead of resurrecting it.Fixes #185
Reading any CA whose schedule Command had stored as Weekly failed outright — Command (observed on v25.5) serializes
Weekly.Daysas day-name strings (["Monday"]) and the SDK only accepted integers, so every Read/Update of such a CA errored. This PR bumpskeyfactor-go-client-sdk/v24tov24.1.2-rc.0(Keyfactor/keyfactor-go-client-sdk#36), which accepts both wire forms. A wire-level regression test locks in the exact string-days payload; it was verified failing againstv24.1.1before the bump.The RC pin should be repinned to the GA tag once Keyfactor/keyfactor-go-client-sdk#36 merges, same as the go-client
v3.6.0repin already planned for this release.Verification
Live-lab lifecycle validation (plan→apply→import→drift→destroy, plus the out-of-band Weekly repro from #185) is the next step and will be reported on this PR.