executor

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIAdapter

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

APIAdapter implements ResourceOperations for APIs

func NewAPIAdapter

func NewAPIAdapter(client *state.Client) *APIAdapter

NewAPIAdapter creates a new API adapter

func (*APIAdapter) Create

func (p *APIAdapter) Create(ctx context.Context, req kkComps.CreateAPIRequest,
	namespace string, _ *ExecutionContext) (string, error)

Create creates a new API

func (*APIAdapter) Delete

func (p *APIAdapter) Delete(ctx context.Context, id string, _ *ExecutionContext) error

Delete deletes an API

func (*APIAdapter) GetByID

func (p *APIAdapter) GetByID(ctx context.Context, id string) (ResourceInfo, error)

GetByID gets an API by ID

func (*APIAdapter) GetByName

func (p *APIAdapter) GetByName(ctx context.Context, name string) (ResourceInfo, error)

GetByName gets an API by name

func (*APIAdapter) MapCreateFields

func (p *APIAdapter) MapCreateFields(_ context.Context, execCtx *ExecutionContext, fields map[string]any,
	create *kkComps.CreateAPIRequest) error

MapCreateFields maps fields to CreateAPIRequest

func (*APIAdapter) MapUpdateFields

func (p *APIAdapter) MapUpdateFields(_ context.Context, execCtx *ExecutionContext, fields map[string]any,
	update *kkComps.UpdateAPIRequest, currentLabels map[string]string) error

MapUpdateFields maps fields to UpdateAPIRequest

func (*APIAdapter) RequiredFields

func (p *APIAdapter) RequiredFields() []string

RequiredFields returns the required fields for creation

func (*APIAdapter) ResourceType

func (p *APIAdapter) ResourceType() string

ResourceType returns the resource type name

func (*APIAdapter) SupportsUpdate

func (p *APIAdapter) SupportsUpdate() bool

SupportsUpdate returns true as APIs support updates

func (*APIAdapter) Update

func (p *APIAdapter) Update(ctx context.Context, id string, req kkComps.UpdateAPIRequest,
	namespace string, _ *ExecutionContext) (string, error)

Update updates an existing API

type APIDocumentAdapter

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

APIDocumentAdapter implements ResourceOperations for API documents

func NewAPIDocumentAdapter

func NewAPIDocumentAdapter(client *state.Client) *APIDocumentAdapter

NewAPIDocumentAdapter creates a new API document adapter

func (*APIDocumentAdapter) Create

Create creates a new API document

func (*APIDocumentAdapter) Delete

func (a *APIDocumentAdapter) Delete(ctx context.Context, id string, execCtx *ExecutionContext) error

Delete deletes an API document

func (*APIDocumentAdapter) GetByID added in v0.1.2

func (a *APIDocumentAdapter) GetByID(ctx context.Context, id string) (ResourceInfo, error)

GetByID gets an API document by ID using API context

func (*APIDocumentAdapter) GetByName

GetByName gets an API document by slug

func (*APIDocumentAdapter) MapCreateFields

func (a *APIDocumentAdapter) MapCreateFields(
	_ context.Context, _ *ExecutionContext, fields map[string]any,
	create *kkComps.CreateAPIDocumentRequest) error

MapCreateFields maps fields to CreateAPIDocumentRequest

func (*APIDocumentAdapter) MapUpdateFields

func (a *APIDocumentAdapter) MapUpdateFields(_ context.Context, _ *ExecutionContext, fields map[string]any,
	update *kkComps.APIDocument, _ map[string]string) error

MapUpdateFields maps fields to APIDocument

func (*APIDocumentAdapter) RequiredFields

func (a *APIDocumentAdapter) RequiredFields() []string

RequiredFields returns the required fields for creation

func (*APIDocumentAdapter) ResourceType

func (a *APIDocumentAdapter) ResourceType() string

ResourceType returns the resource type name

func (*APIDocumentAdapter) SupportsUpdate

func (a *APIDocumentAdapter) SupportsUpdate() bool

SupportsUpdate returns true as documents support updates

func (*APIDocumentAdapter) Update

Update updates an existing API document

type APIDocumentResourceInfo

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

APIDocumentResourceInfo implements ResourceInfo for API documents

func (*APIDocumentResourceInfo) GetID

func (a *APIDocumentResourceInfo) GetID() string

func (*APIDocumentResourceInfo) GetLabels

func (a *APIDocumentResourceInfo) GetLabels() map[string]string

func (*APIDocumentResourceInfo) GetName

func (a *APIDocumentResourceInfo) GetName() string

func (*APIDocumentResourceInfo) GetNormalizedLabels

func (a *APIDocumentResourceInfo) GetNormalizedLabels() map[string]string

type APIImplementationAdapter

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

APIImplementationAdapter is a placeholder adapter for API implementations This resource type is not yet supported by the SDK

func NewAPIImplementationAdapter

func NewAPIImplementationAdapter(client *state.Client) *APIImplementationAdapter

NewAPIImplementationAdapter creates a new API implementation adapter

func (*APIImplementationAdapter) Create

Create is not implemented

func (*APIImplementationAdapter) Delete

Delete is not implemented

func (*APIImplementationAdapter) GetByName

GetByName is not implemented

func (*APIImplementationAdapter) MapCreateFields

MapCreateFields is not implemented

func (*APIImplementationAdapter) MapUpdateFields

MapUpdateFields is not implemented

func (*APIImplementationAdapter) RequiredFields

func (a *APIImplementationAdapter) RequiredFields() []string

RequiredFields returns the required fields for creation

func (*APIImplementationAdapter) ResourceType

func (a *APIImplementationAdapter) ResourceType() string

ResourceType returns the resource type name

func (*APIImplementationAdapter) SupportsUpdate

func (a *APIImplementationAdapter) SupportsUpdate() bool

SupportsUpdate returns false as implementations are not supported

func (*APIImplementationAdapter) Update

Update is not implemented

type APIImplementationResourceInfo

type APIImplementationResourceInfo struct {
}

APIImplementationResourceInfo is a placeholder for API implementation resource info

func (*APIImplementationResourceInfo) GetID

func (*APIImplementationResourceInfo) GetLabels

func (a *APIImplementationResourceInfo) GetLabels() map[string]string

func (*APIImplementationResourceInfo) GetName

func (*APIImplementationResourceInfo) GetNormalizedLabels

func (a *APIImplementationResourceInfo) GetNormalizedLabels() map[string]string

type APIPublicationAdapter

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

APIPublicationAdapter implements CreateDeleteOperations for API publications API publications only support create and delete operations, not updates

func NewAPIPublicationAdapter

func NewAPIPublicationAdapter(client *state.Client) *APIPublicationAdapter

NewAPIPublicationAdapter creates a new API publication adapter

func (*APIPublicationAdapter) Create

Create creates a new API publication

func (*APIPublicationAdapter) Delete

func (a *APIPublicationAdapter) Delete(ctx context.Context, id string, execCtx *ExecutionContext) error

Delete deletes an API publication

func (*APIPublicationAdapter) GetByName

GetByName gets an API publication by name

func (*APIPublicationAdapter) MapCreateFields

func (a *APIPublicationAdapter) MapCreateFields(
	_ context.Context, execCtx *ExecutionContext, fields map[string]any,
	create *kkComps.APIPublication) error

MapCreateFields maps fields to APIPublication

func (*APIPublicationAdapter) RequiredFields

func (a *APIPublicationAdapter) RequiredFields() []string

RequiredFields returns the required fields for creation

func (*APIPublicationAdapter) ResourceType

func (a *APIPublicationAdapter) ResourceType() string

ResourceType returns the resource type name

type APIPublicationResourceInfo

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

APIPublicationResourceInfo implements ResourceInfo for API publications

func (*APIPublicationResourceInfo) GetID

func (*APIPublicationResourceInfo) GetLabels

func (a *APIPublicationResourceInfo) GetLabels() map[string]string

func (*APIPublicationResourceInfo) GetName

func (a *APIPublicationResourceInfo) GetName() string

func (*APIPublicationResourceInfo) GetNormalizedLabels

func (a *APIPublicationResourceInfo) GetNormalizedLabels() map[string]string

type APIResourceInfo

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

APIResourceInfo wraps an API to implement ResourceInfo

func (*APIResourceInfo) GetID

func (a *APIResourceInfo) GetID() string

func (*APIResourceInfo) GetLabels

func (a *APIResourceInfo) GetLabels() map[string]string

func (*APIResourceInfo) GetName

func (a *APIResourceInfo) GetName() string

func (*APIResourceInfo) GetNormalizedLabels

func (a *APIResourceInfo) GetNormalizedLabels() map[string]string

type APIVersionAdapter

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

APIVersionAdapter implements CreateDeleteOperations for API versions API versions only support create and delete operations, not updates

func NewAPIVersionAdapter

func NewAPIVersionAdapter(client *state.Client) *APIVersionAdapter

NewAPIVersionAdapter creates a new API version adapter

func (*APIVersionAdapter) Create

Create creates a new API version

func (*APIVersionAdapter) Delete

func (a *APIVersionAdapter) Delete(ctx context.Context, id string, execCtx *ExecutionContext) error

Delete deletes an API version

func (*APIVersionAdapter) GetByName

func (a *APIVersionAdapter) GetByName(_ context.Context, _ string) (ResourceInfo, error)

GetByName gets an API version by name

func (*APIVersionAdapter) MapCreateFields

func (a *APIVersionAdapter) MapCreateFields(_ context.Context, _ *ExecutionContext, fields map[string]any,
	create *kkComps.CreateAPIVersionRequest) error

MapCreateFields maps fields to CreateAPIVersionRequest

func (*APIVersionAdapter) RequiredFields

func (a *APIVersionAdapter) RequiredFields() []string

RequiredFields returns the required fields for creation

func (*APIVersionAdapter) ResourceType

func (a *APIVersionAdapter) ResourceType() string

ResourceType returns the resource type name

type APIVersionResourceInfo

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

APIVersionResourceInfo implements ResourceInfo for API versions

func (*APIVersionResourceInfo) GetID

func (a *APIVersionResourceInfo) GetID() string

func (*APIVersionResourceInfo) GetLabels

func (a *APIVersionResourceInfo) GetLabels() map[string]string

func (*APIVersionResourceInfo) GetName

func (a *APIVersionResourceInfo) GetName() string

func (*APIVersionResourceInfo) GetNormalizedLabels

func (a *APIVersionResourceInfo) GetNormalizedLabels() map[string]string

type AppliedChange

type AppliedChange struct {
	ChangeID     string `json:"change_id"`
	ResourceType string `json:"resource_type"`
	ResourceName string `json:"resource_name"`
	ResourceRef  string `json:"resource_ref"`
	Action       string `json:"action"`
	ResourceID   string `json:"resource_id,omitempty"` // ID of created/updated resource
}

AppliedChange represents a successfully applied change

type AuthStrategyAdapter

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

AuthStrategyAdapter implements ResourceOperations for application auth strategies This adapter handles the complexity of union types in the SDK

func NewAuthStrategyAdapter

func NewAuthStrategyAdapter(client *state.Client) *AuthStrategyAdapter

NewAuthStrategyAdapter creates a new auth strategy adapter

func (*AuthStrategyAdapter) Create

Create creates a new auth strategy

func (*AuthStrategyAdapter) Delete

Delete deletes an auth strategy

func (*AuthStrategyAdapter) GetByName

func (a *AuthStrategyAdapter) GetByName(ctx context.Context, name string) (ResourceInfo, error)

GetByName gets an auth strategy by name

func (*AuthStrategyAdapter) MapCreateFields

func (a *AuthStrategyAdapter) MapCreateFields(
	_ context.Context, execCtx *ExecutionContext, fields map[string]any,
	create *kkComps.CreateAppAuthStrategyRequest) error

MapCreateFields maps fields to the appropriate auth strategy request type Note: This returns any because the SDK uses union types

func (*AuthStrategyAdapter) MapUpdateFields

func (a *AuthStrategyAdapter) MapUpdateFields(
	_ context.Context, execCtx *ExecutionContext, fields map[string]any,
	update *kkComps.UpdateAppAuthStrategyRequest, currentLabels map[string]string) error

MapUpdateFields maps fields to UpdateAppAuthStrategyRequest

func (*AuthStrategyAdapter) RequiredFields

func (a *AuthStrategyAdapter) RequiredFields() []string

RequiredFields returns the required fields for creation

func (*AuthStrategyAdapter) ResourceType

func (a *AuthStrategyAdapter) ResourceType() string

ResourceType returns the resource type name

func (*AuthStrategyAdapter) SupportsUpdate

func (a *AuthStrategyAdapter) SupportsUpdate() bool

SupportsUpdate returns true as auth strategies support updates

func (*AuthStrategyAdapter) Update

Update updates an existing auth strategy

type AuthStrategyResourceInfo

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

AuthStrategyResourceInfo wraps an ApplicationAuthStrategy to implement ResourceInfo

func (*AuthStrategyResourceInfo) GetID

func (a *AuthStrategyResourceInfo) GetID() string

func (*AuthStrategyResourceInfo) GetLabels

func (a *AuthStrategyResourceInfo) GetLabels() map[string]string

func (*AuthStrategyResourceInfo) GetName

func (a *AuthStrategyResourceInfo) GetName() string

func (*AuthStrategyResourceInfo) GetNormalizedLabels

func (a *AuthStrategyResourceInfo) GetNormalizedLabels() map[string]string

type BaseCreateDeleteExecutor

type BaseCreateDeleteExecutor[TCreate any] struct {
	// contains filtered or unexported fields
}

BaseCreateDeleteExecutor provides common operations for create/delete only resources

func NewBaseCreateDeleteExecutor

func NewBaseCreateDeleteExecutor[TCreate any](
	ops CreateDeleteOperations[TCreate],
	dryRun bool,
) *BaseCreateDeleteExecutor[TCreate]

NewBaseCreateDeleteExecutor creates a new executor for create/delete only resources

func (*BaseCreateDeleteExecutor[TCreate]) Create

func (b *BaseCreateDeleteExecutor[TCreate]) Create(ctx context.Context, change planner.PlannedChange) (string, error)

Create handles CREATE operations

func (*BaseCreateDeleteExecutor[TCreate]) Delete

func (b *BaseCreateDeleteExecutor[TCreate]) Delete(ctx context.Context, change planner.PlannedChange) error

Delete handles DELETE operations

type BaseExecutor

type BaseExecutor[TCreate any, TUpdate any] struct {
	// contains filtered or unexported fields
}

BaseExecutor provides common CRUD operations

func NewBaseExecutor

func NewBaseExecutor[TCreate any, TUpdate any](
	ops ResourceOperations[TCreate, TUpdate],
	client *state.Client,
	dryRun bool,
) *BaseExecutor[TCreate, TUpdate]

NewBaseExecutor creates a new base executor instance

func (*BaseExecutor[TCreate, TUpdate]) Create

func (b *BaseExecutor[TCreate, TUpdate]) Create(ctx context.Context, change planner.PlannedChange) (string, error)

Create handles CREATE operations for any resource type

func (*BaseExecutor[TCreate, TUpdate]) Delete

func (b *BaseExecutor[TCreate, TUpdate]) Delete(ctx context.Context, change planner.PlannedChange) error

Delete handles DELETE operations for any resource type

func (*BaseExecutor[TCreate, TUpdate]) Update

func (b *BaseExecutor[TCreate, TUpdate]) Update(ctx context.Context, change planner.PlannedChange) (string, error)

Update handles UPDATE operations for any resource type

type BaseSingletonExecutor

type BaseSingletonExecutor[TUpdate any] struct {
	// contains filtered or unexported fields
}

BaseSingletonExecutor provides common operations for singleton resources

func NewBaseSingletonExecutor

func NewBaseSingletonExecutor[TUpdate any](
	ops SingletonOperations[TUpdate],
	dryRun bool,
) *BaseSingletonExecutor[TUpdate]

NewBaseSingletonExecutor creates a new executor for singleton resources

func (*BaseSingletonExecutor[TUpdate]) Update

func (b *BaseSingletonExecutor[TUpdate]) Update(ctx context.Context, change planner.PlannedChange,
	parentID string) (string, error)

Update handles both CREATE and UPDATE operations for singleton resources

type ConsoleReporter

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

ConsoleReporter provides console output for plan execution progress

func NewConsoleReporter

func NewConsoleReporter(w io.Writer) *ConsoleReporter

NewConsoleReporter creates a new console reporter that writes to the provided writer

func NewConsoleReporterWithOptions

func NewConsoleReporterWithOptions(w io.Writer, dryRun bool) *ConsoleReporter

NewConsoleReporterWithOptions creates a new console reporter with options

func (*ConsoleReporter) CompleteChange

func (r *ConsoleReporter) CompleteChange(change planner.PlannedChange, err error)

CompleteChange is called after a change is executed (success or failure)

func (*ConsoleReporter) FinishExecution

func (r *ConsoleReporter) FinishExecution(result *ExecutionResult)

FinishExecution is called at the end of plan execution

func (*ConsoleReporter) SkipChange

func (r *ConsoleReporter) SkipChange(change planner.PlannedChange, reason string)

SkipChange is called when a change is skipped

func (*ConsoleReporter) StartChange

func (r *ConsoleReporter) StartChange(change planner.PlannedChange)

StartChange is called before executing a change

func (*ConsoleReporter) StartExecution

func (r *ConsoleReporter) StartExecution(plan *planner.Plan)

StartExecution is called at the beginning of plan execution

type CreateDeleteOperations

type CreateDeleteOperations[TCreate any] interface {
	// Field mapping
	MapCreateFields(ctx context.Context, execCtx *ExecutionContext, fields map[string]any, create *TCreate) error

	// API calls
	Create(ctx context.Context, req TCreate, namespace string, execCtx *ExecutionContext) (string, error)
	Delete(ctx context.Context, id string, execCtx *ExecutionContext) error
	GetByName(ctx context.Context, name string) (ResourceInfo, error)

	// Resource info
	ResourceType() string
	RequiredFields() []string
}

CreateDeleteOperations defines operations for resources that only support create and delete (no update operation), such as API versions and API publications

type ExecutionContext added in v0.1.3

type ExecutionContext struct {
	// Namespace is the kongctl namespace for resource labeling
	Namespace string

	// Protection contains protection-related metadata for resource labeling
	Protection any

	// PlannedChange contains the full planned change being executed,
	// including references and field changes
	PlannedChange *planner.PlannedChange
}

ExecutionContext carries execution state that was previously stored in context. This struct eliminates the need for context.WithValue and unsafe type assertions by making dependencies explicit in function signatures.

func NewExecutionContext added in v0.1.3

func NewExecutionContext(change *planner.PlannedChange) *ExecutionContext

NewExecutionContext creates a new ExecutionContext from a PlannedChange

type ExecutionError

type ExecutionError struct {
	ChangeID     string `json:"change_id"`
	ResourceType string `json:"resource_type"`
	ResourceName string `json:"resource_name"`
	ResourceRef  string `json:"resource_ref"`
	Action       string `json:"action"`
	Error        string `json:"error"`
}

ExecutionError represents an error that occurred during execution

type ExecutionResult

type ExecutionResult struct {
	// Counts
	SuccessCount int `json:"success_count"`
	FailureCount int `json:"failure_count"`
	SkippedCount int `json:"skipped_count"`

	// Errors encountered during execution
	Errors []ExecutionError `json:"errors,omitempty"`

	// Indicates if this was a dry-run execution
	DryRun bool `json:"dry_run"`

	// Changes that were successfully applied (empty in dry-run)
	ChangesApplied []AppliedChange `json:"changes_applied,omitempty"`

	// Validation results for dry-run mode
	ValidationResults []ValidationResult `json:"validation_results,omitempty"`
}

ExecutionResult represents the outcome of executing a plan

func (*ExecutionResult) HasErrors

func (r *ExecutionResult) HasErrors() bool

HasErrors returns true if any errors occurred during execution

func (*ExecutionResult) Message

func (r *ExecutionResult) Message() string

Message returns a user-friendly summary of the execution result

func (*ExecutionResult) TotalChanges

func (r *ExecutionResult) TotalChanges() int

TotalChanges returns the total number of changes processed

type Executor

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

Executor handles the execution of declarative configuration plans

func New

func New(client *state.Client, reporter ProgressReporter, dryRun bool) *Executor

New creates a new Executor instance

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, plan *planner.Plan) (*ExecutionResult, error)

Execute runs the plan and returns the execution result

type ParentAwareOperations

type ParentAwareOperations[TCreate any, TUpdate any] interface {
	ResourceOperations[TCreate, TUpdate]

	// Parent resolution
	ResolveParentID(ctx context.Context, change planner.PlannedChange, executor *Executor) (string, error)
}

ParentAwareOperations extends ResourceOperations for resources with parent relationships

type PortalAdapter

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

PortalAdapter implements ResourceOperations for portals

func NewPortalAdapter

func NewPortalAdapter(client *state.Client) *PortalAdapter

NewPortalAdapter creates a new portal adapter

func (*PortalAdapter) Create

func (p *PortalAdapter) Create(ctx context.Context, req kkComps.CreatePortal,
	namespace string, _ *ExecutionContext) (string, error)

Create creates a new portal

func (*PortalAdapter) Delete

func (p *PortalAdapter) Delete(ctx context.Context, id string, _ *ExecutionContext) error

Delete deletes a portal

func (*PortalAdapter) GetByName

func (p *PortalAdapter) GetByName(ctx context.Context, name string) (ResourceInfo, error)

GetByName gets a portal by name

func (*PortalAdapter) MapCreateFields

func (p *PortalAdapter) MapCreateFields(_ context.Context, execCtx *ExecutionContext, fields map[string]any,
	create *kkComps.CreatePortal) error

MapCreateFields maps fields to CreatePortal request

func (*PortalAdapter) MapUpdateFields

func (p *PortalAdapter) MapUpdateFields(_ context.Context, execCtx *ExecutionContext, fields map[string]any,
	update *kkComps.UpdatePortal, currentLabels map[string]string) error

MapUpdateFields maps fields to UpdatePortal request

func (*PortalAdapter) RequiredFields

func (p *PortalAdapter) RequiredFields() []string

RequiredFields returns the required fields for creation

func (*PortalAdapter) ResourceType

func (p *PortalAdapter) ResourceType() string

ResourceType returns the resource type name

func (*PortalAdapter) SupportsUpdate

func (p *PortalAdapter) SupportsUpdate() bool

SupportsUpdate returns true as portals support updates

func (*PortalAdapter) Update

func (p *PortalAdapter) Update(ctx context.Context, id string, req kkComps.UpdatePortal,
	namespace string, _ *ExecutionContext) (string, error)

Update updates an existing portal

type PortalCustomizationAdapter

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

PortalCustomizationAdapter implements SingletonOperations for portal customization Portal customization is a singleton resource that always exists and only supports updates

func NewPortalCustomizationAdapter

func NewPortalCustomizationAdapter(client *state.Client) *PortalCustomizationAdapter

NewPortalCustomizationAdapter creates a new portal customization adapter

func (*PortalCustomizationAdapter) MapUpdateFields

func (p *PortalCustomizationAdapter) MapUpdateFields(_ context.Context, fields map[string]any,
	update *kkComps.PortalCustomization) error

MapUpdateFields maps fields to PortalCustomization

func (*PortalCustomizationAdapter) ResourceType

func (p *PortalCustomizationAdapter) ResourceType() string

ResourceType returns the resource type name

func (*PortalCustomizationAdapter) Update

Update updates the portal customization

type PortalDomainAdapter

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

PortalDomainAdapter implements ResourceOperations for portal custom domains

func NewPortalDomainAdapter

func NewPortalDomainAdapter(client *state.Client) *PortalDomainAdapter

NewPortalDomainAdapter creates a new portal domain adapter

func (*PortalDomainAdapter) Create

Create creates a new portal custom domain

func (*PortalDomainAdapter) Delete

Delete deletes a portal custom domain

func (*PortalDomainAdapter) GetByID added in v0.1.2

GetByID gets a portal custom domain by ID (portal ID in this case)

func (*PortalDomainAdapter) GetByName

GetByName gets a portal custom domain by name (hostname)

func (*PortalDomainAdapter) MapCreateFields

MapCreateFields maps fields to CreatePortalCustomDomainRequest

func (*PortalDomainAdapter) MapUpdateFields

MapUpdateFields maps fields to UpdatePortalCustomDomainRequest

func (*PortalDomainAdapter) RequiredFields

func (p *PortalDomainAdapter) RequiredFields() []string

RequiredFields returns the required fields for creation

func (*PortalDomainAdapter) ResourceType

func (p *PortalDomainAdapter) ResourceType() string

ResourceType returns the resource type name

func (*PortalDomainAdapter) SupportsUpdate

func (p *PortalDomainAdapter) SupportsUpdate() bool

SupportsUpdate returns true as custom domains support updates (enabled field only)

func (*PortalDomainAdapter) Update

Update updates an existing portal custom domain

type PortalDomainResourceInfo

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

PortalDomainResourceInfo implements ResourceInfo for portal custom domains

func (*PortalDomainResourceInfo) GetID

func (p *PortalDomainResourceInfo) GetID() string

func (*PortalDomainResourceInfo) GetLabels

func (p *PortalDomainResourceInfo) GetLabels() map[string]string

func (*PortalDomainResourceInfo) GetName

func (p *PortalDomainResourceInfo) GetName() string

func (*PortalDomainResourceInfo) GetNormalizedLabels

func (p *PortalDomainResourceInfo) GetNormalizedLabels() map[string]string

type PortalPageAdapter

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

PortalPageAdapter implements ResourceOperations for portal pages

func NewPortalPageAdapter

func NewPortalPageAdapter(client *state.Client) *PortalPageAdapter

NewPortalPageAdapter creates a new portal page adapter

func (*PortalPageAdapter) Create

Create creates a new portal page

func (*PortalPageAdapter) Delete

func (p *PortalPageAdapter) Delete(ctx context.Context, id string, execCtx *ExecutionContext) error

Delete deletes a portal page

func (*PortalPageAdapter) GetByID added in v0.1.1

func (p *PortalPageAdapter) GetByID(ctx context.Context, id string) (ResourceInfo, error)

GetByID gets a portal page by ID using portal context

func (*PortalPageAdapter) GetByName

func (p *PortalPageAdapter) GetByName(_ context.Context, _ string) (ResourceInfo, error)

GetByName gets a portal page by slug

func (*PortalPageAdapter) MapCreateFields

func (p *PortalPageAdapter) MapCreateFields(_ context.Context, execCtx *ExecutionContext, fields map[string]any,
	create *kkComps.CreatePortalPageRequest) error

MapCreateFields maps fields to CreatePortalPageRequest

func (*PortalPageAdapter) MapUpdateFields

func (p *PortalPageAdapter) MapUpdateFields(_ context.Context, execCtx *ExecutionContext, fields map[string]any,
	update *kkComps.UpdatePortalPageRequest, _ map[string]string) error

MapUpdateFields maps fields to UpdatePortalPageRequest

func (*PortalPageAdapter) RequiredFields

func (p *PortalPageAdapter) RequiredFields() []string

RequiredFields returns the required fields for creation

func (*PortalPageAdapter) ResourceType

func (p *PortalPageAdapter) ResourceType() string

ResourceType returns the resource type name

func (*PortalPageAdapter) SupportsUpdate

func (p *PortalPageAdapter) SupportsUpdate() bool

SupportsUpdate returns true as pages support updates

func (*PortalPageAdapter) Update

Update updates an existing portal page

type PortalPageResourceInfo

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

PortalPageResourceInfo implements ResourceInfo for portal pages

func (*PortalPageResourceInfo) GetID

func (p *PortalPageResourceInfo) GetID() string

func (*PortalPageResourceInfo) GetLabels

func (p *PortalPageResourceInfo) GetLabels() map[string]string

func (*PortalPageResourceInfo) GetName

func (p *PortalPageResourceInfo) GetName() string

func (*PortalPageResourceInfo) GetNormalizedLabels

func (p *PortalPageResourceInfo) GetNormalizedLabels() map[string]string

type PortalResourceInfo

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

PortalResourceInfo wraps a Portal to implement ResourceInfo

func (*PortalResourceInfo) GetID

func (p *PortalResourceInfo) GetID() string

func (*PortalResourceInfo) GetLabels

func (p *PortalResourceInfo) GetLabels() map[string]string

func (*PortalResourceInfo) GetName

func (p *PortalResourceInfo) GetName() string

func (*PortalResourceInfo) GetNormalizedLabels

func (p *PortalResourceInfo) GetNormalizedLabels() map[string]string

type PortalSnippetAdapter

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

PortalSnippetAdapter implements ResourceOperations for portal snippets

func NewPortalSnippetAdapter

func NewPortalSnippetAdapter(client *state.Client) *PortalSnippetAdapter

NewPortalSnippetAdapter creates a new portal snippet adapter

func (*PortalSnippetAdapter) Create

Create creates a new portal snippet

func (*PortalSnippetAdapter) Delete

func (p *PortalSnippetAdapter) Delete(ctx context.Context, id string, execCtx *ExecutionContext) error

Delete deletes a portal snippet

func (*PortalSnippetAdapter) GetByID added in v0.1.2

GetByID gets a portal snippet by ID

func (*PortalSnippetAdapter) GetByName

GetByName gets a portal snippet by name

func (*PortalSnippetAdapter) MapCreateFields

func (p *PortalSnippetAdapter) MapCreateFields(
	_ context.Context, _ *ExecutionContext, fields map[string]any,
	create *kkComps.CreatePortalSnippetRequest) error

MapCreateFields maps fields to CreatePortalSnippetRequest

func (*PortalSnippetAdapter) MapUpdateFields

func (p *PortalSnippetAdapter) MapUpdateFields(_ context.Context, _ *ExecutionContext, fields map[string]any,
	update *kkComps.UpdatePortalSnippetRequest, _ map[string]string) error

MapUpdateFields maps fields to UpdatePortalSnippetRequest

func (*PortalSnippetAdapter) RequiredFields

func (p *PortalSnippetAdapter) RequiredFields() []string

RequiredFields returns the required fields for creation

func (*PortalSnippetAdapter) ResourceType

func (p *PortalSnippetAdapter) ResourceType() string

ResourceType returns the resource type name

func (*PortalSnippetAdapter) SupportsUpdate

func (p *PortalSnippetAdapter) SupportsUpdate() bool

SupportsUpdate returns true as snippets support updates

func (*PortalSnippetAdapter) Update

Update updates an existing portal snippet

type PortalSnippetResourceInfo

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

PortalSnippetResourceInfo implements ResourceInfo for portal snippets

func (*PortalSnippetResourceInfo) GetID

func (p *PortalSnippetResourceInfo) GetID() string

func (*PortalSnippetResourceInfo) GetLabels

func (p *PortalSnippetResourceInfo) GetLabels() map[string]string

func (*PortalSnippetResourceInfo) GetName

func (p *PortalSnippetResourceInfo) GetName() string

func (*PortalSnippetResourceInfo) GetNormalizedLabels

func (p *PortalSnippetResourceInfo) GetNormalizedLabels() map[string]string

type ProgressReporter

type ProgressReporter interface {
	// StartExecution is called at the beginning of plan execution
	StartExecution(plan *planner.Plan)

	// StartChange is called before executing a change
	StartChange(change planner.PlannedChange)

	// CompleteChange is called after a change is executed (success or failure)
	CompleteChange(change planner.PlannedChange, err error)

	// SkipChange is called when a change is skipped (e.g., in dry-run mode)
	SkipChange(change planner.PlannedChange, reason string)

	// FinishExecution is called at the end of plan execution
	FinishExecution(result *ExecutionResult)
}

ProgressReporter provides real-time feedback during plan execution

type ResourceInfo

type ResourceInfo interface {
	GetID() string
	GetName() string
	GetLabels() map[string]string
	GetNormalizedLabels() map[string]string
}

ResourceInfo provides common resource information

type ResourceOperations

type ResourceOperations[TCreate any, TUpdate any] interface {
	// Field mapping
	MapCreateFields(ctx context.Context, execCtx *ExecutionContext, fields map[string]any, create *TCreate) error
	MapUpdateFields(ctx context.Context, execCtx *ExecutionContext, fields map[string]any, update *TUpdate,
		currentLabels map[string]string) error

	// API calls
	Create(ctx context.Context, req TCreate, namespace string, execCtx *ExecutionContext) (string, error)
	Update(ctx context.Context, id string, req TUpdate, namespace string, execCtx *ExecutionContext) (string, error)
	Delete(ctx context.Context, id string, execCtx *ExecutionContext) error
	GetByName(ctx context.Context, name string) (ResourceInfo, error)

	// Resource info
	ResourceType() string
	RequiredFields() []string
	SupportsUpdate() bool
}

ResourceOperations defines the contract for resource-specific operations

type SingletonOperations

type SingletonOperations[TUpdate any] interface {
	// Field mapping
	MapUpdateFields(ctx context.Context, fields map[string]any, update *TUpdate) error

	// API calls - note the special signature for singleton resources
	Update(ctx context.Context, parentID string, req TUpdate) error

	// Resource info
	ResourceType() string
}

SingletonOperations defines operations for singleton resources that always exist and only support updates (no create/delete), such as portal customization

type ValidationResult

type ValidationResult struct {
	ChangeID     string `json:"change_id"`
	ResourceType string `json:"resource_type"`
	ResourceName string `json:"resource_name"`
	ResourceRef  string `json:"resource_ref"`
	Action       string `json:"action"`
	Status       string `json:"status"`               // "would_succeed", "would_fail", "skipped"
	Validation   string `json:"validation,omitempty"` // "passed", "failed", reason
	Message      string `json:"message,omitempty"`
}

ValidationResult represents the validation outcome for a change in dry-run mode

Jump to

Keyboard shortcuts

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