k8s.io/client-go@v0.22.2/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go (about)

     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 v1alpha1
    20  
    21  import (
    22  	flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
    23  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    24  	types "k8s.io/apimachinery/pkg/types"
    25  	managedfields "k8s.io/apimachinery/pkg/util/managedfields"
    26  	internal "k8s.io/client-go/applyconfigurations/internal"
    27  	v1 "k8s.io/client-go/applyconfigurations/meta/v1"
    28  )
    29  
    30  // PriorityLevelConfigurationApplyConfiguration represents an declarative configuration of the PriorityLevelConfiguration type for use
    31  // with apply.
    32  type PriorityLevelConfigurationApplyConfiguration struct {
    33  	v1.TypeMetaApplyConfiguration    `json:",inline"`
    34  	*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
    35  	Spec                             *PriorityLevelConfigurationSpecApplyConfiguration   `json:"spec,omitempty"`
    36  	Status                           *PriorityLevelConfigurationStatusApplyConfiguration `json:"status,omitempty"`
    37  }
    38  
    39  // PriorityLevelConfiguration constructs an declarative configuration of the PriorityLevelConfiguration type for use with
    40  // apply.
    41  func PriorityLevelConfiguration(name string) *PriorityLevelConfigurationApplyConfiguration {
    42  	b := &PriorityLevelConfigurationApplyConfiguration{}
    43  	b.WithName(name)
    44  	b.WithKind("PriorityLevelConfiguration")
    45  	b.WithAPIVersion("flowcontrol.apiserver.k8s.io/v1alpha1")
    46  	return b
    47  }
    48  
    49  // ExtractPriorityLevelConfiguration extracts the applied configuration owned by fieldManager from
    50  // priorityLevelConfiguration. If no managedFields are found in priorityLevelConfiguration for fieldManager, a
    51  // PriorityLevelConfigurationApplyConfiguration is returned with only the Name, Namespace (if applicable),
    52  // APIVersion and Kind populated. It is possible that no managed fields were found for because other
    53  // field managers have taken ownership of all the fields previously owned by fieldManager, or because
    54  // the fieldManager never owned fields any fields.
    55  // priorityLevelConfiguration must be a unmodified PriorityLevelConfiguration API object that was retrieved from the Kubernetes API.
    56  // ExtractPriorityLevelConfiguration provides a way to perform a extract/modify-in-place/apply workflow.
    57  // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
    58  // applied if another fieldManager has updated or force applied any of the previously applied fields.
    59  // Experimental!
    60  func ExtractPriorityLevelConfiguration(priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfiguration, fieldManager string) (*PriorityLevelConfigurationApplyConfiguration, error) {
    61  	return extractPriorityLevelConfiguration(priorityLevelConfiguration, fieldManager, "")
    62  }
    63  
    64  // ExtractPriorityLevelConfigurationStatus is the same as ExtractPriorityLevelConfiguration except
    65  // that it extracts the status subresource applied configuration.
    66  // Experimental!
    67  func ExtractPriorityLevelConfigurationStatus(priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfiguration, fieldManager string) (*PriorityLevelConfigurationApplyConfiguration, error) {
    68  	return extractPriorityLevelConfiguration(priorityLevelConfiguration, fieldManager, "status")
    69  }
    70  
    71  func extractPriorityLevelConfiguration(priorityLevelConfiguration *flowcontrolv1alpha1.PriorityLevelConfiguration, fieldManager string, subresource string) (*PriorityLevelConfigurationApplyConfiguration, error) {
    72  	b := &PriorityLevelConfigurationApplyConfiguration{}
    73  	err := managedfields.ExtractInto(priorityLevelConfiguration, internal.Parser().Type("io.k8s.api.flowcontrol.v1alpha1.PriorityLevelConfiguration"), fieldManager, b, subresource)
    74  	if err != nil {
    75  		return nil, err
    76  	}
    77  	b.WithName(priorityLevelConfiguration.Name)
    78  
    79  	b.WithKind("PriorityLevelConfiguration")
    80  	b.WithAPIVersion("flowcontrol.apiserver.k8s.io/v1alpha1")
    81  	return b, nil
    82  }
    83  
    84  // WithKind sets the Kind field in the declarative configuration to the given value
    85  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    86  // If called multiple times, the Kind field is set to the value of the last call.
    87  func (b *PriorityLevelConfigurationApplyConfiguration) WithKind(value string) *PriorityLevelConfigurationApplyConfiguration {
    88  	b.Kind = &value
    89  	return b
    90  }
    91  
    92  // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
    93  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    94  // If called multiple times, the APIVersion field is set to the value of the last call.
    95  func (b *PriorityLevelConfigurationApplyConfiguration) WithAPIVersion(value string) *PriorityLevelConfigurationApplyConfiguration {
    96  	b.APIVersion = &value
    97  	return b
    98  }
    99  
   100  // WithName sets the Name field in the declarative configuration to the given value
   101  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   102  // If called multiple times, the Name field is set to the value of the last call.
   103  func (b *PriorityLevelConfigurationApplyConfiguration) WithName(value string) *PriorityLevelConfigurationApplyConfiguration {
   104  	b.ensureObjectMetaApplyConfigurationExists()
   105  	b.Name = &value
   106  	return b
   107  }
   108  
   109  // WithGenerateName sets the GenerateName field in the declarative configuration to the given value
   110  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   111  // If called multiple times, the GenerateName field is set to the value of the last call.
   112  func (b *PriorityLevelConfigurationApplyConfiguration) WithGenerateName(value string) *PriorityLevelConfigurationApplyConfiguration {
   113  	b.ensureObjectMetaApplyConfigurationExists()
   114  	b.GenerateName = &value
   115  	return b
   116  }
   117  
   118  // WithNamespace sets the Namespace field in the declarative configuration to the given value
   119  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   120  // If called multiple times, the Namespace field is set to the value of the last call.
   121  func (b *PriorityLevelConfigurationApplyConfiguration) WithNamespace(value string) *PriorityLevelConfigurationApplyConfiguration {
   122  	b.ensureObjectMetaApplyConfigurationExists()
   123  	b.Namespace = &value
   124  	return b
   125  }
   126  
   127  // WithSelfLink sets the SelfLink field in the declarative configuration to the given value
   128  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   129  // If called multiple times, the SelfLink field is set to the value of the last call.
   130  func (b *PriorityLevelConfigurationApplyConfiguration) WithSelfLink(value string) *PriorityLevelConfigurationApplyConfiguration {
   131  	b.ensureObjectMetaApplyConfigurationExists()
   132  	b.SelfLink = &value
   133  	return b
   134  }
   135  
   136  // WithUID sets the UID field in the declarative configuration to the given value
   137  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   138  // If called multiple times, the UID field is set to the value of the last call.
   139  func (b *PriorityLevelConfigurationApplyConfiguration) WithUID(value types.UID) *PriorityLevelConfigurationApplyConfiguration {
   140  	b.ensureObjectMetaApplyConfigurationExists()
   141  	b.UID = &value
   142  	return b
   143  }
   144  
   145  // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
   146  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   147  // If called multiple times, the ResourceVersion field is set to the value of the last call.
   148  func (b *PriorityLevelConfigurationApplyConfiguration) WithResourceVersion(value string) *PriorityLevelConfigurationApplyConfiguration {
   149  	b.ensureObjectMetaApplyConfigurationExists()
   150  	b.ResourceVersion = &value
   151  	return b
   152  }
   153  
   154  // WithGeneration sets the Generation field in the declarative configuration to the given value
   155  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   156  // If called multiple times, the Generation field is set to the value of the last call.
   157  func (b *PriorityLevelConfigurationApplyConfiguration) WithGeneration(value int64) *PriorityLevelConfigurationApplyConfiguration {
   158  	b.ensureObjectMetaApplyConfigurationExists()
   159  	b.Generation = &value
   160  	return b
   161  }
   162  
   163  // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
   164  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   165  // If called multiple times, the CreationTimestamp field is set to the value of the last call.
   166  func (b *PriorityLevelConfigurationApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PriorityLevelConfigurationApplyConfiguration {
   167  	b.ensureObjectMetaApplyConfigurationExists()
   168  	b.CreationTimestamp = &value
   169  	return b
   170  }
   171  
   172  // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
   173  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   174  // If called multiple times, the DeletionTimestamp field is set to the value of the last call.
   175  func (b *PriorityLevelConfigurationApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PriorityLevelConfigurationApplyConfiguration {
   176  	b.ensureObjectMetaApplyConfigurationExists()
   177  	b.DeletionTimestamp = &value
   178  	return b
   179  }
   180  
   181  // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
   182  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   183  // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
   184  func (b *PriorityLevelConfigurationApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PriorityLevelConfigurationApplyConfiguration {
   185  	b.ensureObjectMetaApplyConfigurationExists()
   186  	b.DeletionGracePeriodSeconds = &value
   187  	return b
   188  }
   189  
   190  // WithLabels puts the entries into the Labels field in the declarative configuration
   191  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
   192  // If called multiple times, the entries provided by each call will be put on the Labels field,
   193  // overwriting an existing map entries in Labels field with the same key.
   194  func (b *PriorityLevelConfigurationApplyConfiguration) WithLabels(entries map[string]string) *PriorityLevelConfigurationApplyConfiguration {
   195  	b.ensureObjectMetaApplyConfigurationExists()
   196  	if b.Labels == nil && len(entries) > 0 {
   197  		b.Labels = make(map[string]string, len(entries))
   198  	}
   199  	for k, v := range entries {
   200  		b.Labels[k] = v
   201  	}
   202  	return b
   203  }
   204  
   205  // WithAnnotations puts the entries into the Annotations field in the declarative configuration
   206  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
   207  // If called multiple times, the entries provided by each call will be put on the Annotations field,
   208  // overwriting an existing map entries in Annotations field with the same key.
   209  func (b *PriorityLevelConfigurationApplyConfiguration) WithAnnotations(entries map[string]string) *PriorityLevelConfigurationApplyConfiguration {
   210  	b.ensureObjectMetaApplyConfigurationExists()
   211  	if b.Annotations == nil && len(entries) > 0 {
   212  		b.Annotations = make(map[string]string, len(entries))
   213  	}
   214  	for k, v := range entries {
   215  		b.Annotations[k] = v
   216  	}
   217  	return b
   218  }
   219  
   220  // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
   221  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
   222  // If called multiple times, values provided by each call will be appended to the OwnerReferences field.
   223  func (b *PriorityLevelConfigurationApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PriorityLevelConfigurationApplyConfiguration {
   224  	b.ensureObjectMetaApplyConfigurationExists()
   225  	for i := range values {
   226  		if values[i] == nil {
   227  			panic("nil value passed to WithOwnerReferences")
   228  		}
   229  		b.OwnerReferences = append(b.OwnerReferences, *values[i])
   230  	}
   231  	return b
   232  }
   233  
   234  // WithFinalizers adds the given value to the Finalizers field in the declarative configuration
   235  // and returns the receiver, so that objects can be build by chaining "With" function invocations.
   236  // If called multiple times, values provided by each call will be appended to the Finalizers field.
   237  func (b *PriorityLevelConfigurationApplyConfiguration) WithFinalizers(values ...string) *PriorityLevelConfigurationApplyConfiguration {
   238  	b.ensureObjectMetaApplyConfigurationExists()
   239  	for i := range values {
   240  		b.Finalizers = append(b.Finalizers, values[i])
   241  	}
   242  	return b
   243  }
   244  
   245  // WithClusterName sets the ClusterName field in the declarative configuration to the given value
   246  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   247  // If called multiple times, the ClusterName field is set to the value of the last call.
   248  func (b *PriorityLevelConfigurationApplyConfiguration) WithClusterName(value string) *PriorityLevelConfigurationApplyConfiguration {
   249  	b.ensureObjectMetaApplyConfigurationExists()
   250  	b.ClusterName = &value
   251  	return b
   252  }
   253  
   254  func (b *PriorityLevelConfigurationApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
   255  	if b.ObjectMetaApplyConfiguration == nil {
   256  		b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
   257  	}
   258  }
   259  
   260  // WithSpec sets the Spec field in the declarative configuration to the given value
   261  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   262  // If called multiple times, the Spec field is set to the value of the last call.
   263  func (b *PriorityLevelConfigurationApplyConfiguration) WithSpec(value *PriorityLevelConfigurationSpecApplyConfiguration) *PriorityLevelConfigurationApplyConfiguration {
   264  	b.Spec = value
   265  	return b
   266  }
   267  
   268  // WithStatus sets the Status field in the declarative configuration to the given value
   269  // and returns the receiver, so that objects can be built by chaining "With" function invocations.
   270  // If called multiple times, the Status field is set to the value of the last call.
   271  func (b *PriorityLevelConfigurationApplyConfiguration) WithStatus(value *PriorityLevelConfigurationStatusApplyConfiguration) *PriorityLevelConfigurationApplyConfiguration {
   272  	b.Status = value
   273  	return b
   274  }