Skip to content

Commit

Permalink
integrate suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilzington committed Oct 2, 2023
1 parent ff89e16 commit f831e86
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 66 deletions.
9 changes: 5 additions & 4 deletions cmd/metal-api/internal/service/tenant-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
v1 "github.com/metal-stack/masterdata-api/api/rest/v1"
mdmv1 "github.com/metal-stack/masterdata-api/api/v1"
mdm "github.com/metal-stack/masterdata-api/pkg/client"
internalV1 "github.com/metal-stack/metal-api/cmd/metal-api/internal/service/v1"
"go.uber.org/zap"
"google.golang.org/protobuf/types/known/timestamppb"
"google.golang.org/protobuf/types/known/wrapperspb"

restfulspec "github.com/emicklei/go-restful-openapi/v2"
Expand Down Expand Up @@ -79,7 +79,8 @@ func (r *tenantResource) webService() *restful.WebService {
Doc("get tenant with this id at the given timestamp").
Param(ws.PathParameter("id", "identifier of the tenant").DataType("string")).
Metadata(restfulspec.KeyOpenAPITags, tags).
Reads(internalV1.TenantGetHistoryRequest{}).
Metadata(auditing.Exclude, true).
Reads(v1.TenantGetHistoryRequest{}).
Writes(v1.TenantResponse{}).
Returns(http.StatusOK, "OK", v1.TenantResponse{}).
DefaultReturns("Error", httperrors.HTTPErrorResponse{}))
Expand Down Expand Up @@ -201,14 +202,14 @@ func (r *tenantResource) createTenant(request *restful.Request, response *restfu
func (r *tenantResource) getTenantHistory(request *restful.Request, response *restful.Response) {
id := request.PathParameter("id")

var tghr internalV1.TenantGetHistoryRequest
var tghr v1.TenantGetHistoryRequest
err := request.ReadEntity(&tghr)
if err != nil {
r.sendError(request, response, httperrors.BadRequest(err))
return
}

thres, err := r.mdc.Tenant().GetHistory(request.Request.Context(), &mdmv1.TenantGetHistoryRequest{Id: id, At: tghr.At})
thres, err := r.mdc.Tenant().GetHistory(request.Request.Context(), &mdmv1.TenantGetHistoryRequest{Id: id, At: timestamppb.New(tghr.At)})
if err != nil {
r.sendError(request, response, defaultError(err))
return
Expand Down
9 changes: 0 additions & 9 deletions cmd/metal-api/internal/service/v1/tenant.go

This file was deleted.

35 changes: 19 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/metal-stack/metal-api

go 1.21

replace github.com/metal-stack/masterdata-api => ../masterdata-api

require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/avast/retry-go/v4 v4.5.0
Expand All @@ -18,7 +20,7 @@ require (
github.com/looplab/fsm v0.3.0
github.com/metal-stack/go-ipam v1.8.5
github.com/metal-stack/masterdata-api v0.10.0
github.com/metal-stack/metal-lib v0.13.2
github.com/metal-stack/metal-lib v0.13.3
github.com/metal-stack/security v0.6.7
github.com/metal-stack/v v1.0.3
github.com/nsqio/go-nsq v1.1.0
Expand All @@ -29,13 +31,15 @@ require (
github.com/testcontainers/testcontainers-go v0.23.0
github.com/undefinedlabs/go-mpatch v1.0.7
go.uber.org/zap v1.25.0
golang.org/x/crypto v0.12.0
golang.org/x/crypto v0.13.0
golang.org/x/sync v0.3.0
google.golang.org/grpc v1.57.0
google.golang.org/grpc v1.58.0
google.golang.org/protobuf v1.31.0
gopkg.in/rethinkdb/rethinkdb-go.v6 v6.2.2
)

require connectrpc.com/connect v1.11.1 // indirect

replace (
// netipx and x/exp must be replaced for tailscale < 1.48
go4.org/netipx => go4.org/netipx v0.0.0-20230303233057-f1b76eb4bb35
Expand All @@ -56,17 +60,16 @@ require (
github.com/avast/retry-go v3.0.0+incompatible // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bufbuild/connect-go v1.10.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/containerd/containerd v1.7.3 // indirect
github.com/containerd/containerd v1.7.5 // indirect
github.com/coreos/go-oidc/v3 v3.6.0 // indirect
github.com/cpuguy83/dockercfg v0.3.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.3.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.5+incompatible // indirect
github.com/docker/docker v24.0.6+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand Down Expand Up @@ -124,7 +127,7 @@ require (
github.com/meilisearch/meilisearch-go v0.25.0 // indirect
github.com/mitchellh/go-ps v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/patternmatcher v0.5.0 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -136,7 +139,7 @@ require (
github.com/opencontainers/runc v1.1.9 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/philip-bui/grpc-zerolog v1.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand Down Expand Up @@ -164,19 +167,19 @@ require (
go4.org/mem v0.0.0-20220726221520-4f986261bf13 // indirect
go4.org/netipx v0.0.0-20230728180743-ad4cb58a6516 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230525183740-e7c30c78aeb2 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect; indirecct
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect
golang.org/x/tools v0.13.0 // indirect
golang.zx2c4.com/wireguard/windows v0.5.3 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
gopkg.in/cenkalti/backoff.v2 v2.2.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
Loading

0 comments on commit f831e86

Please sign in to comment.