Skip to content

Commit

Permalink
Adds FieldValidationStrict client option
Browse files Browse the repository at this point in the history
  • Loading branch information
dlipovetsky committed Jun 20, 2024
1 parent 4d36613 commit 2219c68
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions pkg/client/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,42 @@ func (f FieldOwner) ApplyToSubResourceUpdate(opts *SubResourceUpdateOptions) {
opts.FieldManager = string(f)
}

// FieldValidationStrict sets the field validation to strict for create, update,
// and patch requests.
var FieldValidationStrict = fieldValidationStrict{}

type fieldValidationStrict struct{}

// ApplyToPatch applies this configuration to the given patch options.
func (f fieldValidationStrict) ApplyToPatch(opts *PatchOptions) {
opts.FieldValidation = metav1.FieldValidationStrict
}

// ApplyToCreate applies this configuration to the given create options.
func (f fieldValidationStrict) ApplyToCreate(opts *CreateOptions) {
opts.FieldValidation = metav1.FieldValidationStrict
}

// ApplyToUpdate applies this configuration to the given update options.
func (f fieldValidationStrict) ApplyToUpdate(opts *UpdateOptions) {
opts.FieldValidation = metav1.FieldValidationStrict
}

// ApplyToSubResourcePatch applies this configuration to the given patch options.
func (f fieldValidationStrict) ApplyToSubResourcePatch(opts *SubResourcePatchOptions) {
opts.FieldValidation = metav1.FieldValidationStrict
}

// ApplyToSubResourceCreate applies this configuration to the given create options.
func (f fieldValidationStrict) ApplyToSubResourceCreate(opts *SubResourceCreateOptions) {
opts.FieldValidation = metav1.FieldValidationStrict
}

// ApplyToSubResourceUpdate applies this configuration to the given update options.
func (f fieldValidationStrict) ApplyToSubResourceUpdate(opts *SubResourceUpdateOptions) {
opts.FieldValidation = metav1.FieldValidationStrict
}

// }}}

// {{{ Create Options
Expand Down

0 comments on commit 2219c68

Please sign in to comment.