Documentation
¶
Overview ¶
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
Package alzlib provides the data structures needed to deploy Azure Landing Zones. It contains the custom Azure policies and policy sets needed to deploy the reference architecture. It also gets the referenced built-in definitions from the Azure Policy service.
Internally the Azure SDK is used to store the resources in memory. It is up to the caller to transform this data into the required format for deployment.
Index ¶
- func FetchAzureLandingZonesLibraryMember(ctx context.Context, member, tag, dst string) (fs.FS, error)
- func FetchLibraryByGetterString(ctx context.Context, getterString, dstDir string) (fs.FS, error)
- type AlzLib
- func (az *AlzLib) AddPolicyAssignments(pas ...*assets.PolicyAssignment) error
- func (az *AlzLib) AddPolicyClient(client *armpolicy.ClientFactory)
- func (az *AlzLib) AddPolicyDefinitions(pds ...*assets.PolicyDefinition) error
- func (az *AlzLib) AddPolicySetDefinitions(psds ...*assets.PolicySetDefinition) error
- func (az *AlzLib) AddRoleDefinitions(rds ...*assets.RoleDefinition) error
- func (az *AlzLib) Archetype(name string) (*Archetype, error)
- func (az *AlzLib) Archetypes() []string
- func (az *AlzLib) Architecture(name string) (*Architecture, error)
- func (az *AlzLib) GetDefinitionsFromAzure(ctx context.Context, pds []string) error
- func (az *AlzLib) Init(ctx context.Context, libs ...fs.FS) error
- func (az *AlzLib) PolicyAssignment(name string) (*assets.PolicyAssignment, error)
- func (az *AlzLib) PolicyAssignmentExists(name string) bool
- func (az *AlzLib) PolicyDefinition(name string) (*assets.PolicyDefinition, error)
- func (az *AlzLib) PolicyDefinitionExists(name string) bool
- func (az *AlzLib) PolicySetDefinition(name string) (*assets.PolicySetDefinition, error)
- func (az *AlzLib) PolicySetDefinitionExists(name string) bool
- func (az *AlzLib) RoleDefinition(name string) (*assets.RoleDefinition, error)
- func (az *AlzLib) RoleDefinitionExists(name string) bool
- type AlzLibOptions
- type Archetype
- type Architecture
- type ArchitectureManagementGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchAzureLandingZonesLibraryMember ¶ added in v0.14.0
func FetchAzureLandingZonesLibraryMember(ctx context.Context, member, tag, dst string) (fs.FS, error)
FetchAzureLandingZonesLibraryByTag is a convenience function to fetch the Azure Landing Zones library by member and tag. It calls FetchLibraryByGetterString with the appropriate URL. The destination directory will be appended to the .alzlib directory in the current working directory. To fetch the ALZ reference, supply "platform/alz" as the member, with the tag (e.g. 2024.03.03).
func FetchLibraryByGetterString ¶ added in v0.14.0
FetchLibraryByGetterString fetches a library from a URL using the go-getter library. The caller must supply a valid go-getter URL and a destination directory, which will be appended to the .alzlib directory in the current working directory. It returns an fs.FS interface to the fetched library to be used in the AlzLib.Init() method.
Types ¶
type AlzLib ¶
type AlzLib struct {
Options *AlzLibOptions
// contains filtered or unexported fields
}
AlzLib is the structure that gets built from the the library files do not create this directly, use NewAlzLib instead. Note: this is not thread safe, and should not be used concurrently without an external mutex.
func NewAlzLib ¶
func NewAlzLib(opts *AlzLibOptions) *AlzLib
NewAlzLib returns a new instance of the alzlib library, optionally using the supplied directory for additional policy (set) definitions.
func (*AlzLib) AddPolicyAssignments ¶ added in v0.14.0
func (az *AlzLib) AddPolicyAssignments(pas ...*assets.PolicyAssignment) error
AddPolicyAssignments adds policy assignments to the AlzLib struct.
func (*AlzLib) AddPolicyClient ¶
func (az *AlzLib) AddPolicyClient(client *armpolicy.ClientFactory)
AddPolicyClient adds an authenticated *armpolicy.ClientFactory to the AlzLib struct. This is needed to get policy objects from Azure.
func (*AlzLib) AddPolicyDefinitions ¶ added in v0.14.0
func (az *AlzLib) AddPolicyDefinitions(pds ...*assets.PolicyDefinition) error
AddPolicyDefinitions adds policy definitions to the AlzLib struct.
func (*AlzLib) AddPolicySetDefinitions ¶ added in v0.14.0
func (az *AlzLib) AddPolicySetDefinitions(psds ...*assets.PolicySetDefinition) error
AddPolicySetDefinitions adds policy set definitions to the AlzLib struct.
func (*AlzLib) AddRoleDefinitions ¶ added in v0.14.0
func (az *AlzLib) AddRoleDefinitions(rds ...*assets.RoleDefinition) error
AddRoleDefinitions adds role definitions to the AlzLib struct.
func (*AlzLib) Archetype ¶ added in v0.14.0
Archetype returns a copy of the requested archetype by name. The returned struct can be used as a parameter to the Deployment.AddManagementGroup method.
func (*AlzLib) Archetypes ¶ added in v0.14.0
Archetypes returns a list of the archetypes in the AlzLib struct.
func (*AlzLib) Architecture ¶ added in v0.14.0
func (az *AlzLib) Architecture(name string) (*Architecture, error)
Architecture returns the requested architecture.
func (*AlzLib) GetDefinitionsFromAzure ¶
GetDefinitionsFromAzure takes a slice of strings containing Azure resource IDs of policy definitions and policy set definitions. It then fetches them from Azure if needed and adds them to the AlzLib struct. For set definitions we need to get all of them, even if they exist in AlzLib already because they can contain built-in definitions.
func (*AlzLib) Init ¶
Init processes ALZ libraries, supplied as fs.FS interfaces. Use FetchAzureLandingZonesLibraryMember to get the library from GitHub. It populates the struct with the results of the processing.
func (*AlzLib) PolicyAssignment ¶ added in v0.14.0
func (az *AlzLib) PolicyAssignment(name string) (*assets.PolicyAssignment, error)
GetPolicySetDefinition returns a deep copy of the requested policy set definition. This is safe to modify without affecting the original.
func (*AlzLib) PolicyAssignmentExists ¶
PolicyAssignmentExists returns true if the policy assignment exists in the AlzLib struct.
func (*AlzLib) PolicyDefinition ¶ added in v0.14.0
func (az *AlzLib) PolicyDefinition(name string) (*assets.PolicyDefinition, error)
PolicyDefinition returns a deep copy of the requested policy definition. This is safe to modify without affecting the original.
func (*AlzLib) PolicyDefinitionExists ¶
PolicyDefinitionExists returns true if the policy definition exists in the AlzLib struct.
func (*AlzLib) PolicySetDefinition ¶ added in v0.14.0
func (az *AlzLib) PolicySetDefinition(name string) (*assets.PolicySetDefinition, error)
PolicySetDefinition returns a deep copy of the requested policy set definition. This is safe to modify without affecting the original.
func (*AlzLib) PolicySetDefinitionExists ¶
PolicySetDefinitionExists returns true if the policy set definition exists in the AlzLib struct.
func (*AlzLib) RoleDefinition ¶ added in v0.14.0
func (az *AlzLib) RoleDefinition(name string) (*assets.RoleDefinition, error)
RoleDefinition returns a deep copy of the requested role definition. This is safe to modify without affecting the original.
func (*AlzLib) RoleDefinitionExists ¶
RoleDefinitionExists returns true if the role definition exists in the AlzLib struct.
type AlzLibOptions ¶
type AlzLibOptions struct {
AllowOverwrite bool // AllowOverwrite allows overwriting of existing policy assignments when processing additional libraries with AlzLib.Init()
Parallelism int // Parallelism is the number of parallel requests to make to Azure APIs
}
AlzLibOptions are options for the AlzLib. This is created by NewAlzLib.
type Archetype ¶
type Archetype struct {
PolicyDefinitions mapset.Set[string]
PolicyAssignments mapset.Set[string]
PolicySetDefinitions mapset.Set[string]
RoleDefinitions mapset.Set[string]
// contains filtered or unexported fields
}
Archetype represents the exported archetype definition that hasn't been assigned to a management group The contents of the sets represent the map keys of the corresponding AlzLib maps.
func NewArchetype ¶ added in v0.14.0
type Architecture ¶ added in v0.14.0
type Architecture struct {
// contains filtered or unexported fields
}
func NewArchitecture ¶ added in v0.14.0
func NewArchitecture(name string, az *AlzLib) *Architecture
func (*Architecture) RootMgs ¶ added in v0.14.0
func (a *Architecture) RootMgs() (res []*ArchitectureManagementGroup)
type ArchitectureManagementGroup ¶ added in v0.14.0
type ArchitectureManagementGroup struct {
// contains filtered or unexported fields
}
func (*ArchitectureManagementGroup) Archetypes ¶ added in v0.14.0
func (mg *ArchitectureManagementGroup) Archetypes() (res []*Archetype)
func (*ArchitectureManagementGroup) Children ¶ added in v0.14.0
func (mg *ArchitectureManagementGroup) Children() (res []*ArchitectureManagementGroup)
func (*ArchitectureManagementGroup) DisplayName ¶ added in v0.14.0
func (mg *ArchitectureManagementGroup) DisplayName() string
func (*ArchitectureManagementGroup) Id ¶ added in v0.14.0
func (mg *ArchitectureManagementGroup) Id() string
Directories
¶
| Path | Synopsis |
|---|---|
|
package assets provides the types used by the Alzlib library.
|
package assets provides the types used by the Alzlib library. |
|
Package deployment contains the types and methods for managing the deployment of an Azure management group hierarchy using the supplied Alzlib.
|
Package deployment contains the types and methods for managing the deployment of an Azure management group hierarchy using the supplied Alzlib. |
|
package processor is used to process the library files and read them into a result struct for Alzlib to use.
|
package processor is used to process the library files and read them into a result struct for Alzlib to use. |
|
Package to contains various type-conversion helper functions.
|
Package to contains various type-conversion helper functions. |
|
tools
|
|
|
alzlibtool
command
|
|