Legacy service extensions imported a lot of the functionality via globals defined at
the package level. The new configuration sources all inputs from
the orchestrator.Orchestrator interface.
The following code snippets are meant only as examples to demonstrate the changes and updates between
the legacy and new service extension interfaces.
// import "github.com/strata-io/service-extension/orchestrator"
// api orchestrator.Orchestrator
logger:=api.Logger()logger.Info("se","this is an info log")logger.Error("se","this is an error log")logger.Debug("se","this is a debug log")
// import "maverics/log"
log.Info("se","this is an info log")log.Error("se","this is an error log")log.Debug("se","this is a debug log")
Secret Provider
// import "github.com/strata-io/service-extension/orchestrator"
// api orchestrator.Orchestrator
secret:=api.SecretProvider()secret.GetString("app1OIDCClientSecret")
// import "github.com/strata-io/service-extension/orchestrator"
// api orchestrator.Orchestrator
azure,err:=api.IdentityProvider("azure")azure.Login(rw,req)
// import "maverics/app"
// ag *app.AppGateway
azure,ok:=ag.IDPs["azure"]azure.CreateRequest().Login(rw,req)
Attribute Provider
// import "github.com/strata-io/service-extension/orchestrator"
// api orchestrator.Orchestrator
ldap,err:=api.AttributeProvider("ldap")attrs,err:=ldap.Query(mail,[]string{"cn","sn","mobile"})
// import "maverics/app"
// ag *app.AppGateway
ldap,ok:=ag.AttrProviders["ldap"]attrs,err:=ldap.Query(mail,[]string{"cn","sn","mobile"})
Session
// import "github.com/strata-io/service-extension/orchestrator"
// api orchestrator.Orchestrator
session,err:=api.Session()isAzureAuth,err:=session.GetString("azure.authenticated")// Now saving information to the session is a two-step process.
err=session.SetString(k,v)err=session.Save()