legacy

package
v0.0.0-...-837eb61 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

README

Legacy IAM V2 Migration

All the code in this folder is copied legacy migration code to upgrade all installs to IAM V2. All code assumes a specific schema at a single point in the migration path.

UNLESS MIGRATIONS START FAILING, THIS CODE SHOULD NEVER NEED TO BE MODIFIED. TREAT THIS CODE LIKE A MIGRATION.

Documentation

Index

Constants

View Source
const (
	// Custom represents a policy created by the enduser.
	Custom v2Type = 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
)
View Source
const (
	// Allow represents the allow case for a Statement Effect.
	Allow v2Effect = iota
	// Deny represents the deny case for a Statement Effect.
	Deny
)

Variables

This section is empty.

Functions

func MigrateToV2

func MigrateToV2(ctx context.Context, db *sql.DB, shouldMigrateV1Policies bool) error

MigrateToV2 inserts needed IAM v2 resources into the db and migrates any valid v1 policies

func MigrationStatus

func MigrationStatus(ctx context.Context, db *sql.DB) (isOnV1, isDirty bool, err error)

func NewEffect

func NewEffect(in string) (v2Effect, error)

NewEffect converts a string to an Effect or returns an error.

func NewType

func NewType(in string) (v2Type, error)

NewType converts a string to a Type or returns an error.

func RecordMigrationStatus

func RecordMigrationStatus(ctx context.Context, ms string, db *sql.DB) error

func ResetIAMDb

func ResetIAMDb(ctx context.Context, db *sql.DB) error

Types

This section is empty.

Directories

Path Synopsis
constants
v1
v2

Jump to

Keyboard shortcuts

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