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

package v1

// SourceURLApplyConfiguration represents a declarative configuration of the SourceURL type for use
// with apply.
//
// SourceURL configures the options used to build the URL that is queried for external claims.
type SourceURLApplyConfiguration struct {
	// hostname is a required hostname for which the external claims are located.
	//
	// It must be a valid DNS subdomain name as per RFC1123.
	//
	// This means that it must start and end with a lowercase alphanumeric character,
	// must only consist of lowercase alphanumeric characters, '-', and '.'.
	// hostname may optionally specify a port in the format ':{port}'.
	// If a port is specified it must not exceed 65535.
	//
	// hostname must be at least 1 character in length.
	// When specifying a port, hostname must not exceed 259 characters in length.
	// When not specifying a port, hostname must not exceed 253 characters in length.
	Hostname *string `json:"hostname,omitempty"`
	// pathExpression is a required CEL expression that returns a list
	// of string values used to construct the URL path.
	// Claims from the token used for the request to the kube-apiserver
	// are made available via the `claims` variable.
	// expression must be at least 1 character in length and must not exceed 1024 characters in length.
	//
	// Values in the returned list will be joined with the hostname using a forward slash
	// (`/`) as a separator. Values in the returned list do not need to include the forward slash.
	// If a forward slash is included in a returned value, it will be encoded as `%2F`.
	//
	// Example of a static path configuration:
	//
	// pathExpression: ['realms', 'k8s', 'protocol', 'openid-connect', 'userinfo']
	//
	// The above example would resolve to the path: '/realms/k8s/protocol/openid-connect/userinfo'
	//
	// Example of a dynamic path configuration:
	//
	// pathExpression: "['admin', 'realms', 'k8s', 'users'] + [claims.sub] + ['groups']"
	//
	// Assuming 'claims.sub' is set to '12345', the above example would resolve to the path: '/admin/realms/k8s/users/12345/groups'
	PathExpression *string `json:"pathExpression,omitempty"`
}

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

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

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