Documentation
¶
Overview ¶
Package fieldcontracts owns resource field policies shared by planning, request mapping and declarative export. It does not depend on those stages.
Index ¶
- Constants
- func CompareAPIFields(desired kkComps.CreateAPIRequest, current kkComps.APIResponseSchema) map[string]FieldChange
- func CompareAuthStrategyConfigs(desired kkComps.CreateAppAuthStrategyRequest, current map[string]any) (old, updated map[string]any)
- func CompareControlPlaneFields(desired kkComps.CreateControlPlaneRequest, current kkComps.ControlPlane) map[string]FieldChange
- func ComparePortalFields(desired kkComps.CreatePortal, current kkComps.ListPortalsResponsePortal) map[string]FieldChange
- func DCRConfigChanged(providerType string, current, desired map[string]any) bool
- func ExportAPIFields(current kkComps.APIResponseSchema, target *kkComps.CreateAPIRequest)
- func ExportControlPlaneFields(current kkComps.ControlPlane, target *kkComps.CreateControlPlaneRequest)
- func ExportPortalFields(current kkComps.ListPortalsResponsePortal, target *kkComps.CreatePortal)
- func ExportPortalResponseFields(current kkComps.PortalResponse, target *kkComps.CreatePortal)
- func ExtractAPIFields(desired kkComps.CreateAPIRequest, fields map[string]any)
- func ExtractAuthStrategyConfigs(desired kkComps.CreateAppAuthStrategyRequest) map[string]any
- func ExtractControlPlaneFields(desired kkComps.CreateControlPlaneRequest, fields map[string]any)
- func ExtractPortalFields(desired kkComps.CreatePortal, fields map[string]any)
- func MapAPICreateFields(fields map[string]any, target *kkComps.CreateAPIRequest)
- func MapAPIUpdateFields(fields map[string]any, target *kkComps.UpdateAPIRequest)
- func MapAuthStrategyConfigUpdate(strategyType string, configs map[string]any) (*kkComps.Configs, error)
- func MapControlPlaneCreateFields(fields map[string]any, target *kkComps.CreateControlPlaneRequest) error
- func MapControlPlaneUpdateField(name string, value any, target *kkComps.UpdateControlPlaneRequest) error
- func MapDCRConfigUpdate(providerType string, raw any) (*kkComps.DcrConfig, error)
- func MapKeyAuthConfigCreate(raw any) (kkComps.AppAuthStrategyConfigKeyAuth, error)
- func MapOIDCConfigCreate(raw any) (kkComps.AppAuthStrategyConfigOpenIDConnect, error)
- func MapPortalCreateFields(fields map[string]any, target *kkComps.CreatePortal)
- func MapPortalUpdateField(name string, value any, target *kkComps.UpdatePortal) bool
- func ValidateDCRConfig(providerType string, config map[string]any) error
- type FieldChange
Constants ¶
const ( FieldVersion = "version" FieldSlug = "slug" FieldAttributes = "attributes" )
Planner constants retain compatibility aliases for these contract identifiers.
const ( FieldAuthType = "auth_type" FieldClusterType = "cluster_type" FieldCloudGateway = "cloud_gateway" FieldProxyURLs = "proxy_urls" )
Planner identifiers retain compatibility aliases for these field contracts.
const ( FieldAuthenticationEnabled = "authentication_enabled" FieldRBACEnabled = "rbac_enabled" FieldSIPREnabled = "sipr_enabled" FieldAutoApproveDevelopers = "auto_approve_developers" FieldAutoApproveApplications = "auto_approve_applications" )
Planner constants retain compatibility aliases for these contract identifiers.
const ( FieldDisplayName = "display_name" FieldDescription = "description" FieldDefaultAPIVisibility = "default_api_visibility" FieldDefaultPageVisibility = "default_page_visibility" )
Planner constants retain compatibility aliases for these contract identifiers.
Variables ¶
This section is empty.
Functions ¶
func CompareAPIFields ¶
func CompareAPIFields(desired kkComps.CreateAPIRequest, current kkComps.APIResponseSchema) map[string]FieldChange
CompareAPIFields compares only declared fields; attributes retain their request representation in diagnostics rather than comparison canonicalization.
func CompareAuthStrategyConfigs ¶
func CompareAuthStrategyConfigs( desired kkComps.CreateAppAuthStrategyRequest, current map[string]any, ) (old, updated map[string]any)
CompareAuthStrategyConfigs returns only changed config fields in the existing nested diagnostic shape. Nil results mean no change; list order matters.
func CompareControlPlaneFields ¶
func CompareControlPlaneFields( desired kkComps.CreateControlPlaneRequest, current kkComps.ControlPlane, ) map[string]FieldChange
CompareControlPlaneFields compares only mutable declared fields. URL order matters; nil and empty observed lists compare equally to a declared empty list.
func ComparePortalFields ¶
func ComparePortalFields( desired kkComps.CreatePortal, current kkComps.ListPortalsResponsePortal, ) map[string]FieldChange
ComparePortalFields compares only declared ordinary fields against list state. Unknown boolean observations remain nil in diagnostics.
func DCRConfigChanged ¶
DCRConfigChanged compares only declared observable fields. Secrets are selected by the existing write-only intent path, never by observed value comparison.
func ExportAPIFields ¶
func ExportAPIFields(current kkComps.APIResponseSchema, target *kkComps.CreateAPIRequest)
ExportAPIFields preserves observed text presence and raw nonempty attributes. Export does not apply request normalization or comparison canonicalization.
func ExportControlPlaneFields ¶
func ExportControlPlaneFields(current kkComps.ControlPlane, target *kkComps.CreateControlPlaneRequest)
ExportControlPlaneFields omits blank descriptions, empty enums/URLs and false cloud_gateway. Nonblank descriptions retain their original whitespace.
func ExportPortalFields ¶
func ExportPortalFields(current kkComps.ListPortalsResponsePortal, target *kkComps.CreatePortal)
ExportPortalFields projects ordinary fields from a Portal list response.
func ExportPortalResponseFields ¶
func ExportPortalResponseFields(current kkComps.PortalResponse, target *kkComps.CreatePortal)
ExportPortalResponseFields projects the same fields from a detail response.
func ExtractAPIFields ¶
func ExtractAPIFields(desired kkComps.CreateAPIRequest, fields map[string]any)
ExtractAPIFields projects optional fields, leaving identity and labels to callers.
func ExtractAuthStrategyConfigs ¶
func ExtractAuthStrategyConfigs(desired kkComps.CreateAppAuthStrategyRequest) map[string]any
ExtractAuthStrategyConfigs preserves declaration presence and the nested plan shape. Identity, labels, strategy type and DCR references belong to callers.
func ExtractControlPlaneFields ¶
func ExtractControlPlaneFields(desired kkComps.CreateControlPlaneRequest, fields map[string]any)
ExtractControlPlaneFields leaves identity, labels and membership to callers.
func ExtractPortalFields ¶
func ExtractPortalFields(desired kkComps.CreatePortal, fields map[string]any)
ExtractPortalFields projects the nine ordinary optional fields. Identity, labels, references and secrets remain the caller's responsibility.
func MapAPICreateFields ¶
func MapAPICreateFields(fields map[string]any, target *kkComps.CreateAPIRequest)
MapAPICreateFields ignores absent or wrong-typed text fields. Attributes normalize when supported and otherwise retain the supplied value, including nil.
func MapAPIUpdateFields ¶
func MapAPIUpdateFields(fields map[string]any, target *kkComps.UpdateAPIRequest)
MapAPIUpdateFields maps only supplied changes, preserving PATCH sparsity.
func MapAuthStrategyConfigUpdate ¶
func MapAuthStrategyConfigUpdate(strategyType string, configs map[string]any) (*kkComps.Configs, error)
MapAuthStrategyConfigUpdate constructs the exact partial SDK union, without applying create defaults or broadening the accepted saved-plan shapes.
func MapControlPlaneCreateFields ¶
func MapControlPlaneCreateFields(fields map[string]any, target *kkComps.CreateControlPlaneRequest) error
MapControlPlaneCreateFields preserves conversion order and leaves absent or nil proxy URLs untouched. The caller maps labels only after this succeeds.
func MapControlPlaneUpdateField ¶
func MapControlPlaneUpdateField(name string, value any, target *kkComps.UpdateControlPlaneRequest) error
MapControlPlaneUpdateField keeps the caller's iteration and error timing. Unknown and create-only fields are ignored; explicit nil URLs clear the slice.
func MapDCRConfigUpdate ¶
MapDCRConfigUpdate preserves type filtering, PATCH sparsity, union selection and the existing object-before-provider error precedence for saved plans.
func MapKeyAuthConfigCreate ¶
func MapKeyAuthConfigCreate(raw any) (kkComps.AppAuthStrategyConfigKeyAuth, error)
MapKeyAuthConfigCreate retains the saved-plan config shape checks and errors.
func MapOIDCConfigCreate ¶
func MapOIDCConfigCreate(raw any) (kkComps.AppAuthStrategyConfigOpenIDConnect, error)
MapOIDCConfigCreate retains issuer validation and the create-only claim fallback.
func MapPortalCreateFields ¶
func MapPortalCreateFields(fields map[string]any, target *kkComps.CreatePortal)
MapPortalCreateFields leaves absent and wrong-typed fields untouched.
func MapPortalUpdateField ¶
func MapPortalUpdateField(name string, value any, target *kkComps.UpdatePortal) bool
MapPortalUpdateField handles one ordinary field, preserving caller iteration and error timing. Wrong-typed values are recognized but ignored.
Types ¶
type FieldChange ¶ added in v1.22.0
FieldChange carries normalized observed and declared diagnostic values.