Skip to content

Commit

Permalink
Revert "xtractl: add support for values"
Browse files Browse the repository at this point in the history
This reverts commit 0d09a47.
  • Loading branch information
azahnen committed Apr 25, 2024
1 parent bb914d0 commit 339532c
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 320 deletions.
70 changes: 1 addition & 69 deletions xtractl/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ type entity struct {
Status string
}

// Value is
type Value struct {
Path, Typ string
}

type value struct {
Path string
}

// LogStatus is
type LogStatus struct {
Level string
Expand Down Expand Up @@ -124,65 +115,6 @@ func (client Client) Reload(ids []string, types []string) error {
return err
}

// Values is
func (client Client) Values() ([]Value, []string, error) {

body, err := client.Request("/values", "GET", false, nil, "")

if err != nil {
return nil, nil, err
}

if body != nil {
var result map[string][]value
err := json.Unmarshal(body, &result)

if err != nil {
return nil, nil, err
}

var values []Value

// needed to preserve order
types := make([]string, 0)
for typ := range result {
types = append(types, typ)
}
sort.Strings(types)

for _, typ := range types {
for _, value := range result[typ] {
values = append(values, Value{value.Path, typ})
}
}

return values, types, nil
}

return nil, nil, nil
}

// ValuesJson is
func (client Client) ValuesJson() ([]byte, error) {

body, err := client.Request("/values", "GET", false, nil, "")

if err != nil {
return nil, err
}
return body, nil
}

// ReloadValue is
func (client Client) ReloadValue(paths []string) error {

query := fmt.Sprintf("?paths=%s", strings.Join(paths, ","))

_, err := client.Request("/tasks/reload-values"+query, "POST", true, nil, "")

return err
}

// LogStatus is
func (client Client) LogStatusJson() ([]byte, error) {

Expand Down Expand Up @@ -271,7 +203,7 @@ func (client Client) PurgeTileCache(id string, collection string, tileMatrixSet

func (client Client) Request(path string, method string, ignoreBody bool, reqBody io.Reader, token string) (body []byte, err error) {

var uri = fmt.Sprintf("%s://%s:%d/api%s", client.protocol, *client.host, *client.port, path)
var uri = fmt.Sprintf("%s://%s:%d%s", client.protocol, *client.host, *client.port, path)

if *client.debug {
fmt.Println("->", uri)
Expand Down
4 changes: 1 addition & 3 deletions xtractl/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/interactive-instruments/xtraplatform-cli/xtractl/cmd/entity"
"github.com/interactive-instruments/xtraplatform-cli/xtractl/cmd/log"
"github.com/interactive-instruments/xtraplatform-cli/xtractl/cmd/tiles"
"github.com/interactive-instruments/xtraplatform-cli/xtractl/cmd/value"

// "github.com/AlecAivazis/survey/v2"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -71,11 +70,10 @@ func init() {
api = *client.New(host, port, &password, debug)

entityCmd := entity.Cmd(api, name, debug)
valueCmd := value.Cmd(api, name, debug)
logCmd := log.Cmd(api, name, debug)
tilesCmd := tiles.Cmd(api, name, debug)

RootCmd.AddCommand(entityCmd, valueCmd, logCmd, tilesCmd)
RootCmd.AddCommand(entityCmd, logCmd, tilesCmd)

for _, c := range entityCmd.Commands() {
if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
Expand Down
108 changes: 0 additions & 108 deletions xtractl/cmd/value/ls.go

This file was deleted.

66 changes: 0 additions & 66 deletions xtractl/cmd/value/reload.go

This file was deleted.

74 changes: 0 additions & 74 deletions xtractl/cmd/value/value.go

This file was deleted.

0 comments on commit 339532c

Please sign in to comment.