...

Source file src/k8s.io/client-go/applyconfigurations/core/v1/podtemplatespec.go

Documentation: k8s.io/client-go/applyconfigurations/core/v1

     1  /*
     2  Copyright The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  // Code generated by applyconfiguration-gen. DO NOT EDIT.
    18  
    19  package v1
    20  
    21  import (
    22  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    23  	types "k8s.io/apimachinery/pkg/types"
    24  	v1 "k8s.io/client-go/applyconfigurations/meta/v1"
    25  )
    26  
    27  // PodTemplateSpecApplyConfiguration represents an declarative configuration of the PodTemplateSpec type for use
    28  // with apply.
    29  type PodTemplateSpecApplyConfiguration struct {
    30  	*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
    31  	Spec                             *PodSpecApplyConfiguration `json:"spec,omitempty"`
    32  }
    33  
    34  // PodTemplateSpecApplyConfiguration constructs an declarative configuration of the PodTemplateSpec type for use with
    35  // apply.
    36  func PodTemplateSpec() *PodTemplateSpecApplyConfiguration {
    37  	return &PodTemplateSpecApplyConfiguration{}
    38  }
    39  
    40  // WithName sets the Name field in the declarative configuration to the given value
    41  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    42  // If called multiple times, the Name field is set to the value of the last call.
    43  func (b *PodTemplateSpecApplyConfiguration) WithName(value string) *PodTemplateSpecApplyConfiguration {
    44  	b.ensureObjectMetaApplyConfigurationExists()
    45  	b.Name = &value
    46  	return b
    47  }
    48  
    49  // WithGenerateName sets the GenerateName field in the declarative configuration to the given value
    50  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    51  // If called multiple times, the GenerateName field is set to the value of the last call.
    52  func (b *PodTemplateSpecApplyConfiguration) WithGenerateName(value string) *PodTemplateSpecApplyConfiguration {
    53  	b.ensureObjectMetaApplyConfigurationExists()
    54  	b.GenerateName = &value
    55  	return b
    56  }
    57  
    58  // WithNamespace sets the Namespace field in the declarative configuration to the given value
    59  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    60  // If called multiple times, the Namespace field is set to the value of the last call.
    61  func (b *PodTemplateSpecApplyConfiguration) WithNamespace(value string) *PodTemplateSpecApplyConfiguration {
    62  	b.ensureObjectMetaApplyConfigurationExists()
    63  	b.Namespace = &value
    64  	return b
    65  }
    66  
    67  // WithUID sets the UID field in the declarative configuration to the given value
    68  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    69  // If called multiple times, the UID field is set to the value of the last call.
    70  func (b *PodTemplateSpecApplyConfiguration) WithUID(value types.UID) *PodTemplateSpecApplyConfiguration {
    71  	b.ensureObjectMetaApplyConfigurationExists()
    72  	b.UID = &value
    73  	return b
    74  }
    75  
    76  // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
    77  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    78  // If called multiple times, the ResourceVersion field is set to the value of the last call.
    79  func (b *PodTemplateSpecApplyConfiguration) WithResourceVersion(value string) *PodTemplateSpecApplyConfiguration {
    80  	b.ensureObjectMetaApplyConfigurationExists()
    81  	b.ResourceVersion = &value
    82  	return b
    83  }
    84  
    85  // WithGeneration sets the Generation field in the declarative configuration to the given value
    86  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    87  // If called multiple times, the Generation field is set to the value of the last call.
    88  func (b *PodTemplateSpecApplyConfiguration) WithGeneration(value int64) *PodTemplateSpecApplyConfiguration {
    89  	b.ensureObjectMetaApplyConfigurationExists()
    90  	b.Generation = &value
    91  	return b
    92  }
    93  
    94  // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
    95  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    96  // If called multiple times, the CreationTimestamp field is set to the value of the last call.
    97  func (b *PodTemplateSpecApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PodTemplateSpecApplyConfiguration {
    98  	b.ensureObjectMetaApplyConfigurationExists()
    99  	b.CreationTimestamp = &value
   100  	return b
   101  }
   102  
   103  // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
   104  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   105  // If called multiple times, the DeletionTimestamp field is set to the value of the last call.
   106  func (b *PodTemplateSpecApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PodTemplateSpecApplyConfiguration {
   107  	b.ensureObjectMetaApplyConfigurationExists()
   108  	b.DeletionTimestamp = &value
   109  	return b
   110  }
   111  
   112  // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
   113  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   114  // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
   115  func (b *PodTemplateSpecApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PodTemplateSpecApplyConfiguration {
   116  	b.ensureObjectMetaApplyConfigurationExists()
   117  	b.DeletionGracePeriodSeconds = &value
   118  	return b
   119  }
   120  
   121  // WithLabels puts the entries into the Labels field in the declarative configuration
   122  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
   123  // If called multiple times, the entries provided by each call will be put on the Labels field,
   124  // overwriting an existing map entries in Labels field with the same key.
   125  func (b *PodTemplateSpecApplyConfiguration) WithLabels(entries map[string]string) *PodTemplateSpecApplyConfiguration {
   126  	b.ensureObjectMetaApplyConfigurationExists()
   127  	if b.Labels == nil && len(entries) > 0 {
   128  		b.Labels = make(map[string]string, len(entries))
   129  	}
   130  	for k, v := range entries {
   131  		b.Labels[k] = v
   132  	}
   133  	return b
   134  }
   135  
   136  // WithAnnotations puts the entries into the Annotations field in the declarative configuration
   137  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
   138  // If called multiple times, the entries provided by each call will be put on the Annotations field,
   139  // overwriting an existing map entries in Annotations field with the same key.
   140  func (b *PodTemplateSpecApplyConfiguration) WithAnnotations(entries map[string]string) *PodTemplateSpecApplyConfiguration {
   141  	b.ensureObjectMetaApplyConfigurationExists()
   142  	if b.Annotations == nil && len(entries) > 0 {
   143  		b.Annotations = make(map[string]string, len(entries))
   144  	}
   145  	for k, v := range entries {
   146  		b.Annotations[k] = v
   147  	}
   148  	return b
   149  }
   150  
   151  // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
   152  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
   153  // If called multiple times, values provided by each call will be appended to the OwnerReferences field.
   154  func (b *PodTemplateSpecApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PodTemplateSpecApplyConfiguration {
   155  	b.ensureObjectMetaApplyConfigurationExists()
   156  	for i := range values {
   157  		if values[i] == nil {
   158  			panic("nil value passed to WithOwnerReferences")
   159  		}
   160  		b.OwnerReferences = append(b.OwnerReferences, *values[i])
   161  	}
   162  	return b
   163  }
   164  
   165  // WithFinalizers adds the given value to the Finalizers field in the declarative configuration
   166  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
   167  // If called multiple times, values provided by each call will be appended to the Finalizers field.
   168  func (b *PodTemplateSpecApplyConfiguration) WithFinalizers(values ...string) *PodTemplateSpecApplyConfiguration {
   169  	b.ensureObjectMetaApplyConfigurationExists()
   170  	for i := range values {
   171  		b.Finalizers = append(b.Finalizers, values[i])
   172  	}
   173  	return b
   174  }
   175  
   176  func (b *PodTemplateSpecApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
   177  	if b.ObjectMetaApplyConfiguration == nil {
   178  		b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
   179  	}
   180  }
   181  
   182  // WithSpec sets the Spec field in the declarative configuration to the given value
   183  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   184  // If called multiple times, the Spec field is set to the value of the last call.
   185  func (b *PodTemplateSpecApplyConfiguration) WithSpec(value *PodSpecApplyConfiguration) *PodTemplateSpecApplyConfiguration {
   186  	b.Spec = value
   187  	return b
   188  }
   189  

View as plain text