Rename NewResourceClient funcs

This commit is contained in:
gamab 2024-09-09 16:14:02 +02:00
parent 36b3752490
commit 79d9969aa8
No known key found for this signature in database
GPG Key ID: 88D8810B587562C1
3 changed files with 5 additions and 5 deletions

View File

@ -545,9 +545,9 @@ func (s *service) running(ctx context.Context) error {
func newResourceClient(conn *grpc.ClientConn, cfg *setting.Cfg) (resource.ResourceStoreClient, error) { func newResourceClient(conn *grpc.ClientConn, cfg *setting.Cfg) (resource.ResourceStoreClient, error) {
if cfg.StackID != "" { if cfg.StackID != "" {
return resource.NewResourceClientCloud(conn, cfg) return resource.NewCloudResourceClient(conn, cfg)
} }
return resource.NewResourceClientGRPC(conn) return resource.NewGRPCResourceClient(conn)
} }
func ensureKubeConfig(restConfig *clientrest.Config, dir string) error { func ensureKubeConfig(restConfig *clientrest.Config, dir string) error {

View File

@ -44,7 +44,7 @@ func NewLocalResourceClient(server ResourceStoreServer) ResourceStoreClient {
return NewResourceStoreClient(grpchan.InterceptClientConn(channel, clientInt.UnaryClientInterceptor, clientInt.StreamClientInterceptor)) return NewResourceStoreClient(grpchan.InterceptClientConn(channel, clientInt.UnaryClientInterceptor, clientInt.StreamClientInterceptor))
} }
func NewResourceClientGRPC(conn *grpc.ClientConn) (ResourceStoreClient, error) { func NewGRPCResourceClient(conn *grpc.ClientConn) (ResourceStoreClient, error) {
// scenario: remote on-prem // scenario: remote on-prem
clientInt, err := authnlib.NewGrpcClientInterceptor( clientInt, err := authnlib.NewGrpcClientInterceptor(
&authnlib.GrpcClientConfig{}, &authnlib.GrpcClientConfig{},
@ -59,7 +59,7 @@ func NewResourceClientGRPC(conn *grpc.ClientConn) (ResourceStoreClient, error) {
return NewResourceStoreClient(grpchan.InterceptClientConn(conn, clientInt.UnaryClientInterceptor, clientInt.StreamClientInterceptor)), nil return NewResourceStoreClient(grpchan.InterceptClientConn(conn, clientInt.UnaryClientInterceptor, clientInt.StreamClientInterceptor)), nil
} }
func NewResourceClientCloud(conn *grpc.ClientConn, cfg *setting.Cfg) (ResourceStoreClient, error) { func NewCloudResourceClient(conn *grpc.ClientConn, cfg *setting.Cfg) (ResourceStoreClient, error) {
// scenario: remote cloud // scenario: remote cloud
grpcClientConfig := clientCfgMapping(grpcutils.ReadGrpcClientConfig(cfg)) grpcClientConfig := clientCfgMapping(grpcutils.ReadGrpcClientConfig(cfg))

View File

@ -357,7 +357,7 @@ func TestClientServer(t *testing.T) {
t.Run("Create a client", func(t *testing.T) { t.Run("Create a client", func(t *testing.T) {
conn, err := grpc.NewClient(svc.GetAddress(), grpc.WithTransportCredentials(insecure.NewCredentials())) conn, err := grpc.NewClient(svc.GetAddress(), grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err) require.NoError(t, err)
client, err = resource.NewResourceClientGRPC(conn) client, err = resource.NewGRPCResourceClient(conn)
require.NoError(t, err) require.NoError(t, err)
}) })