Documentation ¶
Index ¶
- func SetAllSetterDefinitions(openAPIPath string, dirs ...string) error
- type DeleterCreator
- type FieldSetter
- type SetterCreator
- type SubstitutionCreator
- func (c SubstitutionCreator) Create(openAPIPath, resourcesPath string) error
- func (c SubstitutionCreator) CreateSettersForSubstitution(openAPIPath string) error
- func (c *SubstitutionCreator) Filter(input []*yaml.RNode) ([]*yaml.RNode, error)
- func (c SubstitutionCreator) GetStartIndices() (map[int]string, error)
- func (c SubstitutionCreator) GetValuesForMarkers() (map[string]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAllSetterDefinitions ¶ added in v0.1.4
SetAllSetterDefinitions reads all the Setter Definitions from the OpenAPI file and sets all values in the provided directories.
Types ¶
type DeleterCreator ¶ added in v0.3.1
type DeleterCreator struct { // Name is the name of the setter or substitution to delete Name string // DefinitionPrefix is the prefix of the OpenAPI definition type DefinitionPrefix string }
DeleterCreator delete a definition in the OpenAPI definitions, and removes references to the definition from matching resource fields.
func (DeleterCreator) Delete ¶ added in v0.3.1
func (d DeleterCreator) Delete(openAPIPath, resourcesPath string) error
type FieldSetter ¶
type FieldSetter struct { // Name is the name of the setter to set Name string // Value is the value to set Value string // ListValues contains a list of values to set on a Sequence ListValues []string Description string SetBy string Count int OpenAPIPath string ResourcesPath string }
FieldSetter sets the value for a field setter.
type SetterCreator ¶
type SetterCreator struct { // Name is the name of the setter to create or update. Name string SetBy string Description string Type string Schema string // FieldName if set will add the OpenAPI reference to fields with this name or path // FieldName may be the full name of the field, full path to the field, or the path suffix. // e.g. all of the following would match spec.template.spec.containers.image -- // [image, containers.image, spec.containers.image, template.spec.containers.image, // spec.template.spec.containers.image] // Optional. If unspecified match all field names. FieldName string // FieldValue if set will add the OpenAPI reference to fields if they have this value. // Optional. If unspecified match all field values. FieldValue string // Required indicates that the setter must be set by package consumer before // live apply/preview. This field is added to the setter definition to record // the package publisher's intent to make the setter required to be set. Required bool // Path to openAPI file OpenAPIPath string // Path to resources folder ResourcesPath string }
SetterCreator creates or updates a setter in the OpenAPI definitions, and inserts references to the setter from matching resource fields.
func (SetterCreator) Create ¶
func (c SetterCreator) Create(openAPIPath, resourcesPath string) error
type SubstitutionCreator ¶
type SubstitutionCreator struct { // Name is the name of the substitution to create Name string // Pattern is the substitution pattern Pattern string // Values are the substitution values for the pattern Values []setters2.Value // FieldName if set will add the OpenAPI reference to fields with this name or path // FieldName may be the full name of the field, full path to the field, or the path suffix. // e.g. all of the following would match spec.template.spec.containers.image -- // [image, containers.image, spec.containers.image, template.spec.containers.image, // spec.template.spec.containers.image] // Optional. If unspecified match all field names. FieldName string // FieldValue if set will add the OpenAPI reference to fields if they have this value. // Optional. If unspecified match all field values. FieldValue string // Path to openAPI file OpenAPIPath string // Path to resources folder ResourcesPath string }
SubstitutionCreator creates or updates a substitution in the OpenAPI definitions, and inserts references to the substitution from matching resource fields.
func (SubstitutionCreator) Create ¶
func (c SubstitutionCreator) Create(openAPIPath, resourcesPath string) error
func (SubstitutionCreator) CreateSettersForSubstitution ¶ added in v0.1.0
func (c SubstitutionCreator) CreateSettersForSubstitution(openAPIPath string) error
CreateSettersForSubstitution creates the setters for all the references in the substitution values if they don't already exist in openAPIPath file.
func (SubstitutionCreator) GetStartIndices ¶ added in v0.1.0
func (c SubstitutionCreator) GetStartIndices() (map[int]string, error)
GetStartIndices returns the start indices of all the markers in the pattern
func (SubstitutionCreator) GetValuesForMarkers ¶ added in v0.1.0
func (c SubstitutionCreator) GetValuesForMarkers() (map[string]string, error)
GetValuesForMarkers parses the pattern and field value to derive values for the markers in the pattern string. Returns error if the marker values can't be derived