Skip to content

Commit

Permalink
Add client side code for rpc calls
Browse files Browse the repository at this point in the history
Signed-off-by: Rewant Soni <[email protected]>
  • Loading branch information
rewantsoni committed Aug 28, 2024
1 parent 4d12d22 commit d82c826
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions services/provider/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,65 @@ func (cc *OCSProviderClient) ReportStatus(ctx context.Context, consumerUUID stri

return cc.Client.ReportStatus(apiCtx, req)
}

func (cc *OCSProviderClient) OnboardStorageClusterPeer(ctx context.Context, onboardingTicket, storageClusterPeerUID string) (*pb.OnboardStorageClusterPeerResponse, error) {
if cc.Client == nil || cc.clientConn == nil {
return nil, fmt.Errorf("OCS client is closed")
}

req := &pb.OnboardStorageClusterPeerRequest{
OnboardingTicket: onboardingTicket,
StorageClusterPeerUID: storageClusterPeerUID,
}

apiCtx, cancel := context.WithTimeout(ctx, cc.timeout)
defer cancel()

return cc.Client.OnboardStorageClusterPeer(apiCtx, req)
}

func (cc *OCSProviderClient) OffboardStorageClusterPeer(ctx context.Context, storageClusterPeerUID string) (*pb.OffboardStorageClusterPeerResponse, error) {
if cc.Client == nil || cc.clientConn == nil {
return nil, fmt.Errorf("OCS client is closed")
}

req := &pb.OffboardStorageClusterPeerRequest{
StorageClusterPeerUID: storageClusterPeerUID,
}

apiCtx, cancel := context.WithTimeout(ctx, cc.timeout)
defer cancel()

return cc.Client.OffboardStorageClusterPeer(apiCtx, req)
}

func (cc *OCSProviderClient) AcknowledgeOnboardingStorageClusterPeer(ctx context.Context, storageClusterPeerUID string) (*pb.AcknowledgeOnboardingStorageClusterPeerResponse, error) {
if cc.Client == nil || cc.clientConn == nil {
return nil, fmt.Errorf("provider client is closed")
}

req := &pb.AcknowledgeOnboardingStorageClusterPeerRequest{
StorageClusterPeerUID: storageClusterPeerUID,
}

apiCtx, cancel := context.WithTimeout(ctx, cc.timeout)
defer cancel()

return cc.Client.AcknowledgeOnboardingStorageClusterPeer(apiCtx, req)
}

func (cc *OCSProviderClient) GetMirroringInfo(ctx context.Context, storageClusterPeerUID string, blockPoolNames []string) (*pb.MirroringInfoResponse, error) {
if cc.Client == nil || cc.clientConn == nil {
return nil, fmt.Errorf("OCS client is closed")
}

req := &pb.MirroringInfoRequest{
StorageClusterPeerUID: storageClusterPeerUID,
BlockPoolNames: blockPoolNames,
}

apiCtx, cancel := context.WithTimeout(ctx, cc.timeout)
defer cancel()

return cc.Client.GetMirroringInfo(apiCtx, req)
}

0 comments on commit d82c826

Please sign in to comment.