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

package v1

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

// ExternalSourceAuthenticationApplyConfiguration represents a declarative configuration of the ExternalSourceAuthentication type for use
// with apply.
//
// ExternalSourceAuthentication configures how the apiserver should attempt
// to authenticate with an external claims source.
type ExternalSourceAuthenticationApplyConfiguration struct {
	// type is a required field that sets the type of
	// authentication method used by the authenticator
	// when fetching external claims.
	//
	// Allowed values are 'RequestProvidedToken' and 'ClientCredential'.
	//
	// When set to 'RequestProvidedToken', the authenticator will
	// use the token provided to the kube-apiserver as part of the
	// request to authenticate with the external claims source.
	//
	// When set to 'ClientCredential', the authenticator will
	// use the configured client-id, client-secret, and token endpoint
	// to fetch an access token using the OAuth2 client credentials grant
	// flow. The fetched access token will then be used to authenticate
	// with the external claims source.
	Type *configv1.ExternalSourceAuthenticationType `json:"type,omitempty"`
	// clientCredential configures the client credentials
	// and token endpoint to use to get an access token.
	// clientCredential is required when type is 'ClientCredential', and forbidden otherwise.
	ClientCredential *ClientCredentialConfigApplyConfiguration `json:"clientCredential,omitempty"`
}

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

// 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 *ExternalSourceAuthenticationApplyConfiguration) WithType(value configv1.ExternalSourceAuthenticationType) *ExternalSourceAuthenticationApplyConfiguration {
	b.Type = &value
	return b
}

// WithClientCredential sets the ClientCredential 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 ClientCredential field is set to the value of the last call.
func (b *ExternalSourceAuthenticationApplyConfiguration) WithClientCredential(value *ClientCredentialConfigApplyConfiguration) *ExternalSourceAuthenticationApplyConfiguration {
	b.ClientCredential = value
	return b
}
