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

package v1

import (
	configv1 "github.com/openshift/api/config/v1"
)

// AuditApplyConfiguration represents a declarative configuration of the Audit type for use
// with apply.
type AuditApplyConfiguration struct {
	// profile specifies the name of the desired top-level audit profile to be applied to all requests
	// sent to any of the OpenShift-provided API servers in the cluster (kube-apiserver,
	// openshift-apiserver and oauth-apiserver), with the exception of those requests that match
	// one or more of the customRules.
	//
	// The following profiles are provided:
	// - Default: default policy which means MetaData level logging with the exception of events
	// (not logged at all), oauthaccesstokens and oauthauthorizetokens (both logged at RequestBody
	// level).
	// - WriteRequestBodies: like 'Default', but logs request and response HTTP payloads for
	// write requests (create, update, patch).
	// - AllRequestBodies: like 'WriteRequestBodies', but also logs request and response
	// HTTP payloads for read requests (get, list).
	// - None: no requests are logged at all, not even oauthaccesstokens and oauthauthorizetokens.
	//
	// Warning: It is not recommended to disable audit logging by using the `None` profile unless you
	// are fully aware of the risks of not logging data that can be beneficial when troubleshooting issues.
	// If you disable audit logging and a support situation arises, you might need to enable audit logging
	// and reproduce the issue in order to troubleshoot properly.
	//
	// If unset, the 'Default' profile is used as the default.
	Profile *configv1.AuditProfileType `json:"profile,omitempty"`
	// customRules specify profiles per group. These profile take precedence over the
	// top-level profile field if they apply. They are evaluation from top to bottom and
	// the first one that matches, applies.
	CustomRules []AuditCustomRuleApplyConfiguration `json:"customRules,omitempty"`
}

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

// WithProfile sets the Profile 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 Profile field is set to the value of the last call.
func (b *AuditApplyConfiguration) WithProfile(value configv1.AuditProfileType) *AuditApplyConfiguration {
	b.Profile = &value
	return b
}

// WithCustomRules adds the given value to the CustomRules 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 CustomRules field.
func (b *AuditApplyConfiguration) WithCustomRules(values ...*AuditCustomRuleApplyConfiguration) *AuditApplyConfiguration {
	for i := range values {
		if values[i] == nil {
			panic("nil value passed to WithCustomRules")
		}
		b.CustomRules = append(b.CustomRules, *values[i])
	}
	return b
}
