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

package v1

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

// RepositoryDigestMirrorsApplyConfiguration represents a declarative configuration of the RepositoryDigestMirrors type for use
// with apply.
//
// RepositoryDigestMirrors holds cluster-wide information about how to handle mirrors in the registries config.
type RepositoryDigestMirrorsApplyConfiguration struct {
	// source is the repository that users refer to, e.g. in image pull specifications.
	Source *string `json:"source,omitempty"`
	// allowMirrorByTags if true, the mirrors can be used to pull the images that are referenced by their tags. Default is false, the mirrors only work when pulling the images that are referenced by their digests.
	// Pulling images by tag can potentially yield different images, depending on which endpoint
	// we pull from. Forcing digest-pulls for mirrors avoids that issue.
	AllowMirrorByTags *bool `json:"allowMirrorByTags,omitempty"`
	// mirrors is zero or more repositories that may also contain the same images.
	// If the "mirrors" is not specified, the image will continue to be pulled from the specified
	// repository in the pull spec. No mirror will be configured.
	// The order of mirrors in this list is treated as the user's desired priority, while source
	// is by default considered lower priority than all mirrors. Other cluster configuration,
	// including (but not limited to) other repositoryDigestMirrors objects,
	// may impact the exact order mirrors are contacted in, or some mirrors may be contacted
	// in parallel, so this should be considered a preference rather than a guarantee of ordering.
	Mirrors []configv1.Mirror `json:"mirrors,omitempty"`
}

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

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

// WithAllowMirrorByTags sets the AllowMirrorByTags 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 AllowMirrorByTags field is set to the value of the last call.
func (b *RepositoryDigestMirrorsApplyConfiguration) WithAllowMirrorByTags(value bool) *RepositoryDigestMirrorsApplyConfiguration {
	b.AllowMirrorByTags = &value
	return b
}

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