Skip to content

Commit b90d7e5

Browse files
kmavromatilukedirtwalker
authored andcommitted
posix-gateway: add initial service management API
Implementation of the Service Management API for the posix gateway. The supported endpoints are `info`, `log/level` and `config`. GitOrigin-RevId: 58840adc46cf968e92d1e663d9f7ee20894f7a30
1 parent 2addeab commit b90d7e5

File tree

17 files changed

+685
-12
lines changed

17 files changed

+685
-12
lines changed

go/pkg/dispatcher/api/spec.gen.go

+11-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/pkg/gateway/api/BUILD.bazel

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
load("//lint:go.bzl", "go_library")
2+
load("@com_github_scionproto_scion//rules_openapi:defs.bzl", "openapi_generate_go")
3+
4+
openapi_generate_go(
5+
name = "api_generated",
6+
src = "//spec:gateway",
7+
client = False,
8+
)
9+
10+
# exclude the *.gen.go filse in the workspace it's only for editor compatibility.
11+
# gazelle:exclude *.gen.go
12+
go_library(
13+
name = "go_default_library",
14+
srcs = [
15+
"api.go",
16+
":api_generated", # keep
17+
],
18+
importpath = "github.com/scionproto/scion/go/pkg/gateway/api",
19+
visibility = ["//visibility:public"],
20+
deps = [
21+
"@com_github_deepmap_oapi_codegen//pkg/runtime:go_default_library", # keep
22+
"@com_github_getkin_kin_openapi//openapi3:go_default_library", # keep
23+
"@com_github_go_chi_chi_v5//:go_default_library", # keep
24+
],
25+
)

go/pkg/gateway/api/api.go

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2021 Anapaya Systems
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
package api
15+
16+
import (
17+
"net/http"
18+
)
19+
20+
// Server implements the Posix Gateway Service API.
21+
type Server struct {
22+
Config http.HandlerFunc
23+
Info http.HandlerFunc
24+
LogLevel http.HandlerFunc
25+
}
26+
27+
// GetConfig is an indirection to the http handler.
28+
func (s *Server) GetConfig(w http.ResponseWriter, r *http.Request) {
29+
s.Config(w, r)
30+
}
31+
32+
// GetInfo is an indirection to the http handler.
33+
func (s *Server) GetInfo(w http.ResponseWriter, r *http.Request) {
34+
s.Info(w, r)
35+
}
36+
37+
// GetLogLevel is an indirection to the http handler.
38+
func (s *Server) GetLogLevel(w http.ResponseWriter, r *http.Request) {
39+
s.LogLevel(w, r)
40+
}
41+
42+
// SetLogLevel is an indirection to the http handler.
43+
func (s *Server) SetLogLevel(w http.ResponseWriter, r *http.Request) {
44+
s.LogLevel(w, r)
45+
}

go/pkg/gateway/api/server.gen.go

+147
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/pkg/gateway/api/spec.gen.go

+104
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/pkg/gateway/api/types.gen.go

+37
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)