There can be only one! (#1445)

* There can be only one

* fix proto?
This commit is contained in:
Asim Aslam 2020-03-31 10:18:50 +01:00 committed by GitHub
parent 76ade7efd9
commit 1222d076f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 681 additions and 1233 deletions

View File

@ -1,197 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: auth/service/proto/accounts.proto
package auth
import (
context "context"
fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
math "math"
)
// 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
type ListAccountsRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListAccountsRequest) Reset() { *m = ListAccountsRequest{} }
func (m *ListAccountsRequest) String() string { return proto.CompactTextString(m) }
func (*ListAccountsRequest) ProtoMessage() {}
func (*ListAccountsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_fdbfb9fc95541122, []int{0}
}
func (m *ListAccountsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListAccountsRequest.Unmarshal(m, b)
}
func (m *ListAccountsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListAccountsRequest.Marshal(b, m, deterministic)
}
func (m *ListAccountsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListAccountsRequest.Merge(m, src)
}
func (m *ListAccountsRequest) XXX_Size() int {
return xxx_messageInfo_ListAccountsRequest.Size(m)
}
func (m *ListAccountsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ListAccountsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ListAccountsRequest proto.InternalMessageInfo
type ListAccountsResponse struct {
Accounts []*Account `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListAccountsResponse) Reset() { *m = ListAccountsResponse{} }
func (m *ListAccountsResponse) String() string { return proto.CompactTextString(m) }
func (*ListAccountsResponse) ProtoMessage() {}
func (*ListAccountsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_fdbfb9fc95541122, []int{1}
}
func (m *ListAccountsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListAccountsResponse.Unmarshal(m, b)
}
func (m *ListAccountsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListAccountsResponse.Marshal(b, m, deterministic)
}
func (m *ListAccountsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListAccountsResponse.Merge(m, src)
}
func (m *ListAccountsResponse) XXX_Size() int {
return xxx_messageInfo_ListAccountsResponse.Size(m)
}
func (m *ListAccountsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListAccountsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ListAccountsResponse proto.InternalMessageInfo
func (m *ListAccountsResponse) GetAccounts() []*Account {
if m != nil {
return m.Accounts
}
return nil
}
func init() {
proto.RegisterType((*ListAccountsRequest)(nil), "go.micro.auth.ListAccountsRequest")
proto.RegisterType((*ListAccountsResponse)(nil), "go.micro.auth.ListAccountsResponse")
}
func init() { proto.RegisterFile("auth/service/proto/accounts.proto", fileDescriptor_fdbfb9fc95541122) }
var fileDescriptor_fdbfb9fc95541122 = []byte{
// 169 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0x2c, 0x2d, 0xc9,
0xd0, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x4f,
0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xd6, 0x03, 0x73, 0x85, 0x78, 0xd3, 0xf3, 0xf5, 0x72,
0x33, 0x93, 0x8b, 0xf2, 0xf5, 0x40, 0x6a, 0xa5, 0xb8, 0x40, 0x24, 0x44, 0x4a, 0x49, 0x94, 0x4b,
0xd8, 0x27, 0xb3, 0xb8, 0xc4, 0x11, 0xaa, 0x21, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0xc9,
0x8b, 0x4b, 0x04, 0x55, 0xb8, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0xc8, 0x88, 0x8b, 0x03, 0x66,
0xb6, 0x04, 0xa3, 0x02, 0xb3, 0x06, 0xb7, 0x91, 0x98, 0x1e, 0x8a, 0xe1, 0x7a, 0x50, 0x2d, 0x41,
0x70, 0x75, 0x46, 0xb1, 0x5c, 0x1c, 0x30, 0x73, 0x84, 0x02, 0xb9, 0x58, 0x40, 0xe6, 0x0a, 0x29,
0xa1, 0xe9, 0xc2, 0xe2, 0x06, 0x29, 0x65, 0xbc, 0x6a, 0x20, 0x0e, 0x52, 0x62, 0x70, 0xe2, 0x8e,
0xe2, 0x04, 0x49, 0x5b, 0x83, 0x88, 0x24, 0x36, 0xb0, 0xaf, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff,
0xff, 0x88, 0x2c, 0xf7, 0xdc, 0x15, 0x01, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// AccountsClient is the client API for Accounts service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type AccountsClient interface {
List(ctx context.Context, in *ListAccountsRequest, opts ...grpc.CallOption) (*ListAccountsResponse, error)
}
type accountsClient struct {
cc *grpc.ClientConn
}
func NewAccountsClient(cc *grpc.ClientConn) AccountsClient {
return &accountsClient{cc}
}
func (c *accountsClient) List(ctx context.Context, in *ListAccountsRequest, opts ...grpc.CallOption) (*ListAccountsResponse, error) {
out := new(ListAccountsResponse)
err := c.cc.Invoke(ctx, "/go.micro.auth.Accounts/List", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// AccountsServer is the server API for Accounts service.
type AccountsServer interface {
List(context.Context, *ListAccountsRequest) (*ListAccountsResponse, error)
}
// UnimplementedAccountsServer can be embedded to have forward compatible implementations.
type UnimplementedAccountsServer struct {
}
func (*UnimplementedAccountsServer) List(ctx context.Context, req *ListAccountsRequest) (*ListAccountsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func RegisterAccountsServer(s *grpc.Server, srv AccountsServer) {
s.RegisterService(&_Accounts_serviceDesc, srv)
}
func _Accounts_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListAccountsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AccountsServer).List(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/go.micro.auth.Accounts/List",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AccountsServer).List(ctx, req.(*ListAccountsRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Accounts_serviceDesc = grpc.ServiceDesc{
ServiceName: "go.micro.auth.Accounts",
HandlerType: (*AccountsServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "List",
Handler: _Accounts_List_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "auth/service/proto/accounts.proto",
}

View File

@ -1,85 +0,0 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: auth/service/proto/accounts.proto
package auth
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
)
// 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 Accounts service
type AccountsService interface {
List(ctx context.Context, in *ListAccountsRequest, opts ...client.CallOption) (*ListAccountsResponse, error)
}
type accountsService struct {
c client.Client
name string
}
func NewAccountsService(name string, c client.Client) AccountsService {
return &accountsService{
c: c,
name: name,
}
}
func (c *accountsService) List(ctx context.Context, in *ListAccountsRequest, opts ...client.CallOption) (*ListAccountsResponse, error) {
req := c.c.NewRequest(c.name, "Accounts.List", in)
out := new(ListAccountsResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Accounts service
type AccountsHandler interface {
List(context.Context, *ListAccountsRequest, *ListAccountsResponse) error
}
func RegisterAccountsHandler(s server.Server, hdlr AccountsHandler, opts ...server.HandlerOption) error {
type accounts interface {
List(ctx context.Context, in *ListAccountsRequest, out *ListAccountsResponse) error
}
type Accounts struct {
accounts
}
h := &accountsHandler{hdlr}
return s.Handle(s.NewHandler(&Accounts{h}, opts...))
}
type accountsHandler struct {
AccountsHandler
}
func (h *accountsHandler) List(ctx context.Context, in *ListAccountsRequest, out *ListAccountsResponse) error {
return h.AccountsHandler.List(ctx, in, out)
}

View File

@ -1,18 +0,0 @@
syntax = "proto3";
package go.micro.auth;
option go_package = "auth;auth";
import "auth.proto";
service Accounts {
rpc List(ListAccountsRequest) returns (ListAccountsResponse) {};
}
message ListAccountsRequest {
}
message ListAccountsResponse {
repeated Account accounts = 1;
}

View File

@ -1,15 +1,11 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: auth/service/proto/auth.proto // source: github.com/micro/go-micro/auth/service/proto/auth.proto
package auth package go_micro_auth
import ( import (
context "context"
fmt "fmt" fmt "fmt"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
math "math" math "math"
) )
@ -24,6 +20,104 @@ var _ = math.Inf
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Access int32
const (
Access_UNKNOWN Access = 0
Access_GRANTED Access = 1
Access_DENIED Access = 2
)
var Access_name = map[int32]string{
0: "UNKNOWN",
1: "GRANTED",
2: "DENIED",
}
var Access_value = map[string]int32{
"UNKNOWN": 0,
"GRANTED": 1,
"DENIED": 2,
}
func (x Access) String() string {
return proto.EnumName(Access_name, int32(x))
}
func (Access) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_11312eec02fd5712, []int{0}
}
type ListAccountsRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListAccountsRequest) Reset() { *m = ListAccountsRequest{} }
func (m *ListAccountsRequest) String() string { return proto.CompactTextString(m) }
func (*ListAccountsRequest) ProtoMessage() {}
func (*ListAccountsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_11312eec02fd5712, []int{0}
}
func (m *ListAccountsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListAccountsRequest.Unmarshal(m, b)
}
func (m *ListAccountsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListAccountsRequest.Marshal(b, m, deterministic)
}
func (m *ListAccountsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListAccountsRequest.Merge(m, src)
}
func (m *ListAccountsRequest) XXX_Size() int {
return xxx_messageInfo_ListAccountsRequest.Size(m)
}
func (m *ListAccountsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ListAccountsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ListAccountsRequest proto.InternalMessageInfo
type ListAccountsResponse struct {
Accounts []*Account `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListAccountsResponse) Reset() { *m = ListAccountsResponse{} }
func (m *ListAccountsResponse) String() string { return proto.CompactTextString(m) }
func (*ListAccountsResponse) ProtoMessage() {}
func (*ListAccountsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_11312eec02fd5712, []int{1}
}
func (m *ListAccountsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListAccountsResponse.Unmarshal(m, b)
}
func (m *ListAccountsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListAccountsResponse.Marshal(b, m, deterministic)
}
func (m *ListAccountsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListAccountsResponse.Merge(m, src)
}
func (m *ListAccountsResponse) XXX_Size() int {
return xxx_messageInfo_ListAccountsResponse.Size(m)
}
func (m *ListAccountsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListAccountsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ListAccountsResponse proto.InternalMessageInfo
func (m *ListAccountsResponse) GetAccounts() []*Account {
if m != nil {
return m.Accounts
}
return nil
}
type Token struct { type Token struct {
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
@ -42,7 +136,7 @@ func (m *Token) Reset() { *m = Token{} }
func (m *Token) String() string { return proto.CompactTextString(m) } func (m *Token) String() string { return proto.CompactTextString(m) }
func (*Token) ProtoMessage() {} func (*Token) ProtoMessage() {}
func (*Token) Descriptor() ([]byte, []int) { func (*Token) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{0} return fileDescriptor_11312eec02fd5712, []int{2}
} }
func (m *Token) XXX_Unmarshal(b []byte) error { func (m *Token) XXX_Unmarshal(b []byte) error {
@ -134,7 +228,7 @@ func (m *Account) Reset() { *m = Account{} }
func (m *Account) String() string { return proto.CompactTextString(m) } func (m *Account) String() string { return proto.CompactTextString(m) }
func (*Account) ProtoMessage() {} func (*Account) ProtoMessage() {}
func (*Account) Descriptor() ([]byte, []int) { func (*Account) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{1} return fileDescriptor_11312eec02fd5712, []int{3}
} }
func (m *Account) XXX_Unmarshal(b []byte) error { func (m *Account) XXX_Unmarshal(b []byte) error {
@ -203,7 +297,7 @@ func (m *Resource) Reset() { *m = Resource{} }
func (m *Resource) String() string { return proto.CompactTextString(m) } func (m *Resource) String() string { return proto.CompactTextString(m) }
func (*Resource) ProtoMessage() {} func (*Resource) ProtoMessage() {}
func (*Resource) Descriptor() ([]byte, []int) { func (*Resource) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{2} return fileDescriptor_11312eec02fd5712, []int{4}
} }
func (m *Resource) XXX_Unmarshal(b []byte) error { func (m *Resource) XXX_Unmarshal(b []byte) error {
@ -259,7 +353,7 @@ func (m *GenerateRequest) Reset() { *m = GenerateRequest{} }
func (m *GenerateRequest) String() string { return proto.CompactTextString(m) } func (m *GenerateRequest) String() string { return proto.CompactTextString(m) }
func (*GenerateRequest) ProtoMessage() {} func (*GenerateRequest) ProtoMessage() {}
func (*GenerateRequest) Descriptor() ([]byte, []int) { func (*GenerateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{3} return fileDescriptor_11312eec02fd5712, []int{5}
} }
func (m *GenerateRequest) XXX_Unmarshal(b []byte) error { func (m *GenerateRequest) XXX_Unmarshal(b []byte) error {
@ -319,7 +413,7 @@ func (m *GenerateResponse) Reset() { *m = GenerateResponse{} }
func (m *GenerateResponse) String() string { return proto.CompactTextString(m) } func (m *GenerateResponse) String() string { return proto.CompactTextString(m) }
func (*GenerateResponse) ProtoMessage() {} func (*GenerateResponse) ProtoMessage() {}
func (*GenerateResponse) Descriptor() ([]byte, []int) { func (*GenerateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{4} return fileDescriptor_11312eec02fd5712, []int{6}
} }
func (m *GenerateResponse) XXX_Unmarshal(b []byte) error { func (m *GenerateResponse) XXX_Unmarshal(b []byte) error {
@ -359,7 +453,7 @@ func (m *GrantRequest) Reset() { *m = GrantRequest{} }
func (m *GrantRequest) String() string { return proto.CompactTextString(m) } func (m *GrantRequest) String() string { return proto.CompactTextString(m) }
func (*GrantRequest) ProtoMessage() {} func (*GrantRequest) ProtoMessage() {}
func (*GrantRequest) Descriptor() ([]byte, []int) { func (*GrantRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{5} return fileDescriptor_11312eec02fd5712, []int{7}
} }
func (m *GrantRequest) XXX_Unmarshal(b []byte) error { func (m *GrantRequest) XXX_Unmarshal(b []byte) error {
@ -404,7 +498,7 @@ func (m *GrantResponse) Reset() { *m = GrantResponse{} }
func (m *GrantResponse) String() string { return proto.CompactTextString(m) } func (m *GrantResponse) String() string { return proto.CompactTextString(m) }
func (*GrantResponse) ProtoMessage() {} func (*GrantResponse) ProtoMessage() {}
func (*GrantResponse) Descriptor() ([]byte, []int) { func (*GrantResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{6} return fileDescriptor_11312eec02fd5712, []int{8}
} }
func (m *GrantResponse) XXX_Unmarshal(b []byte) error { func (m *GrantResponse) XXX_Unmarshal(b []byte) error {
@ -437,7 +531,7 @@ func (m *RevokeRequest) Reset() { *m = RevokeRequest{} }
func (m *RevokeRequest) String() string { return proto.CompactTextString(m) } func (m *RevokeRequest) String() string { return proto.CompactTextString(m) }
func (*RevokeRequest) ProtoMessage() {} func (*RevokeRequest) ProtoMessage() {}
func (*RevokeRequest) Descriptor() ([]byte, []int) { func (*RevokeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{7} return fileDescriptor_11312eec02fd5712, []int{9}
} }
func (m *RevokeRequest) XXX_Unmarshal(b []byte) error { func (m *RevokeRequest) XXX_Unmarshal(b []byte) error {
@ -482,7 +576,7 @@ func (m *RevokeResponse) Reset() { *m = RevokeResponse{} }
func (m *RevokeResponse) String() string { return proto.CompactTextString(m) } func (m *RevokeResponse) String() string { return proto.CompactTextString(m) }
func (*RevokeResponse) ProtoMessage() {} func (*RevokeResponse) ProtoMessage() {}
func (*RevokeResponse) Descriptor() ([]byte, []int) { func (*RevokeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{8} return fileDescriptor_11312eec02fd5712, []int{10}
} }
func (m *RevokeResponse) XXX_Unmarshal(b []byte) error { func (m *RevokeResponse) XXX_Unmarshal(b []byte) error {
@ -514,7 +608,7 @@ func (m *InspectRequest) Reset() { *m = InspectRequest{} }
func (m *InspectRequest) String() string { return proto.CompactTextString(m) } func (m *InspectRequest) String() string { return proto.CompactTextString(m) }
func (*InspectRequest) ProtoMessage() {} func (*InspectRequest) ProtoMessage() {}
func (*InspectRequest) Descriptor() ([]byte, []int) { func (*InspectRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{9} return fileDescriptor_11312eec02fd5712, []int{11}
} }
func (m *InspectRequest) XXX_Unmarshal(b []byte) error { func (m *InspectRequest) XXX_Unmarshal(b []byte) error {
@ -553,7 +647,7 @@ func (m *InspectResponse) Reset() { *m = InspectResponse{} }
func (m *InspectResponse) String() string { return proto.CompactTextString(m) } func (m *InspectResponse) String() string { return proto.CompactTextString(m) }
func (*InspectResponse) ProtoMessage() {} func (*InspectResponse) ProtoMessage() {}
func (*InspectResponse) Descriptor() ([]byte, []int) { func (*InspectResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{10} return fileDescriptor_11312eec02fd5712, []int{12}
} }
func (m *InspectResponse) XXX_Unmarshal(b []byte) error { func (m *InspectResponse) XXX_Unmarshal(b []byte) error {
@ -594,7 +688,7 @@ func (m *TokenRequest) Reset() { *m = TokenRequest{} }
func (m *TokenRequest) String() string { return proto.CompactTextString(m) } func (m *TokenRequest) String() string { return proto.CompactTextString(m) }
func (*TokenRequest) ProtoMessage() {} func (*TokenRequest) ProtoMessage() {}
func (*TokenRequest) Descriptor() ([]byte, []int) { func (*TokenRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{11} return fileDescriptor_11312eec02fd5712, []int{13}
} }
func (m *TokenRequest) XXX_Unmarshal(b []byte) error { func (m *TokenRequest) XXX_Unmarshal(b []byte) error {
@ -647,7 +741,7 @@ func (m *TokenResponse) Reset() { *m = TokenResponse{} }
func (m *TokenResponse) String() string { return proto.CompactTextString(m) } func (m *TokenResponse) String() string { return proto.CompactTextString(m) }
func (*TokenResponse) ProtoMessage() {} func (*TokenResponse) ProtoMessage() {}
func (*TokenResponse) Descriptor() ([]byte, []int) { func (*TokenResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{12} return fileDescriptor_11312eec02fd5712, []int{14}
} }
func (m *TokenResponse) XXX_Unmarshal(b []byte) error { func (m *TokenResponse) XXX_Unmarshal(b []byte) error {
@ -675,7 +769,315 @@ func (m *TokenResponse) GetToken() *Token {
return nil return nil
} }
type Rule struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"`
Resource *Resource `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"`
Access Access `protobuf:"varint,4,opt,name=access,proto3,enum=go.micro.auth.Access" json:"access,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Rule) Reset() { *m = Rule{} }
func (m *Rule) String() string { return proto.CompactTextString(m) }
func (*Rule) ProtoMessage() {}
func (*Rule) Descriptor() ([]byte, []int) {
return fileDescriptor_11312eec02fd5712, []int{15}
}
func (m *Rule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Rule.Unmarshal(m, b)
}
func (m *Rule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Rule.Marshal(b, m, deterministic)
}
func (m *Rule) XXX_Merge(src proto.Message) {
xxx_messageInfo_Rule.Merge(m, src)
}
func (m *Rule) XXX_Size() int {
return xxx_messageInfo_Rule.Size(m)
}
func (m *Rule) XXX_DiscardUnknown() {
xxx_messageInfo_Rule.DiscardUnknown(m)
}
var xxx_messageInfo_Rule proto.InternalMessageInfo
func (m *Rule) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Rule) GetRole() string {
if m != nil {
return m.Role
}
return ""
}
func (m *Rule) GetResource() *Resource {
if m != nil {
return m.Resource
}
return nil
}
func (m *Rule) GetAccess() Access {
if m != nil {
return m.Access
}
return Access_UNKNOWN
}
type CreateRequest struct {
Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
Resource *Resource `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"`
Access Access `protobuf:"varint,3,opt,name=access,proto3,enum=go.micro.auth.Access" json:"access,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateRequest) Reset() { *m = CreateRequest{} }
func (m *CreateRequest) String() string { return proto.CompactTextString(m) }
func (*CreateRequest) ProtoMessage() {}
func (*CreateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_11312eec02fd5712, []int{16}
}
func (m *CreateRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateRequest.Unmarshal(m, b)
}
func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateRequest.Marshal(b, m, deterministic)
}
func (m *CreateRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateRequest.Merge(m, src)
}
func (m *CreateRequest) XXX_Size() int {
return xxx_messageInfo_CreateRequest.Size(m)
}
func (m *CreateRequest) XXX_DiscardUnknown() {
xxx_messageInfo_CreateRequest.DiscardUnknown(m)
}
var xxx_messageInfo_CreateRequest proto.InternalMessageInfo
func (m *CreateRequest) GetRole() string {
if m != nil {
return m.Role
}
return ""
}
func (m *CreateRequest) GetResource() *Resource {
if m != nil {
return m.Resource
}
return nil
}
func (m *CreateRequest) GetAccess() Access {
if m != nil {
return m.Access
}
return Access_UNKNOWN
}
type CreateResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateResponse) Reset() { *m = CreateResponse{} }
func (m *CreateResponse) String() string { return proto.CompactTextString(m) }
func (*CreateResponse) ProtoMessage() {}
func (*CreateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_11312eec02fd5712, []int{17}
}
func (m *CreateResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateResponse.Unmarshal(m, b)
}
func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateResponse.Marshal(b, m, deterministic)
}
func (m *CreateResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateResponse.Merge(m, src)
}
func (m *CreateResponse) XXX_Size() int {
return xxx_messageInfo_CreateResponse.Size(m)
}
func (m *CreateResponse) XXX_DiscardUnknown() {
xxx_messageInfo_CreateResponse.DiscardUnknown(m)
}
var xxx_messageInfo_CreateResponse proto.InternalMessageInfo
type DeleteRequest struct {
Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
Resource *Resource `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"`
Access Access `protobuf:"varint,3,opt,name=access,proto3,enum=go.micro.auth.Access" json:"access,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
func (m *DeleteRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteRequest) ProtoMessage() {}
func (*DeleteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_11312eec02fd5712, []int{18}
}
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteRequest.Unmarshal(m, b)
}
func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic)
}
func (m *DeleteRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_DeleteRequest.Merge(m, src)
}
func (m *DeleteRequest) XXX_Size() int {
return xxx_messageInfo_DeleteRequest.Size(m)
}
func (m *DeleteRequest) XXX_DiscardUnknown() {
xxx_messageInfo_DeleteRequest.DiscardUnknown(m)
}
var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo
func (m *DeleteRequest) GetRole() string {
if m != nil {
return m.Role
}
return ""
}
func (m *DeleteRequest) GetResource() *Resource {
if m != nil {
return m.Resource
}
return nil
}
func (m *DeleteRequest) GetAccess() Access {
if m != nil {
return m.Access
}
return Access_UNKNOWN
}
type DeleteResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_11312eec02fd5712, []int{19}
}
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteResponse.Unmarshal(m, b)
}
func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DeleteResponse.Marshal(b, m, deterministic)
}
func (m *DeleteResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_DeleteResponse.Merge(m, src)
}
func (m *DeleteResponse) XXX_Size() int {
return xxx_messageInfo_DeleteResponse.Size(m)
}
func (m *DeleteResponse) XXX_DiscardUnknown() {
xxx_messageInfo_DeleteResponse.DiscardUnknown(m)
}
var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo
type ListRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListRequest) Reset() { *m = ListRequest{} }
func (m *ListRequest) String() string { return proto.CompactTextString(m) }
func (*ListRequest) ProtoMessage() {}
func (*ListRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_11312eec02fd5712, []int{20}
}
func (m *ListRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRequest.Unmarshal(m, b)
}
func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListRequest.Marshal(b, m, deterministic)
}
func (m *ListRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListRequest.Merge(m, src)
}
func (m *ListRequest) XXX_Size() int {
return xxx_messageInfo_ListRequest.Size(m)
}
func (m *ListRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ListRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ListRequest proto.InternalMessageInfo
type ListResponse struct {
Rules []*Rule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListResponse) Reset() { *m = ListResponse{} }
func (m *ListResponse) String() string { return proto.CompactTextString(m) }
func (*ListResponse) ProtoMessage() {}
func (*ListResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_11312eec02fd5712, []int{21}
}
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListResponse.Unmarshal(m, b)
}
func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic)
}
func (m *ListResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListResponse.Merge(m, src)
}
func (m *ListResponse) XXX_Size() int {
return xxx_messageInfo_ListResponse.Size(m)
}
func (m *ListResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ListResponse proto.InternalMessageInfo
func (m *ListResponse) GetRules() []*Rule {
if m != nil {
return m.Rules
}
return nil
}
func init() { func init() {
proto.RegisterEnum("go.micro.auth.Access", Access_name, Access_value)
proto.RegisterType((*ListAccountsRequest)(nil), "go.micro.auth.ListAccountsRequest")
proto.RegisterType((*ListAccountsResponse)(nil), "go.micro.auth.ListAccountsResponse")
proto.RegisterType((*Token)(nil), "go.micro.auth.Token") proto.RegisterType((*Token)(nil), "go.micro.auth.Token")
proto.RegisterMapType((map[string]string)(nil), "go.micro.auth.Token.MetadataEntry") proto.RegisterMapType((map[string]string)(nil), "go.micro.auth.Token.MetadataEntry")
proto.RegisterType((*Account)(nil), "go.micro.auth.Account") proto.RegisterType((*Account)(nil), "go.micro.auth.Account")
@ -692,200 +1094,73 @@ func init() {
proto.RegisterType((*InspectResponse)(nil), "go.micro.auth.InspectResponse") proto.RegisterType((*InspectResponse)(nil), "go.micro.auth.InspectResponse")
proto.RegisterType((*TokenRequest)(nil), "go.micro.auth.TokenRequest") proto.RegisterType((*TokenRequest)(nil), "go.micro.auth.TokenRequest")
proto.RegisterType((*TokenResponse)(nil), "go.micro.auth.TokenResponse") proto.RegisterType((*TokenResponse)(nil), "go.micro.auth.TokenResponse")
proto.RegisterType((*Rule)(nil), "go.micro.auth.Rule")
proto.RegisterType((*CreateRequest)(nil), "go.micro.auth.CreateRequest")
proto.RegisterType((*CreateResponse)(nil), "go.micro.auth.CreateResponse")
proto.RegisterType((*DeleteRequest)(nil), "go.micro.auth.DeleteRequest")
proto.RegisterType((*DeleteResponse)(nil), "go.micro.auth.DeleteResponse")
proto.RegisterType((*ListRequest)(nil), "go.micro.auth.ListRequest")
proto.RegisterType((*ListResponse)(nil), "go.micro.auth.ListResponse")
} }
func init() { proto.RegisterFile("auth/service/proto/auth.proto", fileDescriptor_21300bfacc51fc2a) } func init() {
proto.RegisterFile("github.com/micro/go-micro/auth/service/proto/auth.proto", fileDescriptor_11312eec02fd5712)
var fileDescriptor_21300bfacc51fc2a = []byte{
// 600 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x6d, 0x8b, 0xd3, 0x40,
0x10, 0x36, 0x2f, 0x6d, 0xd3, 0x49, 0xdf, 0x58, 0x8e, 0x33, 0xd4, 0xbb, 0xb3, 0x06, 0x91, 0x22,
0x92, 0x4a, 0xef, 0x8b, 0x58, 0x10, 0x4f, 0xef, 0x38, 0x15, 0xce, 0x0f, 0x41, 0xf0, 0xe5, 0x8b,
0xe4, 0xd2, 0xc1, 0x8b, 0xbd, 0x26, 0x71, 0xb3, 0x29, 0xf6, 0x4f, 0xf9, 0x8b, 0xfc, 0x28, 0xf8,
0x37, 0x64, 0xb7, 0xbb, 0xe9, 0x8b, 0xa9, 0x1c, 0xd2, 0x2f, 0x65, 0x66, 0x76, 0xe7, 0x99, 0x79,
0x9e, 0x9d, 0x4e, 0xe0, 0x30, 0xc8, 0xd9, 0xd5, 0x20, 0x43, 0x3a, 0x8b, 0x42, 0x1c, 0xa4, 0x34,
0x61, 0xc9, 0x80, 0x87, 0x3c, 0x61, 0x92, 0xe6, 0x97, 0xc4, 0x9b, 0x46, 0x21, 0x4d, 0x3c, 0x1e,
0x74, 0x7f, 0xe8, 0x50, 0x79, 0x97, 0x4c, 0x30, 0x26, 0x7b, 0x50, 0x61, 0xdc, 0x70, 0xb4, 0x9e,
0xd6, 0xaf, 0xfb, 0x0b, 0x87, 0x10, 0x30, 0xd9, 0x3c, 0x45, 0x47, 0x17, 0x41, 0x61, 0x13, 0x07,
0x6a, 0x21, 0xc5, 0x80, 0xe1, 0xd8, 0x31, 0x7a, 0x5a, 0xdf, 0xf0, 0x95, 0x4b, 0xf6, 0xa1, 0x8a,
0xdf, 0xd3, 0x88, 0xce, 0x1d, 0x53, 0x1c, 0x48, 0x8f, 0x67, 0x64, 0xf9, 0xe5, 0x57, 0x0c, 0x99,
0x53, 0x11, 0x40, 0xca, 0xe5, 0x55, 0x69, 0x72, 0x8d, 0x99, 0x53, 0xed, 0x19, 0xbc, 0xaa, 0x70,
0xc8, 0x33, 0xb0, 0xa6, 0xc8, 0x82, 0x71, 0xc0, 0x02, 0xa7, 0xd6, 0x33, 0xfa, 0xf6, 0xd0, 0xf5,
0xd6, 0xfa, 0xf6, 0x44, 0xcf, 0xde, 0x85, 0xbc, 0x74, 0x16, 0x33, 0x3a, 0xf7, 0x8b, 0x1c, 0x72,
0x00, 0xf5, 0x38, 0x98, 0x62, 0x96, 0x06, 0x21, 0x3a, 0x96, 0xa8, 0xb8, 0x0c, 0x74, 0x47, 0xd0,
0x5c, 0x4b, 0x24, 0x1d, 0x30, 0x26, 0x38, 0x97, 0xc4, 0xb9, 0xc9, 0xdb, 0x9a, 0x05, 0xd7, 0xb9,
0xe2, 0xbd, 0x70, 0x9e, 0xea, 0x4f, 0x34, 0xf7, 0x97, 0x06, 0xb5, 0x93, 0x30, 0x4c, 0xf2, 0x98,
0x91, 0x16, 0xe8, 0xd1, 0x58, 0xa6, 0xe9, 0x91, 0xa0, 0x9f, 0x61, 0x48, 0x91, 0xc9, 0x34, 0xe9,
0x2d, 0x49, 0x1a, 0xab, 0x24, 0x9f, 0xaf, 0x90, 0x34, 0x05, 0xc9, 0xfb, 0x1b, 0x24, 0x65, 0x9d,
0x9b, 0xd1, 0xac, 0xec, 0x94, 0xe6, 0x5b, 0xb0, 0x7c, 0xcc, 0x92, 0x9c, 0x86, 0xc8, 0x67, 0x80,
0xa3, 0xca, 0x44, 0x61, 0x97, 0xce, 0x45, 0x17, 0x2c, 0x8c, 0xc7, 0x69, 0x12, 0xc5, 0x4c, 0x0c,
0x46, 0xdd, 0x2f, 0x7c, 0xf7, 0xa7, 0x06, 0xed, 0x73, 0x8c, 0x91, 0x06, 0x0c, 0x7d, 0xfc, 0x96,
0x63, 0xf6, 0xb7, 0x7c, 0x85, 0x4c, 0xfa, 0xaa, 0x4c, 0xaf, 0x56, 0x64, 0x32, 0x84, 0x4c, 0x8f,
0x36, 0x64, 0xda, 0xc0, 0xbd, 0x99, 0x5c, 0xe6, 0x4e, 0xe5, 0x3a, 0x85, 0xce, 0xb2, 0x8b, 0x2c,
0x4d, 0xe2, 0x0c, 0xc9, 0x63, 0xa8, 0x05, 0x8b, 0x07, 0x14, 0x18, 0xf6, 0x70, 0xbf, 0xfc, 0x79,
0x7d, 0x75, 0xcd, 0x7d, 0x0f, 0x8d, 0x73, 0x1a, 0xc4, 0x4c, 0x09, 0x44, 0xc0, 0xe4, 0x1a, 0x28,
0xe1, 0xb9, 0x4d, 0x8e, 0xc1, 0xa2, 0xf2, 0x61, 0x44, 0x1b, 0xf6, 0xf0, 0xf6, 0x06, 0xac, 0x7a,
0x37, 0xbf, 0xb8, 0xe8, 0xb6, 0xa1, 0x29, 0x81, 0x17, 0xbd, 0xb9, 0x1f, 0xa0, 0xe9, 0xe3, 0x2c,
0x99, 0xe0, 0xce, 0x4b, 0x75, 0xa0, 0xa5, 0x90, 0x65, 0xad, 0x07, 0xd0, 0x7a, 0x1d, 0x67, 0x29,
0x86, 0x05, 0xaf, 0xd2, 0x55, 0xe3, 0xbe, 0x84, 0x76, 0x71, 0xef, 0xbf, 0x25, 0xfc, 0x08, 0x0d,
0xb1, 0x1a, 0xb6, 0xcd, 0xd8, 0xb6, 0xbf, 0xe8, 0x3d, 0x68, 0x88, 0x2e, 0x3e, 0xcb, 0xfd, 0xb5,
0x58, 0x6c, 0xb6, 0x88, 0x9d, 0x89, 0x90, 0x3b, 0x82, 0xa6, 0x84, 0x96, 0xdd, 0x3d, 0x5c, 0xa5,
0x61, 0x0f, 0xf7, 0xca, 0x56, 0x94, 0x24, 0x37, 0xfc, 0xad, 0x81, 0x79, 0x92, 0xb3, 0x2b, 0x72,
0x01, 0x96, 0x9a, 0x14, 0x72, 0xf4, 0xef, 0x41, 0xee, 0xde, 0xdd, 0x7a, 0x2e, 0xa5, 0xbd, 0x45,
0xde, 0x40, 0x4d, 0x8a, 0x46, 0x0e, 0x37, 0x6e, 0xaf, 0x8b, 0xde, 0x3d, 0xda, 0x76, 0x5c, 0x60,
0x9d, 0xaa, 0x4f, 0xc1, 0x9d, 0x52, 0x26, 0x12, 0xe7, 0xa0, 0xfc, 0x50, 0xa1, 0xbc, 0xb0, 0x3f,
0xd5, 0x79, 0x7c, 0xc4, 0x7f, 0x2e, 0xab, 0xe2, 0xa3, 0x73, 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff,
0xc4, 0x24, 0xa4, 0xa3, 0x95, 0x06, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. var fileDescriptor_11312eec02fd5712 = []byte{
var _ context.Context // 860 bytes of a gzipped FileDescriptorProto
var _ grpc.ClientConn 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xdd, 0x8e, 0xdb, 0x44,
0x14, 0x5e, 0xff, 0xc4, 0xf1, 0x9e, 0xfc, 0x6c, 0x34, 0xdd, 0x16, 0x2b, 0xfd, 0x21, 0x18, 0x84,
// This is a compile-time assertion to ensure that this generated file 0x96, 0x8a, 0x3a, 0x28, 0xbd, 0xe0, 0xa7, 0x12, 0x22, 0x6a, 0xa2, 0xd0, 0x42, 0x83, 0xb0, 0x8a,
// is compatible with the grpc package it is being compiled against. 0x0a, 0x17, 0x08, 0x79, 0x9d, 0xa3, 0x5d, 0xb3, 0x89, 0x1d, 0x3c, 0xe3, 0x15, 0x79, 0x02, 0xee,
const _ = grpc.SupportPackageIsVersion4 0x78, 0x14, 0x9e, 0xa8, 0x97, 0x48, 0xbc, 0x06, 0x9a, 0xf1, 0x8c, 0x37, 0x71, 0x9c, 0x55, 0x84,
0x72, 0xc1, 0xdd, 0x9c, 0x99, 0x33, 0xdf, 0x7c, 0xdf, 0xe7, 0x33, 0xc7, 0x03, 0x9f, 0x5e, 0x44,
// AuthClient is the client API for Auth service. 0xec, 0x32, 0x3b, 0xf7, 0xc2, 0x64, 0xd1, 0x5f, 0x44, 0x61, 0x9a, 0xf4, 0x2f, 0x92, 0x27, 0xf9,
// 0x20, 0xc8, 0xd8, 0x65, 0x9f, 0x62, 0x7a, 0x1d, 0x85, 0xd8, 0x5f, 0xa6, 0x09, 0xcb, 0xa7, 0x3c,
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 0x31, 0x24, 0xad, 0x8b, 0xc4, 0x13, 0x79, 0x1e, 0x9f, 0x74, 0xef, 0xc2, 0x9d, 0x6f, 0x23, 0xca,
type AuthClient interface { 0x86, 0x61, 0x98, 0x64, 0x31, 0xa3, 0x3e, 0xfe, 0x96, 0x21, 0x65, 0xee, 0x4b, 0x38, 0xdd, 0x9c,
Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) 0xa6, 0xcb, 0x24, 0xa6, 0x48, 0x06, 0x60, 0x07, 0x72, 0xce, 0xd1, 0x7a, 0xc6, 0x59, 0x63, 0x70,
Inspect(ctx context.Context, in *InspectRequest, opts ...grpc.CallOption) (*InspectResponse, error) 0xcf, 0xdb, 0x00, 0xf4, 0xe4, 0x16, 0xbf, 0xc8, 0x73, 0xff, 0xd2, 0xa1, 0xf6, 0x3a, 0xb9, 0xc2,
Token(ctx context.Context, in *TokenRequest, opts ...grpc.CallOption) (*TokenResponse, error) 0x98, 0x9c, 0x42, 0x8d, 0xf1, 0x81, 0xa3, 0xf5, 0xb4, 0xb3, 0x63, 0x3f, 0x0f, 0x08, 0x01, 0x93,
} 0xad, 0x96, 0xe8, 0xe8, 0x62, 0x52, 0x8c, 0x89, 0x03, 0xf5, 0x30, 0xc5, 0x80, 0xe1, 0xcc, 0x31,
0x7a, 0xda, 0x99, 0xe1, 0xab, 0x90, 0xdc, 0x03, 0x0b, 0x7f, 0x5f, 0x46, 0xe9, 0xca, 0x31, 0xc5,
type authClient struct { 0x82, 0x8c, 0xf8, 0x0e, 0x9a, 0x9d, 0xff, 0x8a, 0x21, 0x73, 0x6a, 0x02, 0x48, 0x85, 0xfc, 0xd4,
cc *grpc.ClientConn 0x34, 0x99, 0x23, 0x75, 0xac, 0x9e, 0xc1, 0x4f, 0x15, 0x01, 0xf9, 0x12, 0xec, 0x05, 0xb2, 0x60,
} 0x16, 0xb0, 0xc0, 0xa9, 0x0b, 0x25, 0x6e, 0x49, 0x89, 0xe0, 0xec, 0xbd, 0x92, 0x49, 0xe3, 0x98,
0xa5, 0x2b, 0xbf, 0xd8, 0x43, 0x1e, 0xc0, 0x71, 0x1c, 0x2c, 0x90, 0x2e, 0x83, 0x10, 0x1d, 0x5b,
func NewAuthClient(cc *grpc.ClientConn) AuthClient { 0x9c, 0x78, 0x33, 0xd1, 0x7d, 0x06, 0xad, 0x8d, 0x8d, 0xa4, 0x03, 0xc6, 0x15, 0xae, 0xa4, 0x70,
return &authClient{cc} 0x3e, 0xe4, 0xb4, 0xae, 0x83, 0x79, 0xa6, 0x74, 0xe7, 0xc1, 0x17, 0xfa, 0x67, 0x9a, 0xfb, 0xb7,
} 0x06, 0x75, 0x69, 0x23, 0x69, 0x83, 0x1e, 0xcd, 0xe4, 0x36, 0x3d, 0x12, 0xf2, 0x29, 0x86, 0x29,
0x32, 0xb9, 0x4d, 0x46, 0x37, 0x22, 0x8d, 0x75, 0x91, 0x5f, 0xad, 0x89, 0x34, 0x85, 0xc8, 0x0f,
func (c *authClient) Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) { 0xaa, 0x3f, 0xd7, 0x7e, 0x32, 0x6b, 0x07, 0x95, 0x39, 0x05, 0xdb, 0x47, 0x9a, 0x64, 0x69, 0x88,
out := new(GenerateResponse) 0xbc, 0x06, 0x38, 0xaa, 0xdc, 0x28, 0xc6, 0x95, 0x75, 0xd1, 0x05, 0x1b, 0xe3, 0xd9, 0x32, 0x89,
err := c.cc.Invoke(ctx, "/go.micro.auth.Auth/Generate", in, out, opts...) 0x62, 0x26, 0x0a, 0xe3, 0xd8, 0x2f, 0x62, 0xf7, 0xad, 0x06, 0x27, 0x13, 0x8c, 0x31, 0x0d, 0x18,
if err != nil { 0xca, 0x3a, 0xde, 0xb2, 0xaf, 0xb0, 0x49, 0x5f, 0xb7, 0xe9, 0xeb, 0x35, 0x9b, 0x0c, 0x61, 0xd3,
return nil, err 0xc7, 0x25, 0x9b, 0x4a, 0xb8, 0xfb, 0xd9, 0x65, 0x1e, 0xd4, 0xae, 0x11, 0x74, 0x6e, 0x58, 0xc8,
} 0xeb, 0xf8, 0x09, 0xd4, 0xe5, 0x35, 0x13, 0x18, 0xbb, 0x6f, 0xa3, 0x4a, 0x73, 0xdf, 0x40, 0x73,
return out, nil 0x92, 0x06, 0x31, 0x53, 0x06, 0x11, 0x30, 0xb9, 0x07, 0xca, 0x78, 0x3e, 0x26, 0x4f, 0xc1, 0x4e,
} 0xe5, 0x87, 0x11, 0x34, 0x1a, 0x83, 0x77, 0x4a, 0xb0, 0xea, 0xbb, 0xf9, 0x45, 0xa2, 0x7b, 0x02,
0x2d, 0x09, 0x9c, 0x73, 0x73, 0x7f, 0x84, 0x96, 0x8f, 0xd7, 0xc9, 0x15, 0x1e, 0xfc, 0xa8, 0x0e,
func (c *authClient) Inspect(ctx context.Context, in *InspectRequest, opts ...grpc.CallOption) (*InspectResponse, error) { 0xb4, 0x15, 0xb2, 0x3c, 0xeb, 0x43, 0x68, 0xbf, 0x88, 0xe9, 0x12, 0xc3, 0x42, 0x57, 0x65, 0xab,
out := new(InspectResponse) 0x71, 0x9f, 0xc3, 0x49, 0x91, 0xf7, 0x9f, 0x2d, 0xfc, 0x09, 0x9a, 0xa2, 0x35, 0xec, 0xaa, 0xb1,
err := c.cc.Invoke(ctx, "/go.micro.auth.Auth/Inspect", in, out, opts...) 0x5d, 0x57, 0xf4, 0x3d, 0x68, 0x0a, 0x16, 0xbf, 0xc8, 0xfe, 0x95, 0x37, 0xb6, 0x86, 0x98, 0x1b,
if err != nil { 0x8b, 0x29, 0xf7, 0x19, 0xb4, 0x24, 0xb4, 0x64, 0xf7, 0x78, 0x5d, 0x46, 0x63, 0x70, 0x5a, 0xd5,
return nil, err 0xa2, 0x94, 0xb8, 0x3f, 0x35, 0x30, 0xfd, 0x6c, 0x8e, 0x5b, 0x84, 0x94, 0xf1, 0xfa, 0x0e, 0xe3,
} 0x8d, 0x3d, 0x8d, 0x27, 0x4f, 0xc0, 0x0a, 0xc2, 0x10, 0x29, 0x15, 0xa5, 0xdd, 0x1e, 0xdc, 0xdd,
return out, nil 0xb6, 0x0a, 0x29, 0xf5, 0x65, 0x92, 0xfb, 0x87, 0x06, 0xad, 0xe7, 0xa2, 0x6d, 0x1f, 0xba, 0x04,
} 0xd6, 0x98, 0x18, 0xfb, 0x30, 0xe9, 0x40, 0x5b, 0x11, 0x91, 0x15, 0xc3, 0xb9, 0x8d, 0x70, 0x8e,
0xff, 0x0b, 0x6e, 0x8a, 0x88, 0xe4, 0xd6, 0x82, 0x06, 0xff, 0xf9, 0xaa, 0x7f, 0xf1, 0xe7, 0xd0,
func (c *authClient) Token(ctx context.Context, in *TokenRequest, opts ...grpc.CallOption) (*TokenResponse, error) { 0xcc, 0x43, 0x59, 0x13, 0x1f, 0x41, 0x2d, 0xcd, 0x78, 0x0f, 0xcb, 0x7f, 0xc0, 0x77, 0xca, 0x8c,
out := new(TokenResponse) 0xb2, 0x39, 0xfa, 0x79, 0xc6, 0x63, 0x0f, 0xac, 0xfc, 0x34, 0xd2, 0x80, 0xfa, 0x0f, 0xd3, 0x6f,
err := c.cc.Invoke(ctx, "/go.micro.auth.Auth/Token", in, out, opts...) 0xa6, 0xdf, 0xbd, 0x99, 0x76, 0x8e, 0x78, 0x30, 0xf1, 0x87, 0xd3, 0xd7, 0xe3, 0x51, 0x47, 0x23,
if err != nil { 0x00, 0xd6, 0x68, 0x3c, 0x7d, 0x31, 0x1e, 0x75, 0xf4, 0xc1, 0x3f, 0x1a, 0x98, 0xc3, 0x8c, 0x5d,
return nil, err 0x92, 0x57, 0x60, 0xab, 0x66, 0x43, 0x1e, 0xdd, 0xde, 0x0b, 0xbb, 0xef, 0xee, 0x5c, 0x97, 0x7a,
} 0x8e, 0xc8, 0x4b, 0xa8, 0xcb, 0x7b, 0x47, 0x1e, 0x96, 0xb2, 0x37, 0xef, 0x6d, 0xf7, 0xd1, 0xae,
return out, nil 0xe5, 0x02, 0x6b, 0xa4, 0x5e, 0x13, 0xf7, 0x2b, 0x2f, 0x83, 0xc4, 0x79, 0x50, 0xbd, 0xa8, 0x50,
} 0x06, 0x3f, 0x83, 0xad, 0x1e, 0x37, 0xe4, 0x7b, 0x30, 0xb9, 0xc1, 0xa4, 0xfc, 0x00, 0xa8, 0x78,
0x18, 0x75, 0xdf, 0xbf, 0x35, 0xa7, 0x80, 0x7f, 0xab, 0x41, 0x8d, 0x7f, 0x08, 0x4a, 0x26, 0x60,
// AuthServer is the server API for Auth service. 0xe5, 0xa5, 0x47, 0xca, 0x94, 0x36, 0xae, 0x46, 0xf7, 0xe1, 0x8e, 0xd5, 0x42, 0xf7, 0x04, 0xac,
type AuthServer interface { 0xbc, 0x4e, 0xb6, 0x80, 0x36, 0xea, 0x78, 0x0b, 0xa8, 0x54, 0x5c, 0x47, 0x64, 0x28, 0xe5, 0x76,
Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) 0x2b, 0xa4, 0x28, 0x90, 0xfb, 0x95, 0x6b, 0x0a, 0xe2, 0xdc, 0x12, 0x6f, 0xc9, 0xa7, 0xff, 0x06,
Inspect(context.Context, *InspectRequest) (*InspectResponse, error) 0x00, 0x00, 0xff, 0xff, 0x24, 0x1b, 0xf8, 0x32, 0x86, 0x0a, 0x00, 0x00,
Token(context.Context, *TokenRequest) (*TokenResponse, error)
}
// UnimplementedAuthServer can be embedded to have forward compatible implementations.
type UnimplementedAuthServer struct {
}
func (*UnimplementedAuthServer) Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Generate not implemented")
}
func (*UnimplementedAuthServer) Inspect(ctx context.Context, req *InspectRequest) (*InspectResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Inspect not implemented")
}
func (*UnimplementedAuthServer) Token(ctx context.Context, req *TokenRequest) (*TokenResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Token not implemented")
}
func RegisterAuthServer(s *grpc.Server, srv AuthServer) {
s.RegisterService(&_Auth_serviceDesc, srv)
}
func _Auth_Generate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GenerateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).Generate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/go.micro.auth.Auth/Generate",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).Generate(ctx, req.(*GenerateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_Inspect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(InspectRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).Inspect(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/go.micro.auth.Auth/Inspect",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).Inspect(ctx, req.(*InspectRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_Token_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TokenRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).Token(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/go.micro.auth.Auth/Token",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServer).Token(ctx, req.(*TokenRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Auth_serviceDesc = grpc.ServiceDesc{
ServiceName: "go.micro.auth.Auth",
HandlerType: (*AuthServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Generate",
Handler: _Auth_Generate_Handler,
},
{
MethodName: "Inspect",
Handler: _Auth_Inspect_Handler,
},
{
MethodName: "Token",
Handler: _Auth_Token_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "auth/service/proto/auth.proto",
} }

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-micro. DO NOT EDIT. // Code generated by protoc-gen-micro. DO NOT EDIT.
// source: auth/service/proto/auth.proto // source: github.com/micro/go-micro/auth/service/proto/auth.proto
package auth package go_micro_auth
import ( import (
fmt "fmt" fmt "fmt"
@ -117,3 +117,143 @@ func (h *authHandler) Inspect(ctx context.Context, in *InspectRequest, out *Insp
func (h *authHandler) Token(ctx context.Context, in *TokenRequest, out *TokenResponse) error { func (h *authHandler) Token(ctx context.Context, in *TokenRequest, out *TokenResponse) error {
return h.AuthHandler.Token(ctx, in, out) return h.AuthHandler.Token(ctx, in, out)
} }
// Client API for Accounts service
type AccountsService interface {
List(ctx context.Context, in *ListAccountsRequest, opts ...client.CallOption) (*ListAccountsResponse, error)
}
type accountsService struct {
c client.Client
name string
}
func NewAccountsService(name string, c client.Client) AccountsService {
return &accountsService{
c: c,
name: name,
}
}
func (c *accountsService) List(ctx context.Context, in *ListAccountsRequest, opts ...client.CallOption) (*ListAccountsResponse, error) {
req := c.c.NewRequest(c.name, "Accounts.List", in)
out := new(ListAccountsResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Accounts service
type AccountsHandler interface {
List(context.Context, *ListAccountsRequest, *ListAccountsResponse) error
}
func RegisterAccountsHandler(s server.Server, hdlr AccountsHandler, opts ...server.HandlerOption) error {
type accounts interface {
List(ctx context.Context, in *ListAccountsRequest, out *ListAccountsResponse) error
}
type Accounts struct {
accounts
}
h := &accountsHandler{hdlr}
return s.Handle(s.NewHandler(&Accounts{h}, opts...))
}
type accountsHandler struct {
AccountsHandler
}
func (h *accountsHandler) List(ctx context.Context, in *ListAccountsRequest, out *ListAccountsResponse) error {
return h.AccountsHandler.List(ctx, in, out)
}
// Client API for Rules service
type RulesService interface {
Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
}
type rulesService struct {
c client.Client
name string
}
func NewRulesService(name string, c client.Client) RulesService {
return &rulesService{
c: c,
name: name,
}
}
func (c *rulesService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
req := c.c.NewRequest(c.name, "Rules.Create", in)
out := new(CreateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *rulesService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
req := c.c.NewRequest(c.name, "Rules.Delete", in)
out := new(DeleteResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *rulesService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "Rules.List", in)
out := new(ListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Rules service
type RulesHandler interface {
Create(context.Context, *CreateRequest, *CreateResponse) error
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
List(context.Context, *ListRequest, *ListResponse) error
}
func RegisterRulesHandler(s server.Server, hdlr RulesHandler, opts ...server.HandlerOption) error {
type rules interface {
Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
List(ctx context.Context, in *ListRequest, out *ListResponse) error
}
type Rules struct {
rules
}
h := &rulesHandler{hdlr}
return s.Handle(s.NewHandler(&Rules{h}, opts...))
}
type rulesHandler struct {
RulesHandler
}
func (h *rulesHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
return h.RulesHandler.Create(ctx, in, out)
}
func (h *rulesHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
return h.RulesHandler.Delete(ctx, in, out)
}
func (h *rulesHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
return h.RulesHandler.List(ctx, in, out)
}

View File

@ -2,14 +2,29 @@ syntax = "proto3";
package go.micro.auth; package go.micro.auth;
option go_package = "auth;auth";
service Auth { service Auth {
rpc Generate(GenerateRequest) returns (GenerateResponse) {}; rpc Generate(GenerateRequest) returns (GenerateResponse) {};
rpc Inspect(InspectRequest) returns (InspectResponse) {}; rpc Inspect(InspectRequest) returns (InspectResponse) {};
rpc Token(TokenRequest) returns (TokenResponse) {}; rpc Token(TokenRequest) returns (TokenResponse) {};
} }
service Accounts {
rpc List(ListAccountsRequest) returns (ListAccountsResponse) {};
}
service Rules {
rpc Create(CreateRequest) returns (CreateResponse) {};
rpc Delete(DeleteRequest) returns (DeleteResponse) {};
rpc List(ListRequest) returns (ListResponse) {};
}
message ListAccountsRequest {
}
message ListAccountsResponse {
repeated Account accounts = 1;
}
message Token { message Token {
string token = 1; string token = 1;
string type = 2; string type = 2;
@ -77,3 +92,39 @@ message TokenRequest {
message TokenResponse { message TokenResponse {
Token token = 1; Token token = 1;
} }
enum Access {
UNKNOWN = 0;
GRANTED = 1;
DENIED = 2;
}
message Rule {
string id = 1;
string role = 2;
Resource resource = 3;
Access access = 4;
}
message CreateRequest {
string role = 1;
Resource resource = 2;
Access access = 3;
}
message CreateResponse {}
message DeleteRequest {
string role = 1;
Resource resource = 2;
Access access = 3;
}
message DeleteResponse {}
message ListRequest {
}
message ListResponse {
repeated Rule rules = 1;
}

View File

@ -1,550 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: auth/service/proto/rules.proto
package auth
import (
context "context"
fmt "fmt"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
math "math"
)
// 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
type Access int32
const (
Access_UNKNOWN Access = 0
Access_GRANTED Access = 1
Access_DENIED Access = 2
)
var Access_name = map[int32]string{
0: "UNKNOWN",
1: "GRANTED",
2: "DENIED",
}
var Access_value = map[string]int32{
"UNKNOWN": 0,
"GRANTED": 1,
"DENIED": 2,
}
func (x Access) String() string {
return proto.EnumName(Access_name, int32(x))
}
func (Access) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_ce1ef0aa40cdd6dc, []int{0}
}
type Rule struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"`
Resource *Resource `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"`
Access Access `protobuf:"varint,4,opt,name=access,proto3,enum=go.micro.auth.Access" json:"access,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Rule) Reset() { *m = Rule{} }
func (m *Rule) String() string { return proto.CompactTextString(m) }
func (*Rule) ProtoMessage() {}
func (*Rule) Descriptor() ([]byte, []int) {
return fileDescriptor_ce1ef0aa40cdd6dc, []int{0}
}
func (m *Rule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Rule.Unmarshal(m, b)
}
func (m *Rule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Rule.Marshal(b, m, deterministic)
}
func (m *Rule) XXX_Merge(src proto.Message) {
xxx_messageInfo_Rule.Merge(m, src)
}
func (m *Rule) XXX_Size() int {
return xxx_messageInfo_Rule.Size(m)
}
func (m *Rule) XXX_DiscardUnknown() {
xxx_messageInfo_Rule.DiscardUnknown(m)
}
var xxx_messageInfo_Rule proto.InternalMessageInfo
func (m *Rule) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Rule) GetRole() string {
if m != nil {
return m.Role
}
return ""
}
func (m *Rule) GetResource() *Resource {
if m != nil {
return m.Resource
}
return nil
}
func (m *Rule) GetAccess() Access {
if m != nil {
return m.Access
}
return Access_UNKNOWN
}
type CreateRequest struct {
Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
Resource *Resource `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"`
Access Access `protobuf:"varint,3,opt,name=access,proto3,enum=go.micro.auth.Access" json:"access,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateRequest) Reset() { *m = CreateRequest{} }
func (m *CreateRequest) String() string { return proto.CompactTextString(m) }
func (*CreateRequest) ProtoMessage() {}
func (*CreateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_ce1ef0aa40cdd6dc, []int{1}
}
func (m *CreateRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateRequest.Unmarshal(m, b)
}
func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateRequest.Marshal(b, m, deterministic)
}
func (m *CreateRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateRequest.Merge(m, src)
}
func (m *CreateRequest) XXX_Size() int {
return xxx_messageInfo_CreateRequest.Size(m)
}
func (m *CreateRequest) XXX_DiscardUnknown() {
xxx_messageInfo_CreateRequest.DiscardUnknown(m)
}
var xxx_messageInfo_CreateRequest proto.InternalMessageInfo
func (m *CreateRequest) GetRole() string {
if m != nil {
return m.Role
}
return ""
}
func (m *CreateRequest) GetResource() *Resource {
if m != nil {
return m.Resource
}
return nil
}
func (m *CreateRequest) GetAccess() Access {
if m != nil {
return m.Access
}
return Access_UNKNOWN
}
type CreateResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateResponse) Reset() { *m = CreateResponse{} }
func (m *CreateResponse) String() string { return proto.CompactTextString(m) }
func (*CreateResponse) ProtoMessage() {}
func (*CreateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_ce1ef0aa40cdd6dc, []int{2}
}
func (m *CreateResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateResponse.Unmarshal(m, b)
}
func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateResponse.Marshal(b, m, deterministic)
}
func (m *CreateResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateResponse.Merge(m, src)
}
func (m *CreateResponse) XXX_Size() int {
return xxx_messageInfo_CreateResponse.Size(m)
}
func (m *CreateResponse) XXX_DiscardUnknown() {
xxx_messageInfo_CreateResponse.DiscardUnknown(m)
}
var xxx_messageInfo_CreateResponse proto.InternalMessageInfo
type DeleteRequest struct {
Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
Resource *Resource `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"`
Access Access `protobuf:"varint,3,opt,name=access,proto3,enum=go.micro.auth.Access" json:"access,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
func (m *DeleteRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteRequest) ProtoMessage() {}
func (*DeleteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_ce1ef0aa40cdd6dc, []int{3}
}
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteRequest.Unmarshal(m, b)
}
func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic)
}
func (m *DeleteRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_DeleteRequest.Merge(m, src)
}
func (m *DeleteRequest) XXX_Size() int {
return xxx_messageInfo_DeleteRequest.Size(m)
}
func (m *DeleteRequest) XXX_DiscardUnknown() {
xxx_messageInfo_DeleteRequest.DiscardUnknown(m)
}
var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo
func (m *DeleteRequest) GetRole() string {
if m != nil {
return m.Role
}
return ""
}
func (m *DeleteRequest) GetResource() *Resource {
if m != nil {
return m.Resource
}
return nil
}
func (m *DeleteRequest) GetAccess() Access {
if m != nil {
return m.Access
}
return Access_UNKNOWN
}
type DeleteResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_ce1ef0aa40cdd6dc, []int{4}
}
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteResponse.Unmarshal(m, b)
}
func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DeleteResponse.Marshal(b, m, deterministic)
}
func (m *DeleteResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_DeleteResponse.Merge(m, src)
}
func (m *DeleteResponse) XXX_Size() int {
return xxx_messageInfo_DeleteResponse.Size(m)
}
func (m *DeleteResponse) XXX_DiscardUnknown() {
xxx_messageInfo_DeleteResponse.DiscardUnknown(m)
}
var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo
type ListRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListRequest) Reset() { *m = ListRequest{} }
func (m *ListRequest) String() string { return proto.CompactTextString(m) }
func (*ListRequest) ProtoMessage() {}
func (*ListRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_ce1ef0aa40cdd6dc, []int{5}
}
func (m *ListRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRequest.Unmarshal(m, b)
}
func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListRequest.Marshal(b, m, deterministic)
}
func (m *ListRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListRequest.Merge(m, src)
}
func (m *ListRequest) XXX_Size() int {
return xxx_messageInfo_ListRequest.Size(m)
}
func (m *ListRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ListRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ListRequest proto.InternalMessageInfo
type ListResponse struct {
Rules []*Rule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListResponse) Reset() { *m = ListResponse{} }
func (m *ListResponse) String() string { return proto.CompactTextString(m) }
func (*ListResponse) ProtoMessage() {}
func (*ListResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_ce1ef0aa40cdd6dc, []int{6}
}
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListResponse.Unmarshal(m, b)
}
func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic)
}
func (m *ListResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListResponse.Merge(m, src)
}
func (m *ListResponse) XXX_Size() int {
return xxx_messageInfo_ListResponse.Size(m)
}
func (m *ListResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ListResponse proto.InternalMessageInfo
func (m *ListResponse) GetRules() []*Rule {
if m != nil {
return m.Rules
}
return nil
}
func init() {
proto.RegisterEnum("go.micro.auth.Access", Access_name, Access_value)
proto.RegisterType((*Rule)(nil), "go.micro.auth.Rule")
proto.RegisterType((*CreateRequest)(nil), "go.micro.auth.CreateRequest")
proto.RegisterType((*CreateResponse)(nil), "go.micro.auth.CreateResponse")
proto.RegisterType((*DeleteRequest)(nil), "go.micro.auth.DeleteRequest")
proto.RegisterType((*DeleteResponse)(nil), "go.micro.auth.DeleteResponse")
proto.RegisterType((*ListRequest)(nil), "go.micro.auth.ListRequest")
proto.RegisterType((*ListResponse)(nil), "go.micro.auth.ListResponse")
}
func init() { proto.RegisterFile("auth/service/proto/rules.proto", fileDescriptor_ce1ef0aa40cdd6dc) }
var fileDescriptor_ce1ef0aa40cdd6dc = []byte{
// 368 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x93, 0x5f, 0x4b, 0xf3, 0x30,
0x18, 0xc5, 0x97, 0xae, 0xeb, 0xfb, 0xee, 0xa9, 0x1b, 0x25, 0x22, 0x96, 0xfa, 0x87, 0xb2, 0xab,
0x2a, 0xd8, 0x41, 0x77, 0x25, 0x5e, 0x4d, 0x3b, 0x86, 0x28, 0x15, 0x82, 0x22, 0x78, 0x37, 0xbb,
0x07, 0x2d, 0x54, 0x3b, 0x93, 0xd6, 0xaf, 0xe0, 0x9d, 0x9f, 0xd0, 0x0f, 0x23, 0x69, 0xba, 0xe1,
0x3a, 0x07, 0x7a, 0xe7, 0x4d, 0x48, 0x72, 0x4e, 0x4e, 0x7f, 0x39, 0x6d, 0x61, 0x7f, 0x52, 0xe4,
0x8f, 0x7d, 0x81, 0xfc, 0x35, 0x89, 0xb1, 0x3f, 0xe3, 0x59, 0x9e, 0xf5, 0x79, 0x91, 0xa2, 0xf0,
0xcb, 0x39, 0xed, 0x3c, 0x64, 0xfe, 0x53, 0x12, 0xf3, 0xcc, 0x97, 0x46, 0x07, 0xe4, 0xa8, 0xa4,
0xde, 0x3b, 0x01, 0x9d, 0x15, 0x29, 0xd2, 0x2e, 0x68, 0xc9, 0xd4, 0x26, 0x2e, 0xf1, 0xda, 0x4c,
0x4b, 0xa6, 0x94, 0x82, 0xce, 0xb3, 0x14, 0x6d, 0xad, 0xdc, 0x29, 0xe7, 0x74, 0x00, 0xff, 0x39,
0x8a, 0xac, 0xe0, 0x31, 0xda, 0x4d, 0x97, 0x78, 0x66, 0xb0, 0xed, 0x2f, 0x45, 0xfb, 0xac, 0x92,
0xd9, 0xc2, 0x48, 0x8f, 0xc0, 0x98, 0xc4, 0x31, 0x0a, 0x61, 0xeb, 0x2e, 0xf1, 0xba, 0xc1, 0x56,
0xed, 0xc8, 0xb0, 0x14, 0x59, 0x65, 0xea, 0xbd, 0x11, 0xe8, 0x9c, 0x71, 0x9c, 0xe4, 0xc8, 0xf0,
0xa5, 0x40, 0x91, 0x2f, 0x48, 0xc8, 0x1a, 0x12, 0xed, 0xf7, 0x24, 0xcd, 0x9f, 0x90, 0x58, 0xd0,
0x9d, 0x83, 0x88, 0x59, 0xf6, 0x2c, 0xb0, 0x64, 0x0b, 0x31, 0xc5, 0x3f, 0xc1, 0x36, 0x07, 0xa9,
0xd8, 0x3a, 0x60, 0x5e, 0x26, 0x22, 0xaf, 0xc0, 0x7a, 0xc7, 0xb0, 0xa1, 0x96, 0x4a, 0xa6, 0x07,
0xd0, 0x2a, 0xbf, 0x08, 0x9b, 0xb8, 0x4d, 0xcf, 0x0c, 0x36, 0xeb, 0x44, 0x45, 0x8a, 0x4c, 0x39,
0x0e, 0x7d, 0x30, 0xd4, 0xd3, 0xa8, 0x09, 0xff, 0x6e, 0xa2, 0x8b, 0xe8, 0xea, 0x36, 0xb2, 0x1a,
0x72, 0x31, 0x66, 0xc3, 0xe8, 0x7a, 0x14, 0x5a, 0x84, 0x02, 0x18, 0xe1, 0x28, 0x3a, 0x1f, 0x85,
0x96, 0x16, 0x7c, 0x10, 0x68, 0xc9, 0xf3, 0x82, 0x8e, 0xc1, 0x50, 0x8d, 0xd1, 0xdd, 0x5a, 0xfe,
0xd2, 0x1b, 0x75, 0xf6, 0xd6, 0xa8, 0xd5, 0x55, 0x1a, 0x32, 0x48, 0x5d, 0x6f, 0x25, 0x68, 0xa9,
0xfe, 0x95, 0xa0, 0x5a, 0x27, 0x0d, 0x3a, 0x04, 0x5d, 0xd6, 0x40, 0x9d, 0x9a, 0xf1, 0x4b, 0x55,
0xce, 0xce, 0xb7, 0xda, 0x3c, 0xe2, 0xd4, 0xbc, 0x6b, 0xcb, 0xed, 0x13, 0x39, 0xdc, 0x1b, 0xe5,
0x5f, 0x33, 0xf8, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x63, 0x57, 0x37, 0xef, 0x72, 0x03, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// RulesClient is the client API for Rules service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type RulesClient interface {
Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
}
type rulesClient struct {
cc *grpc.ClientConn
}
func NewRulesClient(cc *grpc.ClientConn) RulesClient {
return &rulesClient{cc}
}
func (c *rulesClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) {
out := new(CreateResponse)
err := c.cc.Invoke(ctx, "/go.micro.auth.Rules/Create", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *rulesClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) {
out := new(DeleteResponse)
err := c.cc.Invoke(ctx, "/go.micro.auth.Rules/Delete", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *rulesClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) {
out := new(ListResponse)
err := c.cc.Invoke(ctx, "/go.micro.auth.Rules/List", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// RulesServer is the server API for Rules service.
type RulesServer interface {
Create(context.Context, *CreateRequest) (*CreateResponse, error)
Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
List(context.Context, *ListRequest) (*ListResponse, error)
}
// UnimplementedRulesServer can be embedded to have forward compatible implementations.
type UnimplementedRulesServer struct {
}
func (*UnimplementedRulesServer) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (*UnimplementedRulesServer) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (*UnimplementedRulesServer) List(ctx context.Context, req *ListRequest) (*ListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func RegisterRulesServer(s *grpc.Server, srv RulesServer) {
s.RegisterService(&_Rules_serviceDesc, srv)
}
func _Rules_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RulesServer).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/go.micro.auth.Rules/Create",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RulesServer).Create(ctx, req.(*CreateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Rules_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RulesServer).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/go.micro.auth.Rules/Delete",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RulesServer).Delete(ctx, req.(*DeleteRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Rules_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RulesServer).List(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/go.micro.auth.Rules/List",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RulesServer).List(ctx, req.(*ListRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Rules_serviceDesc = grpc.ServiceDesc{
ServiceName: "go.micro.auth.Rules",
HandlerType: (*RulesServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Create",
Handler: _Rules_Create_Handler,
},
{
MethodName: "Delete",
Handler: _Rules_Delete_Handler,
},
{
MethodName: "List",
Handler: _Rules_List_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "auth/service/proto/rules.proto",
}

View File

@ -1,119 +0,0 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: auth/service/proto/rules.proto
package auth
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
client "github.com/micro/go-micro/v2/client"
server "github.com/micro/go-micro/v2/server"
)
// 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 Rules service
type RulesService interface {
Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
}
type rulesService struct {
c client.Client
name string
}
func NewRulesService(name string, c client.Client) RulesService {
return &rulesService{
c: c,
name: name,
}
}
func (c *rulesService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
req := c.c.NewRequest(c.name, "Rules.Create", in)
out := new(CreateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *rulesService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
req := c.c.NewRequest(c.name, "Rules.Delete", in)
out := new(DeleteResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *rulesService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "Rules.List", in)
out := new(ListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Rules service
type RulesHandler interface {
Create(context.Context, *CreateRequest, *CreateResponse) error
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
List(context.Context, *ListRequest, *ListResponse) error
}
func RegisterRulesHandler(s server.Server, hdlr RulesHandler, opts ...server.HandlerOption) error {
type rules interface {
Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
List(ctx context.Context, in *ListRequest, out *ListResponse) error
}
type Rules struct {
rules
}
h := &rulesHandler{hdlr}
return s.Handle(s.NewHandler(&Rules{h}, opts...))
}
type rulesHandler struct {
RulesHandler
}
func (h *rulesHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
return h.RulesHandler.Create(ctx, in, out)
}
func (h *rulesHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
return h.RulesHandler.Delete(ctx, in, out)
}
func (h *rulesHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
return h.RulesHandler.List(ctx, in, out)
}

View File

@ -1,49 +0,0 @@
syntax = "proto3";
package go.micro.auth;
option go_package = "auth;auth";
import "auth.proto";
service Rules {
rpc Create(CreateRequest) returns (CreateResponse) {};
rpc Delete(DeleteRequest) returns (DeleteResponse) {};
rpc List(ListRequest) returns (ListResponse) {};
}
enum Access {
UNKNOWN = 0;
GRANTED = 1;
DENIED = 2;
}
message Rule {
string id = 1;
string role = 2;
Resource resource = 3;
Access access = 4;
}
message CreateRequest {
string role = 1;
Resource resource = 2;
Access access = 3;
}
message CreateResponse {}
message DeleteRequest {
string role = 1;
Resource resource = 2;
Access access = 3;
}
message DeleteResponse {}
message ListRequest {
}
message ListResponse {
repeated Rule rules = 1;
}