mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Rename NewResourceClient funcs
This commit is contained in:
parent
36b3752490
commit
79d9969aa8
@ -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 {
|
||||||
|
@ -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))
|
||||||
|
|
||||||
|
@ -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)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user