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

package v1alpha1

import (
	configv1alpha1 "github.com/openshift/api/config/v1alpha1"
	v1 "k8s.io/api/core/v1"
)

// RemoteWriteAuthorizationApplyConfiguration represents a declarative configuration of the RemoteWriteAuthorization type for use
// with apply.
//
// RemoteWriteAuthorization defines the authorization method for a remote write endpoint.
// Exactly one of the nested configs must be set according to the type discriminator.
type RemoteWriteAuthorizationApplyConfiguration struct {
	// type specifies the authorization method to use.
	// Allowed values are BearerToken, BasicAuth, OAuth2, SigV4, SafeAuthorization, ServiceAccount.
	//
	// When set to BearerToken, the bearer token is read from a Secret referenced by the bearerToken field.
	//
	// When set to BasicAuth, HTTP basic authentication is used; the basicAuth field (username and password from Secrets) must be set.
	//
	// When set to OAuth2, OAuth2 client credentials flow is used; the oauth2 field (clientId, clientSecret, tokenUrl) must be set.
	//
	// When set to SigV4, AWS Signature Version 4 is used for authentication; the sigv4 field must be set.
	//
	// When set to SafeAuthorization, credentials are read from a single Secret key (Prometheus SafeAuthorization pattern). The secret key typically contains a Bearer token. Use the safeAuthorization field.
	//
	// When set to ServiceAccount, the pod's service account token is used for machine identity. No additional field is required; the operator configures the token path.
	Type *configv1alpha1.RemoteWriteAuthorizationType `json:"type,omitempty"`
	// safeAuthorization defines the secret reference containing the credentials for authentication (e.g. Bearer token).
	// Required when type is "SafeAuthorization", and forbidden otherwise. Maps to Prometheus SafeAuthorization. The secret must exist in the openshift-monitoring namespace.
	SafeAuthorization *v1.SecretKeySelector `json:"safeAuthorization,omitempty"`
	// bearerToken defines the secret reference containing the bearer token.
	// Required when type is "BearerToken", and forbidden otherwise.
	BearerToken *SecretKeySelectorApplyConfiguration `json:"bearerToken,omitempty"`
	// basicAuth defines HTTP basic authentication credentials.
	// Required when type is "BasicAuth", and forbidden otherwise.
	BasicAuth *BasicAuthApplyConfiguration `json:"basicAuth,omitempty"`
	// oauth2 defines OAuth2 client credentials authentication.
	// Required when type is "OAuth2", and forbidden otherwise.
	OAuth2 *OAuth2ApplyConfiguration `json:"oauth2,omitempty"`
	// sigv4 defines AWS Signature Version 4 authentication.
	// Required when type is "SigV4", and forbidden otherwise.
	Sigv4 *Sigv4ApplyConfiguration `json:"sigv4,omitempty"`
}

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

// 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 *RemoteWriteAuthorizationApplyConfiguration) WithType(value configv1alpha1.RemoteWriteAuthorizationType) *RemoteWriteAuthorizationApplyConfiguration {
	b.Type = &value
	return b
}

// WithSafeAuthorization sets the SafeAuthorization 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 SafeAuthorization field is set to the value of the last call.
func (b *RemoteWriteAuthorizationApplyConfiguration) WithSafeAuthorization(value v1.SecretKeySelector) *RemoteWriteAuthorizationApplyConfiguration {
	b.SafeAuthorization = &value
	return b
}

// WithBearerToken sets the BearerToken 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 BearerToken field is set to the value of the last call.
func (b *RemoteWriteAuthorizationApplyConfiguration) WithBearerToken(value *SecretKeySelectorApplyConfiguration) *RemoteWriteAuthorizationApplyConfiguration {
	b.BearerToken = value
	return b
}

// WithBasicAuth sets the BasicAuth 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 BasicAuth field is set to the value of the last call.
func (b *RemoteWriteAuthorizationApplyConfiguration) WithBasicAuth(value *BasicAuthApplyConfiguration) *RemoteWriteAuthorizationApplyConfiguration {
	b.BasicAuth = value
	return b
}

// WithOAuth2 sets the OAuth2 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 OAuth2 field is set to the value of the last call.
func (b *RemoteWriteAuthorizationApplyConfiguration) WithOAuth2(value *OAuth2ApplyConfiguration) *RemoteWriteAuthorizationApplyConfiguration {
	b.OAuth2 = value
	return b
}

// WithSigv4 sets the Sigv4 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 Sigv4 field is set to the value of the last call.
func (b *RemoteWriteAuthorizationApplyConfiguration) WithSigv4(value *Sigv4ApplyConfiguration) *RemoteWriteAuthorizationApplyConfiguration {
	b.Sigv4 = value
	return b
}
