planner

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FieldID contains a resource ID
	FieldID = "id"

	// FieldName contains a resource name
	FieldName = "name"

	// FieldDescription contains a resource description
	FieldDescription = "description"

	// FieldCurrentLabels contains the current labels of a resource
	// Used during updates to determine which labels should be removed
	FieldCurrentLabels = "_current_labels"

	// FieldStrategyType contains the current strategy type for auth strategies
	// Used during updates since strategy type cannot be changed
	FieldStrategyType = "_strategy_type"

	// FieldDCRProviderUpdateType contains the current provider type for DCR providers
	// Used during updates since provider type cannot be changed and update config is a union type
	FieldDCRProviderUpdateType = "_provider_type"

	// FieldDCRProviderID contains the DCR provider reference or resolved ID for OIDC auth strategies
	FieldDCRProviderID = "dcr_provider_id"

	// FieldDCRProviderProviderType contains the DCR provider type
	FieldDCRProviderProviderType = "provider_type"

	// FieldDCRProviderIssuer contains the DCR provider issuer URL
	FieldDCRProviderIssuer = "issuer"

	// FieldDCRProviderConfig contains provider-specific DCR configuration
	FieldDCRProviderConfig = "dcr_config"

	// FieldDisplayName contains a resource display name
	FieldDisplayName = "display_name"

	// FieldLabels contains user-managed labels
	FieldLabels = "labels"

	// FieldPreservedLabels contains labels preserved during resource recreation
	FieldPreservedLabels = "preserved_labels"

	// FieldError contains validation errors that should be reported
	// Used when the planner detects an invalid operation
	FieldError = "_error"
)

Field names used for communication between planner and executor. Internal fields are prefixed with underscore to avoid confusion with resource fields.

View Source
const (
	FieldNamespace   = "namespace"
	FieldContent     = "content"
	FieldTitle       = "title"
	FieldStatus      = "status"
	FieldAttributes  = "attributes"
	FieldType        = "type"
	FieldConfig      = "config"
	FieldConfigs     = "configs"
	FieldEnabled     = "enabled"
	FieldVersion     = "version"
	FieldSpec        = "spec"
	FieldSlug        = "slug"
	FieldValue       = "value"
	FieldMetadata    = "metadata"
	FieldDataURL     = "data_url"
	FieldDeckBaseDir = "deck_base_dir"
	FieldFlags       = "flags"
	FieldFiles       = "files"
	FieldDefinition  = "definition"
)

Common plan field identifiers.

View Source
const (
	FieldAPI                          = "api"
	FieldAPIID                        = "api_id"
	FieldAuthStrategyIDs              = "auth_strategy_ids"
	FieldAuthStrategyType             = "strategy_type"
	FieldAuditLogDestinationID        = "audit_log_destination_id"
	FieldControlPlaneID               = "control_plane_id"
	FieldControlPlaneName             = "control_plane_name"
	FieldControlPlaneRef              = "control_plane_ref"
	FieldDefaultApplicationStrategyID = "default_application_auth_strategy_id"
	FieldDCRProvider                  = "dcr_provider"
	FieldEntityID                     = "entity_id"
	FieldEntityRegion                 = "entity_region"
	FieldEntityTypeName               = "entity_type_name"
	FieldEventGatewayID               = "event_gateway_id"
	FieldEventGatewayBackendClusterID = "event_gateway_backend_cluster_id"
	FieldEventGatewayListenerID       = "event_gateway_listener_id"
	FieldEventGatewayVirtualClusterID = "event_gateway_virtual_cluster_id"
	FieldGatewayServices              = "gateway_services"
	FieldParentDocumentID             = "parent_document_id"
	FieldParentPageID                 = "parent_page_id"
	FieldParentPath                   = "parent_path"
	FieldPortalID                     = "portal_id"
	FieldRoleName                     = "role_name"
	FieldService                      = "service"
	FieldSlugPath                     = "slug_path"
	FieldTeamID                       = "team_id"
	FieldUserID                       = "user_id"
	FieldSystemAccountID              = "system_account_id"
)

Common relationship and reference field identifiers.

View Source
const (
	FieldAuthenticationEnabled        = "authentication_enabled"
	FieldAllowedIPs                   = "allowed_ips"
	FieldAutoApproveApplications      = "auto_approve_applications"
	FieldAutoApproveDevelopers        = "auto_approve_developers"
	FieldAutoApproveRegistrations     = "auto_approve_registrations"
	FieldBasicAuthEnabled             = "basic_auth_enabled"
	FieldCanOwnApplications           = "can_own_applications"
	FieldCSS                          = "css"
	FieldConfigData                   = "config_data"
	FieldAuthReferrerPolicy           = "auth_referrer_policy"
	FieldCookiesWin                   = "cookies_win"
	FieldDataLayer                    = "data_layer"
	FieldDefaultAPIVisibility         = "default_api_visibility"
	FieldDefaultPageVisibility        = "default_page_visibility"
	FieldDomainName                   = "domain_name"
	FieldDebug                        = "debug"
	FieldEnvName                      = "env_name"
	FieldFromEmail                    = "from_email"
	FieldFromName                     = "from_name"
	FieldGoogleAnalytics4             = "google_analytics_4"
	FieldGoogleTagManager             = "google_tag_manager"
	FieldHostname                     = "hostname"
	FieldIDPMappingEnabled            = "idp_mapping_enabled"
	FieldKonnectMappingEnabled        = "konnect_mapping_enabled"
	FieldL                            = "l"
	FieldLayout                       = "layout"
	FieldLoginPath                    = "login_path"
	FieldMenu                         = "menu"
	FieldGroups                       = "groups"
	FieldNPA                          = "npa"
	FieldPreview                      = "preview"
	FieldReplyToEmail                 = "reply_to_email"
	FieldRBACEnabled                  = "rbac_enabled"
	FieldSSL                          = "ssl"
	FieldTheme                        = "theme"
	FieldVisibility                   = "visibility"
	FieldCustomFields                 = "custom_fields"
	FieldAuthenticationStrategyUpdate = "authentication_strategy_update"
)

Common portal plan field identifiers.

View Source
const (
	FieldACLMode                                    = "acl_mode"
	FieldAddresses                                  = "addresses"
	FieldAuthentication                             = "authentication"
	FieldAuthType                                   = "auth_type"
	FieldBootstrapServers                           = "bootstrap_servers"
	FieldCertificate                                = "certificate"
	FieldCert                                       = "cert"
	FieldCloudGateway                               = "cloud_gateway"
	FieldClusterType                                = "cluster_type"
	FieldDestination                                = "destination"
	FieldDNSLabel                                   = "dns_label"
	FieldInsecureAllowAnonymousVirtualClusterAuth   = "insecure_allow_anonymous_virtual_cluster_auth"
	FieldMembers                                    = "members"
	FieldMetadataUpdateIntervalSeconds              = "metadata_update_interval_seconds"
	FieldPorts                                      = "ports"
	FieldProxyURLs                                  = "proxy_urls"
	FieldTLS                                        = "tls"
	FieldDefaultVirtualClusterTarget                = "default_virtual_cluster_target"
	FieldGatewayControlPlaneMembershipControlPlanes = "control_planes"
)

Common gateway and event-gateway plan field identifiers.

View Source
const (
	ResourceTypePortal                           = string(resources.ResourceTypePortal)
	ResourceTypeApplicationAuthStrategy          = string(resources.ResourceTypeApplicationAuthStrategy)
	ResourceTypeDCRProvider                      = string(resources.ResourceTypeDCRProvider)
	ResourceTypeControlPlane                     = string(resources.ResourceTypeControlPlane)
	ResourceTypeAPI                              = string(resources.ResourceTypeAPI)
	ResourceTypeDashboard                        = string(resources.ResourceTypeDashboard)
	ResourceTypeAPIVersion                       = string(resources.ResourceTypeAPIVersion)
	ResourceTypeAPIPublication                   = string(resources.ResourceTypeAPIPublication)
	ResourceTypeAPIImplementation                = string(resources.ResourceTypeAPIImplementation)
	ResourceTypeAPIDocument                      = string(resources.ResourceTypeAPIDocument)
	ResourceTypeGatewayService                   = string(resources.ResourceTypeGatewayService)
	ResourceTypeControlPlaneDataPlaneCertificate = string(resources.ResourceTypeControlPlaneDataPlaneCertificate)
	ResourceTypeCatalogService                   = string(resources.ResourceTypeCatalogService)

	ResourceTypePortalCustomization        = string(resources.ResourceTypePortalCustomization)
	ResourceTypePortalCustomDomain         = string(resources.ResourceTypePortalCustomDomain)
	ResourceTypePortalAuthSettings         = string(resources.ResourceTypePortalAuthSettings)
	ResourceTypePortalIPAllowList          = string(resources.ResourceTypePortalIPAllowList)
	ResourceTypePortalIntegration          = string(resources.ResourceTypePortalIntegration)
	ResourceTypePortalIdentityProvider     = string(resources.ResourceTypePortalIdentityProvider)
	ResourceTypePortalTeamGroupMapping     = string(resources.ResourceTypePortalTeamGroupMapping)
	ResourceTypePortalPage                 = string(resources.ResourceTypePortalPage)
	ResourceTypePortalSnippet              = string(resources.ResourceTypePortalSnippet)
	ResourceTypePortalTeam                 = string(resources.ResourceTypePortalTeam)
	ResourceTypePortalTeamRole             = string(resources.ResourceTypePortalTeamRole)
	ResourceTypePortalAssetFavicon         = string(resources.ResourceTypePortalAssetFavicon)
	ResourceTypePortalEmailConfig          = string(resources.ResourceTypePortalEmailConfig)
	ResourceTypePortalEmailTemplate        = string(resources.ResourceTypePortalEmailTemplate)
	ResourceTypePortalAuditLogWebhook      = string(resources.ResourceTypePortalAuditLogWebhook)
	ResourceTypeAuditLogWebhookDestination = string(resources.ResourceTypeAuditLogWebhookDestination)

	ResourceTypeEventGatewayControlPlane                = string(resources.ResourceTypeEventGatewayControlPlane)
	ResourceTypeEventGatewayBackendCluster              = string(resources.ResourceTypeEventGatewayBackendCluster)
	ResourceTypeEventGatewayVirtualCluster              = string(resources.ResourceTypeEventGatewayVirtualCluster)
	ResourceTypeEventGatewayListener                    = string(resources.ResourceTypeEventGatewayListener)
	ResourceTypeEventGatewayListenerPolicy              = string(resources.ResourceTypeEventGatewayListenerPolicy)
	ResourceTypeEventGatewayDataPlaneCertificate        = string(resources.ResourceTypeEventGatewayDataPlaneCertificate)
	ResourceTypeEventGatewayClusterPolicy               = string(resources.ResourceTypeEventGatewayClusterPolicy)
	ResourceTypeEventGatewayProducePolicy               = string(resources.ResourceTypeEventGatewayProducePolicy)
	ResourceTypeEventGatewayConsumePolicy               = string(resources.ResourceTypeEventGatewayConsumePolicy)
	ResourceTypeEventGatewaySchemaRegistry              = string(resources.ResourceTypeEventGatewaySchemaRegistry)
	ResourceTypeEventGatewayStaticKey                   = string(resources.ResourceTypeEventGatewayStaticKey)
	ResourceTypeEventGatewayTLSTrustBundle              = string(resources.ResourceTypeEventGatewayTLSTrustBundle)
	ResourceTypeOrganizationTeam                        = string(resources.ResourceTypeOrganizationTeam)
	ResourceTypeOrganizationTeamRole                    = string(resources.ResourceTypeOrganizationTeamRole)
	ResourceTypeOrganizationUserTeamMembership          = string(resources.ResourceTypeOrganizationUserTeamMembership)
	ResourceTypeOrganizationUserRole                    = string(resources.ResourceTypeOrganizationUserRole)
	ResourceTypeOrganizationSystemAccountTeamMembership = string(
		resources.ResourceTypeOrganizationSystemAccountTeamMembership)
	ResourceTypeOrganizationSystemAccountRole = string(resources.ResourceTypeOrganizationSystemAccountRole)

	// ResourceTypeDeck represents an internal deck execution step.
	ResourceTypeDeck = "_deck"
)

Resource type constants are aliases for the canonical resource identifiers in the resources package. Keep these only for planner/executor compatibility.

View Source
const (
	// DefaultNamespace is the default namespace when none is specified
	DefaultNamespace = "default"
)

Default values

Variables

View Source
var NoRequiredFields = []string{}

NoRequiredFields is an explicitly empty slice for operations that don't require field validation

Functions

func ExtractFields

func ExtractFields(resource any, fieldMapping func(any) map[string]any) map[string]any

ExtractFields is a helper to create field extractors for resources with SDK types

func LabelsEqual

func LabelsEqual(current, desired map[string]string) bool

LabelsEqual compares two label maps for equality

func LabelsEqualPtr

func LabelsEqualPtr(current map[string]*string, desired map[string]string) bool

LabelsEqualPtr compares two label maps with pointer values

Types

type APIPlanner

type APIPlanner interface {
	ResourcePlanner
}

APIPlanner handles planning for API resources and their child resources

func NewAPIPlanner

func NewAPIPlanner(base *BasePlanner) APIPlanner

NewAPIPlanner creates a new API planner

type ActionType

type ActionType string

ActionType represents the type of change

const (
	ActionCreate       ActionType = "CREATE"
	ActionUpdate       ActionType = "UPDATE"
	ActionDelete       ActionType = "DELETE"
	ActionExternalTool ActionType = "EXTERNAL_TOOL"
)

type AuthStrategyPlanner

type AuthStrategyPlanner interface {
	ResourcePlanner
}

AuthStrategyPlanner handles planning for auth strategy resources

func NewAuthStrategyPlanner

func NewAuthStrategyPlanner(base *BasePlanner) AuthStrategyPlanner

NewAuthStrategyPlanner creates a new auth strategy planner

type BasePlanner

type BasePlanner struct {
	// contains filtered or unexported fields
}

BasePlanner provides common functionality for all resource planners

func NewBasePlanner

func NewBasePlanner(p *Planner) *BasePlanner

NewBasePlanner creates a new base planner instance

func (*BasePlanner) GetClient

func (b *BasePlanner) GetClient() *state.Client

GetClient returns the state client

func (*BasePlanner) GetDesiredAPIDocuments

func (b *BasePlanner) GetDesiredAPIDocuments(namespace string) []resources.APIDocumentResource

GetDesiredAPIDocuments returns desired API document resources from the specified namespace

func (*BasePlanner) GetDesiredAPIImplementations

func (b *BasePlanner) GetDesiredAPIImplementations(namespace string) []resources.APIImplementationResource

GetDesiredAPIImplementations returns desired API implementation resources from the specified namespace

func (*BasePlanner) GetDesiredAPIPublications

func (b *BasePlanner) GetDesiredAPIPublications(namespace string) []resources.APIPublicationResource

GetDesiredAPIPublications returns desired API publication resources from the specified namespace

func (*BasePlanner) GetDesiredAPIVersions

func (b *BasePlanner) GetDesiredAPIVersions(namespace string) []resources.APIVersionResource

GetDesiredAPIVersions returns desired API version resources from the specified namespace

func (*BasePlanner) GetDesiredAPIs

func (b *BasePlanner) GetDesiredAPIs(namespace string) []resources.APIResource

GetDesiredAPIs returns desired API resources from the specified namespace

func (*BasePlanner) GetDesiredAuthStrategies

func (b *BasePlanner) GetDesiredAuthStrategies(namespace string) []resources.ApplicationAuthStrategyResource

GetDesiredAuthStrategies returns desired auth strategy resources from the specified namespace

func (*BasePlanner) GetDesiredCatalogServices added in v0.3.6

func (b *BasePlanner) GetDesiredCatalogServices(namespace string) []resources.CatalogServiceResource

GetDesiredCatalogServices returns desired catalog service resources from the specified namespace

func (*BasePlanner) GetDesiredControlPlanes added in v0.1.6

func (b *BasePlanner) GetDesiredControlPlanes(namespace string) []resources.ControlPlaneResource

GetDesiredControlPlanes returns desired control plane resources from the specified namespace

func (*BasePlanner) GetDesiredDCRProviders added in v0.8.0

func (b *BasePlanner) GetDesiredDCRProviders(namespace string) []resources.DCRProviderResource

GetDesiredDCRProviders returns desired DCR provider resources from the specified namespace

func (*BasePlanner) GetDesiredDashboards added in v1.0.0

func (b *BasePlanner) GetDesiredDashboards(namespace string) []resources.DashboardResource

GetDesiredDashboards returns desired dashboard resources from the specified namespace.

func (*BasePlanner) GetDesiredEventGatewayControlPlanes added in v0.3.7

func (b *BasePlanner) GetDesiredEventGatewayControlPlanes(
	namespace string,
) []resources.EventGatewayControlPlaneResource

GetDesiredEventGatewayControlPlanes returns desired EGW CP resources from the specified namespace

func (*BasePlanner) GetDesiredOrganizationSystemAccountRoles added in v1.0.0

func (b *BasePlanner) GetDesiredOrganizationSystemAccountRoles(
	namespace string,
) []resources.OrganizationSystemAccountRoleResource

GetDesiredOrganizationSystemAccountRoles returns desired organization system account roles.

func (*BasePlanner) GetDesiredOrganizationSystemAccountTeamMemberships added in v1.0.0

func (b *BasePlanner) GetDesiredOrganizationSystemAccountTeamMemberships(
	namespace string,
) []resources.OrganizationSystemAccountTeamMembershipResource

GetDesiredOrganizationSystemAccountTeamMemberships returns desired system account team memberships.

func (*BasePlanner) GetDesiredOrganizationTeamRoles added in v1.0.0

func (b *BasePlanner) GetDesiredOrganizationTeamRoles(namespace string) []resources.OrganizationTeamRoleResource

GetDesiredOrganizationTeamRoles returns desired organization_team_role resources from the specified namespace.

func (*BasePlanner) GetDesiredOrganizationTeams added in v0.4.0

func (b *BasePlanner) GetDesiredOrganizationTeams(namespace string) []resources.OrganizationTeamResource

GetDesiredOrganizationTeams returns desired organization_team resources from the specified namespace

func (*BasePlanner) GetDesiredOrganizationUserRoles added in v1.0.0

func (b *BasePlanner) GetDesiredOrganizationUserRoles(namespace string) []resources.OrganizationUserRoleResource

GetDesiredOrganizationUserRoles returns desired organization user roles from the specified namespace.

func (*BasePlanner) GetDesiredOrganizationUserTeamMemberships added in v1.0.0

func (b *BasePlanner) GetDesiredOrganizationUserTeamMemberships(
	namespace string,
) []resources.OrganizationUserTeamMembershipResource

GetDesiredOrganizationUserTeamMemberships returns desired user team memberships from the specified namespace.

func (*BasePlanner) GetDesiredPortalAuditLogWebhooks added in v0.10.0

func (b *BasePlanner) GetDesiredPortalAuditLogWebhooks(namespace string) []resources.PortalAuditLogWebhookResource

GetDesiredPortalAuditLogWebhooks returns desired portal audit-log webhook resources from the specified namespace

func (*BasePlanner) GetDesiredPortalAuthSettings added in v0.3.4

func (b *BasePlanner) GetDesiredPortalAuthSettings(namespace string) []resources.PortalAuthSettingsResource

GetDesiredPortalAuthSettings returns desired portal auth settings resources from the specified namespace

func (*BasePlanner) GetDesiredPortalCustomDomains

func (b *BasePlanner) GetDesiredPortalCustomDomains(namespace string) []resources.PortalCustomDomainResource

GetDesiredPortalCustomDomains returns desired portal custom domain resources from the specified namespace

func (*BasePlanner) GetDesiredPortalCustomizations

func (b *BasePlanner) GetDesiredPortalCustomizations(namespace string) []resources.PortalCustomizationResource

GetDesiredPortalCustomizations returns desired portal customization resources from the specified namespace

func (*BasePlanner) GetDesiredPortalEmailConfigs added in v0.3.5

func (b *BasePlanner) GetDesiredPortalEmailConfigs(namespace string) []resources.PortalEmailConfigResource

GetDesiredPortalEmailConfigs returns desired portal email config resources from the specified namespace

func (*BasePlanner) GetDesiredPortalIPAllowLists added in v0.10.0

func (b *BasePlanner) GetDesiredPortalIPAllowLists(namespace string) []resources.PortalIPAllowListResource

GetDesiredPortalIPAllowLists returns desired portal IP allow list resources from the specified namespace

func (*BasePlanner) GetDesiredPortalIdentityProviders added in v0.9.0

func (b *BasePlanner) GetDesiredPortalIdentityProviders(namespace string) []resources.PortalIdentityProviderResource

GetDesiredPortalIdentityProviders returns desired portal identity provider resources from the specified namespace

func (*BasePlanner) GetDesiredPortalIntegrations added in v0.10.0

func (b *BasePlanner) GetDesiredPortalIntegrations(namespace string) []resources.PortalIntegrationResource

GetDesiredPortalIntegrations returns desired portal integration resources from the specified namespace

func (*BasePlanner) GetDesiredPortalPages

func (b *BasePlanner) GetDesiredPortalPages(namespace string) []resources.PortalPageResource

GetDesiredPortalPages returns desired portal page resources from the specified namespace

func (*BasePlanner) GetDesiredPortalSnippets

func (b *BasePlanner) GetDesiredPortalSnippets(namespace string) []resources.PortalSnippetResource

GetDesiredPortalSnippets returns desired portal snippet resources from the specified namespace

func (*BasePlanner) GetDesiredPortals

func (b *BasePlanner) GetDesiredPortals(namespace string) []resources.PortalResource

GetDesiredPortals returns desired portal resources from the specified namespace

func (*BasePlanner) GetGenericPlanner

func (b *BasePlanner) GetGenericPlanner() *GenericPlanner

GetGenericPlanner returns the generic planner instance

func (*BasePlanner) GetString

func (b *BasePlanner) GetString(s *string) string

GetString safely dereferences a string pointer

func (*BasePlanner) NextChangeID

func (b *BasePlanner) NextChangeID(action ActionType, resourceType string, resourceRef string) string

NextChangeID generates a unique change ID

func (*BasePlanner) ValidateProtection

func (b *BasePlanner) ValidateProtection(resourceType, resourceName string, isProtected bool, action ActionType) error

ValidateProtection validates protection status for an operation

func (*BasePlanner) ValidateProtectionWithChange

func (b *BasePlanner) ValidateProtectionWithChange(
	resourceType, resourceName string,
	isProtected bool,
	action ActionType,
	protectionChange *ProtectionChange,
	hasOtherFieldChanges bool,
) error

ValidateProtectionWithChange validates protection status for an operation with protection change info

type CatalogServicePlanner added in v0.3.6

type CatalogServicePlanner interface {
	ResourcePlanner
}

CatalogServicePlanner handles planning for catalog service resources

func NewCatalogServicePlanner added in v0.3.6

func NewCatalogServicePlanner(base *BasePlanner) CatalogServicePlanner

NewCatalogServicePlanner creates a new catalog service planner.

type ComponentProvider added in v0.5.0

type ComponentProvider interface {
	PlannerComponent() string
}

ComponentProvider optionally exposes the workflow component name to use in HTTP logging. Implementations should return the canonical resource-style identifier (for example: "portal").

type Config added in v0.1.3

type Config struct {
	// Namespace specifies the target namespace for planning operations
	Namespace string
}

Config contains configuration data needed during planning operations. This replaces the anti-pattern of passing data through context.WithValue.

func NewConfig added in v0.1.3

func NewConfig(namespace string) *Config

NewConfig creates a new planner config with the specified namespace.

type ControlPlanePlanner added in v0.1.6

type ControlPlanePlanner interface {
	ResourcePlanner
}

ControlPlanePlanner handles planning for control plane resources

func NewControlPlanePlanner added in v0.1.6

func NewControlPlanePlanner(base *BasePlanner) ControlPlanePlanner

NewControlPlanePlanner creates a new control plane planner

type CreateConfig

type CreateConfig struct {
	ResourceType   string
	ResourceName   string
	ResourceRef    string
	RequiredFields []string
	FieldExtractor func(resource any) map[string]any
	Namespace      string
	DependsOn      []string
	References     map[string]ReferenceInfo
	Parent         *ParentInfo
}

CreateConfig defines configuration for generic create operations

type DCRProviderPlanner added in v0.8.0

type DCRProviderPlanner interface {
	ResourcePlanner
}

DCRProviderPlanner handles planning for DCR provider resources.

func NewDCRProviderPlanner added in v0.8.0

func NewDCRProviderPlanner(base *BasePlanner) DCRProviderPlanner

type DashboardPlanner added in v1.0.0

type DashboardPlanner interface {
	ResourcePlanner
}

DashboardPlanner handles planning for dashboard resources.

func NewDashboardPlanner added in v1.0.0

func NewDashboardPlanner(base *BasePlanner) DashboardPlanner

NewDashboardPlanner creates a new dashboard planner.

type DeckOptions added in v0.3.8

type DeckOptions struct {
	Runner             deck.Runner
	KonnectToken       string
	KonnectTokenSource deck.KonnectTokenSource
	KonnectAddress     string
}

DeckOptions provides configuration for deck-based planning.

type DeleteConfig

type DeleteConfig struct {
	ResourceType string
	ResourceName string
	ResourceRef  string
	ResourceID   string
	Namespace    string
}

DeleteConfig defines configuration for generic delete operations

type DependencyResolutionResult added in v1.0.0

type DependencyResolutionResult struct {
	// ExecutionOrder is a flat topological ordering of all change IDs (same semantics as ResolveDependencies).
	ExecutionOrder []string
	// ExecutionGroups groups change IDs by Kahn level; changes within a group are safe
	// to execute concurrently. Groups must be executed sequentially in order.
	ExecutionGroups [][]string
	// FullDepsMap maps each change ID to the complete set of direct dependency IDs,
	// including both explicit DependsOn entries and all implicit edges discovered during
	// graph construction. The planner uses this to persist implicit edges back to
	// PlannedChange.DependsOn so the plan is the single source of truth for ordering.
	FullDepsMap map[string][]string
}

DependencyResolutionResult holds the results of a full dependency resolution run.

type DependencyResolver

type DependencyResolver struct{}

DependencyResolver calculates execution order for plan changes

func NewDependencyResolver

func NewDependencyResolver() *DependencyResolver

NewDependencyResolver creates a new resolver

func (*DependencyResolver) ResolveDependencies

func (d *DependencyResolver) ResolveDependencies(changes []PlannedChange) ([]string, error)

ResolveDependencies builds dependency graph and calculates execution order

func (*DependencyResolver) ResolveDependenciesWithGroups added in v1.0.0

func (d *DependencyResolver) ResolveDependenciesWithGroups(
	changes []PlannedChange,
) (*DependencyResolutionResult, error)

ResolveDependenciesWithGroups builds the dependency graph, computes a flat topological execution order, and additionally computes Kahn-level concurrency groups. Changes within the same group are guaranteed to have no dependencies on each other and are safe to execute concurrently.

type EGWControlPlanePlanner added in v0.3.7

type EGWControlPlanePlanner interface {
	ResourcePlanner
}

EGWControlPlanePlanner handles planning for Event Gateway Control Plane resources

type EGWControlPlanePlannerImpl added in v0.3.7

type EGWControlPlanePlannerImpl struct {
	*BasePlanner
	// contains filtered or unexported fields
}

func NewEGWControlPlanePlanner added in v0.3.7

func NewEGWControlPlanePlanner(planner *BasePlanner, resources *resources.ResourceSet) *EGWControlPlanePlannerImpl

func (*EGWControlPlanePlannerImpl) GetDesiredEGWControlPlanes added in v0.3.7

func (p *EGWControlPlanePlannerImpl) GetDesiredEGWControlPlanes(
	namespace string,
) []resources.EventGatewayControlPlaneResource

func (*EGWControlPlanePlannerImpl) PlanChanges added in v0.3.7

func (p *EGWControlPlanePlannerImpl) PlanChanges(ctx context.Context, plannerCtx *Config, plan *Plan) error

func (*EGWControlPlanePlannerImpl) PlannerComponent added in v0.5.0

func (p *EGWControlPlanePlannerImpl) PlannerComponent() string

type ExternalToolDependency added in v0.3.8

type ExternalToolDependency struct {
	ControlPlaneRef  string                      `json:"control_plane_ref,omitempty"`
	ControlPlaneID   string                      `json:"control_plane_id,omitempty"`
	ControlPlaneName string                      `json:"control_plane_name,omitempty"`
	GatewayServices  []ExternalToolGatewayTarget `json:"gateway_services,omitempty"`
	Files            []string                    `json:"files,omitempty"`
	Flags            []string                    `json:"flags,omitempty"`
	DeckBaseDir      string                      `json:"deck_base_dir,omitempty"`
}

ExternalToolDependency captures external tool execution requirements for summary output.

type ExternalToolGatewayTarget added in v0.3.8

type ExternalToolGatewayTarget struct {
	Ref      string                `json:"ref"`
	Selector *ExternalToolSelector `json:"selector,omitempty"`
}

ExternalToolGatewayTarget represents a gateway service selector tied to a deck run.

type ExternalToolSelector added in v0.3.8

type ExternalToolSelector struct {
	MatchFields map[string]string `json:"matchFields"`
}

ExternalToolSelector represents selector match fields for external tool dependencies.

type FieldChange

type FieldChange struct {
	Old any `json:"old"`
	New any `json:"new"`
}

FieldChange represents a single field modification (for UPDATE)

type GenericPlanner

type GenericPlanner struct {
	// contains filtered or unexported fields
}

GenericPlanner provides common planning operations for all resource types

func NewGenericPlanner

func NewGenericPlanner(p *Planner) *GenericPlanner

NewGenericPlanner creates a new generic planner instance

func (*GenericPlanner) PlanCreate

func (g *GenericPlanner) PlanCreate(_ context.Context, config CreateConfig) (PlannedChange, error)

PlanCreate creates a planned change for resource creation

func (*GenericPlanner) PlanDelete

func (g *GenericPlanner) PlanDelete(_ context.Context, config DeleteConfig) PlannedChange

PlanDelete creates a planned change for resource deletion

func (*GenericPlanner) PlanProtectionChange

func (g *GenericPlanner) PlanProtectionChange(_ context.Context, config ProtectionChangeConfig) PlannedChange

PlanProtectionChange creates a planned change for protection status update

func (*GenericPlanner) PlanUpdate

func (g *GenericPlanner) PlanUpdate(_ context.Context, config UpdateConfig) (PlannedChange, error)

PlanUpdate creates a planned change for resource update

func (*GenericPlanner) ShouldUpdate

func (g *GenericPlanner) ShouldUpdate(config UpdateConfig) bool

ShouldUpdate determines if an update is needed by comparing current and desired state

type Options

type Options struct {
	Mode      PlanMode
	Generator string
	Deck      DeckOptions
}

Options configures plan generation behavior

type OrganizationTeamPlanner added in v0.4.0

type OrganizationTeamPlanner interface {
	ResourcePlanner
}

TeamPlanner handles planning for team resources

func NewOrganizationTeamPlanner added in v0.4.0

func NewOrganizationTeamPlanner(base *BasePlanner) OrganizationTeamPlanner

NewOrganizationTeamPlanner creates a new organization team planner

type OrganizationTeamPlannerImpl added in v0.4.0

type OrganizationTeamPlannerImpl struct {
	*BasePlanner
}

OrganizationTeamPlannerImpl implements planning logic for organization teams

func (*OrganizationTeamPlannerImpl) PlanChanges added in v0.4.0

func (t *OrganizationTeamPlannerImpl) PlanChanges(ctx context.Context, plannerCtx *Config, plan *Plan) error

PlanChanges generates changes for organization_team resources

func (*OrganizationTeamPlannerImpl) PlannerComponent added in v0.5.0

func (t *OrganizationTeamPlannerImpl) PlannerComponent() string

type ParentInfo

type ParentInfo struct {
	Ref string `json:"ref"`
	ID  string `json:"id"` // May be "[unknown]" for parents in same plan
}

ParentInfo tracks parent relationships

type Plan

type Plan struct {
	Metadata PlanMetadata    `json:"metadata"`
	Changes  []PlannedChange `json:"changes"`
	// Legacy execution order for sequential plans; ignored if ExecutionGroups is set
	ExecutionOrder []string `json:"execution_order"`
	// ExecutionGroups is an ordered list of concurrency groups.
	// Changes within a group are safe to execute concurrently; group N+1 must
	// not start until group N is fully complete. Plans without this field
	// (legacy plans or plans with no changes) execute sequentially via ExecutionOrder.
	ExecutionGroups [][]string    `json:"execution_groups,omitempty"`
	Summary         PlanSummary   `json:"summary"`
	Warnings        []PlanWarning `json:"warnings,omitempty"`
}

Plan represents a declarative configuration plan

func NewPlan

func NewPlan(version, generator string, mode PlanMode) *Plan

NewPlan creates a new plan with metadata

func (*Plan) AddChange

func (p *Plan) AddChange(change PlannedChange)

AddChange adds a change to the plan

func (*Plan) AddWarning

func (p *Plan) AddWarning(changeID, message string)

AddWarning adds a warning to the plan

func (*Plan) ContainsDeletes

func (p *Plan) ContainsDeletes() bool

ContainsDeletes returns true if plan contains any DELETE operations

func (*Plan) HasChange added in v0.2.0

func (p *Plan) HasChange(resourceType, resourceRef string) bool

HasChange returns true if the plan already contains a change for the given resource type and ref.

func (*Plan) IsEmpty

func (p *Plan) IsEmpty() bool

IsEmpty returns true if plan has no changes

func (*Plan) SetExecutionGroups added in v1.0.0

func (p *Plan) SetExecutionGroups(groups [][]string)

SetExecutionGroups sets the concurrency groups computed during dependency resolution. Each group holds change IDs that are safe to run concurrently; groups must be executed one at a time in order.

func (*Plan) SetExecutionOrder

func (p *Plan) SetExecutionOrder(order []string)

SetExecutionOrder sets the calculated execution order

func (*Plan) UpdateSummary

func (p *Plan) UpdateSummary()

UpdateSummary recalculates plan statistics

type PlanMetadata

type PlanMetadata struct {
	Version     string         `json:"version"`
	GeneratedAt time.Time      `json:"generated_at"`
	Generator   string         `json:"generator"`
	Mode        PlanMode       `json:"mode"`
	SyncScope   *PlanSyncScope `json:"sync_scope,omitempty"`
}

PlanMetadata contains plan generation information

type PlanMode

type PlanMode string

PlanMode represents the mode of plan generation

const (
	PlanModeSync   PlanMode = "sync"
	PlanModeApply  PlanMode = "apply"
	PlanModeDelete PlanMode = "delete"
)

type PlanSummary

type PlanSummary struct {
	TotalChanges      int                                 `json:"total_changes"`
	ByAction          map[ActionType]int                  `json:"by_action"`
	ByResource        map[string]int                      `json:"by_resource"`
	ByExternalTools   map[string][]ExternalToolDependency `json:"by_external_tools,omitempty"`
	ProtectionChanges *ProtectionSummary                  `json:"protection_changes,omitempty"`
}

PlanSummary provides overview statistics

type PlanSyncChildScope added in v1.0.0

type PlanSyncChildScope struct {
	ParentType   string `json:"parent_type"`
	ParentRef    string `json:"parent_ref"`
	ResourceType string `json:"resource_type"`
}

PlanSyncChildScope identifies a child collection scoped under one parent.

type PlanSyncScope added in v1.0.0

type PlanSyncScope struct {
	RootResourceTypes          []string             `json:"root_resource_types,omitempty"`
	ChildResourceTypes         []PlanSyncChildScope `json:"child_resource_types,omitempty"`
	RootChildResourceTypes     []string             `json:"root_child_resource_types,omitempty"`
	OrganizationUsers          bool                 `json:"organization_users,omitempty"`
	OrganizationSystemAccounts bool                 `json:"organization_system_accounts,omitempty"`
}

PlanSyncScope records the explicit resource collections used for sync planning.

type PlanWarning

type PlanWarning struct {
	ChangeID string `json:"change_id"`
	Message  string `json:"message"`
}

PlanWarning represents a warning about the plan

type PlannedChange

type PlannedChange struct {
	ID           string `json:"id"`
	ResourceType string `json:"resource_type"`
	ResourceRef  string `json:"resource_ref"`
	ResourceID   string `json:"resource_id,omitempty"` // Only for UPDATE/DELETE
	// Human-readable identifiers for resources without config refs
	ResourceMonikers      map[string]string        `json:"resource_monikers,omitempty"`
	Action                ActionType               `json:"action"`
	Fields                map[string]any           `json:"fields"`
	ChangedFields         map[string]FieldChange   `json:"changed_fields,omitempty"`
	PostResolutionTargets []PostResolutionTarget   `json:"post_resolution_targets,omitempty"`
	References            map[string]ReferenceInfo `json:"references,omitempty"`
	Parent                *ParentInfo              `json:"parent,omitempty"`
	ProtectingParent      *ProtectingParentInfo    `json:"protecting_parent,omitempty"`
	Protection            any                      `json:"protection,omitempty"` // bool or ProtectionChange
	Namespace             string                   `json:"namespace"`
	DependsOn             []string                 `json:"depends_on,omitempty"`
}

PlannedChange represents a single resource change

type Planner

type Planner struct {
	// contains filtered or unexported fields
}

Planner generates execution plans

func NewPlanner

func NewPlanner(client *state.Client, logger *slog.Logger) *Planner

NewPlanner creates a new planner

func (*Planner) GeneratePlan

func (p *Planner) GeneratePlan(ctx context.Context, rs *resources.ResourceSet, opts Options) (*Plan, error)

GeneratePlan creates a plan from declarative configuration

func (*Planner) GetDesiredAPIs

func (p *Planner) GetDesiredAPIs() []resources.APIResource

GetDesiredAPIs returns all desired API resources (across all namespaces)

func (*Planner) GetDesiredPortalCustomDomains

func (p *Planner) GetDesiredPortalCustomDomains() []resources.PortalCustomDomainResource

GetDesiredPortalCustomDomains returns all desired portal custom domain resources (across all namespaces)

func (*Planner) GetDesiredPortalCustomizations

func (p *Planner) GetDesiredPortalCustomizations() []resources.PortalCustomizationResource

GetDesiredPortalCustomizations returns all desired portal customization resources (across all namespaces)

func (*Planner) GetDesiredPortalPages

func (p *Planner) GetDesiredPortalPages() []resources.PortalPageResource

GetDesiredPortalPages returns all desired portal page resources (across all namespaces)

func (*Planner) GetDesiredPortalSnippets

func (p *Planner) GetDesiredPortalSnippets() []resources.PortalSnippetResource

GetDesiredPortalSnippets returns all desired portal snippet resources (across all namespaces)

type PortalPlanner

type PortalPlanner interface {
	ResourcePlanner
}

PortalPlanner handles planning for portal resources

func NewPortalPlanner

func NewPortalPlanner(base *BasePlanner) PortalPlanner

NewPortalPlanner creates a new portal planner

type PostResolutionTarget added in v0.3.8

type PostResolutionTarget struct {
	ResourceType     string                `json:"resource_type"`
	ResourceRef      string                `json:"resource_ref"`
	ControlPlaneRef  string                `json:"control_plane_ref,omitempty"`
	ControlPlaneID   string                `json:"control_plane_id,omitempty"`
	ControlPlaneName string                `json:"control_plane_name,omitempty"`
	Selector         *ExternalToolSelector `json:"selector,omitempty"`
}

PostResolutionTarget represents a resource that must be resolved after a change executes.

type ProtectingParentInfo added in v0.8.0

type ProtectingParentInfo struct {
	ResourceType string `json:"resource_type,omitempty"`
	ResourceRef  string `json:"resource_ref,omitempty"`
	ResourceID   string `json:"resource_id,omitempty"`
	ResourceName string `json:"resource_name,omitempty"`
}

ProtectingParentInfo identifies the top-level managed resource whose protection applies to a child change.

type ProtectionChange

type ProtectionChange struct {
	Old bool `json:"old"`
	New bool `json:"new"`
}

ProtectionChange tracks protection status changes

type ProtectionChangeConfig

type ProtectionChangeConfig struct {
	ResourceType string
	ResourceName string
	ResourceRef  string
	ResourceID   string
	OldProtected bool
	NewProtected bool
	Namespace    string
}

ProtectionChangeConfig defines configuration for protection change operations

type ProtectionErrorCollector

type ProtectionErrorCollector struct {
	// contains filtered or unexported fields
}

CollectProtectionErrors collects protection validation errors for batch reporting

func (*ProtectionErrorCollector) Add

func (c *ProtectionErrorCollector) Add(err error)

Add adds a protection error to the collector

func (*ProtectionErrorCollector) Error

func (c *ProtectionErrorCollector) Error() error

Error returns a combined error message

func (*ProtectionErrorCollector) HasErrors

func (c *ProtectionErrorCollector) HasErrors() bool

HasErrors returns true if any errors were collected

type ProtectionSummary

type ProtectionSummary struct {
	Protecting   int `json:"protecting"`
	Unprotecting int `json:"unprotecting"`
}

ProtectionSummary tracks protection changes

type ReferenceInfo

type ReferenceInfo struct {
	// Existing fields for single references
	Ref          string            `json:"ref,omitempty"`
	ID           string            `json:"id,omitempty"`            // May be "[unknown]" for resources in same plan
	LookupFields map[string]string `json:"lookup_fields,omitempty"` // Resource-specific identifying fields

	// New fields for array references
	Refs         []string            `json:"refs,omitempty"`          // Array of reference strings
	ResolvedIDs  []string            `json:"resolved_ids,omitempty"`  // Array of resolved UUIDs
	LookupArrays map[string][]string `json:"lookup_arrays,omitempty"` // Array lookup fields
	IsArray      bool                `json:"is_array,omitempty"`      // Flag to indicate array reference
}

ReferenceInfo tracks reference resolution

func (ReferenceInfo) HasID added in v1.0.0

func (r ReferenceInfo) HasID() bool

HasID reports whether the reference carries any ID value.

func (ReferenceInfo) HasResolvedID added in v1.0.0

func (r ReferenceInfo) HasResolvedID() bool

HasResolvedID reports whether the reference has a concrete, non-placeholder ID.

func (ReferenceInfo) IsUnknownID added in v1.0.0

func (r ReferenceInfo) IsUnknownID() bool

IsUnknownID reports whether the reference ID is the unresolved placeholder.

type ReferenceResolver

type ReferenceResolver struct {
	// contains filtered or unexported fields
}

ReferenceResolver resolves declarative refs to Konnect IDs

func NewReferenceResolver

func NewReferenceResolver(client *state.Client, rs *resources.ResourceSet) *ReferenceResolver

NewReferenceResolver creates a new resolver

func (*ReferenceResolver) ResolveReferences

func (r *ReferenceResolver) ResolveReferences(ctx context.Context, changes []PlannedChange) (*ResolveResult, error)

ResolveReferences resolves all references in planned changes

type ResolveResult

type ResolveResult struct {
	// Map of change_id -> field -> resolved reference
	ChangeReferences map[string]map[string]ResolvedReference
	// Errors encountered during resolution
	Errors []error
}

ResolveResult contains resolved reference information

type ResolvedReference

type ResolvedReference struct {
	Ref string
	ID  string
}

ResolvedReference contains ref and resolved ID

type ResourcePlanner

type ResourcePlanner interface {
	// PlanChanges is the main entry point for planning changes for a resource type
	PlanChanges(ctx context.Context, plannerCtx *Config, plan *Plan) error
}

ResourcePlanner defines the interface that all resource type planners must implement

type UpdateConfig

type UpdateConfig struct {
	ResourceType    string
	ResourceName    string
	ResourceRef     string
	ResourceID      string
	CurrentFields   map[string]any
	DesiredFields   map[string]any
	ChangedFields   map[string]FieldChange
	CurrentLabels   map[string]string
	DesiredLabels   map[string]string
	RequiredFields  []string
	FieldComparator func(current, desired map[string]any) bool
	Namespace       string
	References      map[string]ReferenceInfo
}

UpdateConfig defines configuration for generic update operations

Jump to

Keyboard shortcuts

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