Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty definition from google #750

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
347 changes: 153 additions & 194 deletions adsys.pb.go

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions adsys.proto
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
syntax = "proto3";

import "google/protobuf/empty.proto";

option go_package = "github.com/ubuntu/adsys";

service service {
rpc Cat(Empty) returns (stream StringResponse);
rpc Version(Empty) returns (stream StringResponse);
rpc Status(Empty) returns (stream StringResponse);
rpc Stop(StopRequest) returns (stream Empty);
rpc UpdatePolicy(UpdatePolicyRequest) returns (stream Empty);
rpc Cat(google.protobuf.Empty) returns (stream StringResponse);
rpc Version(google.protobuf.Empty) returns (stream StringResponse);
rpc Status(google.protobuf.Empty) returns (stream StringResponse);
rpc Stop(StopRequest) returns (stream google.protobuf.Empty);
rpc UpdatePolicy(UpdatePolicyRequest) returns (stream google.protobuf.Empty);
rpc DumpPolicies(DumpPoliciesRequest) returns (stream StringResponse);
rpc DumpPoliciesDefinitions(DumpPolicyDefinitionsRequest) returns (stream DumpPolicyDefinitionsResponse);
rpc GetDoc(GetDocRequest) returns (stream StringResponse);
rpc ListDoc(ListDocRequest) returns (stream StringResponse);
rpc ListUsers(ListUsersRequest) returns (stream StringResponse);
rpc GPOListScript(Empty) returns (stream StringResponse);
rpc GPOListScript(google.protobuf.Empty) returns (stream StringResponse);
}

message Empty {}

message ListUsersRequest {
bool active = 1;
}
Expand Down
61 changes: 31 additions & 30 deletions adsys_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion cmd/adsysd/client/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/ubuntu/adsys/internal/cmdhandler"
"github.com/ubuntu/adsys/internal/consts"
log "github.com/ubuntu/adsys/internal/grpc/logstreamer"
"google.golang.org/protobuf/types/known/emptypb"
)

func (a *App) installPolicy() {
Expand Down Expand Up @@ -258,7 +259,7 @@ func (a *App) dumpGPOListScript() error {
}
defer client.Close()

stream, err := client.GPOListScript(a.ctx, &adsys.Empty{})
stream, err := client.GPOListScript(a.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand Down
5 changes: 3 additions & 2 deletions cmd/adsysd/client/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/ubuntu/adsys/internal/cmdhandler"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/emptypb"
)

func (a *App) installService() {
Expand Down Expand Up @@ -61,7 +62,7 @@ func (a *App) serviceCat() error {
}
defer client.Close()

stream, err := client.Cat(a.ctx, &adsys.Empty{})
stream, err := client.Cat(a.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand Down Expand Up @@ -89,7 +90,7 @@ func (a App) getStatus() (err error) {
}
defer client.Close()

stream, err := client.Status(a.ctx, &adsys.Empty{})
stream, err := client.Status(a.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/adsysd/client/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (

"github.com/leonelquinteros/gotext"
"github.com/spf13/cobra"
"github.com/ubuntu/adsys"
"github.com/ubuntu/adsys/internal/adsysservice"
"github.com/ubuntu/adsys/internal/cmdhandler"
"github.com/ubuntu/adsys/internal/consts"
"google.golang.org/protobuf/types/known/emptypb"
)

func (a *App) installVersion() {
Expand All @@ -32,7 +32,7 @@ func (a App) getVersion() (err error) {
}
defer client.Close()

stream, err := client.Version(a.ctx, &adsys.Empty{})
stream, err := client.Version(a.ctx, &emptypb.Empty{})
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/adsysd/integration_tests/adsys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/ubuntu/adsys/internal/authorizer"
"github.com/ubuntu/adsys/internal/testutils"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"
)

const dockerSystemDaemonsImage = "ghcr.io/ubuntu/adsys/systemdaemons:0.1"
Expand Down Expand Up @@ -134,7 +135,7 @@ type timeoutOnVersionServer struct {
callbackHandled chan struct{}
}

func (server *timeoutOnVersionServer) Version(_ *adsys.Empty, s adsys.Service_VersionServer) error {
func (server *timeoutOnVersionServer) Version(_ *emptypb.Empty, s adsys.Service_VersionServer) error {
defer close(server.callbackHandled)
select {
case <-s.Context().Done():
Expand Down
3 changes: 2 additions & 1 deletion internal/adsysservice/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/ubuntu/adsys/internal/policies"
"github.com/ubuntu/decorate"
"golang.org/x/sync/errgroup"
"google.golang.org/protobuf/types/known/emptypb"
)

// UpdatePolicy refreshes or creates a policy for current user or user given as argument.
Expand Down Expand Up @@ -140,7 +141,7 @@ func (s *Service) DumpPoliciesDefinitions(r *adsys.DumpPolicyDefinitionsRequest,
}

// GPOListScript returns the embedded GPO python list script.
func (s *Service) GPOListScript(_ *adsys.Empty, stream adsys.Service_GPOListScriptServer) (err error) {
func (s *Service) GPOListScript(_ *emptypb.Empty, stream adsys.Service_GPOListScriptServer) (err error) {
defer decorate.OnError(&err, i18n.G("error while getting gpo list script"))

if err := s.authorizer.IsAllowedFromContext(stream.Context(), authorizer.ActionAlwaysAllowed); err != nil {
Expand Down
5 changes: 3 additions & 2 deletions internal/adsysservice/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ import (
"github.com/ubuntu/decorate"
"golang.org/x/exp/slices"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"
)

// Cat forwards any messages from all requests to the client.
// Anything logged by the server on stdout, stderr or via the standard logger.
// Only one call at a time can be performed here.
func (s *Service) Cat(_ *adsys.Empty, stream adsys.Service_CatServer) (err error) {
func (s *Service) Cat(_ *emptypb.Empty, stream adsys.Service_CatServer) (err error) {
defer decorate.OnError(&err, i18n.G("error while trying to display daemon output"))

if err := s.authorizer.IsAllowedFromContext(stream.Context(), actions.ActionServiceManage); err != nil {
Expand Down Expand Up @@ -59,7 +60,7 @@ func (ss streamWriter) Write(b []byte) (n int, err error) {
}

// Status returns internal daemon status to the client.
func (s *Service) Status(_ *adsys.Empty, stream adsys.Service_StatusServer) (err error) {
func (s *Service) Status(_ *emptypb.Empty, stream adsys.Service_StatusServer) (err error) {
defer decorate.OnError(&err, i18n.G("error while getting daemon status"))

if err := s.authorizer.IsAllowedFromContext(stream.Context(), authorizer.ActionAlwaysAllowed); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion internal/adsysservice/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
log "github.com/ubuntu/adsys/internal/grpc/logstreamer"
"github.com/ubuntu/adsys/internal/i18n"
"github.com/ubuntu/decorate"
"google.golang.org/protobuf/types/known/emptypb"
)

// Version returns version from server.
func (s *Service) Version(_ *adsys.Empty, stream adsys.Service_VersionServer) (err error) {
func (s *Service) Version(_ *emptypb.Empty, stream adsys.Service_VersionServer) (err error) {
defer decorate.OnError(&err, i18n.G("error while getting daemon version"))

if err := s.authorizer.IsAllowedFromContext(stream.Context(), authorizer.ActionAlwaysAllowed); err != nil {
Expand Down