mirror of
https://github.com/openziti/zrok.git
synced 2025-06-19 17:27:54 +02:00
env_core.Environment.Token -> env_core.Environment.AccountToken (#820); new 'zrok rebase' tree with 'zrok rebase apiEndpoint' and 'zrok rebase accountToken' (#897)
This commit is contained in:
parent
6006410ae6
commit
cf3f3c1fd6
@ -14,7 +14,7 @@ FEATURE: `zrok share [public|private|reserved]` and `zrok access private` now au
|
|||||||
|
|
||||||
FEATURE: `zrok access private` supports a new `--auto` mode, which can automatically find an available open address/port to bind the frontend listener on. Also includes `--auto-address`, `--auto-start-port`, and `--auto-end-port` features with sensible defaults. Supported by both the agent and local operating modes (https://github.com/openziti/zrok/issues/780)
|
FEATURE: `zrok access private` supports a new `--auto` mode, which can automatically find an available open address/port to bind the frontend listener on. Also includes `--auto-address`, `--auto-start-port`, and `--auto-end-port` features with sensible defaults. Supported by both the agent and local operating modes (https://github.com/openziti/zrok/issues/780)
|
||||||
|
|
||||||
FEATURE: `zrok rebase` command allows "rebasing" an enabled environment onto a different API endpoint. This is useful for migrating already-enabled environments between endpoints supporting different zrok versions (https://github.com/openziti/zrok/issues/869)
|
FEATURE: `zrok rebase` commands (`zrok rebase apiEndpoint` and `zrok rebase accountToken`) allows "rebasing" an enabled environment onto a different API endpoint or a different account token. This is useful for migrating already-enabled environments between endpoints supporting different zrok versions, and is also useful when regenerating an account token (https://github.com/openziti/zrok/issues/869, https://github.com/openziti/zrok/issues/897)
|
||||||
|
|
||||||
FEATURE: `zrok test canary` CLI tree replaces the old `zrok test loop` tree; new `zrok test canary public-proxy` and `zrok test canary private-proxy` provide modernized, updated versions of what the `zrok test loop` commands used to do. This new approach will serve as the foundation for all future zrok testing infrastructure (https://github.com/openziti/zrok/issues/771)
|
FEATURE: `zrok test canary` CLI tree replaces the old `zrok test loop` tree; new `zrok test canary public-proxy` and `zrok test canary private-proxy` provide modernized, updated versions of what the `zrok test loop` commands used to do. This new approach will serve as the foundation for all future zrok testing infrastructure (https://github.com/openziti/zrok/issues/771)
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ func (cmd *accessPrivateCommand) accessLocal(args []string, root env_core.Root)
|
|||||||
cmd.error(err)
|
cmd.error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().Token)
|
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().AccountToken)
|
||||||
req := share.NewAccessParams()
|
req := share.NewAccessParams()
|
||||||
req.Body.ShareToken = shrToken
|
req.Body.ShareToken = shrToken
|
||||||
req.Body.EnvZID = root.Environment().ZitiIdentity
|
req.Body.EnvZID = root.Environment().ZitiIdentity
|
||||||
|
@ -49,7 +49,7 @@ func (cmd *disableCommand) run(_ *cobra.Command, _ []string) {
|
|||||||
}
|
}
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
auth := httpTransport.APIKeyAuth("X-TOKEN", "header", env.Environment().Token)
|
auth := httpTransport.APIKeyAuth("X-TOKEN", "header", env.Environment().AccountToken)
|
||||||
req := restEnvironment.NewDisableParams()
|
req := restEnvironment.NewDisableParams()
|
||||||
req.Body.Identity = env.Environment().ZitiIdentity
|
req.Body.Identity = env.Environment().ZitiIdentity
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ func (cmd *enableCommand) run(_ *cobra.Command, args []string) {
|
|||||||
prg.Send("writing the environment details...")
|
prg.Send("writing the environment details...")
|
||||||
}
|
}
|
||||||
apiEndpoint, _ := env.ApiEndpoint()
|
apiEndpoint, _ := env.ApiEndpoint()
|
||||||
if err := env.SetEnvironment(&env_core.Environment{Token: token, ZitiIdentity: resp.Payload.Identity, ApiEndpoint: apiEndpoint}); err != nil {
|
if err := env.SetEnvironment(&env_core.Environment{AccountToken: token, ZitiIdentity: resp.Payload.Identity, ApiEndpoint: apiEndpoint}); err != nil {
|
||||||
if !cmd.headless && prg != nil {
|
if !cmd.headless && prg != nil {
|
||||||
prg.Send(fmt.Sprintf("there was an error saving the new environment: %v", err))
|
prg.Send(fmt.Sprintf("there was an error saving the new environment: %v", err))
|
||||||
prg.Quit()
|
prg.Quit()
|
||||||
|
@ -33,6 +33,7 @@ func init() {
|
|||||||
rootCmd.AddCommand(modifyCmd)
|
rootCmd.AddCommand(modifyCmd)
|
||||||
organizationCmd.AddCommand(organizationAdminCmd)
|
organizationCmd.AddCommand(organizationAdminCmd)
|
||||||
rootCmd.AddCommand(organizationCmd)
|
rootCmd.AddCommand(organizationCmd)
|
||||||
|
rootCmd.AddCommand(rebaseCmd)
|
||||||
rootCmd.AddCommand(shareCmd)
|
rootCmd.AddCommand(shareCmd)
|
||||||
rootCmd.AddCommand(testCmd)
|
rootCmd.AddCommand(testCmd)
|
||||||
testCmd.AddCommand(testCanaryCmd)
|
testCmd.AddCommand(testCanaryCmd)
|
||||||
@ -126,6 +127,11 @@ var organizationCmd = &cobra.Command{
|
|||||||
Short: "Organization commands",
|
Short: "Organization commands",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rebaseCmd = &cobra.Command{
|
||||||
|
Use: "rebase",
|
||||||
|
Short: "Rebase enabled zrok environment",
|
||||||
|
}
|
||||||
|
|
||||||
var shareCmd = &cobra.Command{
|
var shareCmd = &cobra.Command{
|
||||||
Use: "share",
|
Use: "share",
|
||||||
Short: "Create backend access for shares",
|
Short: "Create backend access for shares",
|
||||||
|
@ -54,7 +54,7 @@ func (cmd *modifyShareCommand) run(_ *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().Token)
|
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().AccountToken)
|
||||||
|
|
||||||
if len(cmd.addAccessGrants) > 0 || len(cmd.removeAccessGrants) > 0 {
|
if len(cmd.addAccessGrants) > 0 || len(cmd.removeAccessGrants) > 0 {
|
||||||
req := share.NewUpdateShareParams()
|
req := share.NewUpdateShareParams()
|
||||||
|
@ -50,7 +50,7 @@ func (c *orgAdminListCommand) run(_ *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().Token)
|
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().AccountToken)
|
||||||
|
|
||||||
req := metadata.NewListOrgMembersParams()
|
req := metadata.NewListOrgMembersParams()
|
||||||
req.OrganizationToken = args[0]
|
req.OrganizationToken = args[0]
|
||||||
|
@ -51,7 +51,7 @@ func (cmd *orgAdminOverviewCommand) run(_ *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
req.Header.Add("X-TOKEN", root.Environment().Token)
|
req.Header.Add("X-TOKEN", root.Environment().AccountToken)
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !panicInstead {
|
if !panicInstead {
|
||||||
|
@ -49,7 +49,7 @@ func (c *orgMembershipsCommand) run(_ *cobra.Command, _ []string) {
|
|||||||
}
|
}
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().Token)
|
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().AccountToken)
|
||||||
|
|
||||||
in, err := zrok.Metadata.ListMemberships(nil, auth)
|
in, err := zrok.Metadata.ListMemberships(nil, auth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
66
cmd/zrok/rebaseAccountToken.go
Normal file
66
cmd/zrok/rebaseAccountToken.go
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"fmt"
|
||||||
|
"github.com/openziti/zrok/environment"
|
||||||
|
"github.com/openziti/zrok/tui"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rebaseCmd.AddCommand(newRebaseAccountTokenCommand().cmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
type rebaseAccountTokenCommand struct {
|
||||||
|
cmd *cobra.Command
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRebaseAccountTokenCommand() *rebaseAccountTokenCommand {
|
||||||
|
cmd := &cobra.Command{
|
||||||
|
Use: "accountToken <accountToken>",
|
||||||
|
Short: "Rebase an enabled environment onto a different account token",
|
||||||
|
Args: cobra.ExactArgs(1),
|
||||||
|
}
|
||||||
|
command := &rebaseAccountTokenCommand{cmd: cmd}
|
||||||
|
cmd.Run = command.run
|
||||||
|
return command
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cmd *rebaseAccountTokenCommand) run(_ *cobra.Command, args []string) {
|
||||||
|
root, err := environment.LoadRoot()
|
||||||
|
if err != nil {
|
||||||
|
tui.Error("error loading root", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !root.IsEnabled() {
|
||||||
|
tui.Error("environment not enabled; 'zrok enable' your environment instead", nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
env := root.Environment()
|
||||||
|
if args[0] != env.AccountToken {
|
||||||
|
fmt.Printf("this action will rebase your enabled environment to use the account token '%v'\n", args[0])
|
||||||
|
fmt.Println()
|
||||||
|
fmt.Println("you should only proceed if you understand why you're doing this!")
|
||||||
|
fmt.Println()
|
||||||
|
fmt.Print("to proceed, type 'yes': ")
|
||||||
|
scanner := bufio.NewScanner(os.Stdin)
|
||||||
|
if scanner.Scan() {
|
||||||
|
text := scanner.Text()
|
||||||
|
if text != "yes" {
|
||||||
|
tui.Error("rebase aborted!", nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Println()
|
||||||
|
|
||||||
|
env.AccountToken = args[0]
|
||||||
|
if err := root.SetEnvironment(env); err != nil {
|
||||||
|
tui.Error("error rebasing environment", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("environment rebased to account token '%v'\n", env.AccountToken)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("environment already configured to use the account token '%v'\n", env.AccountToken)
|
||||||
|
}
|
||||||
|
}
|
@ -10,25 +10,25 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(newRebaseCommand().cmd)
|
rebaseCmd.AddCommand(newRebaseApiEndpointCommand().cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
type rebaseCommand struct {
|
type rebaseApiEndpointCommand struct {
|
||||||
cmd *cobra.Command
|
cmd *cobra.Command
|
||||||
}
|
}
|
||||||
|
|
||||||
func newRebaseCommand() *rebaseCommand {
|
func newRebaseApiEndpointCommand() *rebaseApiEndpointCommand {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "rebase <apiEndpoint>",
|
Use: "apiEndpoint <apiEndpoint>",
|
||||||
Short: "Rebase an enabled environment onto a different API endpoint URL",
|
Short: "Rebase an enabled environment onto a different API endpoint URL",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
}
|
}
|
||||||
command := &rebaseCommand{cmd: cmd}
|
command := &rebaseApiEndpointCommand{cmd: cmd}
|
||||||
cmd.Run = command.run
|
cmd.Run = command.run
|
||||||
return command
|
return command
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *rebaseCommand) run(_ *cobra.Command, args []string) {
|
func (cmd *rebaseApiEndpointCommand) run(_ *cobra.Command, args []string) {
|
||||||
root, err := environment.LoadRoot()
|
root, err := environment.LoadRoot()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tui.Error("error loading root", err)
|
tui.Error("error loading root", err)
|
||||||
@ -40,7 +40,7 @@ func (cmd *rebaseCommand) run(_ *cobra.Command, args []string) {
|
|||||||
|
|
||||||
currentEndpoint, _ := root.ApiEndpoint()
|
currentEndpoint, _ := root.ApiEndpoint()
|
||||||
if args[0] != currentEndpoint {
|
if args[0] != currentEndpoint {
|
||||||
fmt.Printf("this action will rebase your enabled environment to use the zrok API at: %v\n", currentEndpoint)
|
fmt.Printf("this action will rebase your enabled environment to use the zrok API at: %v\n", args[0])
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println("you should only proceed if you understand why you're doing this!")
|
fmt.Println("you should only proceed if you understand why you're doing this!")
|
||||||
fmt.Println()
|
fmt.Println()
|
@ -50,7 +50,7 @@ func (cmd *releaseCommand) run(_ *cobra.Command, args []string) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", env.Environment().Token)
|
auth := httptransport.APIKeyAuth("X-TOKEN", "header", env.Environment().AccountToken)
|
||||||
req := share.NewUnshareParams()
|
req := share.NewUnshareParams()
|
||||||
req.Body.EnvZID = env.Environment().ZitiIdentity
|
req.Body.EnvZID = env.Environment().ZitiIdentity
|
||||||
req.Body.ShareToken = shrToken
|
req.Body.ShareToken = shrToken
|
||||||
|
@ -105,7 +105,7 @@ func (cmd *shareReservedCommand) shareLocal(args []string, root env_core.Root) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
cmd.error("unable to create zrok client", err)
|
cmd.error("unable to create zrok client", err)
|
||||||
}
|
}
|
||||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().Token)
|
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().AccountToken)
|
||||||
req := metadata.NewGetShareDetailParams()
|
req := metadata.NewGetShareDetailParams()
|
||||||
req.ShareToken = shrToken
|
req.ShareToken = shrToken
|
||||||
resp, err := zrok.Metadata.GetShareDetail(req, auth)
|
resp, err := zrok.Metadata.GetShareDetail(req, auth)
|
||||||
|
@ -67,14 +67,14 @@ func (cmd *statusCommand) run(_ *cobra.Command, _ []string) {
|
|||||||
t.SetStyle(table.StyleColoredDark)
|
t.SetStyle(table.StyleColoredDark)
|
||||||
t.AppendHeader(table.Row{"Property", "Value"})
|
t.AppendHeader(table.Row{"Property", "Value"})
|
||||||
if cmd.secrets {
|
if cmd.secrets {
|
||||||
t.AppendRow(table.Row{"Secret Token", env.Environment().Token})
|
t.AppendRow(table.Row{"Account Token", env.Environment().AccountToken})
|
||||||
t.AppendRow(table.Row{"Ziti Identity", env.Environment().ZitiIdentity})
|
t.AppendRow(table.Row{"Ziti Identity", env.Environment().ZitiIdentity})
|
||||||
} else {
|
} else {
|
||||||
secretToken := "<<SET>>"
|
secretToken := "<<SET>>"
|
||||||
if env.Environment().Token == "" {
|
if env.Environment().AccountToken == "" {
|
||||||
secretToken = "<<UNSET>>"
|
secretToken = "<<UNSET>>"
|
||||||
}
|
}
|
||||||
t.AppendRow(table.Row{"Secret Token", secretToken})
|
t.AppendRow(table.Row{"Account Token", secretToken})
|
||||||
|
|
||||||
zId := "<<SET>>"
|
zId := "<<SET>>"
|
||||||
if env.Environment().ZitiIdentity == "" {
|
if env.Environment().ZitiIdentity == "" {
|
||||||
|
@ -32,7 +32,7 @@ type Root interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Environment struct {
|
type Environment struct {
|
||||||
Token string
|
AccountToken string
|
||||||
ZitiIdentity string
|
ZitiIdentity string
|
||||||
ApiEndpoint string
|
ApiEndpoint string
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ func loadEnvironment() (*env_core.Environment, error) {
|
|||||||
return nil, errors.Wrapf(err, "error unmarshaling environment file '%v'", ef)
|
return nil, errors.Wrapf(err, "error unmarshaling environment file '%v'", ef)
|
||||||
}
|
}
|
||||||
out := &env_core.Environment{
|
out := &env_core.Environment{
|
||||||
Token: env.Token,
|
AccountToken: env.AccountToken,
|
||||||
ZitiIdentity: env.ZId,
|
ZitiIdentity: env.ZId,
|
||||||
ApiEndpoint: env.ApiEndpoint,
|
ApiEndpoint: env.ApiEndpoint,
|
||||||
}
|
}
|
||||||
@ -214,9 +214,9 @@ func loadEnvironment() (*env_core.Environment, error) {
|
|||||||
|
|
||||||
func saveEnvironment(env *env_core.Environment) error {
|
func saveEnvironment(env *env_core.Environment) error {
|
||||||
in := &environment{
|
in := &environment{
|
||||||
Token: env.Token,
|
AccountToken: env.AccountToken,
|
||||||
ZId: env.ZitiIdentity,
|
ZId: env.ZitiIdentity,
|
||||||
ApiEndpoint: env.ApiEndpoint,
|
ApiEndpoint: env.ApiEndpoint,
|
||||||
}
|
}
|
||||||
data, err := json.MarshalIndent(in, "", " ")
|
data, err := json.MarshalIndent(in, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -256,7 +256,7 @@ type config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type environment struct {
|
type environment struct {
|
||||||
Token string `json:"zrok_token"`
|
AccountToken string `json:"zrok_token"`
|
||||||
ZId string `json:"ziti_identity"`
|
ZId string `json:"ziti_identity"`
|
||||||
ApiEndpoint string `json:"api_endpoint"`
|
ApiEndpoint string `json:"api_endpoint"`
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ func loadEnvironment() (*env_core.Environment, error) {
|
|||||||
return nil, errors.Wrapf(err, "error unmarshaling environment file '%v'", ef)
|
return nil, errors.Wrapf(err, "error unmarshaling environment file '%v'", ef)
|
||||||
}
|
}
|
||||||
out := &env_core.Environment{
|
out := &env_core.Environment{
|
||||||
Token: env.Token,
|
AccountToken: env.AccountToken,
|
||||||
ZitiIdentity: env.ZId,
|
ZitiIdentity: env.ZId,
|
||||||
ApiEndpoint: env.ApiEndpoint,
|
ApiEndpoint: env.ApiEndpoint,
|
||||||
}
|
}
|
||||||
@ -291,9 +291,9 @@ func loadEnvironment() (*env_core.Environment, error) {
|
|||||||
|
|
||||||
func saveEnvironment(env *env_core.Environment) error {
|
func saveEnvironment(env *env_core.Environment) error {
|
||||||
in := &environment{
|
in := &environment{
|
||||||
Token: env.Token,
|
AccountToken: env.AccountToken,
|
||||||
ZId: env.ZitiIdentity,
|
ZId: env.ZitiIdentity,
|
||||||
ApiEndpoint: env.ApiEndpoint,
|
ApiEndpoint: env.ApiEndpoint,
|
||||||
}
|
}
|
||||||
data, err := json.MarshalIndent(in, "", " ")
|
data, err := json.MarshalIndent(in, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -335,7 +335,7 @@ type config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type environment struct {
|
type environment struct {
|
||||||
Token string `json:"zrok_token"`
|
AccountToken string `json:"zrok_token"`
|
||||||
ZId string `json:"ziti_identity"`
|
ZId string `json:"ziti_identity"`
|
||||||
ApiEndpoint string `json:"api_endpoint"`
|
ApiEndpoint string `json:"api_endpoint"`
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ func CreateAccess(root env_core.Root, request *AccessRequest) (*Access, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "error getting zrok client")
|
return nil, errors.Wrap(err, "error getting zrok client")
|
||||||
}
|
}
|
||||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().Token)
|
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().AccountToken)
|
||||||
|
|
||||||
in, err := zrok.Share.Access(out, auth)
|
in, err := zrok.Share.Access(out, auth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -40,7 +40,7 @@ func DeleteAccess(root env_core.Root, acc *Access) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "error getting zrok client")
|
return errors.Wrap(err, "error getting zrok client")
|
||||||
}
|
}
|
||||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().Token)
|
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().AccountToken)
|
||||||
|
|
||||||
_, err = zrok.Share.Unaccess(out, auth)
|
_, err = zrok.Share.Unaccess(out, auth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -19,7 +19,7 @@ func Overview(root env_core.Root) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
req.Header.Add("X-TOKEN", root.Environment().Token)
|
req.Header.Add("X-TOKEN", root.Environment().AccountToken)
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -50,7 +50,7 @@ func CreateShare(root env_core.Root, request *ShareRequest) (*Share, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "error getting zrok client")
|
return nil, errors.Wrap(err, "error getting zrok client")
|
||||||
}
|
}
|
||||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().Token)
|
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().AccountToken)
|
||||||
|
|
||||||
in, err := zrok.Share.Share(out, auth)
|
in, err := zrok.Share.Share(out, auth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -104,7 +104,7 @@ func DeleteShare(root env_core.Root, shr *Share) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "error getting zrok client")
|
return errors.Wrap(err, "error getting zrok client")
|
||||||
}
|
}
|
||||||
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().Token)
|
auth := httptransport.APIKeyAuth("X-TOKEN", "header", root.Environment().AccountToken)
|
||||||
|
|
||||||
_, err = zrok.Share.Unshare(req, auth)
|
_, err = zrok.Share.Unshare(req, auth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user