Documentation
¶
Index ¶
- func ConfirmExecution(plan *planner.Plan, _, stderr io.Writer, stdin io.Reader) bool
- func CopyField(dest, src map[string]any, key string)
- func DisplayPlanSummary(plan *planner.Plan, out io.Writer)
- func ExtractResourceID(fields map[string]any) string
- func ExtractResourceInfoFromChange(change planner.PlannedChange) (resourceType, resourceName string)
- func ExtractResourceName(fields map[string]any) string
- func FormatAPIError(resourceType, resourceName, operation string, err error) error
- func FormatDependencyError(resourceType, resourceName, dependencyType, dependencyRef string) error
- func FormatExecutionError(resourceType, resourceName, action, errorMsg string) error
- func FormatProtectionError(resourceType, resourceName, action string) error
- func FormatResourceExistsError(resourceType, resourceName string) error
- func FormatResourceNotFoundError(resourceType, resourceName string) error
- func FormatValidationError(resourceType, resourceName, reason string) error
- func GetProtectionStatus(normalizedLabels map[string]string) bool
- func HasFieldChanged(oldFields, newFields map[string]any, key string) bool
- func IsProtectionChange(protection any) bool
- func LoadPlan(source string, stdin io.Reader) (*planner.Plan, error)
- func MapOptionalBoolField(target *bool, source map[string]any, key string)
- func MapOptionalBoolFieldToPtr(target **bool, source map[string]any, key string)
- func MapOptionalIntField(target *int, source map[string]any, key string)
- func MapOptionalSliceField(target *[]string, source map[string]any, key string)
- func MapOptionalStringField(target *string, source map[string]any, key string)
- func MapOptionalStringFieldToPtr(target **string, source map[string]any, key string)
- func PaginatedList[T any](ctx context.Context, handler PaginationHandler[T]) ([]T, error)
- func ProcessInBatches[T any](items []T, batchSize int, processor BatchProcessor[T]) error
- func ValidateRequiredFields(fields map[string]any, requiredFields []string) error
- func ValidateResourceProtection(resourceType, resourceName string, isProtected bool, ...) error
- func WrapWithResourceContext(err error, resourceType, resourceName string) error
- type BatchProcessor
- type PageMeta
- type PaginationHandler
- type SimplePaginationFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfirmExecution ¶
ConfirmExecution prompts for confirmation. Returns true if the user confirms with 'yes', false otherwise.
func DisplayPlanSummary ¶
DisplayPlanSummary shows an enhanced summary of the plan with better formatting, field-level changes, protected resource warnings, and comprehensive statistics.
func ExtractResourceID ¶
ExtractResourceID extracts the resource ID from fields map
func ExtractResourceInfoFromChange ¶
func ExtractResourceInfoFromChange(change planner.PlannedChange) (resourceType, resourceName string)
ExtractResourceInfoFromChange gets resource type and name from a planned change
func ExtractResourceName ¶
ExtractResourceName extracts the resource name from fields map
func FormatAPIError ¶
FormatAPIError wraps API errors with resource context
func FormatDependencyError ¶
FormatDependencyError creates an error for dependency resolution failures
func FormatExecutionError ¶
FormatExecutionError creates a standardized error message for execution failures
func FormatProtectionError ¶
FormatProtectionError creates a standardized error message for protection violations
func FormatResourceExistsError ¶
FormatResourceExistsError creates a standardized error for resources that already exist
func FormatResourceNotFoundError ¶
FormatResourceNotFoundError creates a standardized error for missing resources
func FormatValidationError ¶
FormatValidationError creates a standardized error message for validation failures
func GetProtectionStatus ¶
GetProtectionStatus extracts the protection status from normalized labels
func HasFieldChanged ¶
HasFieldChanged checks if a field value has changed between old and new maps
func IsProtectionChange ¶
IsProtectionChange checks if the change is specifically updating the protection status
func LoadPlan ¶
LoadPlan loads a plan from the given source. If source is "-", reads from stdin. Otherwise, reads from the specified file path.
func MapOptionalBoolField ¶
MapOptionalBoolField maps a boolean field from source map to target pointer if present
func MapOptionalBoolFieldToPtr ¶
MapOptionalBoolFieldToPtr maps a boolean field to a double pointer (used by SDK types)
func MapOptionalIntField ¶
MapOptionalIntField maps an integer field from source map to target pointer if present
func MapOptionalSliceField ¶
MapOptionalSliceField maps a slice field from source map to target pointer if present
func MapOptionalStringField ¶
MapOptionalStringField maps a string field from source map to target pointer if present
func MapOptionalStringFieldToPtr ¶
MapOptionalStringFieldToPtr maps a string field to a double pointer (used by SDK types)
func PaginatedList ¶
func PaginatedList[T any](ctx context.Context, handler PaginationHandler[T]) ([]T, error)
PaginatedList handles pagination logic for any paginated API
func ProcessInBatches ¶
func ProcessInBatches[T any](items []T, batchSize int, processor BatchProcessor[T]) error
ProcessInBatches processes a slice of items in batches
func ValidateRequiredFields ¶
ValidateRequiredFields checks that all required fields are present and non-empty
func ValidateResourceProtection ¶
func ValidateResourceProtection( resourceType, resourceName string, isProtected bool, change planner.PlannedChange, isProtectionChange bool, ) error
ValidateResourceProtection validates that protected resources are not being modified inappropriately
func WrapWithResourceContext ¶
WrapWithResourceContext adds resource context to an existing error
Types ¶
type BatchProcessor ¶
BatchProcessor processes items in batches with a given batch size
type PageMeta ¶
type PageMeta struct {
Total float64 `json:"total"`
Page int64 `json:"page"`
PageSize int64 `json:"page_size"`
HasNextPage bool `json:"has_next_page"`
}
PageMeta represents pagination metadata returned by APIs
type PaginationHandler ¶
PaginationHandler defines a function that performs paginated requests Returns: (items, pageInfo, error)
func NewSimplePaginationHandler ¶
func NewSimplePaginationHandler[T any](pageSize int64, fn SimplePaginationFunc[T]) PaginationHandler[T]