11
vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
generated
vendored
11
vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
generated
vendored
@ -26,7 +26,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/google/gofuzz"
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// IntOrString is a type that can hold an int32 or a string. When used in
|
||||
@ -45,7 +45,7 @@ type IntOrString struct {
|
||||
}
|
||||
|
||||
// Type represents the stored type of IntOrString.
|
||||
type Type int
|
||||
type Type int64
|
||||
|
||||
const (
|
||||
Int Type = iota // The IntOrString holds an int.
|
||||
@ -97,7 +97,8 @@ func (intstr *IntOrString) String() string {
|
||||
}
|
||||
|
||||
// IntValue returns the IntVal if type Int, or if
|
||||
// it is a String, will attempt a conversion to int.
|
||||
// it is a String, will attempt a conversion to int,
|
||||
// returning 0 if a parsing error occurs.
|
||||
func (intstr *IntOrString) IntValue() int {
|
||||
if intstr.Type == String {
|
||||
i, _ := strconv.Atoi(intstr.StrVal)
|
||||
@ -122,11 +123,11 @@ func (intstr IntOrString) MarshalJSON() ([]byte, error) {
|
||||
// the OpenAPI spec of this type.
|
||||
//
|
||||
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
|
||||
func (_ IntOrString) OpenAPISchemaType() []string { return []string{"string"} }
|
||||
func (IntOrString) OpenAPISchemaType() []string { return []string{"string"} }
|
||||
|
||||
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
|
||||
// the OpenAPI spec of this type.
|
||||
func (_ IntOrString) OpenAPISchemaFormat() string { return "int-or-string" }
|
||||
func (IntOrString) OpenAPISchemaFormat() string { return "int-or-string" }
|
||||
|
||||
func (intstr *IntOrString) Fuzz(c fuzz.Continue) {
|
||||
if intstr == nil {
|
||||
|
Reference in New Issue
Block a user