processor

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

package processor is used to process the library files and read them into a result struct for Alzlib to use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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"`
	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"`
	PolicySetDefinitionsToAdd    mapset.Set[string] `json:"policy_set_definitions_to_add" yaml:"policy_set_definitions_to_add"`
	PolicySetDefinitionsToRemove mapset.Set[string] `json:"policy_set_definitions_to_remove" yaml:"policy_set_definitions_to_remove"`
	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

func (*LibArchetypeOverride) UnmarshalYAML

func (lao *LibArchetypeOverride) UnmarshalYAML(n *yaml.Node) error

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

UnmarshalJSON 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"`
}

type LibDefaultPolicyValues

type LibDefaultPolicyValues struct {
	Defaults []LibDefaultPolicyValuesDefaults `json:"defaults" yaml:"defaults"`
}

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"`
}

LibDefaultPolicyValues 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
	Dependencies []LibMetadataDependency `json:"dependencies" yaml:"dependencies"` // The dependencies of the library member in the format of "path/tag", e.g. "platform/alz/2024.03.0
	Path         string                  `json:"path" yaml:"path"`                 // The relative path to the library member, e.g. "platform/alz"
}

type LibMetadataDependency

type LibMetadataDependency struct {
	Path      string `json:"path" yaml:"path"`             // The relative path to the library member within the ALZ Library, e.g. "platform/alz"
	Ref       string `json:"ref" yaml:"ref"`               // The calver tag of the library member, e.g. "2024.03.0"
	CustomUrl string `json:"custom_url" yaml:"custom_url"` // The custom URL (go-getter path) of the library member, used when the library member is not in the ALZ Library
}

LibMetadataDependency represents a dependency of a library member. Use either Path + Ref or CustomUrl.

type ProcessorClient

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

ProcessorClient is the client that is used to process the library files.

func NewProcessorClient

func NewProcessorClient(fs fs.FS) *ProcessorClient

func (*ProcessorClient) Metadata

func (client *ProcessorClient) Metadata() (*LibMetadata, error)

Metadata returns the metadata of the library.

func (*ProcessorClient) Process

func (client *ProcessorClient) Process(res *Result) error

Process reads the library files and processes them into a Result. Pass in a pointer to a Result struct to store the processed data, create a new *Result with NewResult().

type Result

type Result struct {
	PolicyDefinitions      map[string]*armpolicy.Definition
	PolicySetDefinitions   map[string]*armpolicy.SetDefinition
	PolicyAssignments      map[string]*armpolicy.Assignment
	RoleDefinitions        map[string]*armauthorization.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.

func NewResult

func NewResult() *Result

Jump to

Keyboard shortcuts

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