Skip to content

Commit

Permalink
add client side implementation for mmode 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 Nov 6, 2024
1 parent 7ef3c81 commit f01c461
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
46 changes: 46 additions & 0 deletions services/provider/api/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,50 @@ func (cc *OCSProviderClient) PeerStorageCluster(ctx context.Context, onboardingT
defer cancel()

return cc.Client.PeerStorageCluster(apiCtx, req)

}

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

req := &pb.StartMaintenanceModeRequest{
StorageConsumerUUID: consumerUUID,
}

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

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

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

req := &pb.StopMaintenanceModeRequest{
StorageConsumerUUID: consumerUUID,
}

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

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

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

req := &pb.GetMaintenanceModeStatusRequest{
StorageConsumerUUID: consumerUUID,
}

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

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f01c461

Please sign in to comment.