Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetReportConfig ¶ added in v0.99.0
func GetReportConfig(rs ResourceConfig) (any, error)
GetReportConfig returns a clean version of the resource configuration without any sensitive information or context specific data.
func GetResourceMapping ¶ added in v0.23.0
func GetResourceMapping() map[string]interface{}
Need to do reflect of ResourceConfig
Types ¶
type Resource ¶
type Resource interface {
// Source returns the resource value
Source(workingDir string, sourceResult *result.Source) error
// Condition checks if the resource is in the expected state
Condition(version string, scm scm.ScmHandler) (pass bool, message string, err error)
// Target updates the resource with the given value
Target(source string, scm scm.ScmHandler, dryRun bool, targetResult *result.Target) (err error)
// Changelog returns the changelog for this resource, or an empty string if not supported
Changelog(from, to string) *result.Changelogs
// ReportConfig returns a new resource configuration
// with only the necessary configuration fields without any sensitive information
// or context specific data.
ReportConfig() interface{}
}
Resource allow to manipulate a resource that can be a source, a condition or a target
func New ¶
func New(rs ResourceConfig) (resource Resource, err error)
New returns a newly initialized Resource or an error
type ResourceConfig ¶
type ResourceConfig struct {
//"dependson" allows to specify the order of execution of resources.
//It accepts a list of rules like "(resourceType#)resourceId(:booleanOperator)".
//
//The resourceType is optional and can be one of "condition", "source" or "target"
//By default the resourceType is the current resource type
//
//The resourceId is the name of the resource to depend on
//
//The booleanOperator is optional and can be "AND" or "OR"
//
//examples:
// dependson:
// * condition#myCondition:and
// * source#mySource
//
//remarks:
// * The parameters "sourceid" and "conditionsids" affect the order of resource execution.
// * To avoid circular dependencies, the depended resource may need to remove any conditionids or set "disablesourceinput to true".
DependsOn []string `yaml:",omitempty"`
//name specifies the resource name
Name string `yaml:",omitempty"`
//kind specifies the resource kind which defines accepted spec value
Kind string `yaml:",omitempty" jsonschema:"required"`
//transformers defines how the default input value need to be transformed
Transformers transformer.Transformers `yaml:",omitempty"`
//spec specifies parameters for a specific resource kind
Spec interface{} `yaml:",omitempty"`
//scmid specifies the scm configuration key associated to the current resource
SCMID string `yaml:",omitempty"` // SCMID references a uniq scm configuration
//!deprecated, please use scmid
//DeprecatedSCMID is kept for backward compatibility
DeprecatedSCMID string `yaml:"scmID,omitempty" jsonschema:"-"`
//!deprecated, please use dependson
//DeprecatedDependsOn is kept for backward compatibility
DeprecatedDependsOn []string `yaml:"depends_on,omitempty" jsonschema:"-"`
}
Click to show internal directories.
Click to hide internal directories.