Skip to content

Commit c0c4bb6

Browse files
committed
pkg/api/validate: add comments for exported methods
Signed-off-by: Markus Lehtonen <[email protected]>
1 parent c0ba9da commit c0c4bb6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pkg/api/validate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,26 @@ import (
2020
"fmt"
2121
)
2222

23+
// AddPlugin records a plugin for the validation request.
2324
func (v *ValidateContainerAdjustmentRequest) AddPlugin(name, index string) {
2425
v.Plugins = append(v.Plugins, &PluginInstance{
2526
Name: name,
2627
Index: index,
2728
})
2829
}
2930

31+
// AddResponse records the container adjustments and updates to validate from a CreateContainerResponse.
3032
func (v *ValidateContainerAdjustmentRequest) AddResponse(rpl *CreateContainerResponse) {
3133
v.Adjust = rpl.Adjust
3234
v.Update = rpl.Update
3335
}
3436

37+
// AddOwners sets the owning plugins for the container adjustment request.
3538
func (v *ValidateContainerAdjustmentRequest) AddOwners(owners *OwningPlugins) {
3639
v.Owners = owners
3740
}
3841

42+
// ValidationResult returns the validation result as an error (non-nil if rejected).
3943
func (v *ValidateContainerAdjustmentResponse) ValidationResult(plugin string) error {
4044
if !v.Reject {
4145
return nil
@@ -49,6 +53,7 @@ func (v *ValidateContainerAdjustmentResponse) ValidationResult(plugin string) er
4953
return fmt.Errorf("validator %q rejected container adjustment, reason: %s", plugin, reason)
5054
}
5155

56+
// GetPluginMap returns a map of plugin name to PluginInstance.
5257
func (v *ValidateContainerAdjustmentRequest) GetPluginMap() map[string]*PluginInstance {
5358
if v == nil {
5459
return nil

0 commit comments

Comments
 (0)