account

package
v2.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIdFieldMissing = errors.New("no ref id field found")
View Source
var ErrIdFieldNoString = errors.New("ref id field is not a string")
View Source
var ErrRefMissing = errors.New("no referenced target found")

Functions

func Validate

func Validate(res *AMResources) error

Validate checks the references in the provided AMResources instance to ensure that all referenced groups and policies exist. It iterates through the users, environment policies, and account policies, validating their references.

Types

type AMResources

type AMResources struct {
	Policies map[string]Policy
	Groups   map[string]Group
	Users    map[string]User
}

func Load

func Load(fs afero.Fs, rootPath string) (*AMResources, error)

Load loads account management resources from YAML configuration files located within the specified root directory path. It parses the YAML files, extracts policies, groups, and users data, and organizes them into a AMResources struct, which is then returned.

func (*AMResources) GroupExists

func (a *AMResources) GroupExists(id string) bool

func (*AMResources) PolicyExists

func (a *AMResources) PolicyExists(id string) bool

type Account

type Account struct {
	Permissions []any `mapstructure:"permissions"`
	Policies    []any `mapstructure:"policies"`
}

type Environment

type Environment struct {
	Name        string `mapstructure:"name"`
	Permissions []any  `mapstructure:"permissions"`
	Policies    []any  `mapstructure:"policies"`
}

type Group

type Group struct {
	ID             string           `mapstructure:"id"`
	Name           string           `mapstructure:"name"`
	Description    string           `mapstructure:"description"`
	Account        *Account         `mapstructure:"account"`
	Environment    []Environment    `mapstructure:"environment"`
	ManagementZone []ManagementZone `mapstructure:"managementZone" yaml:"managementZone"`
}

type Groups

type Groups struct {
	Groups []Group `mapstructure:"groups"`
}

type ManagementZone

type ManagementZone struct {
	Environment    string `mapstructure:"environment"`
	ManagementZone string `mapstructure:"managementZone" yaml:"managementZone"`
	Permissions    []any  `mapstructure:"permissions"`
}

type Policies

type Policies struct {
	Policies []Policy `mapstructure:"policies"`
}

type Policy

type Policy struct {
	ID          string      `mapstructure:"id"`
	Name        string      `mapstructure:"name"`
	Level       interface{} `mapstructure:"level"` // either PolicyLevelAccount or PolicyLevelEnvironment
	Description string      `mapstructure:"description"`
	Policy      string      `mapstructure:"policy"`
}

type PolicyLevelAccount

type PolicyLevelAccount struct {
	Type string `mapstructure:"type"`
}

type PolicyLevelEnvironment

type PolicyLevelEnvironment struct {
	Type        string `mapstructure:"type"`
	Environment string `mapstructure:"environment"`
}

type User

type User struct {
	Email  string `mapstructure:"email"`
	Groups []any  `mapstructure:"groups"`
}

type Users

type Users struct {
	Users []User `mapstructure:"users"`
}

Jump to

Keyboard shortcuts

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