type IntOrString … type Type … const Int … const String … // FromInt creates an IntOrString object with an int32 value. It is // your responsibility not to call this method with a value greater // than int32. // Deprecated: use FromInt32 instead. func FromInt(val int) IntOrString { … } // FromInt32 creates an IntOrString object with an int32 value. func FromInt32(val int32) IntOrString { … } // FromString creates an IntOrString object with a string value. func FromString(val string) IntOrString { … } // Parse the given string and try to convert it to an int32 integer before // setting it as a string value. func Parse(val string) IntOrString { … } // UnmarshalJSON implements the json.Unmarshaller interface. func (intstr *IntOrString) UnmarshalJSON(value []byte) error { … } func (intstr *IntOrString) UnmarshalCBOR(value []byte) error { … } // String returns the string value, or the Itoa of the int value. func (intstr *IntOrString) String() string { … } // IntValue returns the IntVal if type Int, or if // it is a String, will attempt a conversion to int, // returning 0 if a parsing error occurs. func (intstr *IntOrString) IntValue() int { … } // MarshalJSON implements the json.Marshaller interface. func (intstr IntOrString) MarshalJSON() ([]byte, error) { … } func (intstr IntOrString) MarshalCBOR() ([]byte, error) { … } // OpenAPISchemaType is used by the kube-openapi generator when constructing // the OpenAPI spec of this type. // // See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators func (IntOrString) OpenAPISchemaType() []string { … } // OpenAPISchemaFormat is used by the kube-openapi generator when constructing // the OpenAPI spec of this type. func (IntOrString) OpenAPISchemaFormat() string { … } // OpenAPIV3OneOfTypes is used by the kube-openapi generator when constructing // the OpenAPI v3 spec of this type. func (IntOrString) OpenAPIV3OneOfTypes() []string { … } func ValueOrDefault(intOrPercent *IntOrString, defaultValue IntOrString) *IntOrString { … } // GetScaledValueFromIntOrPercent is meant to replace GetValueFromIntOrPercent. // This method returns a scaled value from an IntOrString type. If the IntOrString // is a percentage string value it's treated as a percentage and scaled appropriately // in accordance to the total, if it's an int value it's treated as a simple value and // if it is a string value which is either non-numeric or numeric but lacking a trailing '%' it returns an error. func GetScaledValueFromIntOrPercent(intOrPercent *IntOrString, total int, roundUp bool) (int, error) { … } // GetValueFromIntOrPercent was deprecated in favor of // GetScaledValueFromIntOrPercent. This method was treating all int as a numeric value and all // strings with or without a percent symbol as a percentage value. // Deprecated func GetValueFromIntOrPercent(intOrPercent *IntOrString, total int, roundUp bool) (int, error) { … } // getIntOrPercentValue is a legacy function and only meant to be called by GetValueFromIntOrPercent // For a more correct implementation call getIntOrPercentSafely func getIntOrPercentValue(intOrStr *IntOrString) (int, bool, error) { … } func getIntOrPercentValueSafely(intOrStr *IntOrString) (int, bool, error) { … }