2020-02-03 11:16:02 +03:00
|
|
|
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
2020-03-23 19:19:30 +03:00
|
|
|
// source: auth/service/proto/auth.proto
|
2020-02-03 11:16:02 +03:00
|
|
|
|
|
|
|
package go_micro_auth
|
|
|
|
|
|
|
|
import (
|
|
|
|
fmt "fmt"
|
2020-02-26 01:15:44 +03:00
|
|
|
proto "github.com/golang/protobuf/proto"
|
2020-02-03 11:16:02 +03:00
|
|
|
math "math"
|
2020-02-26 01:15:44 +03:00
|
|
|
)
|
2020-02-03 11:16:02 +03:00
|
|
|
|
2020-02-26 01:15:44 +03:00
|
|
|
import (
|
2020-02-03 11:16:02 +03:00
|
|
|
context "context"
|
2020-02-03 11:26:57 +03:00
|
|
|
client "github.com/micro/go-micro/v2/client"
|
|
|
|
server "github.com/micro/go-micro/v2/server"
|
2020-02-03 11:16:02 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
|
|
var _ = proto.Marshal
|
|
|
|
var _ = fmt.Errorf
|
|
|
|
var _ = math.Inf
|
|
|
|
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
|
|
// is compatible with the proto package it is being compiled against.
|
|
|
|
// A compilation error at this line likely means your copy of the
|
|
|
|
// proto package needs to be updated.
|
|
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
|
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
|
|
var _ context.Context
|
|
|
|
var _ client.Option
|
|
|
|
var _ server.Option
|
|
|
|
|
|
|
|
// Client API for Auth service
|
|
|
|
|
|
|
|
type AuthService interface {
|
|
|
|
Generate(ctx context.Context, in *GenerateRequest, opts ...client.CallOption) (*GenerateResponse, error)
|
2020-03-23 19:19:30 +03:00
|
|
|
Grant(ctx context.Context, in *GrantRequest, opts ...client.CallOption) (*GrantResponse, error)
|
2020-02-03 11:16:02 +03:00
|
|
|
Revoke(ctx context.Context, in *RevokeRequest, opts ...client.CallOption) (*RevokeResponse, error)
|
2020-03-23 19:19:30 +03:00
|
|
|
Inspect(ctx context.Context, in *InspectRequest, opts ...client.CallOption) (*InspectResponse, error)
|
|
|
|
Refresh(ctx context.Context, in *RefreshRequest, opts ...client.CallOption) (*RefreshResponse, error)
|
2020-03-24 16:48:37 +03:00
|
|
|
ListRules(ctx context.Context, in *ListRulesRequest, opts ...client.CallOption) (*ListRulesResponse, error)
|
2020-02-03 11:16:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
type authService struct {
|
|
|
|
c client.Client
|
|
|
|
name string
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewAuthService(name string, c client.Client) AuthService {
|
|
|
|
return &authService{
|
|
|
|
c: c,
|
|
|
|
name: name,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *authService) Generate(ctx context.Context, in *GenerateRequest, opts ...client.CallOption) (*GenerateResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Auth.Generate", in)
|
|
|
|
out := new(GenerateResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-03-23 19:19:30 +03:00
|
|
|
func (c *authService) Grant(ctx context.Context, in *GrantRequest, opts ...client.CallOption) (*GrantResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Auth.Grant", in)
|
|
|
|
out := new(GrantResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-02-03 11:16:02 +03:00
|
|
|
func (c *authService) Revoke(ctx context.Context, in *RevokeRequest, opts ...client.CallOption) (*RevokeResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Auth.Revoke", in)
|
|
|
|
out := new(RevokeResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-03-23 19:19:30 +03:00
|
|
|
func (c *authService) Inspect(ctx context.Context, in *InspectRequest, opts ...client.CallOption) (*InspectResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Auth.Inspect", in)
|
|
|
|
out := new(InspectResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *authService) Refresh(ctx context.Context, in *RefreshRequest, opts ...client.CallOption) (*RefreshResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Auth.Refresh", in)
|
|
|
|
out := new(RefreshResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-03-24 16:48:37 +03:00
|
|
|
func (c *authService) ListRules(ctx context.Context, in *ListRulesRequest, opts ...client.CallOption) (*ListRulesResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Auth.ListRules", in)
|
|
|
|
out := new(ListRulesResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-02-03 11:16:02 +03:00
|
|
|
// Server API for Auth service
|
|
|
|
|
|
|
|
type AuthHandler interface {
|
|
|
|
Generate(context.Context, *GenerateRequest, *GenerateResponse) error
|
2020-03-23 19:19:30 +03:00
|
|
|
Grant(context.Context, *GrantRequest, *GrantResponse) error
|
2020-02-03 11:16:02 +03:00
|
|
|
Revoke(context.Context, *RevokeRequest, *RevokeResponse) error
|
2020-03-23 19:19:30 +03:00
|
|
|
Inspect(context.Context, *InspectRequest, *InspectResponse) error
|
|
|
|
Refresh(context.Context, *RefreshRequest, *RefreshResponse) error
|
2020-03-24 16:48:37 +03:00
|
|
|
ListRules(context.Context, *ListRulesRequest, *ListRulesResponse) error
|
2020-02-03 11:16:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func RegisterAuthHandler(s server.Server, hdlr AuthHandler, opts ...server.HandlerOption) error {
|
|
|
|
type auth interface {
|
|
|
|
Generate(ctx context.Context, in *GenerateRequest, out *GenerateResponse) error
|
2020-03-23 19:19:30 +03:00
|
|
|
Grant(ctx context.Context, in *GrantRequest, out *GrantResponse) error
|
2020-02-03 11:16:02 +03:00
|
|
|
Revoke(ctx context.Context, in *RevokeRequest, out *RevokeResponse) error
|
2020-03-23 19:19:30 +03:00
|
|
|
Inspect(ctx context.Context, in *InspectRequest, out *InspectResponse) error
|
|
|
|
Refresh(ctx context.Context, in *RefreshRequest, out *RefreshResponse) error
|
2020-03-24 16:48:37 +03:00
|
|
|
ListRules(ctx context.Context, in *ListRulesRequest, out *ListRulesResponse) error
|
2020-02-03 11:16:02 +03:00
|
|
|
}
|
|
|
|
type Auth struct {
|
|
|
|
auth
|
|
|
|
}
|
|
|
|
h := &authHandler{hdlr}
|
|
|
|
return s.Handle(s.NewHandler(&Auth{h}, opts...))
|
|
|
|
}
|
|
|
|
|
|
|
|
type authHandler struct {
|
|
|
|
AuthHandler
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *authHandler) Generate(ctx context.Context, in *GenerateRequest, out *GenerateResponse) error {
|
|
|
|
return h.AuthHandler.Generate(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
2020-03-23 19:19:30 +03:00
|
|
|
func (h *authHandler) Grant(ctx context.Context, in *GrantRequest, out *GrantResponse) error {
|
|
|
|
return h.AuthHandler.Grant(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
2020-02-03 11:16:02 +03:00
|
|
|
func (h *authHandler) Revoke(ctx context.Context, in *RevokeRequest, out *RevokeResponse) error {
|
|
|
|
return h.AuthHandler.Revoke(ctx, in, out)
|
|
|
|
}
|
2020-03-23 19:19:30 +03:00
|
|
|
|
|
|
|
func (h *authHandler) Inspect(ctx context.Context, in *InspectRequest, out *InspectResponse) error {
|
|
|
|
return h.AuthHandler.Inspect(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *authHandler) Refresh(ctx context.Context, in *RefreshRequest, out *RefreshResponse) error {
|
|
|
|
return h.AuthHandler.Refresh(ctx, in, out)
|
|
|
|
}
|
2020-03-24 16:48:37 +03:00
|
|
|
|
|
|
|
func (h *authHandler) ListRules(ctx context.Context, in *ListRulesRequest, out *ListRulesResponse) error {
|
|
|
|
return h.AuthHandler.ListRules(ctx, in, out)
|
|
|
|
}
|