{"modulePath":"github.com/windsorcli/cli","version":"v0.10.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package migrate\n\n## Types\n\n```go\ntype Conflict struct {\n\tContext     string\n\tKeyPath     string\n\tSourceValue any\n\tSourceFile  string\n\tValuesValue any\n\tValuesFile  string\n}\n```\nConflict is a key that holds different values in a v1alpha1 source and in values.yaml.\n\n```go\ntype FileWrite struct {\n\tPath string\n\tData []byte\n}\n```\nFileWrite is a file that Apply writes, with the planned content.\n\n```go\ntype Migrator struct {\n\t// contains filtered or unexported fields\n}\n```\nMigrator reads and writes the files of a project through its shims.\n\n```go\nfunc NewMigrator(s *shims.Shims) *Migrator\n```\nNewMigrator creates a Migrator. A nil argument selects the real file system.\n\n```go\nfunc (m *Migrator) Apply(plan *Plan) error\n```\nApply writes the files of a plan and deletes the context windsor.yaml files. It writes the root file last, so that a failure leaves a project that migrate can read again. A plan with conflicts writes nothing and returns an error.\n\n```go\nfunc (m *Migrator) LegacyFiles(projectRoot string) []string\n```\nLegacyFiles lists the v1alpha1 files of a project. They are the root windsor.yaml when its version is v1alpha1 or missing, and each contexts/\\\u003cname\u003e/windsor.yaml or windsor.yml. It returns nil when the project holds none.\n\n```go\nfunc (m *Migrator) Plan(projectRoot string) (*Plan, error)\n```\nPlan reads the v1alpha1 sources of the project and compares them with each values.yaml. For each context it merges the root contexts.\\\u003cname\u003e map and then contexts/\\\u003cname\u003e/windsor.yaml. It maps provider to platform, and copies a root terraform.driver into every context. A key that only the sources hold is added to values.yaml. A key with a different value is a conflict. A root key other than version, environment, paths, contexts, and terraform.driver fails the plan.\n\n```go\ntype Plan struct {\n\tWrites    []FileWrite\n\tDeletes   []string\n\tConflicts []Conflict\n}\n```\nPlan is the result of reading a project. It lists the files to write and delete and the conflicts that stop the migration. A plan with conflicts writes nothing.\n\n```go\nfunc (p *Plan) Empty() bool\n```\nEmpty reports whether the plan has nothing to write or delete and no conflict.\n\n```go\nfunc (p *Plan) Format(dryRun bool) string\n```\nFormat returns the text that migrate prints for a plan. It lists each conflict with the key path, both values, and both file names. Without conflicts it lists the files to write and delete. A dry run words the list as a plan.\n\n","path":"github.com/windsorcli/cli/pkg/runtime/migrate","name":"migrate","synopsis":"","isRedistributable":true}
