khenaidoo | ab1f7bd | 2019-11-14 14:00:27 -0500 | [diff] [blame] | 1 | // Copyright 2017 The etcd Authors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package adapter |
| 16 | |
| 17 | import ( |
| 18 | "context" |
| 19 | |
| 20 | pb "go.etcd.io/etcd/etcdserver/etcdserverpb" |
| 21 | |
| 22 | grpc "google.golang.org/grpc" |
| 23 | ) |
| 24 | |
| 25 | type as2ac struct{ as pb.AuthServer } |
| 26 | |
| 27 | func AuthServerToAuthClient(as pb.AuthServer) pb.AuthClient { |
| 28 | return &as2ac{as} |
| 29 | } |
| 30 | |
| 31 | func (s *as2ac) AuthEnable(ctx context.Context, in *pb.AuthEnableRequest, opts ...grpc.CallOption) (*pb.AuthEnableResponse, error) { |
| 32 | return s.as.AuthEnable(ctx, in) |
| 33 | } |
| 34 | |
| 35 | func (s *as2ac) AuthDisable(ctx context.Context, in *pb.AuthDisableRequest, opts ...grpc.CallOption) (*pb.AuthDisableResponse, error) { |
| 36 | return s.as.AuthDisable(ctx, in) |
| 37 | } |
| 38 | |
| 39 | func (s *as2ac) Authenticate(ctx context.Context, in *pb.AuthenticateRequest, opts ...grpc.CallOption) (*pb.AuthenticateResponse, error) { |
| 40 | return s.as.Authenticate(ctx, in) |
| 41 | } |
| 42 | |
| 43 | func (s *as2ac) RoleAdd(ctx context.Context, in *pb.AuthRoleAddRequest, opts ...grpc.CallOption) (*pb.AuthRoleAddResponse, error) { |
| 44 | return s.as.RoleAdd(ctx, in) |
| 45 | } |
| 46 | |
| 47 | func (s *as2ac) RoleDelete(ctx context.Context, in *pb.AuthRoleDeleteRequest, opts ...grpc.CallOption) (*pb.AuthRoleDeleteResponse, error) { |
| 48 | return s.as.RoleDelete(ctx, in) |
| 49 | } |
| 50 | |
| 51 | func (s *as2ac) RoleGet(ctx context.Context, in *pb.AuthRoleGetRequest, opts ...grpc.CallOption) (*pb.AuthRoleGetResponse, error) { |
| 52 | return s.as.RoleGet(ctx, in) |
| 53 | } |
| 54 | |
| 55 | func (s *as2ac) RoleList(ctx context.Context, in *pb.AuthRoleListRequest, opts ...grpc.CallOption) (*pb.AuthRoleListResponse, error) { |
| 56 | return s.as.RoleList(ctx, in) |
| 57 | } |
| 58 | |
| 59 | func (s *as2ac) RoleRevokePermission(ctx context.Context, in *pb.AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (*pb.AuthRoleRevokePermissionResponse, error) { |
| 60 | return s.as.RoleRevokePermission(ctx, in) |
| 61 | } |
| 62 | |
| 63 | func (s *as2ac) RoleGrantPermission(ctx context.Context, in *pb.AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (*pb.AuthRoleGrantPermissionResponse, error) { |
| 64 | return s.as.RoleGrantPermission(ctx, in) |
| 65 | } |
| 66 | |
| 67 | func (s *as2ac) UserDelete(ctx context.Context, in *pb.AuthUserDeleteRequest, opts ...grpc.CallOption) (*pb.AuthUserDeleteResponse, error) { |
| 68 | return s.as.UserDelete(ctx, in) |
| 69 | } |
| 70 | |
| 71 | func (s *as2ac) UserAdd(ctx context.Context, in *pb.AuthUserAddRequest, opts ...grpc.CallOption) (*pb.AuthUserAddResponse, error) { |
| 72 | return s.as.UserAdd(ctx, in) |
| 73 | } |
| 74 | |
| 75 | func (s *as2ac) UserGet(ctx context.Context, in *pb.AuthUserGetRequest, opts ...grpc.CallOption) (*pb.AuthUserGetResponse, error) { |
| 76 | return s.as.UserGet(ctx, in) |
| 77 | } |
| 78 | |
| 79 | func (s *as2ac) UserList(ctx context.Context, in *pb.AuthUserListRequest, opts ...grpc.CallOption) (*pb.AuthUserListResponse, error) { |
| 80 | return s.as.UserList(ctx, in) |
| 81 | } |
| 82 | |
| 83 | func (s *as2ac) UserGrantRole(ctx context.Context, in *pb.AuthUserGrantRoleRequest, opts ...grpc.CallOption) (*pb.AuthUserGrantRoleResponse, error) { |
| 84 | return s.as.UserGrantRole(ctx, in) |
| 85 | } |
| 86 | |
| 87 | func (s *as2ac) UserRevokeRole(ctx context.Context, in *pb.AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (*pb.AuthUserRevokeRoleResponse, error) { |
| 88 | return s.as.UserRevokeRole(ctx, in) |
| 89 | } |
| 90 | |
| 91 | func (s *as2ac) UserChangePassword(ctx context.Context, in *pb.AuthUserChangePasswordRequest, opts ...grpc.CallOption) (*pb.AuthUserChangePasswordResponse, error) { |
| 92 | return s.as.UserChangePassword(ctx, in) |
| 93 | } |