...

Source file src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/deepcopy.go

Documentation: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1

     1  /*
     2  Copyright 2017 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  package v1beta1
    18  
    19  // TODO: Update this after a tag is created for interface fields in DeepCopy
    20  func (in *JSONSchemaProps) DeepCopy() *JSONSchemaProps {
    21  	if in == nil {
    22  		return nil
    23  	}
    24  	out := new(JSONSchemaProps)
    25  	*out = *in
    26  
    27  	if in.Ref != nil {
    28  		in, out := &in.Ref, &out.Ref
    29  		if *in == nil {
    30  			*out = nil
    31  		} else {
    32  			*out = new(string)
    33  			**out = **in
    34  		}
    35  	}
    36  
    37  	if in.Maximum != nil {
    38  		in, out := &in.Maximum, &out.Maximum
    39  		if *in == nil {
    40  			*out = nil
    41  		} else {
    42  			*out = new(float64)
    43  			**out = **in
    44  		}
    45  	}
    46  
    47  	if in.Minimum != nil {
    48  		in, out := &in.Minimum, &out.Minimum
    49  		if *in == nil {
    50  			*out = nil
    51  		} else {
    52  			*out = new(float64)
    53  			**out = **in
    54  		}
    55  	}
    56  
    57  	if in.MaxLength != nil {
    58  		in, out := &in.MaxLength, &out.MaxLength
    59  		if *in == nil {
    60  			*out = nil
    61  		} else {
    62  			*out = new(int64)
    63  			**out = **in
    64  		}
    65  	}
    66  
    67  	if in.MinLength != nil {
    68  		in, out := &in.MinLength, &out.MinLength
    69  		if *in == nil {
    70  			*out = nil
    71  		} else {
    72  			*out = new(int64)
    73  			**out = **in
    74  		}
    75  	}
    76  	if in.MaxItems != nil {
    77  		in, out := &in.MaxItems, &out.MaxItems
    78  		if *in == nil {
    79  			*out = nil
    80  		} else {
    81  			*out = new(int64)
    82  			**out = **in
    83  		}
    84  	}
    85  
    86  	if in.MinItems != nil {
    87  		in, out := &in.MinItems, &out.MinItems
    88  		if *in == nil {
    89  			*out = nil
    90  		} else {
    91  			*out = new(int64)
    92  			**out = **in
    93  		}
    94  	}
    95  
    96  	if in.MultipleOf != nil {
    97  		in, out := &in.MultipleOf, &out.MultipleOf
    98  		if *in == nil {
    99  			*out = nil
   100  		} else {
   101  			*out = new(float64)
   102  			**out = **in
   103  		}
   104  	}
   105  
   106  	if in.MaxProperties != nil {
   107  		in, out := &in.MaxProperties, &out.MaxProperties
   108  		if *in == nil {
   109  			*out = nil
   110  		} else {
   111  			*out = new(int64)
   112  			**out = **in
   113  		}
   114  	}
   115  
   116  	if in.MinProperties != nil {
   117  		in, out := &in.MinProperties, &out.MinProperties
   118  		if *in == nil {
   119  			*out = nil
   120  		} else {
   121  			*out = new(int64)
   122  			**out = **in
   123  		}
   124  	}
   125  
   126  	if in.Required != nil {
   127  		in, out := &in.Required, &out.Required
   128  		*out = make([]string, len(*in))
   129  		copy(*out, *in)
   130  	}
   131  
   132  	if in.Items != nil {
   133  		in, out := &in.Items, &out.Items
   134  		if *in == nil {
   135  			*out = nil
   136  		} else {
   137  			*out = new(JSONSchemaPropsOrArray)
   138  			(*in).DeepCopyInto(*out)
   139  		}
   140  	}
   141  
   142  	if in.AllOf != nil {
   143  		in, out := &in.AllOf, &out.AllOf
   144  		*out = make([]JSONSchemaProps, len(*in))
   145  		for i := range *in {
   146  			(*in)[i].DeepCopyInto(&(*out)[i])
   147  		}
   148  	}
   149  
   150  	if in.OneOf != nil {
   151  		in, out := &in.OneOf, &out.OneOf
   152  		*out = make([]JSONSchemaProps, len(*in))
   153  		for i := range *in {
   154  			(*in)[i].DeepCopyInto(&(*out)[i])
   155  		}
   156  	}
   157  	if in.AnyOf != nil {
   158  		in, out := &in.AnyOf, &out.AnyOf
   159  		*out = make([]JSONSchemaProps, len(*in))
   160  		for i := range *in {
   161  			(*in)[i].DeepCopyInto(&(*out)[i])
   162  		}
   163  	}
   164  
   165  	if in.Not != nil {
   166  		in, out := &in.Not, &out.Not
   167  		if *in == nil {
   168  			*out = nil
   169  		} else {
   170  			*out = new(JSONSchemaProps)
   171  			(*in).DeepCopyInto(*out)
   172  		}
   173  	}
   174  
   175  	if in.Properties != nil {
   176  		in, out := &in.Properties, &out.Properties
   177  		*out = make(map[string]JSONSchemaProps, len(*in))
   178  		for key, val := range *in {
   179  			(*out)[key] = *val.DeepCopy()
   180  		}
   181  	}
   182  
   183  	if in.AdditionalProperties != nil {
   184  		in, out := &in.AdditionalProperties, &out.AdditionalProperties
   185  		if *in == nil {
   186  			*out = nil
   187  		} else {
   188  			*out = new(JSONSchemaPropsOrBool)
   189  			(*in).DeepCopyInto(*out)
   190  		}
   191  	}
   192  
   193  	if in.PatternProperties != nil {
   194  		in, out := &in.PatternProperties, &out.PatternProperties
   195  		*out = make(map[string]JSONSchemaProps, len(*in))
   196  		for key, val := range *in {
   197  			(*out)[key] = *val.DeepCopy()
   198  		}
   199  	}
   200  
   201  	if in.Dependencies != nil {
   202  		in, out := &in.Dependencies, &out.Dependencies
   203  		*out = make(JSONSchemaDependencies, len(*in))
   204  		for key, val := range *in {
   205  			(*out)[key] = *val.DeepCopy()
   206  		}
   207  	}
   208  
   209  	if in.AdditionalItems != nil {
   210  		in, out := &in.AdditionalItems, &out.AdditionalItems
   211  		if *in == nil {
   212  			*out = nil
   213  		} else {
   214  			*out = new(JSONSchemaPropsOrBool)
   215  			(*in).DeepCopyInto(*out)
   216  		}
   217  	}
   218  
   219  	if in.Definitions != nil {
   220  		in, out := &in.Definitions, &out.Definitions
   221  		*out = make(JSONSchemaDefinitions, len(*in))
   222  		for key, val := range *in {
   223  			(*out)[key] = *val.DeepCopy()
   224  		}
   225  	}
   226  
   227  	if in.ExternalDocs != nil {
   228  		in, out := &in.ExternalDocs, &out.ExternalDocs
   229  		if *in == nil {
   230  			*out = nil
   231  		} else {
   232  			*out = new(ExternalDocumentation)
   233  			(*in).DeepCopyInto(*out)
   234  		}
   235  	}
   236  
   237  	if in.XPreserveUnknownFields != nil {
   238  		in, out := &in.XPreserveUnknownFields, &out.XPreserveUnknownFields
   239  		if *in == nil {
   240  			*out = nil
   241  		} else {
   242  			*out = new(bool)
   243  			**out = **in
   244  		}
   245  	}
   246  
   247  	if in.XListMapKeys != nil {
   248  		in, out := &in.XListMapKeys, &out.XListMapKeys
   249  		*out = make([]string, len(*in))
   250  		copy(*out, *in)
   251  	}
   252  
   253  	if in.XListType != nil {
   254  		in, out := &in.XListType, &out.XListType
   255  		if *in == nil {
   256  			*out = nil
   257  		} else {
   258  			*out = new(string)
   259  			**out = **in
   260  		}
   261  	}
   262  
   263  	if in.XMapType != nil {
   264  		in, out := &in.XMapType, &out.XMapType
   265  		*out = new(string)
   266  		**out = **in
   267  	}
   268  
   269  	if in.XValidations != nil {
   270  		inValidations, outValidations := &in.XValidations, &out.XValidations
   271  		*outValidations = make([]ValidationRule, len(*inValidations))
   272  		for i := range *inValidations {
   273  			in.XValidations[i].DeepCopyInto(&out.XValidations[i])
   274  		}
   275  	}
   276  
   277  	return out
   278  }
   279  

View as plain text