fieldcontracts

package
v1.28.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	FieldVersion    = "version"
	FieldSlug       = "slug"
	FieldAttributes = "attributes"
)

Planner constants retain compatibility aliases for these contract identifiers.

View Source
const (
	FieldAuthType     = "auth_type"
	FieldClusterType  = "cluster_type"
	FieldCloudGateway = "cloud_gateway"
	FieldProxyURLs    = "proxy_urls"
)

Planner identifiers retain compatibility aliases for these field contracts.

View Source
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.

View Source
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

func DCRConfigChanged(providerType string, current, desired map[string]any) bool

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

func MapDCRConfigUpdate(providerType string, raw any) (*kkComps.DcrConfig, error)

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.

func ValidateDCRConfig

func ValidateDCRConfig(providerType string, config map[string]any) error

ValidateDCRConfig checks declared boolean values in deterministic field order. Unknown providers and other fields retain their existing validation elsewhere.

Types

type FieldChange added in v1.22.0

type FieldChange struct {
	Old any
	New any
}

FieldChange carries normalized observed and declared diagnostic values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL