From c669cadaa7e4b8a94179ba63c9b94978c187814e Mon Sep 17 00:00:00 2001 From: Rewant Soni Date: Mon, 4 Nov 2024 21:05:07 +0530 Subject: [PATCH] add client side implementation Signed-off-by: Rewant Soni add generated changes Signed-off-by: Rewant Soni --- services/provider/api/client/client.go | 32 +++++++++++++++++++ .../services/provider/api/v4/client/client.go | 32 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/services/provider/api/client/client.go b/services/provider/api/client/client.go index 568964922e..4a2db6d72b 100644 --- a/services/provider/api/client/client.go +++ b/services/provider/api/client/client.go @@ -243,3 +243,35 @@ func (cc *OCSProviderClient) RequestMaintenanceMode(ctx context.Context, consume return cc.Client.RequestMaintenanceMode(apiCtx, req) } + +func (cc *OCSProviderClient) GetStorageClientsInfo(ctx context.Context, storageClusterUID string, clientIDs []string) (*pb.StorageClientsInfoResponse, error) { + if cc.Client == nil || cc.clientConn == nil { + return nil, fmt.Errorf("connection to Peer OCS is closed") + } + + req := &pb.StorageClientsInfoRequest{ + StorageClusterUID: storageClusterUID, + ClientIDs: clientIDs, + } + + apiCtx, cancel := context.WithTimeout(ctx, cc.timeout) + defer cancel() + + return cc.Client.GetStorageClientsInfo(apiCtx, req) +} + +func (cc *OCSProviderClient) GetBlockPoolsInfo(ctx context.Context, storageClusterUID string, blockPoolNames []string) (*pb.BlockPoolsInfoResponse, error) { + if cc.Client == nil || cc.clientConn == nil { + return nil, fmt.Errorf("connection to Peer OCS is closed") + } + + req := &pb.BlockPoolsInfoRequest{ + StorageClusterUID: storageClusterUID, + BlockPoolNames: blockPoolNames, + } + + apiCtx, cancel := context.WithTimeout(ctx, cc.timeout) + defer cancel() + + return cc.Client.GetBlockPoolsInfo(apiCtx, req) +} diff --git a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client/client.go b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client/client.go index 568964922e..4a2db6d72b 100644 --- a/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client/client.go +++ b/vendor/github.com/red-hat-storage/ocs-operator/services/provider/api/v4/client/client.go @@ -243,3 +243,35 @@ func (cc *OCSProviderClient) RequestMaintenanceMode(ctx context.Context, consume return cc.Client.RequestMaintenanceMode(apiCtx, req) } + +func (cc *OCSProviderClient) GetStorageClientsInfo(ctx context.Context, storageClusterUID string, clientIDs []string) (*pb.StorageClientsInfoResponse, error) { + if cc.Client == nil || cc.clientConn == nil { + return nil, fmt.Errorf("connection to Peer OCS is closed") + } + + req := &pb.StorageClientsInfoRequest{ + StorageClusterUID: storageClusterUID, + ClientIDs: clientIDs, + } + + apiCtx, cancel := context.WithTimeout(ctx, cc.timeout) + defer cancel() + + return cc.Client.GetStorageClientsInfo(apiCtx, req) +} + +func (cc *OCSProviderClient) GetBlockPoolsInfo(ctx context.Context, storageClusterUID string, blockPoolNames []string) (*pb.BlockPoolsInfoResponse, error) { + if cc.Client == nil || cc.clientConn == nil { + return nil, fmt.Errorf("connection to Peer OCS is closed") + } + + req := &pb.BlockPoolsInfoRequest{ + StorageClusterUID: storageClusterUID, + BlockPoolNames: blockPoolNames, + } + + apiCtx, cancel := context.WithTimeout(ctx, cc.timeout) + defer cancel() + + return cc.Client.GetBlockPoolsInfo(apiCtx, req) +}