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

package v1

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

// ClientCredentialConfigApplyConfiguration represents a declarative configuration of the ClientCredentialConfig type for use
// with apply.
//
// ClientCredentialConfig configures the client credentials and token endpoint
// to use to get an access token via the OAuth2 client credentials grant flow.
type ClientCredentialConfigApplyConfiguration struct {
	// clientID is a required client identifier to use during the OAuth2 client credentials flow.
	// clientID must be at least 1 character in length, must not exceed 256 characters in length,
	// and must only contain printable ASCII characters.
	ClientID *string `json:"clientID,omitempty"`
	// clientSecret is a required reference to a Secret in the openshift-config namespace to be used
	// as the client secret during the OAuth2 client credentials flow.
	//
	// The key 'client-secret' is used to locate the client secret data in the Secret.
	ClientSecret *ClientSecretSecretReferenceApplyConfiguration `json:"clientSecret,omitempty"`
	// tokenEndpoint is a required URL to query for an access token using
	// the client credential OAuth2 flow.
	// tokenEndpoint must be at least 1 character in length and must not exceed 2048 characters in length.
	// tokenEndpoint must be a valid HTTPS URL.
	// tokenEndpoint must have a host and a path.
	// tokenEndpoint must not contain query parameters, fragments,
	// or user information (e.g., "user:password@host").
	TokenEndpoint *string `json:"tokenEndpoint,omitempty"`
	// scopes is an optional list of OAuth2 scopes to request when obtaining
	// an access token.
	//
	// If not specified, the token endpoint's default scopes
	// will be used.
	//
	// When specified, there must be at least 1 entry and must not exceed 16 entries.
	// Each entry must be at least 1 character in length and must not exceed 256 characters in length.
	// Each entry must only contain printable ASCII characters, excluding spaces, double quotes and backslashes.
	// Entries must be unique.
	Scopes []configv1.OAuth2Scope `json:"scopes,omitempty"`
	// tls is an optional field that allows configuring the TLS
	// settings used to interact with the identity provider
	// as an OAuth2 client.
	//
	// When omitted, system default TLS settings will be used
	// for the OAuth2 client.
	TLS *ExternalSourceTLSApplyConfiguration `json:"tls,omitempty"`
}

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

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

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

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

// WithScopes adds the given value to the Scopes 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 Scopes field.
func (b *ClientCredentialConfigApplyConfiguration) WithScopes(values ...configv1.OAuth2Scope) *ClientCredentialConfigApplyConfiguration {
	for i := range values {
		b.Scopes = append(b.Scopes, values[i])
	}
	return b
}

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