From 3dd90fd15d08bbc59031ef67e4356f006f0093f3 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Wed, 12 Jul 2023 16:18:13 -0400 Subject: [PATCH] updated high-level environment framework (#369) --- environment/api.go | 43 +++++++++++++++++++---------------- environment/env_core/model.go | 5 ++++ 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/environment/api.go b/environment/api.go index 8d163d95..4884b091 100644 --- a/environment/api.go +++ b/environment/api.go @@ -1,36 +1,39 @@ package environment 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 { + 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 } -func IsEnabled() (bool, error) { - return env_v0_3.IsEnabled() +func LoadRoot() (Root, error) { + return nil, nil } -func DeleteEnvironment() error { - return env_v0_3.DeleteEnvironment() +func LoadRootVersion(m *env_core.Metadata) (Root, error) { + return nil, nil } -func HasConfig() (bool, error) { - return env_v0_3.HasConfig() -} - -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) +func UpdateRoot(r Root) (Root, error) { + return nil, nil } diff --git a/environment/env_core/model.go b/environment/env_core/model.go index 6ae74a4d..2f7f9da7 100644 --- a/environment/env_core/model.go +++ b/environment/env_core/model.go @@ -9,3 +9,8 @@ type Environment struct { type Config struct { ApiEndpoint string } + +type Metadata struct { + V string + RootPath string +}