/*
Copyright The Volcano Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.

package v1alpha1

import (
	datadependencyv1alpha1 "volcano.sh/apis/pkg/apis/datadependency/v1alpha1"
)

// DataSourceSpecApplyConfiguration represents a declarative configuration of the DataSourceSpec type for use
// with apply.
//
// DataSourceSpec defines the desired state of DataSource.
type DataSourceSpecApplyConfiguration struct {
	// System specifies the underlying data system.
	// This provides context for the 'name' and 'attributes' fields.
	// e.g., "hive", "s3", "hdfs".
	System *string `json:"system,omitempty"`
	// Type specifies the category of the data source within the system.
	// e.g., for system="hive", type could be "table", "view".
	// e.g., for system="s3", type could be "bucket", "object", "prefix".
	Type *string `json:"type,omitempty"`
	// Name is the identifier of the data source, its format is interpreted
	// in the context of the 'system' and 'type'.
	Name *string `json:"name,omitempty"`
	// Locality defines which clusters this data source is available on.
	Locality *DataSourceLocalityApplyConfiguration `json:"locality,omitempty"`
	// Attributes provides extra, non-identifying metadata.
	Attributes map[string]string `json:"attributes,omitempty"`
	// ReclaimPolicy defines what happens to this DataSource when its last bound DataSourceClaim is deleted.
	// Defaults to "Retain".
	ReclaimPolicy *datadependencyv1alpha1.DataSourceReclaimPolicy `json:"reclaimPolicy,omitempty"`
}

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

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

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

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

// WithLocality sets the Locality 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 Locality field is set to the value of the last call.
func (b *DataSourceSpecApplyConfiguration) WithLocality(value *DataSourceLocalityApplyConfiguration) *DataSourceSpecApplyConfiguration {
	b.Locality = value
	return b
}

// WithAttributes puts the entries into the Attributes field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Attributes field,
// overwriting an existing map entries in Attributes field with the same key.
func (b *DataSourceSpecApplyConfiguration) WithAttributes(entries map[string]string) *DataSourceSpecApplyConfiguration {
	if b.Attributes == nil && len(entries) > 0 {
		b.Attributes = make(map[string]string, len(entries))
	}
	for k, v := range entries {
		b.Attributes[k] = v
	}
	return b
}

// WithReclaimPolicy sets the ReclaimPolicy 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 ReclaimPolicy field is set to the value of the last call.
func (b *DataSourceSpecApplyConfiguration) WithReclaimPolicy(value datadependencyv1alpha1.DataSourceReclaimPolicy) *DataSourceSpecApplyConfiguration {
	b.ReclaimPolicy = &value
	return b
}
