// Copyright (c) 2026 Tigera, Inc. All rights reserved.

// Code generated by applyconfiguration-gen. DO NOT EDIT.

package v3

// ICMPFieldsApplyConfiguration represents a declarative configuration of the ICMPFields type for use
// with apply.
//
// ICMPFields defines structure for ICMP and NotICMP sub-struct for ICMP code and type
type ICMPFieldsApplyConfiguration struct {
	// Match on a specific ICMP type.  For example a value of 8 refers to ICMP Echo Request
	// (i.e. pings).
	Type *int `json:"type,omitempty"`
	// Match on a specific ICMP code.  If specified, the Type value must also be specified.
	// This is a technical limitation imposed by the kernel's iptables firewall, which
	// Calico uses to enforce the rule.
	Code *int `json:"code,omitempty"`
}

// ICMPFieldsApplyConfiguration constructs a declarative configuration of the ICMPFields type for use with
// apply.
func ICMPFields() *ICMPFieldsApplyConfiguration {
	return &ICMPFieldsApplyConfiguration{}
}

// WithType sets the Type field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Type field is set to the value of the last call.
func (b *ICMPFieldsApplyConfiguration) WithType(value int) *ICMPFieldsApplyConfiguration {
	b.Type = &value
	return b
}

// WithCode sets the Code field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Code field is set to the value of the last call.
func (b *ICMPFieldsApplyConfiguration) WithCode(value int) *ICMPFieldsApplyConfiguration {
	b.Code = &value
	return b
}
