updated high-level environment framework (#369)

This commit is contained in:
Michael Quigley 2023-07-12 16:18:13 -04:00
parent 875644398f
commit 3dd90fd15d
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 28 additions and 20 deletions

View File

@ -1,36 +1,39 @@
package environment package environment
import ( import (
"github.com/openziti/zrok/environment/env_v0_3" "github.com/openziti/zrok/environment/env_core"
"github.com/openziti/zrok/rest_client_zrok"
) )
type Root interface { type Root interface {
Metadata() *env_core.Metadata
IsLatest() bool
HasConfig() (bool, error)
Config() *env_core.Config
SetConfig(cfg *env_core.Config) error
Client() (*rest_client_zrok.Zrok, error)
ApiEndpoint() (string, string)
Environment() *env_core.Environment
DeleteEnvironment() error
IsEnabled() (bool, error)
ZitiIdentityFile(name string) (string, error)
SaveZitiIdentity(name, data string) error
DeleteZitiIdentity(name string) error
Obliterate() error
} }
func Load() (Root, error) { func ListRoots() ([]*env_core.Metadata, error) {
return nil, nil return nil, nil
} }
func IsEnabled() (bool, error) { func LoadRoot() (Root, error) {
return env_v0_3.IsEnabled() return nil, nil
} }
func DeleteEnvironment() error { func LoadRootVersion(m *env_core.Metadata) (Root, error) {
return env_v0_3.DeleteEnvironment() return nil, nil
} }
func HasConfig() (bool, error) { func UpdateRoot(r Root) (Root, error) {
return env_v0_3.HasConfig() return nil, nil
}
func ZitiIdentityFile(name string) (string, error) {
return env_v0_3.ZitiIdentityFile(name)
}
func SaveZitiIdentity(name, data string) error {
return env_v0_3.SaveZitiIdentity(name, data)
}
func DeleteZitiIdentity(name string) error {
return env_v0_3.DeleteZitiIdentity(name)
} }

View File

@ -9,3 +9,8 @@ type Environment struct {
type Config struct { type Config struct {
ApiEndpoint string ApiEndpoint string
} }
type Metadata struct {
V string
RootPath string
}