khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 1 | // Copyright 2016 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 clientv3 |
| 16 | |
| 17 | import ( |
| 18 | "context" |
| 19 | |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 20 | "go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes" |
| 21 | pb "go.etcd.io/etcd/etcdserver/etcdserverpb" |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 22 | |
| 23 | "google.golang.org/grpc" |
| 24 | "google.golang.org/grpc/codes" |
| 25 | "google.golang.org/grpc/status" |
| 26 | ) |
| 27 | |
| 28 | type retryPolicy uint8 |
| 29 | |
| 30 | const ( |
| 31 | repeatable retryPolicy = iota |
| 32 | nonRepeatable |
| 33 | ) |
| 34 | |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 35 | func (rp retryPolicy) String() string { |
| 36 | switch rp { |
| 37 | case repeatable: |
| 38 | return "repeatable" |
| 39 | case nonRepeatable: |
| 40 | return "nonRepeatable" |
| 41 | default: |
| 42 | return "UNKNOWN" |
| 43 | } |
| 44 | } |
| 45 | |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 46 | // isSafeRetryImmutableRPC returns "true" when an immutable request is safe for retry. |
| 47 | // |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 48 | // immutable requests (e.g. Get) should be retried unless it's |
| 49 | // an obvious server-side error (e.g. rpctypes.ErrRequestTooLarge). |
| 50 | // |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 51 | // Returning "false" means retry should stop, since client cannot |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 52 | // handle itself even with retries. |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 53 | func isSafeRetryImmutableRPC(err error) bool { |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 54 | eErr := rpctypes.Error(err) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 55 | if serverErr, ok := eErr.(rpctypes.EtcdError); ok && serverErr.Code() != codes.Unavailable { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 56 | // interrupted by non-transient server-side or gRPC-side error |
| 57 | // client cannot handle itself (e.g. rpctypes.ErrCompacted) |
| 58 | return false |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 59 | } |
| 60 | // only retry if unavailable |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 61 | ev, ok := status.FromError(err) |
| 62 | if !ok { |
| 63 | // all errors from RPC is typed "grpc/status.(*statusError)" |
| 64 | // (ref. https://github.com/grpc/grpc-go/pull/1782) |
| 65 | // |
| 66 | // if the error type is not "grpc/status.(*statusError)", |
| 67 | // it could be from "Dial" |
| 68 | // TODO: do not retry for now |
| 69 | // ref. https://github.com/grpc/grpc-go/issues/1581 |
| 70 | return false |
| 71 | } |
| 72 | return ev.Code() == codes.Unavailable |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 73 | } |
| 74 | |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 75 | // isSafeRetryMutableRPC returns "true" when a mutable request is safe for retry. |
| 76 | // |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 77 | // mutable requests (e.g. Put, Delete, Txn) should only be retried |
| 78 | // when the status code is codes.Unavailable when initial connection |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 79 | // has not been established (no endpoint is up). |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 80 | // |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 81 | // Returning "false" means retry should stop, otherwise it violates |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 82 | // write-at-most-once semantics. |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 83 | func isSafeRetryMutableRPC(err error) bool { |
| 84 | if ev, ok := status.FromError(err); ok && ev.Code() != codes.Unavailable { |
| 85 | // not safe for mutable RPCs |
| 86 | // e.g. interrupted by non-transient error that client cannot handle itself, |
| 87 | // or transient error while the connection has already been established |
| 88 | return false |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 89 | } |
| 90 | desc := rpctypes.ErrorDesc(err) |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 91 | return desc == "there is no address available" || desc == "there is no connection available" |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | type retryKVClient struct { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 95 | kc pb.KVClient |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | // RetryKVClient implements a KVClient. |
| 99 | func RetryKVClient(c *Client) pb.KVClient { |
| 100 | return &retryKVClient{ |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 101 | kc: pb.NewKVClient(c.conn), |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 102 | } |
| 103 | } |
| 104 | func (rkv *retryKVClient) Range(ctx context.Context, in *pb.RangeRequest, opts ...grpc.CallOption) (resp *pb.RangeResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 105 | return rkv.kc.Range(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | func (rkv *retryKVClient) Put(ctx context.Context, in *pb.PutRequest, opts ...grpc.CallOption) (resp *pb.PutResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 109 | return rkv.kc.Put(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | func (rkv *retryKVClient) DeleteRange(ctx context.Context, in *pb.DeleteRangeRequest, opts ...grpc.CallOption) (resp *pb.DeleteRangeResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 113 | return rkv.kc.DeleteRange(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | func (rkv *retryKVClient) Txn(ctx context.Context, in *pb.TxnRequest, opts ...grpc.CallOption) (resp *pb.TxnResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 117 | return rkv.kc.Txn(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | func (rkv *retryKVClient) Compact(ctx context.Context, in *pb.CompactionRequest, opts ...grpc.CallOption) (resp *pb.CompactionResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 121 | return rkv.kc.Compact(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | type retryLeaseClient struct { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 125 | lc pb.LeaseClient |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | // RetryLeaseClient implements a LeaseClient. |
| 129 | func RetryLeaseClient(c *Client) pb.LeaseClient { |
| 130 | return &retryLeaseClient{ |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 131 | lc: pb.NewLeaseClient(c.conn), |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 132 | } |
| 133 | } |
| 134 | |
| 135 | func (rlc *retryLeaseClient) LeaseTimeToLive(ctx context.Context, in *pb.LeaseTimeToLiveRequest, opts ...grpc.CallOption) (resp *pb.LeaseTimeToLiveResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 136 | return rlc.lc.LeaseTimeToLive(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | func (rlc *retryLeaseClient) LeaseLeases(ctx context.Context, in *pb.LeaseLeasesRequest, opts ...grpc.CallOption) (resp *pb.LeaseLeasesResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 140 | return rlc.lc.LeaseLeases(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | func (rlc *retryLeaseClient) LeaseGrant(ctx context.Context, in *pb.LeaseGrantRequest, opts ...grpc.CallOption) (resp *pb.LeaseGrantResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 144 | return rlc.lc.LeaseGrant(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | func (rlc *retryLeaseClient) LeaseRevoke(ctx context.Context, in *pb.LeaseRevokeRequest, opts ...grpc.CallOption) (resp *pb.LeaseRevokeResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 148 | return rlc.lc.LeaseRevoke(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | func (rlc *retryLeaseClient) LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (stream pb.Lease_LeaseKeepAliveClient, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 152 | return rlc.lc.LeaseKeepAlive(ctx, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 153 | } |
| 154 | |
| 155 | type retryClusterClient struct { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 156 | cc pb.ClusterClient |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | // RetryClusterClient implements a ClusterClient. |
| 160 | func RetryClusterClient(c *Client) pb.ClusterClient { |
| 161 | return &retryClusterClient{ |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 162 | cc: pb.NewClusterClient(c.conn), |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 163 | } |
| 164 | } |
| 165 | |
| 166 | func (rcc *retryClusterClient) MemberList(ctx context.Context, in *pb.MemberListRequest, opts ...grpc.CallOption) (resp *pb.MemberListResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 167 | return rcc.cc.MemberList(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | func (rcc *retryClusterClient) MemberAdd(ctx context.Context, in *pb.MemberAddRequest, opts ...grpc.CallOption) (resp *pb.MemberAddResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 171 | return rcc.cc.MemberAdd(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | func (rcc *retryClusterClient) MemberRemove(ctx context.Context, in *pb.MemberRemoveRequest, opts ...grpc.CallOption) (resp *pb.MemberRemoveResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 175 | return rcc.cc.MemberRemove(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | func (rcc *retryClusterClient) MemberUpdate(ctx context.Context, in *pb.MemberUpdateRequest, opts ...grpc.CallOption) (resp *pb.MemberUpdateResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 179 | return rcc.cc.MemberUpdate(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 180 | } |
| 181 | |
Scott Baker | beb3cfa | 2019-10-01 14:44:30 -0700 | [diff] [blame^] | 182 | func (rcc *retryClusterClient) MemberPromote(ctx context.Context, in *pb.MemberPromoteRequest, opts ...grpc.CallOption) (resp *pb.MemberPromoteResponse, err error) { |
| 183 | return rcc.cc.MemberPromote(ctx, in, opts...) |
| 184 | } |
| 185 | |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 186 | type retryMaintenanceClient struct { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 187 | mc pb.MaintenanceClient |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | // RetryMaintenanceClient implements a Maintenance. |
| 191 | func RetryMaintenanceClient(c *Client, conn *grpc.ClientConn) pb.MaintenanceClient { |
| 192 | return &retryMaintenanceClient{ |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 193 | mc: pb.NewMaintenanceClient(conn), |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 194 | } |
| 195 | } |
| 196 | |
| 197 | func (rmc *retryMaintenanceClient) Alarm(ctx context.Context, in *pb.AlarmRequest, opts ...grpc.CallOption) (resp *pb.AlarmResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 198 | return rmc.mc.Alarm(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | func (rmc *retryMaintenanceClient) Status(ctx context.Context, in *pb.StatusRequest, opts ...grpc.CallOption) (resp *pb.StatusResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 202 | return rmc.mc.Status(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | func (rmc *retryMaintenanceClient) Hash(ctx context.Context, in *pb.HashRequest, opts ...grpc.CallOption) (resp *pb.HashResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 206 | return rmc.mc.Hash(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | func (rmc *retryMaintenanceClient) HashKV(ctx context.Context, in *pb.HashKVRequest, opts ...grpc.CallOption) (resp *pb.HashKVResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 210 | return rmc.mc.HashKV(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | func (rmc *retryMaintenanceClient) Snapshot(ctx context.Context, in *pb.SnapshotRequest, opts ...grpc.CallOption) (stream pb.Maintenance_SnapshotClient, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 214 | return rmc.mc.Snapshot(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | func (rmc *retryMaintenanceClient) MoveLeader(ctx context.Context, in *pb.MoveLeaderRequest, opts ...grpc.CallOption) (resp *pb.MoveLeaderResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 218 | return rmc.mc.MoveLeader(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | func (rmc *retryMaintenanceClient) Defragment(ctx context.Context, in *pb.DefragmentRequest, opts ...grpc.CallOption) (resp *pb.DefragmentResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 222 | return rmc.mc.Defragment(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | type retryAuthClient struct { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 226 | ac pb.AuthClient |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | // RetryAuthClient implements a AuthClient. |
| 230 | func RetryAuthClient(c *Client) pb.AuthClient { |
| 231 | return &retryAuthClient{ |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 232 | ac: pb.NewAuthClient(c.conn), |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 233 | } |
| 234 | } |
| 235 | |
| 236 | func (rac *retryAuthClient) UserList(ctx context.Context, in *pb.AuthUserListRequest, opts ...grpc.CallOption) (resp *pb.AuthUserListResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 237 | return rac.ac.UserList(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | func (rac *retryAuthClient) UserGet(ctx context.Context, in *pb.AuthUserGetRequest, opts ...grpc.CallOption) (resp *pb.AuthUserGetResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 241 | return rac.ac.UserGet(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 242 | } |
| 243 | |
| 244 | func (rac *retryAuthClient) RoleGet(ctx context.Context, in *pb.AuthRoleGetRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleGetResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 245 | return rac.ac.RoleGet(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | func (rac *retryAuthClient) RoleList(ctx context.Context, in *pb.AuthRoleListRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleListResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 249 | return rac.ac.RoleList(ctx, in, append(opts, withRetryPolicy(repeatable))...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | func (rac *retryAuthClient) AuthEnable(ctx context.Context, in *pb.AuthEnableRequest, opts ...grpc.CallOption) (resp *pb.AuthEnableResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 253 | return rac.ac.AuthEnable(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | func (rac *retryAuthClient) AuthDisable(ctx context.Context, in *pb.AuthDisableRequest, opts ...grpc.CallOption) (resp *pb.AuthDisableResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 257 | return rac.ac.AuthDisable(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | func (rac *retryAuthClient) UserAdd(ctx context.Context, in *pb.AuthUserAddRequest, opts ...grpc.CallOption) (resp *pb.AuthUserAddResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 261 | return rac.ac.UserAdd(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | func (rac *retryAuthClient) UserDelete(ctx context.Context, in *pb.AuthUserDeleteRequest, opts ...grpc.CallOption) (resp *pb.AuthUserDeleteResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 265 | return rac.ac.UserDelete(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | func (rac *retryAuthClient) UserChangePassword(ctx context.Context, in *pb.AuthUserChangePasswordRequest, opts ...grpc.CallOption) (resp *pb.AuthUserChangePasswordResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 269 | return rac.ac.UserChangePassword(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | func (rac *retryAuthClient) UserGrantRole(ctx context.Context, in *pb.AuthUserGrantRoleRequest, opts ...grpc.CallOption) (resp *pb.AuthUserGrantRoleResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 273 | return rac.ac.UserGrantRole(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | func (rac *retryAuthClient) UserRevokeRole(ctx context.Context, in *pb.AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (resp *pb.AuthUserRevokeRoleResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 277 | return rac.ac.UserRevokeRole(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | func (rac *retryAuthClient) RoleAdd(ctx context.Context, in *pb.AuthRoleAddRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleAddResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 281 | return rac.ac.RoleAdd(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | func (rac *retryAuthClient) RoleDelete(ctx context.Context, in *pb.AuthRoleDeleteRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleDeleteResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 285 | return rac.ac.RoleDelete(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | func (rac *retryAuthClient) RoleGrantPermission(ctx context.Context, in *pb.AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleGrantPermissionResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 289 | return rac.ac.RoleGrantPermission(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | func (rac *retryAuthClient) RoleRevokePermission(ctx context.Context, in *pb.AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleRevokePermissionResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 293 | return rac.ac.RoleRevokePermission(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | func (rac *retryAuthClient) Authenticate(ctx context.Context, in *pb.AuthenticateRequest, opts ...grpc.CallOption) (resp *pb.AuthenticateResponse, err error) { |
Stephane Barbarie | 260a563 | 2019-02-26 16:12:49 -0500 | [diff] [blame] | 297 | return rac.ac.Authenticate(ctx, in, opts...) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 298 | } |