mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-10 00:10:20 +00:00
util: add ValidateGroupControllerServiceRequest helper
added ValidateGroupControllerServiceRequest helper function which can be used to validate the group controller service request. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
5ecfa0660f
commit
2af26ca62d
@ -130,3 +130,21 @@ func (d *CSIDriver) AddGroupControllerServiceCapabilities(cl []csi.GroupControll
|
|||||||
|
|
||||||
d.groupCapabilities = csc
|
d.groupCapabilities = csc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ValidateGroupControllerServiceRequest validates the group controller
|
||||||
|
// plugin capabilities.
|
||||||
|
//
|
||||||
|
//nolint:interfacer // c can be of type fmt.Stringer, but that does not make the API clearer
|
||||||
|
func (d *CSIDriver) ValidateGroupControllerServiceRequest(c csi.GroupControllerServiceCapability_RPC_Type) error {
|
||||||
|
if c == csi.GroupControllerServiceCapability_RPC_UNKNOWN {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, capability := range d.groupCapabilities {
|
||||||
|
if c == capability.GetRpc().GetType() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return status.Error(codes.InvalidArgument, c.String())
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user