Documentation ¶
Index ¶
- func DefaultProjectIDs() []string
- func MemberSliceToStringSlice(m []Member) []string
- func ValidateProjects(projects []string) error
- type Effect
- type Member
- type MigrationStatus
- type MigrationStatusProvider
- type Policy
- type PolicyChangeNotification
- type PolicyChangeNotifier
- type Project
- type Role
- type Statement
- type Storage
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultProjectIDs ¶
func DefaultProjectIDs() []string
func MemberSliceToStringSlice ¶
MemberSliceToStringSlice returns a slice of the names of members or an empty string slice if the member array is of length zero or nil.
func ValidateProjects ¶
Types ¶
type Effect ¶
type Effect int
Effect is an enum of allow or deny for use in Statements.
func (*Effect) UnmarshalJSON ¶
UnmarshalJSON implements json unmarshalling for an Effect reference so we can pull them out of the database directly as the correct type.
type MigrationStatus ¶
type MigrationStatus int8
const ( Pristine MigrationStatus = iota InProgress Successful SuccessfulBeta1 Failed )
type MigrationStatusProvider ¶
type MigrationStatusProvider interface { // record migration status Pristine(context.Context) error // for reset InProgress(context.Context) error Success(context.Context) error SuccessBeta1(context.Context) error Failure(context.Context) error // retrieve migration status MigrationStatus(context.Context) (MigrationStatus, error) }
type Policy ¶
type Policy struct { ID string `json:"id"` Name string `json:"name"` Members []Member `json:"members"` Statements []Statement `json:"statements"` Type Type `json:"type"` Projects []string `json:"projects"` }
Policy represents a policy definition to be persisted to storage.
func DefaultPolicies ¶
DefaultPolicies shipped with IAM v2, and also the set of policies to which we factory-reset our storage.
type PolicyChangeNotification ¶
type PolicyChangeNotification struct{}
type PolicyChangeNotifier ¶
type PolicyChangeNotifier interface { C() <-chan PolicyChangeNotification Close() error }
type Project ¶
type Project struct { ID string `json:"id"` Name string `json:"name"` Type Type `json:"type"` Projects []string `json:"projects"` }
Project represents a project definition to be persisted to storage.
func DefaultProjects ¶
func DefaultProjects() []Project
DefaultProjects defines the default Chef-managed projects provided on storage reset At present, this list contains internally required projects only, hidden from the user.
func NewProject ¶
NewProject is a factory for creating a Project storage object that also does validation around what a valid project is in terms of our storage layer.
type Role ¶
type Role struct { ID string `json:"id"` Name string `json:"name"` Actions []string `json:"actions"` Type Type `json:"type"` Projects []string `json:"projects"` }
Role represents a role definition to be persisted to storage.
func DefaultRoles ¶
func DefaultRoles() []Role
DefaultRoles defines the default Chef-managed roles provided on storage reset
func NewRole ¶
func NewRole(id string, name string, typeVal Type, actions []string, projects []string) (*Role, error)
NewRole is a factory for creating a Role storage object that also does validation around what a valid role is in terms of our storage layer.
func NewUpdateRole ¶
NewUpdateRole is a factory for modifying an existing role.
type Statement ¶
type Statement struct { ID uuid.UUID `json:"id"` Actions []string `json:"actions"` Resources []string `json:"resources"` Role string `json:"role"` Projects []string `json:"projects"` Effect Effect `json:"effect"` }
Statement must have at least a role OR a non-empty actions list
func NewStatement ¶
func NewStatement(effect Effect, role string, projects, resources, actions []string) (Statement, error)
NewStatement is a factory for creating a Statement storage object that also does validation around what a valid statement is in terms of our storage layer. It also generates a new ID for our statement.
type Storage ¶
type Storage interface { // Reset allows "factory-resetting" IAM v2 policies Reset(context.Context) error // Close closes the connection to the backend Close() error MigrationStatusProvider // contains filtered or unexported methods }
Storage is the interface that both our postgres and memstore storage solutions implement for consistency. The memstore implementation is only used for ease of testing.
type Type ¶
type Type int
Type is an enum to denote custom or chef-managed policy.
const ( // Custom represents a policy created by the enduser. Custom Type = iota // ChefManaged represents a policy created by Chef Software. ChefManaged // System represents a policy that is only loaded directly into OPA // to allow Automate to function correctly without revealing Automate's // internal policies to the customer // This type is only used in the OPA cache (not in API or database) System )
func (*Type) UnmarshalJSON ¶
UnmarshalJSON implements json unmarshalling for a Type reference so we can pull them out of the database directly as the correct type.