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

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

package v3

// ServiceAccountMatchApplyConfiguration represents a declarative configuration of the ServiceAccountMatch type for use
// with apply.
type ServiceAccountMatchApplyConfiguration struct {
	// Names is an optional field that restricts the rule to only apply to traffic that originates from (or terminates
	// at) a pod running as a service account whose name is in the list.
	Names []string `json:"names,omitempty"`
	// Selector is an optional field that restricts the rule to only apply to traffic that originates from
	// (or terminates at) a pod running as a service account that matches the given label selector.
	// If both Names and Selector are specified then they are AND'ed.
	Selector *string `json:"selector,omitempty"`
}

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

// WithNames adds the given value to the Names field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Names field.
func (b *ServiceAccountMatchApplyConfiguration) WithNames(values ...string) *ServiceAccountMatchApplyConfiguration {
	for i := range values {
		b.Names = append(b.Names, values[i])
	}
	return b
}

// WithSelector sets the Selector 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 Selector field is set to the value of the last call.
func (b *ServiceAccountMatchApplyConfiguration) WithSelector(value string) *ServiceAccountMatchApplyConfiguration {
	b.Selector = &value
	return b
}
