Tags: gemini-oss/rego
Tags
Merge pull request #15 from gemini-oss/anthony-dardano New LenelS2 integration; Update {`SnipeIT`, `AD`, `Generics`} & more...
Feature Release: `2025.02.12` (#10) * Add `context` to HTTP requests * {Okta} Marshal Custom Attributes; Organize methods * {Google} Update `BuildURL`; {SnipeIT} Update URLs * {SnipeIT} Begin entities refactor to handle dynamic JSON typing for other methods; {Jamf} Add `History` related entities * {Google} Begin attempts to flatten embedded structs to a sheet * `{Starstruct}`: `The Flattening` ⏥ Refactor & more... {Google} - Enhance `GenerateValueRange()` to automatically generate headers if none are provided, leveraging the new StarStruct flattening logic {Okta} - Implemented `Functional Options` patterns to `NewClient()` with the help of a new `clientConfig` to customize org name, base URL, and API token to make switching between production and sandbox easier - Introduce `Attribute`, `Attributes`, and `AttributesList` types with dynamic validation and custom serialization for user attributes - Add `UserDevice`, `UserDevices`, `GetUserDevices()` to list a user's devices {SnipeIT} - Minor formatting adjustment in `StatusLabel` entity {StarStruct} - Introduce `Functional Options` pattern for `FlattenStructFields()`: `WithSort()`, `WithGenerate()`, `WithHeaders()` - Support deep flattening of nested structs, maps, pointers, and interfaces via new helpers - Provide finer control over generated field names (e.g. allowing dynamic header generation vs. custom headers) {go.[mod|sum]} _Update dependencies_ * {Starstruct} WIP [Temp]: Better handle embedded struct flattening * `The Flattening` ⏥ (v2) WIP (cont.) {StarStruct} - Overhaul flattening logic for arrays, maps, and pointers, merging field sets from multiple slice elements. - Introduce advanced field merging and key-joining functions (mergeFields, joinPrefixKey) for more consistent flattening output - Change `FlattenStructFields` to use an Option-based approach (`WithGenerate()`, `WithHeaders()`) rather than a `*[]string` parameter. - Add `ExcludeNil` to `pkgConfig` and with a `WithExcludeNil()` option to skip nil pointer expansions. {Google Sheets} - Leverage the new StarStruct approach in `GenerateValueRange()` to optionally auto-generate headers or respect existing ones {Okta} - Convert `UserProfile` to use `json:",inline" for `CustomAttributes`, removing a separate JSON key {SnipeIT} - Introduced a new `generics` package (`pkg/common/generics) enabling type-safe generic unmarshalling. - Add a generic `UnmarshalJSON` method for `Hardware[M], delegating to `generics.UnmarshalGeneric[Hardware[M], M]`. * `The Flattening` ⏥ (v3) WIP (cont.) {Generics} - Enhance `UnmarshalGeneric[T,M]` to automatically detect which field should hold leftover JSON keys based on the inline generic type `M`. - Return an error if multiple generic fields or unconsumed keys remain. - Support unmarshal for json:",inline" fields in the struct T. {StarStruct} - Refine non-generated flattening to fill missing headers with empty-string entries. - Introduce `MergeFields` as a public function, consolidating logic for combining field sets from multiple slice elements or leftover keys. - Expand pointer dereferencing and inline logic, ensuring leftover map keys get assigned consistently. {Google Sheets} - Use `MergeFields` to unify discovered headers with user-provided ones, preserving row alignment. - Collect flattened rows into a map, then build consistent final rows with any missing columns replaced by `""`. {Okta} - Reorder and tidy the `User` struct fields - Simplify `UserProfileBase` by rearranging fields. - Adjust `UserProfile` unmarshal logic to reflect updated field sets and keys. * `{Google}` Fix paginated responses for newer Go versions {Makefile} Add a new diff target to save the current git diff to `rego.diff`. {Requests} - Replace raw string checks with constants (`JSON`, `Plain`) for content types. - In `parseJSONError()`, append any raw JSON message to the final `reqError.Message`. {StarStruct} - Introduce `IncludeZero` in `pkgConfig` for selectively including zero-values in flattening or map conversions. - Refine documentation and helper functions for flattening logic (e.g., sorting map keys, consistent indexing of slices). {Google} - Transition from `interface{}` to Go 1.18+ alias `any` for general requests and queries. - Implement a typed pagination pattern via `GoogleAPIResponse[T]` and `GoogleQuery`, allowing `doPaginated()` to strongly type appended results. - Provide a `SetPageToken()` method in various query structs (e.g., `UserQuery`, `DeviceQuery`, `PolicyQuery`) for consistent pagination handling. - In OU cloning, skip user/device policy cloning if no direct (non-inherited) policies are found. {SnipeIT} - Add `GetAssetByTag()` to fetch hardware assets by their asset tag, with 5-minute result caching. (No dependency updates.) * `{Okta}` Implement `AddUserToGroup()` * `go mod tidy` * {Hugo} Fix `bad substitution`; Introducing Pretty Print Logs 💅 for Shell! 🐚 * Disable Google Analytics * Ensure Git sub-modules are updated
`{Google,Okta}` User Operations: {Requests} - Update `ToMap()` default parameter from `true` to `false`. - Add handling for `http.StatusNoContent` {Google} - Add `Map()` method in Users struct to convert a slice of users to a map with `PrimaryEmail` as the key. - Implement `UpdateUser()` {Okta} - Add `GetUserApplications()`, `ConvertApplicationAssignment()`, `RemoveApplicationAssignment()` for application related workloads - Add `Map()` to Users struct to convert a slice of users to a map with `Profile.Login` as the key. - Implement custom unmarshaller for UserProfile to handle known and custom attributes. - Define `Factor` structs and `FactorTypes` with various authentication factor types supported by Okta. - Add `RemoveUserFromGroup()` to unassign a user from a group. - Modify cache handling logic to respect the cache enable flag. - Introduce `FactorsClient` for user factor operations and added methods to list all enrolled factors, enroll a new factor, list supported factors, and reset all factors for a user. - Add `DeactivateUser()`, `RevokeUserSessions()`
{Orchestrators} Fix `ADReportToGoogleSheet()` successful log line
{All Clients} URL Builders now accept variadic interface; {Slack,Snip… …e-IT} Add missing BodyType to HTTP client
{SnipeIT} Add asset endpoints; `make pretty`
{SnipeIT} Add `GetAssetBySerial()` method
{Backupify} Add Snapshot Date to downloaded filenames
PreviousNext