Remove remaining gRPC references with additional tests
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -20,6 +20,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Fix path traversal vulnerability (CWE-23) by validating overlay names in `overlay.Get()` and `overlay.Create()`
|
- Fix path traversal vulnerability (CWE-23) by validating overlay names in `overlay.Get()` and `overlay.Create()`
|
||||||
- Upgrade golang version to 1.25 to resolve stdlib CVEs (CVE-2025-4673, CVE-2025-58187, CVE-2025-61723, CVE-2025-58188, CVE-2025-61725, CVE-2025-61726, CVE-2025-47907, CVE-2025-58189, CVE-2025-47906, CVE-2025-58186, CVE-2025-61727, CVE-2025-61724, CVE-2025-58185, CVE-2025-47912, CVE-2025-61729, CVE-2025-0913, CVE-2025-22873, CVE-2024-45336, CVE-2024-45341, CVE-2025-58183, CVE-2025-68121, CVE-2025-61730)
|
- Upgrade golang version to 1.25 to resolve stdlib CVEs (CVE-2025-4673, CVE-2025-58187, CVE-2025-61723, CVE-2025-58188, CVE-2025-61725, CVE-2025-61726, CVE-2025-47907, CVE-2025-58189, CVE-2025-47906, CVE-2025-58186, CVE-2025-61727, CVE-2025-61724, CVE-2025-58185, CVE-2025-47912, CVE-2025-61729, CVE-2025-0913, CVE-2025-22873, CVE-2024-45336, CVE-2024-45341, CVE-2025-58183, CVE-2025-68121, CVE-2025-61730)
|
||||||
- Fix path traversal vulnerability (CWE-23) in overlay cleanup function
|
- Fix path traversal vulnerability (CWE-23) in overlay cleanup function
|
||||||
|
- Fix `wwctl image build --all` to build all images
|
||||||
|
- Fix `wwctl node set --all` to set values on all nodes
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
@@ -62,8 +64,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Document configuring the arp cache for large clusters
|
- Document configuring the arp cache for large clusters
|
||||||
- Expand troubleshooting documentation for container runtimes
|
- Expand troubleshooting documentation for container runtimes
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Removed gRPC API libraries and protobuf types
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- Refactored `wwctl <node|profile> set` to use cobra `cmd.Flags().Changed()` to
|
||||||
|
apply only explicitly-set fields.
|
||||||
- Runtime overlay download failure during dracut/wwinit boot is now non-fatal;
|
- Runtime overlay download failure during dracut/wwinit boot is now non-fatal;
|
||||||
the node continues to boot and `wwclient` retries the download at runtime.
|
the node continues to boot and `wwclient` retries the download at runtime.
|
||||||
- `hosts` overlay added to the default system overlay list
|
- `hosts` overlay added to the default system overlay list
|
||||||
|
|||||||
@@ -383,12 +383,6 @@ The dependencies and their licenses are as follows:
|
|||||||
|
|
||||||
**License URL:** <https://github.com/gorilla/mux/blob/v1.8.1/LICENSE>
|
**License URL:** <https://github.com/gorilla/mux/blob/v1.8.1/LICENSE>
|
||||||
|
|
||||||
## github.com/grpc-ecosystem/grpc-gateway/v2
|
|
||||||
|
|
||||||
**License:** BSD-3-Clause
|
|
||||||
|
|
||||||
**License URL:** <https://github.com/grpc-ecosystem/grpc-gateway/blob/v2.28.0/LICENSE>
|
|
||||||
|
|
||||||
## github.com/klauspost/compress/internal/snapref
|
## github.com/klauspost/compress/internal/snapref
|
||||||
|
|
||||||
**License:** BSD-3-Clause
|
**License:** BSD-3-Clause
|
||||||
|
|||||||
29
Tools.mk
29
Tools.mk
@@ -13,24 +13,11 @@ GOLANG_LICENSES := $(TOOLS_BIN)/go-licenses
|
|||||||
|
|
||||||
GOLANG_STATICCHECK := $(TOOLS_BIN)/staticcheck
|
GOLANG_STATICCHECK := $(TOOLS_BIN)/staticcheck
|
||||||
|
|
||||||
PROTOC := $(TOOLS_BIN)/protoc
|
|
||||||
PROTOC_GEN_GO := $(TOOLS_BIN)/protoc-gen-go
|
|
||||||
PROTOC_GEN_GO_GRPC := $(TOOLS_BIN)/protoc-gen-go-grpc
|
|
||||||
PROTOC_GEN_GRPC_GATEWAY := $(TOOLS_BIN)/protoc-gen-grpc-gateway
|
|
||||||
|
|
||||||
ifeq ($(ARCH),aarch64)
|
|
||||||
PROTOC_URL := https://github.com/protocolbuffers/protobuf/releases/download/v24.0/protoc-24.0-linux-aarch_64.zip
|
|
||||||
PROTOC_GEN_GRPC_GATEWAY_URL := https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v2.26.0/protoc-gen-grpc-gateway-v2.26.0-linux-arm64
|
|
||||||
else
|
|
||||||
PROTOC_URL := https://github.com/protocolbuffers/protobuf/releases/download/v24.0/protoc-24.0-linux-x86_64.zip
|
|
||||||
PROTOC_GEN_GRPC_GATEWAY_URL := https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v2.26.0/protoc-gen-grpc-gateway-v2.26.0-linux-x86_64
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(TOOLS_DIR):
|
$(TOOLS_DIR):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
.PHONY: tools
|
.PHONY: tools
|
||||||
tools: $(GO_TOOLS_BIN) $(GOLANGCI_LINT) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC)
|
tools: $(GO_TOOLS_BIN) $(GOLANGCI_LINT)
|
||||||
|
|
||||||
$(GO_TOOLS_BIN):
|
$(GO_TOOLS_BIN):
|
||||||
GOBIN="$(PWD)/$(TOOLS_BIN)" go install -mod=vendor $(GO_TOOLS)
|
GOBIN="$(PWD)/$(TOOLS_BIN)" go install -mod=vendor $(GO_TOOLS)
|
||||||
@@ -41,20 +28,6 @@ $(GOLANGCI_LINT):
|
|||||||
$(GOLANG_DEADCODE):
|
$(GOLANG_DEADCODE):
|
||||||
GOBIN="$(PWD)/$(TOOLS_BIN)" go install golang.org/x/tools/cmd/deadcode@v0.34.0
|
GOBIN="$(PWD)/$(TOOLS_BIN)" go install golang.org/x/tools/cmd/deadcode@v0.34.0
|
||||||
|
|
||||||
$(PROTOC): $(TOOLS_DIR)
|
|
||||||
cd $(TOOLS_DIR) && curl -LO $(PROTOC_URL) && unzip -o $(notdir $(PROTOC_URL))
|
|
||||||
touch --no-create $(PROTOC) # by default the timestamp is preserved from the archive
|
|
||||||
|
|
||||||
$(PROTOC_GEN_GRPC_GATEWAY):
|
|
||||||
curl -L $(PROTOC_GEN_GRPC_GATEWAY_URL) -o $(PROTOC_GEN_GRPC_GATEWAY)
|
|
||||||
chmod +x $(PROTOC_GEN_GRPC_GATEWAY)
|
|
||||||
|
|
||||||
$(PROTOC_GEN_GO):
|
|
||||||
GOBIN="$(PWD)/$(TOOLS_BIN)" go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.5
|
|
||||||
|
|
||||||
$(PROTOC_GEN_GO_GRPC):
|
|
||||||
GOBIN="$(PWD)/$(TOOLS_BIN)" go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
|
|
||||||
|
|
||||||
$(GOLANG_LICENSES):
|
$(GOLANG_LICENSES):
|
||||||
GOBIN="$(PWD)/$(TOOLS_BIN)" go install github.com/google/go-licenses@v1.6.0
|
GOBIN="$(PWD)/$(TOOLS_BIN)" go install github.com/google/go-licenses@v1.6.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
# Configuration for wwapic, the grpc wwapi client.
|
|
||||||
api:
|
|
||||||
server: localhost
|
|
||||||
port: 9872
|
|
||||||
tls:
|
|
||||||
enabled: true
|
|
||||||
cert: @SYSCONFDIR@/warewulf/keys/wwapic/client.pem
|
|
||||||
key: @SYSCONFDIR@/warewulf/keys/wwapic/client.key
|
|
||||||
cacert: @SYSCONFDIR@/warewulf/keys/wwapic/cacert.pem
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# Configuration for wwapird, the wwapi grpc server.
|
|
||||||
api:
|
|
||||||
version: 1.0.0
|
|
||||||
prefix: v1
|
|
||||||
port: 9872
|
|
||||||
tls:
|
|
||||||
enabled: true
|
|
||||||
cert: @SYSCONFDIR@/warewulf/keys/wwapid/server.pem
|
|
||||||
key: @SYSCONFDIR@/warewulf/keys/wwapid/server.key
|
|
||||||
cacert: @SYSCONFDIR@/warewulf/keys/wwapid/cacert.pem
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# Configuration for wwapird, the grpc / http reverse proxy REST server.
|
|
||||||
# This server allows one to curl the wwapi.
|
|
||||||
clientapi:
|
|
||||||
server: localhost
|
|
||||||
port: 9872
|
|
||||||
serverapi:
|
|
||||||
version: ignored
|
|
||||||
prefix: ignored
|
|
||||||
port: 9871
|
|
||||||
clienttls:
|
|
||||||
enabled: true
|
|
||||||
cert: @SYSCONFDIR@/warewulf/keys/wwapird/client.pem
|
|
||||||
key: @SYSCONFDIR@/warewulf/keys/wwapird/client.key
|
|
||||||
cacert: @SYSCONFDIR@/warewulf/keys/wwapird/cacert.pem
|
|
||||||
servertls:
|
|
||||||
enabled: true
|
|
||||||
cert: ignored
|
|
||||||
key: @SYSCONFDIR@/warewulf/keys/server.key
|
|
||||||
cacert: ignored
|
|
||||||
concatcert: @SYSCONFDIR@/warewulf/keys/serverAndCacert.pem # This is a cat of server.pem and cacert.pem
|
|
||||||
8
go.mod
8
go.mod
@@ -17,7 +17,6 @@ require (
|
|||||||
github.com/fatih/color v1.18.0
|
github.com/fatih/color v1.18.0
|
||||||
github.com/go-chi/chi/v5 v5.2.5
|
github.com/go-chi/chi/v5 v5.2.5
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0
|
|
||||||
github.com/hashicorp/go-version v1.8.0
|
github.com/hashicorp/go-version v1.8.0
|
||||||
github.com/kinbiko/jsonassert v1.2.0
|
github.com/kinbiko/jsonassert v1.2.0
|
||||||
github.com/manifoldco/promptui v0.9.0
|
github.com/manifoldco/promptui v0.9.0
|
||||||
@@ -37,9 +36,6 @@ require (
|
|||||||
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67
|
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67
|
||||||
golang.org/x/sys v0.42.0
|
golang.org/x/sys v0.42.0
|
||||||
golang.org/x/term v0.41.0
|
golang.org/x/term v0.41.0
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57
|
|
||||||
google.golang.org/grpc v1.79.3
|
|
||||||
google.golang.org/protobuf v1.36.11
|
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -81,6 +77,7 @@ require (
|
|||||||
github.com/golang/protobuf v1.5.4 // indirect
|
github.com/golang/protobuf v1.5.4 // indirect
|
||||||
github.com/google/go-containerregistry v0.20.3 // indirect
|
github.com/google/go-containerregistry v0.20.3 // indirect
|
||||||
github.com/gorilla/mux v1.8.1 // indirect
|
github.com/gorilla/mux v1.8.1 // indirect
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
|
||||||
github.com/huandu/xstrings v1.5.0 // indirect
|
github.com/huandu/xstrings v1.5.0 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
@@ -140,6 +137,9 @@ require (
|
|||||||
golang.org/x/net v0.51.0 // indirect
|
golang.org/x/net v0.51.0 // indirect
|
||||||
golang.org/x/sync v0.20.0 // indirect
|
golang.org/x/sync v0.20.0 // indirect
|
||||||
golang.org/x/text v0.35.0 // indirect
|
golang.org/x/text v0.35.0 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 // indirect
|
||||||
|
google.golang.org/grpc v1.79.3 // indirect
|
||||||
|
google.golang.org/protobuf v1.36.11 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
|
|||||||
}
|
}
|
||||||
defer cleanUp()
|
defer cleanUp()
|
||||||
|
|
||||||
wwlog.Debug("Version: %s", version.GetVersion())
|
wwlog.Debug("Version: %s", version.Version())
|
||||||
|
|
||||||
target := "/"
|
target := "/"
|
||||||
if os.Args[0] == path.Join(conf.Paths.WWClientdir, "wwclient") {
|
if os.Args[0] == path.Join(conf.Paths.WWClientdir, "wwclient") {
|
||||||
|
|||||||
@@ -4,42 +4,38 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/warewulf/warewulf/internal/pkg/api/routes/wwapiv1"
|
|
||||||
"github.com/warewulf/warewulf/internal/pkg/image"
|
"github.com/warewulf/warewulf/internal/pkg/image"
|
||||||
"github.com/warewulf/warewulf/internal/pkg/wwlog"
|
"github.com/warewulf/warewulf/internal/pkg/wwlog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
|
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
|
||||||
cdp := &wwapiv1.ImageCopyParameter{
|
imageSource := args[0]
|
||||||
ImageSource: args[0],
|
imageDestination := args[1]
|
||||||
ImageDestination: args[1],
|
|
||||||
Build: Build,
|
if !image.DoesSourceExist(imageSource) {
|
||||||
|
return fmt.Errorf("image's source doesn't exists: %s", imageSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !image.DoesSourceExist(cdp.ImageSource) {
|
if !image.ValidName(imageDestination) {
|
||||||
return fmt.Errorf("image's source doesn't exists: %s", cdp.ImageSource)
|
return fmt.Errorf("image name contains illegal characters : %s", imageDestination)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !image.ValidName(cdp.ImageDestination) {
|
if image.DoesSourceExist(imageDestination) {
|
||||||
return fmt.Errorf("image name contains illegal characters : %s", cdp.ImageDestination)
|
return fmt.Errorf("an other image with name: %s already exists in sources", imageDestination)
|
||||||
}
|
}
|
||||||
|
|
||||||
if image.DoesSourceExist(cdp.ImageDestination) {
|
err = image.Duplicate(imageSource, imageDestination)
|
||||||
return fmt.Errorf("an other image with name: %s already exists in sources", cdp.ImageDestination)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = image.Duplicate(cdp.ImageSource, cdp.ImageDestination)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not duplicate image: %s", err.Error())
|
return fmt.Errorf("could not duplicate image: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if cdp.Build {
|
if Build {
|
||||||
err = image.Build(cdp.ImageDestination, true)
|
err = image.Build(imageDestination, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wwlog.Info("Image %s successfully duplicated as %s", cdp.ImageSource, cdp.ImageDestination)
|
wwlog.Info("Image %s successfully duplicated as %s", imageSource, imageDestination)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
121
internal/app/wwctl/node/delete/main_test.go
Normal file
121
internal/app/wwctl/node/delete/main_test.go
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
package delete
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/warewulf/warewulf/internal/pkg/testenv"
|
||||||
|
"github.com/warewulf/warewulf/internal/pkg/warewulfd"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test_Delete(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
args []string
|
||||||
|
inDB string
|
||||||
|
outDB string
|
||||||
|
wantErr bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "delete single node",
|
||||||
|
args: []string{"--yes", "n01"},
|
||||||
|
inDB: `
|
||||||
|
nodeprofiles:
|
||||||
|
default: {}
|
||||||
|
nodes:
|
||||||
|
n01:
|
||||||
|
profiles:
|
||||||
|
- default
|
||||||
|
n02:
|
||||||
|
profiles:
|
||||||
|
- default`,
|
||||||
|
outDB: `
|
||||||
|
nodeprofiles:
|
||||||
|
default: {}
|
||||||
|
nodes:
|
||||||
|
n02:
|
||||||
|
profiles:
|
||||||
|
- default`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "delete multiple nodes",
|
||||||
|
args: []string{"--yes", "n01", "n02"},
|
||||||
|
inDB: `
|
||||||
|
nodeprofiles:
|
||||||
|
default: {}
|
||||||
|
nodes:
|
||||||
|
n01:
|
||||||
|
profiles:
|
||||||
|
- default
|
||||||
|
n02:
|
||||||
|
profiles:
|
||||||
|
- default
|
||||||
|
n03:
|
||||||
|
profiles:
|
||||||
|
- default`,
|
||||||
|
outDB: `
|
||||||
|
nodeprofiles:
|
||||||
|
default: {}
|
||||||
|
nodes:
|
||||||
|
n03:
|
||||||
|
profiles:
|
||||||
|
- default`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "delete non-existent node",
|
||||||
|
args: []string{"--yes", "doesnotexist"},
|
||||||
|
inDB: `
|
||||||
|
nodeprofiles:
|
||||||
|
default: {}
|
||||||
|
nodes:
|
||||||
|
n01:
|
||||||
|
profiles:
|
||||||
|
- default`,
|
||||||
|
outDB: `
|
||||||
|
nodeprofiles:
|
||||||
|
default: {}
|
||||||
|
nodes:
|
||||||
|
n01:
|
||||||
|
profiles:
|
||||||
|
- default`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "delete all nodes",
|
||||||
|
args: []string{"--yes", "n01", "n02"},
|
||||||
|
inDB: `
|
||||||
|
nodeprofiles:
|
||||||
|
default: {}
|
||||||
|
nodes:
|
||||||
|
n01: {}
|
||||||
|
n02: {}`,
|
||||||
|
outDB: `
|
||||||
|
nodeprofiles:
|
||||||
|
default: {}
|
||||||
|
nodes: {}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
warewulfd.SetNoDaemon()
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
env := testenv.New(t)
|
||||||
|
defer env.RemoveAll()
|
||||||
|
env.WriteFile("etc/warewulf/nodes.conf", tt.inDB)
|
||||||
|
|
||||||
|
buf := new(bytes.Buffer)
|
||||||
|
baseCmd := GetCommand()
|
||||||
|
baseCmd.SetArgs(tt.args)
|
||||||
|
baseCmd.SetOut(buf)
|
||||||
|
baseCmd.SetErr(buf)
|
||||||
|
err := baseCmd.Execute()
|
||||||
|
if tt.wantErr {
|
||||||
|
assert.Error(t, err)
|
||||||
|
} else {
|
||||||
|
assert.NoError(t, err)
|
||||||
|
content := env.ReadFile("etc/warewulf/nodes.conf")
|
||||||
|
assert.YAMLEq(t, tt.outDB, content)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
|
|
||||||
type variables struct {
|
type variables struct {
|
||||||
setYes bool
|
setYes bool
|
||||||
setForce bool
|
|
||||||
profileConf node.Profile
|
profileConf node.Profile
|
||||||
profileDel node.NodeConfDel
|
profileDel node.NodeConfDel
|
||||||
profileAdd node.NodeConfAdd
|
profileAdd node.NodeConfAdd
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ import (
|
|||||||
|
|
||||||
func CobraRunE(cmd *cobra.Command, args []string) error {
|
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
fmt.Println("wwctl version:\t", version.GetVersion())
|
fmt.Println("wwctl version:\t", version.Version())
|
||||||
|
|
||||||
wwVersionResponse := version.Version()
|
|
||||||
fmt.Println("rpc version:", wwVersionResponse.String())
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,346 +0,0 @@
|
|||||||
// Routes for the wwapi (WareWulf API).
|
|
||||||
// TODO: Try protoc-gen-doc for generating documentation.
|
|
||||||
|
|
||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
option go_package = "internal/pkg/api/routes/wwapiv1;wwapiv1";
|
|
||||||
|
|
||||||
package wwapi.v1;
|
|
||||||
|
|
||||||
import "google/protobuf/empty.proto";
|
|
||||||
import "google/api/annotations.proto";
|
|
||||||
|
|
||||||
// Information about the database
|
|
||||||
|
|
||||||
message NodeDBHash {
|
|
||||||
string hash = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Image
|
|
||||||
|
|
||||||
// ImageBuildParameter contains input for building zero or more images.
|
|
||||||
message ImageBuildParameter {
|
|
||||||
repeated string imageNames = 1;
|
|
||||||
bool force = 2;
|
|
||||||
bool all = 3;
|
|
||||||
// bool default = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageDeleteParameter contains input for removing images from Warewulf
|
|
||||||
// management.
|
|
||||||
message ImageDeleteParameter {
|
|
||||||
repeated string imageNames = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageCopyParameter contains 2 inputs : first one for the image source name and second one for the duplicated image name.
|
|
||||||
message ImageCopyParameter {
|
|
||||||
string imageSource = 1;
|
|
||||||
string imageDestination = 2;
|
|
||||||
bool build = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageImportParameter has all input for importing an image.
|
|
||||||
message ImageImportParameter{
|
|
||||||
string source = 1; // image source uri
|
|
||||||
string name = 2; // image name
|
|
||||||
bool force = 3;
|
|
||||||
bool update = 4;
|
|
||||||
bool build = 5;
|
|
||||||
// bool default = 6;
|
|
||||||
bool syncUser = 7;
|
|
||||||
bool ociNoHttps = 8;
|
|
||||||
string ociUsername = 9;
|
|
||||||
string ociPassword = 10;
|
|
||||||
string platform = 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageInfo has data on each image. This is emitted in the
|
|
||||||
// ImageListResponse.
|
|
||||||
message ImageInfo {
|
|
||||||
string name = 1;
|
|
||||||
uint32 nodeCount = 2;
|
|
||||||
string kernelVersion = 3;
|
|
||||||
uint64 createDate = 4; // creation date in unix time
|
|
||||||
uint64 modDate = 5; // date of last modification in unix time
|
|
||||||
// uint64 size = 6; // size of chroot and images in bytes
|
|
||||||
uint64 imgSize = 7;
|
|
||||||
uint64 imgSizeComp = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageListResponse has all information that ImageList provides.
|
|
||||||
message ImageListResponse {
|
|
||||||
repeated ImageInfo images = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageShowParameter is the input for ImageShow.
|
|
||||||
message ImageShowParameter {
|
|
||||||
string imageName = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageShowResponse has all information emitted on ImageShow.
|
|
||||||
message ImageShowResponse {
|
|
||||||
string Name = 1;
|
|
||||||
string Rootfs = 2;
|
|
||||||
repeated string Nodes = 3;
|
|
||||||
string KernelVersion = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageSyncUserParameter is the input for ImageSyncUser.
|
|
||||||
message ImageSyncUserParameter {
|
|
||||||
string imageName = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageRenameParameter is the input for ImageRename
|
|
||||||
message ImageRenameParameter {
|
|
||||||
string imageName = 1;
|
|
||||||
string targetName = 2;
|
|
||||||
bool build = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nodes
|
|
||||||
|
|
||||||
// NodeNames is an array of node ids.
|
|
||||||
message NodeNames {
|
|
||||||
repeated string nodeNames = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeField contains data output on NodeList.
|
|
||||||
message NodeField {
|
|
||||||
string source = 1;
|
|
||||||
string value = 2; // TODO: Variable name okay?
|
|
||||||
string print = 3; // Empty values printed as -- in wwctl.
|
|
||||||
}
|
|
||||||
|
|
||||||
// NetDev is network devices (NICs) on a node.
|
|
||||||
message NetDev {
|
|
||||||
map<string, NodeField> Field = 1;
|
|
||||||
map<string, NodeField> Tags = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeInfo contains details about a node managed by Warewulf/
|
|
||||||
message NodeInfo {
|
|
||||||
map<string, NodeField> Fields = 1;
|
|
||||||
map<string, NetDev> NetDevs = 23;
|
|
||||||
map<string, NodeField> Tags = 24;
|
|
||||||
map<string, NodeField> Keys = 25; // TODO: We may not need this. Tags may be it. Ask Greg.
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeListResponse is the output of NodeList.
|
|
||||||
message NodeListResponse {
|
|
||||||
repeated NodeInfo nodes = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Request a node list
|
|
||||||
message GetNodeList {
|
|
||||||
enum ListType {
|
|
||||||
Simple = 0;
|
|
||||||
Ipmi = 1;
|
|
||||||
Network = 2;
|
|
||||||
Long = 3;
|
|
||||||
All = 4;
|
|
||||||
YAML = 6;
|
|
||||||
JSON = 7;
|
|
||||||
}
|
|
||||||
ListType type = 8;
|
|
||||||
repeated string Nodes = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the formated output as string
|
|
||||||
message NodeList {
|
|
||||||
repeated string Output = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Request a profile list view
|
|
||||||
message GetProfileList {
|
|
||||||
bool ShowAll = 1;
|
|
||||||
bool ShowYaml = 3;
|
|
||||||
bool ShowJson = 4;
|
|
||||||
repeated string Profiles = 5;
|
|
||||||
}
|
|
||||||
// Get the formated output as string
|
|
||||||
message ProfileList {
|
|
||||||
repeated string Output = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeAddParameter contains all input for adding a node to be managed by
|
|
||||||
// Warewulf. Only adds nodes if the hash matches the actual hash of the
|
|
||||||
// configuration.
|
|
||||||
message NodeAddParameter {
|
|
||||||
string nodeConfYaml = 1;
|
|
||||||
bool force = 2;
|
|
||||||
string hash = 3;
|
|
||||||
repeated string nodeNames = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeYaml is just the updated YAML config which will be added
|
|
||||||
// to nodes.conf (is resused for profile edit)
|
|
||||||
message NodeYaml {
|
|
||||||
string nodeConfMapYaml = 1;
|
|
||||||
string hash = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeDeleteParameter contains input for removing nodes from Warewulf
|
|
||||||
// management. If the given hash differs with the actual hash of the
|
|
||||||
// configuration, no node is deleted. The force option allows the deletion
|
|
||||||
// of nodes with a correct hash.
|
|
||||||
message NodeDeleteParameter {
|
|
||||||
bool force = 1;
|
|
||||||
repeated string nodeNames = 2;
|
|
||||||
string hash = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeSetParameter contains all fields for updating aspects of nodes managed
|
|
||||||
// by Warewulf.
|
|
||||||
message ConfSetParameter {
|
|
||||||
string nodeConfYaml = 1;
|
|
||||||
string netdevDelete = 2;
|
|
||||||
string diskDelete = 3;
|
|
||||||
string partitionDelete = 4;
|
|
||||||
string filesystemDelete = 5;
|
|
||||||
bool allConfs = 6;
|
|
||||||
bool force = 7;
|
|
||||||
repeated string confList = 8;
|
|
||||||
map<string, string> tagAdd = 9;
|
|
||||||
map<string, string> netTagAdd = 10;
|
|
||||||
map<string, string> ipmiTagAdd = 11;
|
|
||||||
repeated string tagDel = 12;
|
|
||||||
repeated string netTagDel = 13;
|
|
||||||
repeated string ipmiTagDel = 14;
|
|
||||||
string netdev = 15;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeStatus contains information about the imaging status per node.
|
|
||||||
message NodeStatus {
|
|
||||||
string nodeName = 1; // Name (Id) of the node.
|
|
||||||
string stage = 2; // Stage of imaging.
|
|
||||||
string sent = 3; // Last overlay sent.
|
|
||||||
string ipaddr = 4; // Node IP address.
|
|
||||||
int64 lastseen = 5; // Time in seconds since the node was last seen.
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeStatusResponse contains NodeStatus for zero or more nodes.
|
|
||||||
message NodeStatusResponse {
|
|
||||||
repeated NodeStatus nodeStatus = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Version
|
|
||||||
|
|
||||||
// VersionReponse contains versions of the software.
|
|
||||||
message VersionResponse {
|
|
||||||
string apiPrefix = 1;
|
|
||||||
string apiVersion = 2;
|
|
||||||
string warewulfVersion = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if config is writeable
|
|
||||||
message CanWriteConfig {
|
|
||||||
bool canWriteConfig = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// WWApi defines the wwapid service web interface.
|
|
||||||
service WWApi {
|
|
||||||
|
|
||||||
// Images
|
|
||||||
|
|
||||||
// ImageBuild builds zero or more images.
|
|
||||||
rpc ImageBuild(ImageBuildParameter) returns (ImageListResponse) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
post: "/v1/imagebuild"
|
|
||||||
body: "*"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageDelete removes one or more image from Warewulf management.
|
|
||||||
rpc ImageDelete(ImageDeleteParameter) returns (google.protobuf.Empty) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
delete: "/v1/image"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
rpc ImageCopy(ImageCopyParameter) returns (google.protobuf.Empty) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
post: "/v1/imagecopy"
|
|
||||||
body: "*"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// ImageImport imports an image to Warewulf.
|
|
||||||
rpc ImageImport(ImageImportParameter) returns (ImageListResponse) {
|
|
||||||
option(google.api.http) = {
|
|
||||||
post: "/v1/image"
|
|
||||||
body: "*"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageList lists ImageInfo for each image.
|
|
||||||
rpc ImageList(google.protobuf.Empty) returns (ImageListResponse) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
get: "/v1/image"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageShow lists ImageShow for each image.
|
|
||||||
rpc ImageShow(ImageShowParameter) returns (ImageShowResponse) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
get: "/v1/imageshow"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageRename renames the image
|
|
||||||
rpc ImageRename(ImageRenameParameter) returns (google.protobuf.Empty) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
post: "/v1/imagerename"
|
|
||||||
body: "*"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nodes
|
|
||||||
|
|
||||||
// NodeAdd adds one or more nodes for management by Warewulf and returns
|
|
||||||
// the added nodes. Node fields may be shimmed in per profiles.
|
|
||||||
rpc NodeAdd(NodeAddParameter) returns (NodeListResponse) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
post: "/v1/node"
|
|
||||||
body: "*"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeDelete removes one or more nodes from Warewulf management.
|
|
||||||
rpc NodeDelete(NodeDeleteParameter) returns (google.protobuf.Empty) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
delete: "/v1/node"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeList lists some or all nodes managed by Warewulf.
|
|
||||||
rpc NodeList(NodeNames) returns (NodeListResponse) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
get: "/v1/node"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeSet updates node fields for one or more nodes.
|
|
||||||
rpc NodeSet(ConfSetParameter) returns (NodeListResponse) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
post: "/v1/nodeset" // TODO: This should be a patch. Had trouble getting patch to work at all.
|
|
||||||
body: "*"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeStatus returns the imaging state for nodes.
|
|
||||||
// This requires warewulfd.
|
|
||||||
rpc NodeStatus(NodeNames) returns (NodeStatusResponse) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
get: "/v1/nodestatus"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Version returns the wwapi version, the api prefix, and the Warewulf
|
|
||||||
// version. This is also useful for testing if the service is up.
|
|
||||||
rpc Version(google.protobuf.Empty) returns (VersionResponse) {
|
|
||||||
option (google.api.http) = {
|
|
||||||
get: "/version"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,939 +0,0 @@
|
|||||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
|
||||||
// source: routes.proto
|
|
||||||
|
|
||||||
/*
|
|
||||||
Package wwapiv1 is a reverse proxy.
|
|
||||||
|
|
||||||
It translates gRPC into RESTful JSON APIs.
|
|
||||||
*/
|
|
||||||
package wwapiv1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
|
||||||
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
|
|
||||||
"google.golang.org/grpc"
|
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
"google.golang.org/grpc/grpclog"
|
|
||||||
"google.golang.org/grpc/metadata"
|
|
||||||
"google.golang.org/grpc/status"
|
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
"google.golang.org/protobuf/types/known/emptypb"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Suppress "imported and not used" errors
|
|
||||||
var (
|
|
||||||
_ codes.Code
|
|
||||||
_ io.Reader
|
|
||||||
_ status.Status
|
|
||||||
_ = errors.New
|
|
||||||
_ = runtime.String
|
|
||||||
_ = utilities.NewDoubleArray
|
|
||||||
_ = metadata.Join
|
|
||||||
)
|
|
||||||
|
|
||||||
func request_WWApi_ImageBuild_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageBuildParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.ImageBuild(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_ImageBuild_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageBuildParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.ImageBuild(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var filter_WWApi_ImageDelete_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
|
||||||
|
|
||||||
func request_WWApi_ImageDelete_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageDeleteParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WWApi_ImageDelete_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.ImageDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_ImageDelete_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageDeleteParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WWApi_ImageDelete_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.ImageDelete(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_WWApi_ImageCopy_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageCopyParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.ImageCopy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_ImageCopy_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageCopyParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.ImageCopy(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_WWApi_ImageImport_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageImportParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.ImageImport(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_ImageImport_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageImportParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.ImageImport(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_WWApi_ImageList_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq emptypb.Empty
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
msg, err := client.ImageList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_ImageList_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq emptypb.Empty
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
msg, err := server.ImageList(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var filter_WWApi_ImageShow_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
|
||||||
|
|
||||||
func request_WWApi_ImageShow_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageShowParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WWApi_ImageShow_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.ImageShow(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_ImageShow_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageShowParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WWApi_ImageShow_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.ImageShow(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_WWApi_ImageRename_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageRenameParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.ImageRename(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_ImageRename_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ImageRenameParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.ImageRename(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_WWApi_NodeAdd_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq NodeAddParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.NodeAdd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_NodeAdd_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq NodeAddParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.NodeAdd(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var filter_WWApi_NodeDelete_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
|
||||||
|
|
||||||
func request_WWApi_NodeDelete_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq NodeDeleteParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WWApi_NodeDelete_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.NodeDelete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_NodeDelete_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq NodeDeleteParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WWApi_NodeDelete_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.NodeDelete(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var filter_WWApi_NodeList_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
|
||||||
|
|
||||||
func request_WWApi_NodeList_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq NodeNames
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WWApi_NodeList_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.NodeList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_NodeList_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq NodeNames
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WWApi_NodeList_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.NodeList(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_WWApi_NodeSet_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ConfSetParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.NodeSet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_NodeSet_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq ConfSetParameter
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.NodeSet(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var filter_WWApi_NodeStatus_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
|
||||||
|
|
||||||
func request_WWApi_NodeStatus_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq NodeNames
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WWApi_NodeStatus_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := client.NodeStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_NodeStatus_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq NodeNames
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
if err := req.ParseForm(); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WWApi_NodeStatus_0); err != nil {
|
|
||||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
|
||||||
}
|
|
||||||
msg, err := server.NodeStatus(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func request_WWApi_Version_0(ctx context.Context, marshaler runtime.Marshaler, client WWApiClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq emptypb.Empty
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
msg, err := client.Version(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func local_request_WWApi_Version_0(ctx context.Context, marshaler runtime.Marshaler, server WWApiServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
|
||||||
var (
|
|
||||||
protoReq emptypb.Empty
|
|
||||||
metadata runtime.ServerMetadata
|
|
||||||
)
|
|
||||||
msg, err := server.Version(ctx, &protoReq)
|
|
||||||
return msg, metadata, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterWWApiHandlerServer registers the http handlers for service WWApi to "mux".
|
|
||||||
// UnaryRPC :call WWApiServer directly.
|
|
||||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
|
||||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWWApiHandlerFromEndpoint instead.
|
|
||||||
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
|
|
||||||
func RegisterWWApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WWApiServer) error {
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_ImageBuild_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageBuild", runtime.WithHTTPPathPattern("/v1/imagebuild"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_ImageBuild_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageBuild_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodDelete, pattern_WWApi_ImageDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageDelete", runtime.WithHTTPPathPattern("/v1/image"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_ImageDelete_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_ImageCopy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageCopy", runtime.WithHTTPPathPattern("/v1/imagecopy"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_ImageCopy_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageCopy_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_ImageImport_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageImport", runtime.WithHTTPPathPattern("/v1/image"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_ImageImport_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageImport_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_WWApi_ImageList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageList", runtime.WithHTTPPathPattern("/v1/image"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_ImageList_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_WWApi_ImageShow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageShow", runtime.WithHTTPPathPattern("/v1/imageshow"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_ImageShow_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageShow_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_ImageRename_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageRename", runtime.WithHTTPPathPattern("/v1/imagerename"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_ImageRename_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageRename_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_NodeAdd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/NodeAdd", runtime.WithHTTPPathPattern("/v1/node"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_NodeAdd_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_NodeAdd_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodDelete, pattern_WWApi_NodeDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/NodeDelete", runtime.WithHTTPPathPattern("/v1/node"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_NodeDelete_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_NodeDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_WWApi_NodeList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/NodeList", runtime.WithHTTPPathPattern("/v1/node"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_NodeList_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_NodeList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_NodeSet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/NodeSet", runtime.WithHTTPPathPattern("/v1/nodeset"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_NodeSet_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_NodeSet_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_WWApi_NodeStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/NodeStatus", runtime.WithHTTPPathPattern("/v1/nodestatus"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_NodeStatus_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_NodeStatus_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_WWApi_Version_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
var stream runtime.ServerTransportStream
|
|
||||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/wwapi.v1.WWApi/Version", runtime.WithHTTPPathPattern("/version"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := local_request_WWApi_Version_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
|
||||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_Version_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterWWApiHandlerFromEndpoint is same as RegisterWWApiHandler but
|
|
||||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
|
||||||
func RegisterWWApiHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
|
||||||
conn, err := grpc.NewClient(endpoint, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
if cerr := conn.Close(); cerr != nil {
|
|
||||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
go func() {
|
|
||||||
<-ctx.Done()
|
|
||||||
if cerr := conn.Close(); cerr != nil {
|
|
||||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}()
|
|
||||||
return RegisterWWApiHandler(ctx, mux, conn)
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterWWApiHandler registers the http handlers for service WWApi to "mux".
|
|
||||||
// The handlers forward requests to the grpc endpoint over "conn".
|
|
||||||
func RegisterWWApiHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
|
||||||
return RegisterWWApiHandlerClient(ctx, mux, NewWWApiClient(conn))
|
|
||||||
}
|
|
||||||
|
|
||||||
// RegisterWWApiHandlerClient registers the http handlers for service WWApi
|
|
||||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WWApiClient".
|
|
||||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WWApiClient"
|
|
||||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
|
||||||
// "WWApiClient" to call the correct interceptors. This client ignores the HTTP middlewares.
|
|
||||||
func RegisterWWApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WWApiClient) error {
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_ImageBuild_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageBuild", runtime.WithHTTPPathPattern("/v1/imagebuild"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_ImageBuild_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageBuild_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodDelete, pattern_WWApi_ImageDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageDelete", runtime.WithHTTPPathPattern("/v1/image"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_ImageDelete_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_ImageCopy_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageCopy", runtime.WithHTTPPathPattern("/v1/imagecopy"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_ImageCopy_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageCopy_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_ImageImport_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageImport", runtime.WithHTTPPathPattern("/v1/image"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_ImageImport_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageImport_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_WWApi_ImageList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageList", runtime.WithHTTPPathPattern("/v1/image"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_ImageList_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_WWApi_ImageShow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageShow", runtime.WithHTTPPathPattern("/v1/imageshow"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_ImageShow_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageShow_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_ImageRename_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/ImageRename", runtime.WithHTTPPathPattern("/v1/imagerename"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_ImageRename_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_ImageRename_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_NodeAdd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/NodeAdd", runtime.WithHTTPPathPattern("/v1/node"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_NodeAdd_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_NodeAdd_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodDelete, pattern_WWApi_NodeDelete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/NodeDelete", runtime.WithHTTPPathPattern("/v1/node"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_NodeDelete_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_NodeDelete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_WWApi_NodeList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/NodeList", runtime.WithHTTPPathPattern("/v1/node"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_NodeList_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_NodeList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodPost, pattern_WWApi_NodeSet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/NodeSet", runtime.WithHTTPPathPattern("/v1/nodeset"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_NodeSet_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_NodeSet_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_WWApi_NodeStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/NodeStatus", runtime.WithHTTPPathPattern("/v1/nodestatus"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_NodeStatus_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_NodeStatus_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
mux.Handle(http.MethodGet, pattern_WWApi_Version_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
|
||||||
defer cancel()
|
|
||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
|
||||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/wwapi.v1.WWApi/Version", runtime.WithHTTPPathPattern("/version"))
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, md, err := request_WWApi_Version_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
|
||||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
|
||||||
if err != nil {
|
|
||||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
forward_WWApi_Version_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
|
||||||
})
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
pattern_WWApi_ImageBuild_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "imagebuild"}, ""))
|
|
||||||
pattern_WWApi_ImageDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "image"}, ""))
|
|
||||||
pattern_WWApi_ImageCopy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "imagecopy"}, ""))
|
|
||||||
pattern_WWApi_ImageImport_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "image"}, ""))
|
|
||||||
pattern_WWApi_ImageList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "image"}, ""))
|
|
||||||
pattern_WWApi_ImageShow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "imageshow"}, ""))
|
|
||||||
pattern_WWApi_ImageRename_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "imagerename"}, ""))
|
|
||||||
pattern_WWApi_NodeAdd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "node"}, ""))
|
|
||||||
pattern_WWApi_NodeDelete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "node"}, ""))
|
|
||||||
pattern_WWApi_NodeList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "node"}, ""))
|
|
||||||
pattern_WWApi_NodeSet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "nodeset"}, ""))
|
|
||||||
pattern_WWApi_NodeStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "nodestatus"}, ""))
|
|
||||||
pattern_WWApi_Version_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"version"}, ""))
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
forward_WWApi_ImageBuild_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_ImageDelete_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_ImageCopy_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_ImageImport_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_ImageList_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_ImageShow_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_ImageRename_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_NodeAdd_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_NodeDelete_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_NodeList_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_NodeSet_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_NodeStatus_0 = runtime.ForwardResponseMessage
|
|
||||||
forward_WWApi_Version_0 = runtime.ForwardResponseMessage
|
|
||||||
)
|
|
||||||
@@ -1,615 +0,0 @@
|
|||||||
// Routes for the wwapi (WareWulf API).
|
|
||||||
// TODO: Try protoc-gen-doc for generating documentation.
|
|
||||||
|
|
||||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
||||||
// versions:
|
|
||||||
// - protoc-gen-go-grpc v1.5.1
|
|
||||||
// - protoc v4.24.0
|
|
||||||
// source: routes.proto
|
|
||||||
|
|
||||||
package wwapiv1
|
|
||||||
|
|
||||||
import (
|
|
||||||
context "context"
|
|
||||||
grpc "google.golang.org/grpc"
|
|
||||||
codes "google.golang.org/grpc/codes"
|
|
||||||
status "google.golang.org/grpc/status"
|
|
||||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
|
||||||
)
|
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
|
||||||
// is compatible with the grpc package it is being compiled against.
|
|
||||||
// Requires gRPC-Go v1.64.0 or later.
|
|
||||||
const _ = grpc.SupportPackageIsVersion9
|
|
||||||
|
|
||||||
const (
|
|
||||||
WWApi_ImageBuild_FullMethodName = "/wwapi.v1.WWApi/ImageBuild"
|
|
||||||
WWApi_ImageDelete_FullMethodName = "/wwapi.v1.WWApi/ImageDelete"
|
|
||||||
WWApi_ImageCopy_FullMethodName = "/wwapi.v1.WWApi/ImageCopy"
|
|
||||||
WWApi_ImageImport_FullMethodName = "/wwapi.v1.WWApi/ImageImport"
|
|
||||||
WWApi_ImageList_FullMethodName = "/wwapi.v1.WWApi/ImageList"
|
|
||||||
WWApi_ImageShow_FullMethodName = "/wwapi.v1.WWApi/ImageShow"
|
|
||||||
WWApi_ImageRename_FullMethodName = "/wwapi.v1.WWApi/ImageRename"
|
|
||||||
WWApi_NodeAdd_FullMethodName = "/wwapi.v1.WWApi/NodeAdd"
|
|
||||||
WWApi_NodeDelete_FullMethodName = "/wwapi.v1.WWApi/NodeDelete"
|
|
||||||
WWApi_NodeList_FullMethodName = "/wwapi.v1.WWApi/NodeList"
|
|
||||||
WWApi_NodeSet_FullMethodName = "/wwapi.v1.WWApi/NodeSet"
|
|
||||||
WWApi_NodeStatus_FullMethodName = "/wwapi.v1.WWApi/NodeStatus"
|
|
||||||
WWApi_Version_FullMethodName = "/wwapi.v1.WWApi/Version"
|
|
||||||
)
|
|
||||||
|
|
||||||
// WWApiClient is the client API for WWApi service.
|
|
||||||
//
|
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
||||||
//
|
|
||||||
// WWApi defines the wwapid service web interface.
|
|
||||||
type WWApiClient interface {
|
|
||||||
// ImageBuild builds zero or more images.
|
|
||||||
ImageBuild(ctx context.Context, in *ImageBuildParameter, opts ...grpc.CallOption) (*ImageListResponse, error)
|
|
||||||
// ImageDelete removes one or more image from Warewulf management.
|
|
||||||
ImageDelete(ctx context.Context, in *ImageDeleteParameter, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
|
||||||
ImageCopy(ctx context.Context, in *ImageCopyParameter, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
|
||||||
// ImageImport imports an image to Warewulf.
|
|
||||||
ImageImport(ctx context.Context, in *ImageImportParameter, opts ...grpc.CallOption) (*ImageListResponse, error)
|
|
||||||
// ImageList lists ImageInfo for each image.
|
|
||||||
ImageList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ImageListResponse, error)
|
|
||||||
// ImageShow lists ImageShow for each image.
|
|
||||||
ImageShow(ctx context.Context, in *ImageShowParameter, opts ...grpc.CallOption) (*ImageShowResponse, error)
|
|
||||||
// ImageRename renames the image
|
|
||||||
ImageRename(ctx context.Context, in *ImageRenameParameter, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
|
||||||
// NodeAdd adds one or more nodes for management by Warewulf and returns
|
|
||||||
// the added nodes. Node fields may be shimmed in per profiles.
|
|
||||||
NodeAdd(ctx context.Context, in *NodeAddParameter, opts ...grpc.CallOption) (*NodeListResponse, error)
|
|
||||||
// NodeDelete removes one or more nodes from Warewulf management.
|
|
||||||
NodeDelete(ctx context.Context, in *NodeDeleteParameter, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
|
||||||
// NodeList lists some or all nodes managed by Warewulf.
|
|
||||||
NodeList(ctx context.Context, in *NodeNames, opts ...grpc.CallOption) (*NodeListResponse, error)
|
|
||||||
// NodeSet updates node fields for one or more nodes.
|
|
||||||
NodeSet(ctx context.Context, in *ConfSetParameter, opts ...grpc.CallOption) (*NodeListResponse, error)
|
|
||||||
// NodeStatus returns the imaging state for nodes.
|
|
||||||
// This requires warewulfd.
|
|
||||||
NodeStatus(ctx context.Context, in *NodeNames, opts ...grpc.CallOption) (*NodeStatusResponse, error)
|
|
||||||
// Version returns the wwapi version, the api prefix, and the Warewulf
|
|
||||||
// version. This is also useful for testing if the service is up.
|
|
||||||
Version(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*VersionResponse, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type wWApiClient struct {
|
|
||||||
cc grpc.ClientConnInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWWApiClient(cc grpc.ClientConnInterface) WWApiClient {
|
|
||||||
return &wWApiClient{cc}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) ImageBuild(ctx context.Context, in *ImageBuildParameter, opts ...grpc.CallOption) (*ImageListResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(ImageListResponse)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_ImageBuild_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) ImageDelete(ctx context.Context, in *ImageDeleteParameter, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(emptypb.Empty)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_ImageDelete_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) ImageCopy(ctx context.Context, in *ImageCopyParameter, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(emptypb.Empty)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_ImageCopy_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) ImageImport(ctx context.Context, in *ImageImportParameter, opts ...grpc.CallOption) (*ImageListResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(ImageListResponse)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_ImageImport_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) ImageList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ImageListResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(ImageListResponse)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_ImageList_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) ImageShow(ctx context.Context, in *ImageShowParameter, opts ...grpc.CallOption) (*ImageShowResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(ImageShowResponse)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_ImageShow_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) ImageRename(ctx context.Context, in *ImageRenameParameter, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(emptypb.Empty)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_ImageRename_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) NodeAdd(ctx context.Context, in *NodeAddParameter, opts ...grpc.CallOption) (*NodeListResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(NodeListResponse)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_NodeAdd_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) NodeDelete(ctx context.Context, in *NodeDeleteParameter, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(emptypb.Empty)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_NodeDelete_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) NodeList(ctx context.Context, in *NodeNames, opts ...grpc.CallOption) (*NodeListResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(NodeListResponse)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_NodeList_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) NodeSet(ctx context.Context, in *ConfSetParameter, opts ...grpc.CallOption) (*NodeListResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(NodeListResponse)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_NodeSet_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) NodeStatus(ctx context.Context, in *NodeNames, opts ...grpc.CallOption) (*NodeStatusResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(NodeStatusResponse)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_NodeStatus_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *wWApiClient) Version(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*VersionResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(VersionResponse)
|
|
||||||
err := c.cc.Invoke(ctx, WWApi_Version_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// WWApiServer is the server API for WWApi service.
|
|
||||||
// All implementations must embed UnimplementedWWApiServer
|
|
||||||
// for forward compatibility.
|
|
||||||
//
|
|
||||||
// WWApi defines the wwapid service web interface.
|
|
||||||
type WWApiServer interface {
|
|
||||||
// ImageBuild builds zero or more images.
|
|
||||||
ImageBuild(context.Context, *ImageBuildParameter) (*ImageListResponse, error)
|
|
||||||
// ImageDelete removes one or more image from Warewulf management.
|
|
||||||
ImageDelete(context.Context, *ImageDeleteParameter) (*emptypb.Empty, error)
|
|
||||||
ImageCopy(context.Context, *ImageCopyParameter) (*emptypb.Empty, error)
|
|
||||||
// ImageImport imports an image to Warewulf.
|
|
||||||
ImageImport(context.Context, *ImageImportParameter) (*ImageListResponse, error)
|
|
||||||
// ImageList lists ImageInfo for each image.
|
|
||||||
ImageList(context.Context, *emptypb.Empty) (*ImageListResponse, error)
|
|
||||||
// ImageShow lists ImageShow for each image.
|
|
||||||
ImageShow(context.Context, *ImageShowParameter) (*ImageShowResponse, error)
|
|
||||||
// ImageRename renames the image
|
|
||||||
ImageRename(context.Context, *ImageRenameParameter) (*emptypb.Empty, error)
|
|
||||||
// NodeAdd adds one or more nodes for management by Warewulf and returns
|
|
||||||
// the added nodes. Node fields may be shimmed in per profiles.
|
|
||||||
NodeAdd(context.Context, *NodeAddParameter) (*NodeListResponse, error)
|
|
||||||
// NodeDelete removes one or more nodes from Warewulf management.
|
|
||||||
NodeDelete(context.Context, *NodeDeleteParameter) (*emptypb.Empty, error)
|
|
||||||
// NodeList lists some or all nodes managed by Warewulf.
|
|
||||||
NodeList(context.Context, *NodeNames) (*NodeListResponse, error)
|
|
||||||
// NodeSet updates node fields for one or more nodes.
|
|
||||||
NodeSet(context.Context, *ConfSetParameter) (*NodeListResponse, error)
|
|
||||||
// NodeStatus returns the imaging state for nodes.
|
|
||||||
// This requires warewulfd.
|
|
||||||
NodeStatus(context.Context, *NodeNames) (*NodeStatusResponse, error)
|
|
||||||
// Version returns the wwapi version, the api prefix, and the Warewulf
|
|
||||||
// version. This is also useful for testing if the service is up.
|
|
||||||
Version(context.Context, *emptypb.Empty) (*VersionResponse, error)
|
|
||||||
mustEmbedUnimplementedWWApiServer()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnimplementedWWApiServer must be embedded to have
|
|
||||||
// forward compatible implementations.
|
|
||||||
//
|
|
||||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
||||||
// pointer dereference when methods are called.
|
|
||||||
type UnimplementedWWApiServer struct{}
|
|
||||||
|
|
||||||
func (UnimplementedWWApiServer) ImageBuild(context.Context, *ImageBuildParameter) (*ImageListResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ImageBuild not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) ImageDelete(context.Context, *ImageDeleteParameter) (*emptypb.Empty, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ImageDelete not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) ImageCopy(context.Context, *ImageCopyParameter) (*emptypb.Empty, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ImageCopy not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) ImageImport(context.Context, *ImageImportParameter) (*ImageListResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ImageImport not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) ImageList(context.Context, *emptypb.Empty) (*ImageListResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ImageList not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) ImageShow(context.Context, *ImageShowParameter) (*ImageShowResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ImageShow not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) ImageRename(context.Context, *ImageRenameParameter) (*emptypb.Empty, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ImageRename not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) NodeAdd(context.Context, *NodeAddParameter) (*NodeListResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method NodeAdd not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) NodeDelete(context.Context, *NodeDeleteParameter) (*emptypb.Empty, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method NodeDelete not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) NodeList(context.Context, *NodeNames) (*NodeListResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method NodeList not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) NodeSet(context.Context, *ConfSetParameter) (*NodeListResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method NodeSet not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) NodeStatus(context.Context, *NodeNames) (*NodeStatusResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method NodeStatus not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) Version(context.Context, *emptypb.Empty) (*VersionResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Version not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedWWApiServer) mustEmbedUnimplementedWWApiServer() {}
|
|
||||||
func (UnimplementedWWApiServer) testEmbeddedByValue() {}
|
|
||||||
|
|
||||||
// UnsafeWWApiServer may be embedded to opt out of forward compatibility for this service.
|
|
||||||
// Use of this interface is not recommended, as added methods to WWApiServer will
|
|
||||||
// result in compilation errors.
|
|
||||||
type UnsafeWWApiServer interface {
|
|
||||||
mustEmbedUnimplementedWWApiServer()
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterWWApiServer(s grpc.ServiceRegistrar, srv WWApiServer) {
|
|
||||||
// If the following call pancis, it indicates UnimplementedWWApiServer was
|
|
||||||
// embedded by pointer and is nil. This will cause panics if an
|
|
||||||
// unimplemented method is ever invoked, so we test this at initialization
|
|
||||||
// time to prevent it from happening at runtime later due to I/O.
|
|
||||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
||||||
t.testEmbeddedByValue()
|
|
||||||
}
|
|
||||||
s.RegisterService(&WWApi_ServiceDesc, srv)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_ImageBuild_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(ImageBuildParameter)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).ImageBuild(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_ImageBuild_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).ImageBuild(ctx, req.(*ImageBuildParameter))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_ImageDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(ImageDeleteParameter)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).ImageDelete(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_ImageDelete_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).ImageDelete(ctx, req.(*ImageDeleteParameter))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_ImageCopy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(ImageCopyParameter)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).ImageCopy(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_ImageCopy_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).ImageCopy(ctx, req.(*ImageCopyParameter))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_ImageImport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(ImageImportParameter)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).ImageImport(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_ImageImport_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).ImageImport(ctx, req.(*ImageImportParameter))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_ImageList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(emptypb.Empty)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).ImageList(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_ImageList_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).ImageList(ctx, req.(*emptypb.Empty))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_ImageShow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(ImageShowParameter)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).ImageShow(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_ImageShow_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).ImageShow(ctx, req.(*ImageShowParameter))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_ImageRename_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(ImageRenameParameter)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).ImageRename(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_ImageRename_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).ImageRename(ctx, req.(*ImageRenameParameter))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_NodeAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(NodeAddParameter)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).NodeAdd(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_NodeAdd_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).NodeAdd(ctx, req.(*NodeAddParameter))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_NodeDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(NodeDeleteParameter)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).NodeDelete(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_NodeDelete_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).NodeDelete(ctx, req.(*NodeDeleteParameter))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_NodeList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(NodeNames)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).NodeList(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_NodeList_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).NodeList(ctx, req.(*NodeNames))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_NodeSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(ConfSetParameter)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).NodeSet(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_NodeSet_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).NodeSet(ctx, req.(*ConfSetParameter))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_NodeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(NodeNames)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).NodeStatus(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_NodeStatus_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).NodeStatus(ctx, req.(*NodeNames))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _WWApi_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(emptypb.Empty)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(WWApiServer).Version(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: WWApi_Version_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(WWApiServer).Version(ctx, req.(*emptypb.Empty))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
// WWApi_ServiceDesc is the grpc.ServiceDesc for WWApi service.
|
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
|
||||||
// and not to be introspected or modified (even as a copy)
|
|
||||||
var WWApi_ServiceDesc = grpc.ServiceDesc{
|
|
||||||
ServiceName: "wwapi.v1.WWApi",
|
|
||||||
HandlerType: (*WWApiServer)(nil),
|
|
||||||
Methods: []grpc.MethodDesc{
|
|
||||||
{
|
|
||||||
MethodName: "ImageBuild",
|
|
||||||
Handler: _WWApi_ImageBuild_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "ImageDelete",
|
|
||||||
Handler: _WWApi_ImageDelete_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "ImageCopy",
|
|
||||||
Handler: _WWApi_ImageCopy_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "ImageImport",
|
|
||||||
Handler: _WWApi_ImageImport_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "ImageList",
|
|
||||||
Handler: _WWApi_ImageList_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "ImageShow",
|
|
||||||
Handler: _WWApi_ImageShow_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "ImageRename",
|
|
||||||
Handler: _WWApi_ImageRename_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "NodeAdd",
|
|
||||||
Handler: _WWApi_NodeAdd_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "NodeDelete",
|
|
||||||
Handler: _WWApi_NodeDelete_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "NodeList",
|
|
||||||
Handler: _WWApi_NodeList_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "NodeSet",
|
|
||||||
Handler: _WWApi_NodeSet_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "NodeStatus",
|
|
||||||
Handler: _WWApi_NodeStatus_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "Version",
|
|
||||||
Handler: _WWApi_Version_Handler,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Streams: []grpc.StreamDesc{},
|
|
||||||
Metadata: "routes.proto",
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,7 @@ func Build(name string, buildForce bool) error {
|
|||||||
imagePath := ImageFile(name)
|
imagePath := ImageFile(name)
|
||||||
|
|
||||||
if !ValidSource(name) {
|
if !ValidSource(name) {
|
||||||
return fmt.Errorf("Image does not exist: %s", name)
|
return fmt.Errorf("image does not exist: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !buildForce {
|
if !buildForce {
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ func DeleteImage(name string) error {
|
|||||||
wwlog.Verbose("removing %s for image %s", imageFile+".gz", name)
|
wwlog.Verbose("removing %s for image %s", imageFile+".gz", name)
|
||||||
errGz := os.Remove(imageFile + ".gz")
|
errGz := os.Remove(imageFile + ".gz")
|
||||||
if errImg != nil {
|
if errImg != nil {
|
||||||
return fmt.Errorf("Problems delete %s for image %s: %s", imageFile, name, errImg)
|
return fmt.Errorf("problem deleting %s for image %s: %s", imageFile, name, errImg)
|
||||||
}
|
}
|
||||||
if errGz != nil {
|
if errGz != nil {
|
||||||
return fmt.Errorf("Problems delete %s for image %s: %s", imageFile+".gz", name, errGz)
|
return fmt.Errorf("problem deleting %s for image %s: %s", imageFile+".gz", name, errGz)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("Image %s of image %s doesn't exist", imageFile, name)
|
return fmt.Errorf("image %s of image %s doesn't exist", imageFile, name)
|
||||||
}
|
}
|
||||||
|
|||||||
184
internal/pkg/node/update_test.go
Normal file
184
internal/pkg/node/update_test.go
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
package node
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
// changedSet returns a changed function that reports true for the given flag names.
|
||||||
|
func changedSet(flags ...string) func(string) bool {
|
||||||
|
set := make(map[string]bool)
|
||||||
|
for _, f := range flags {
|
||||||
|
set[f] = true
|
||||||
|
}
|
||||||
|
return func(name string) bool { return set[name] }
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateFrom_NoChanges(t *testing.T) {
|
||||||
|
dst := NewNode("test")
|
||||||
|
dst.Comment = "original"
|
||||||
|
dst.ImageName = "centos7"
|
||||||
|
|
||||||
|
src := NewNode("")
|
||||||
|
src.Comment = "new"
|
||||||
|
src.ImageName = "rocky9"
|
||||||
|
|
||||||
|
dst.UpdateFrom(&src, changedSet())
|
||||||
|
|
||||||
|
assert.Equal(t, "original", dst.Comment)
|
||||||
|
assert.Equal(t, "centos7", dst.ImageName)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateFrom_StringField(t *testing.T) {
|
||||||
|
dst := NewNode("test")
|
||||||
|
dst.Comment = "original"
|
||||||
|
dst.ImageName = "centos7"
|
||||||
|
|
||||||
|
src := NewNode("")
|
||||||
|
src.Comment = "updated"
|
||||||
|
src.ImageName = "rocky9"
|
||||||
|
|
||||||
|
dst.UpdateFrom(&src, changedSet("comment"))
|
||||||
|
|
||||||
|
assert.Equal(t, "updated", dst.Comment)
|
||||||
|
assert.Equal(t, "centos7", dst.ImageName, "unchanged field should be preserved")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateFrom_UndefString(t *testing.T) {
|
||||||
|
dst := NewNode("test")
|
||||||
|
dst.Comment = "original"
|
||||||
|
|
||||||
|
src := NewNode("")
|
||||||
|
src.Comment = "UNDEF"
|
||||||
|
|
||||||
|
dst.UpdateFrom(&src, changedSet("comment"))
|
||||||
|
|
||||||
|
assert.Equal(t, "UNDEF", dst.Comment, "UNDEF should pass through; Flatten during Persist cleans it")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateFrom_SliceField(t *testing.T) {
|
||||||
|
dst := NewNode("test")
|
||||||
|
dst.Profiles = []string{"default"}
|
||||||
|
|
||||||
|
src := NewNode("")
|
||||||
|
src.Profiles = []string{"compute", "gpu"}
|
||||||
|
|
||||||
|
dst.UpdateFrom(&src, changedSet("profile"))
|
||||||
|
|
||||||
|
assert.Equal(t, []string{"compute", "gpu"}, dst.Profiles)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateFrom_SliceFieldUnchanged(t *testing.T) {
|
||||||
|
dst := NewNode("test")
|
||||||
|
dst.Profiles = []string{"default"}
|
||||||
|
|
||||||
|
src := NewNode("")
|
||||||
|
src.Profiles = []string{}
|
||||||
|
|
||||||
|
dst.UpdateFrom(&src, changedSet())
|
||||||
|
|
||||||
|
assert.Equal(t, []string{"default"}, dst.Profiles, "unchanged slice should be preserved")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateFrom_NestedIpmiField(t *testing.T) {
|
||||||
|
dst := NewNode("test")
|
||||||
|
dst.Ipmi = &IpmiConf{UserName: "admin", Port: "623"}
|
||||||
|
|
||||||
|
src := NewNode("")
|
||||||
|
src.Ipmi = &IpmiConf{UserName: "root"}
|
||||||
|
|
||||||
|
dst.UpdateFrom(&src, changedSet("ipmiuser"))
|
||||||
|
|
||||||
|
assert.Equal(t, "root", dst.Ipmi.UserName)
|
||||||
|
assert.Equal(t, "623", dst.Ipmi.Port, "unchanged ipmi field should be preserved")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateFrom_NilDstIpmiAutoCreated(t *testing.T) {
|
||||||
|
dst := NewNode("test")
|
||||||
|
dst.Ipmi = nil
|
||||||
|
|
||||||
|
src := NewNode("")
|
||||||
|
src.Ipmi = &IpmiConf{UserName: "admin"}
|
||||||
|
|
||||||
|
dst.UpdateFrom(&src, changedSet("ipmiuser"))
|
||||||
|
|
||||||
|
assert.NotNil(t, dst.Ipmi, "nil dst Ipmi should be auto-created")
|
||||||
|
assert.Equal(t, "admin", dst.Ipmi.UserName)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateFrom_NetDevFieldPreservesOthers(t *testing.T) {
|
||||||
|
dst := NewNode("test")
|
||||||
|
dst.NetDevs = map[string]*NetDev{
|
||||||
|
"default": {
|
||||||
|
Ipaddr: net.ParseIP("10.0.0.1"),
|
||||||
|
Device: "eth0",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
src := NewNode("")
|
||||||
|
src.NetDevs = map[string]*NetDev{
|
||||||
|
"default": {
|
||||||
|
OnBoot: "true",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
dst.UpdateFrom(&src, changedSet("onboot"))
|
||||||
|
|
||||||
|
assert.Equal(t, "true", string(dst.NetDevs["default"].OnBoot))
|
||||||
|
assert.Equal(t, "10.0.0.1", dst.NetDevs["default"].Ipaddr.String(), "ipaddr should be preserved")
|
||||||
|
assert.Equal(t, "eth0", dst.NetDevs["default"].Device, "device should be preserved")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateFrom_NetDevNewEntry(t *testing.T) {
|
||||||
|
dst := NewNode("test")
|
||||||
|
dst.NetDevs = map[string]*NetDev{
|
||||||
|
"default": {Ipaddr: net.ParseIP("10.0.0.1")},
|
||||||
|
}
|
||||||
|
|
||||||
|
src := NewNode("")
|
||||||
|
src.NetDevs = map[string]*NetDev{
|
||||||
|
"secondary": {
|
||||||
|
Device: "eth1",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
dst.UpdateFrom(&src, changedSet("netdev"))
|
||||||
|
|
||||||
|
assert.Contains(t, dst.NetDevs, "default", "existing entry should be preserved")
|
||||||
|
assert.Contains(t, dst.NetDevs, "secondary", "new entry should be created")
|
||||||
|
assert.Equal(t, "eth1", dst.NetDevs["secondary"].Device)
|
||||||
|
assert.Equal(t, "10.0.0.1", dst.NetDevs["default"].Ipaddr.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateFrom_MultipleFields(t *testing.T) {
|
||||||
|
dst := NewNode("test")
|
||||||
|
dst.Comment = "old"
|
||||||
|
dst.ImageName = "centos7"
|
||||||
|
dst.Ipmi = &IpmiConf{UserName: "admin", Port: "623"}
|
||||||
|
|
||||||
|
src := NewNode("")
|
||||||
|
src.Comment = "new"
|
||||||
|
src.ImageName = "rocky9"
|
||||||
|
src.Ipmi = &IpmiConf{UserName: "root"}
|
||||||
|
|
||||||
|
dst.UpdateFrom(&src, changedSet("comment", "image", "ipmiuser"))
|
||||||
|
|
||||||
|
assert.Equal(t, "new", dst.Comment)
|
||||||
|
assert.Equal(t, "rocky9", dst.ImageName)
|
||||||
|
assert.Equal(t, "root", dst.Ipmi.UserName)
|
||||||
|
assert.Equal(t, "623", dst.Ipmi.Port, "unchanged ipmi field should be preserved")
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestUpdateProfileFrom_BasicField(t *testing.T) {
|
||||||
|
dst := NewProfile("test")
|
||||||
|
dst.Comment = "original"
|
||||||
|
|
||||||
|
src := NewProfile("")
|
||||||
|
src.Comment = "updated"
|
||||||
|
|
||||||
|
dst.UpdateFrom(&src, changedSet("comment"))
|
||||||
|
|
||||||
|
assert.Equal(t, "updated", dst.Comment)
|
||||||
|
}
|
||||||
@@ -3,24 +3,12 @@ package version
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/warewulf/warewulf/internal/pkg/api/routes/wwapiv1"
|
|
||||||
warewulfconf "github.com/warewulf/warewulf/internal/pkg/config"
|
warewulfconf "github.com/warewulf/warewulf/internal/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return the version of wwctl
|
Return the version of wwctl
|
||||||
*/
|
*/
|
||||||
func GetVersion() string {
|
func Version() string {
|
||||||
return fmt.Sprintf("%s-%s", warewulfconf.Version, warewulfconf.Release)
|
return fmt.Sprintf("%s-%s", warewulfconf.Version, warewulfconf.Release)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Returns the version of the api via grpc
|
|
||||||
*/
|
|
||||||
func Version() (versionResponse *wwapiv1.VersionResponse) {
|
|
||||||
versionResponse = &wwapiv1.VersionResponse{}
|
|
||||||
versionResponse.ApiPrefix = "rc1"
|
|
||||||
versionResponse.ApiVersion = "1"
|
|
||||||
versionResponse.WarewulfVersion = GetVersion()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ func Handler(auth *config.Authentication, allowedNets []net.IPNet) *web.Service
|
|||||||
|
|
||||||
api.OpenAPISchema().SetTitle("Warewulf v4 API")
|
api.OpenAPISchema().SetTitle("Warewulf v4 API")
|
||||||
api.OpenAPISchema().SetDescription("This service provides an API to a Warewulf v4 server.")
|
api.OpenAPISchema().SetDescription("This service provides an API to a Warewulf v4 server.")
|
||||||
api.OpenAPISchema().SetVersion(version.GetVersion())
|
api.OpenAPISchema().SetVersion(version.Version())
|
||||||
|
|
||||||
api.Route("/api/nodes", func(r chi.Router) {
|
api.Route("/api/nodes", func(r chi.Router) {
|
||||||
r.Group(func(r chi.Router) {
|
r.Group(func(r chi.Router) {
|
||||||
|
|||||||
Reference in New Issue
Block a user