Documentation
¶
Overview ¶
Package processor is used to process the library files and read them into a result struct for Alzlib to use.
Index ¶
- Constants
- Variables
- func NewErrNoNameProvided(resourceType string) error
- func NewErrResourceAlreadyExists(resourceType, name string) error
- func NewErrorUnmarshaling(detail string) error
- type Client
- type LibArchetype
- type LibArchetypeOverride
- type LibArchitecture
- type LibArchitectureManagementGroup
- type LibDefaultPolicyValueAssignments
- type LibDefaultPolicyValues
- type LibDefaultPolicyValuesDefaults
- type LibMetadata
- type LibMetadataDependency
- type Result
Constants ¶
const ( PolicyAssignmentFileType = "alz_policy_assignment" PolicyDefinitionFileType = "alz_policy_definition" PolicySetDefinitionFileType = "alz_policy_set_definition" RoleDefinitionFileType = "alz_role_definition" ArchitectureDefinitionFileType = "alz_architecture_definition" ArchetypeDefinitionFileType = "alz_archetype_definition" ArchetypeOverrideFileType = "alz_archetype_override" PolicyDefaultValuesFileType = "alz_policy_default_values" )
These are the file prefixes for the resource types.
Variables ¶
var ( // ErrResourceAlreadyExists is returned when a resource already exists in the result. ErrResourceAlreadyExists = errors.New("resource already exists in the result") // ErrNoNameProvided is returned when no name was provided for the resource. ErrNoNameProvided = errors.New("no name provided for the resource, cannot process it without a name") // ErrUnmarshaling is returned when unmarshaling fails. ErrUnmarshaling = errors.New("error converting data from YAML/JSON, please check the file format and content") // ErrMultipleDefaultPolicyValuesFileFound is returned when multiple default policy values files are found. ErrMultipleDefaultPolicyValuesFileFound = errors.New("multiple default policy values files found, only one is allowed") // ErrProcessingFile is returned when there is an error processing the file. ErrProcessingFile = errors.New("error processing file, please check the file format and content") )
Functions ¶
func NewErrNoNameProvided ¶ added in v0.27.0
NewErrNoNameProvided creates a new error indicating that no name was provided for the resource.
func NewErrResourceAlreadyExists ¶ added in v0.27.0
NewErrResourceAlreadyExists creates a new error indicating that a resource already exists in the result.
func NewErrorUnmarshaling ¶ added in v0.27.0
NewErrorUnmarshaling creates a new error indicating that unmarshaling failed.
Types ¶
type Client ¶ added in v0.27.0
type Client struct {
// contains filtered or unexported fields
}
Client is the client that is used to process the library files.
func (*Client) Metadata ¶ added in v0.27.0
func (client *Client) Metadata() (*LibMetadata, error)
Metadata returns the metadata of the library.
type LibArchetype ¶
type LibArchetype struct { Name string `json:"name" yaml:"name"` PolicyAssignments mapset.Set[string] `json:"policy_assignments" yaml:"policy_assignments"` PolicyDefinitions mapset.Set[string] `json:"policy_definitions" yaml:"policy_definitions"` PolicySetDefinitions mapset.Set[string] `json:"policy_set_definitions" yaml:"policy_set_definitions"` RoleDefinitions mapset.Set[string] `json:"role_definitions" yaml:"role_definitions"` }
LibArchetype represents an archetype definition file, it used to construct the Archetype struct and is then added to the AlzLib struct.
func (*LibArchetype) UnmarshalJSON ¶
func (la *LibArchetype) UnmarshalJSON(data []byte) error
UnmarshalJSON creates a LibArchetype from the supplied JSON bytes.
func (*LibArchetype) UnmarshalYAML ¶
func (la *LibArchetype) UnmarshalYAML(n *yaml.Node) error
UnmarshalYAML creates a LibArchetype from the supplied JSON bytes.
type LibArchetypeOverride ¶
type LibArchetypeOverride struct { Name string `json:"name" yaml:"name"` BaseArchetype string `json:"base_archetype" yaml:"base_archetype"` PolicyAssignmentsToAdd mapset.Set[string] `json:"policy_assignments_to_add" yaml:"policy_assignments_to_add"` PolicyAssignmentsToRemove mapset.Set[string] `json:"policy_assignments_to_remove" yaml:"policy_assignments_to_remove"` //nolint:lll PolicyDefinitionsToAdd mapset.Set[string] `json:"policy_definitions_to_add" yaml:"policy_definitions_to_add"` PolicyDefinitionsToRemove mapset.Set[string] `json:"policy_definitions_to_remove" yaml:"policy_definitions_to_remove"` //nolint:lll PolicySetDefinitionsToAdd mapset.Set[string] `json:"policy_set_definitions_to_add" yaml:"policy_set_definitions_to_add"` //nolint:lll PolicySetDefinitionsToRemove mapset.Set[string] `json:"policy_set_definitions_to_remove" yaml:"policy_set_definitions_to_remove"` //nolint:lll RoleDefinitionsToAdd mapset.Set[string] `json:"role_definitions_to_add" yaml:"role_definitions_to_add"` RoleDefinitionsToRemove mapset.Set[string] `json:"role_definitions_to_remove" yaml:"role_definitions_to_remove"` }
LibArchetypeOverride represents an archetype override definition file, it used to construct generate a new Archetype struct from an existing full archetype and is then added to the AlzLib struct.
func (*LibArchetypeOverride) UnmarshalJSON ¶
func (lao *LibArchetypeOverride) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for LibArchetypeOverride.
func (*LibArchetypeOverride) UnmarshalYAML ¶
func (lao *LibArchetypeOverride) UnmarshalYAML(n *yaml.Node) error
UnmarshalYAML implements the yaml.Unmarshaler interface for LibArchetypeOverride.
type LibArchitecture ¶
type LibArchitecture struct { Name string `json:"name" yaml:"name"` ManagementGroups []LibArchitectureManagementGroup `json:"management_groups" yaml:"management_groups"` }
LibArchitecture represents a management group hierarchy in the library.
func (*LibArchitecture) UnmarshalJSON ¶
func (la *LibArchitecture) UnmarshalJSON(data []byte) error
UnmarshalJSON creates a LibArchitecture from the supplied JSON bytes.
func (*LibArchitecture) UnmarshalYAML ¶
func (la *LibArchitecture) UnmarshalYAML(n *yaml.Node) error
UnmarshalYAML creates a LibArchitecture from the supplied JSON bytes.
type LibArchitectureManagementGroup ¶
type LibArchitectureManagementGroup struct { ID string `json:"id" yaml:"id"` DisplayName string `json:"display_name" yaml:"display_name"` Archetypes mapset.Set[string] `json:"archetypes" yaml:"archetypes"` ParentID *string `json:"parent_id" yaml:"parent_id"` Exists bool `json:"exists" yaml:"exists"` }
LibArchitectureManagementGroup represents a management group in the library.
type LibDefaultPolicyValueAssignments ¶
type LibDefaultPolicyValueAssignments struct { PolicyAssignmentName string `json:"policy_assignment_name" yaml:"policy_assignment_name"` ParameterNames []string `json:"parameter_names" yaml:"parameter_names"` }
LibDefaultPolicyValueAssignments represents the policy assignments for a default value.
type LibDefaultPolicyValues ¶
type LibDefaultPolicyValues struct {
Defaults []LibDefaultPolicyValuesDefaults `json:"defaults" yaml:"defaults"`
}
LibDefaultPolicyValues represents the top level value that allow a single value to be mapped into different assignments.
type LibDefaultPolicyValuesDefaults ¶
type LibDefaultPolicyValuesDefaults struct { DefaultName string `json:"default_name" yaml:"default_name"` Description string `json:"description,omitempty" yaml:"description"` PolicyAssignments []LibDefaultPolicyValueAssignments `json:"policy_assignments" yaml:"policy_assignments"` }
LibDefaultPolicyValuesDefaults represents the default policy values that allow a single value to be mapped into different assignments.
type LibMetadata ¶
type LibMetadata struct { Name string `json:"name" yaml:"name"` // The name of the library member DisplayName string `json:"display_name" yaml:"display_name"` // The display name of the library member Description string `json:"description" yaml:"description"` // The description of the library member // The dependencies of the library member in the format of "path/tag", e.g. "platform/alz/2024.03.0 Dependencies []LibMetadataDependency `json:"dependencies" yaml:"dependencies"` // The relative path to the library member, e.g. "platform/alz" Path string `json:"path" yaml:"path"` }
LibMetadata represents the metadata of a library member in the ALZ Library.
type LibMetadataDependency ¶
type LibMetadataDependency struct { // The relative path to the library member within the ALZ Library, e.g. "platform/alz" Path string `json:"path" yaml:"path"` Ref string `json:"ref" yaml:"ref"` // The calver tag of the library member, e.g. "2024.03.0" // The custom URL (go-getter path) of the library member, used when the library member is not in the ALZ Library CustomURL string `json:"custom_url" yaml:"custom_url"` }
LibMetadataDependency represents a dependency of a library member. Use either Path + Ref or CustomUrl.
type Result ¶
type Result struct { PolicyDefinitions map[string]*assets.PolicyDefinition PolicySetDefinitions map[string]*assets.PolicySetDefinition PolicyAssignments map[string]*assets.PolicyAssignment RoleDefinitions map[string]*assets.RoleDefinition LibArchetypes map[string]*LibArchetype LibArchetypeOverrides map[string]*LibArchetypeOverride LibDefaultPolicyValues map[string]*LibDefaultPolicyValuesDefaults LibArchitectures map[string]*LibArchitecture Metadata *LibMetadata // contains filtered or unexported fields }
Result is the structure that gets built by scanning the library files.