apimachinery: k8s.io/apimachinery/pkg/util/intstr Index | Files

package intstr

import "k8s.io/apimachinery/pkg/util/intstr"


Package Files

generated.pb.go intstr.go


var (
    ErrInvalidLengthGenerated        = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowGenerated          = fmt.Errorf("proto: integer overflow")
    ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group")

func GetValueFromIntOrPercent Uses

func GetValueFromIntOrPercent(intOrPercent *IntOrString, total int, roundUp bool) (int, error)

type IntOrString Uses

type IntOrString struct {
    Type   Type   `protobuf:"varint,1,opt,name=type,casttype=Type"`
    IntVal int32  `protobuf:"varint,2,opt,name=intVal"`
    StrVal string `protobuf:"bytes,3,opt,name=strVal"`

IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. TODO: Rename to Int32OrString

+protobuf=true +protobuf.options.(gogoproto.goproto_stringer)=false +k8s:openapi-gen=true

func FromInt Uses

func FromInt(val int) IntOrString

FromInt creates an IntOrString object with an int32 value. It is your responsibility not to call this method with a value greater than int32. TODO: convert to (val int32)

func FromString Uses

func FromString(val string) IntOrString

FromString creates an IntOrString object with a string value.

func Parse Uses

func Parse(val string) IntOrString

Parse the given string and try to convert it to an integer before setting it as a string value.

func ValueOrDefault Uses

func ValueOrDefault(intOrPercent *IntOrString, defaultValue IntOrString) *IntOrString

func (*IntOrString) Descriptor Uses

func (*IntOrString) Descriptor() ([]byte, []int)

func (*IntOrString) Fuzz Uses

func (intstr *IntOrString) Fuzz(c fuzz.Continue)

func (*IntOrString) IntValue Uses

func (intstr *IntOrString) IntValue() int

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 (*IntOrString) Marshal Uses

func (m *IntOrString) Marshal() (dAtA []byte, err error)

func (IntOrString) MarshalJSON Uses

func (intstr IntOrString) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface.

func (*IntOrString) MarshalTo Uses

func (m *IntOrString) MarshalTo(dAtA []byte) (int, error)

func (*IntOrString) MarshalToSizedBuffer Uses

func (m *IntOrString) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (IntOrString) OpenAPISchemaFormat Uses

func (IntOrString) OpenAPISchemaFormat() string

OpenAPISchemaFormat is used by the kube-openapi generator when constructing the OpenAPI spec of this type.

func (IntOrString) OpenAPISchemaType Uses

func (IntOrString) OpenAPISchemaType() []string

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) ProtoMessage Uses

func (*IntOrString) ProtoMessage()

func (*IntOrString) Reset Uses

func (m *IntOrString) Reset()

func (*IntOrString) Size Uses

func (m *IntOrString) Size() (n int)

func (*IntOrString) String Uses

func (intstr *IntOrString) String() string

String returns the string value, or the Itoa of the int value.

func (*IntOrString) Unmarshal Uses

func (m *IntOrString) Unmarshal(dAtA []byte) error

func (*IntOrString) UnmarshalJSON Uses

func (intstr *IntOrString) UnmarshalJSON(value []byte) error

UnmarshalJSON implements the json.Unmarshaller interface.

func (*IntOrString) XXX_DiscardUnknown Uses

func (m *IntOrString) XXX_DiscardUnknown()

func (*IntOrString) XXX_Marshal Uses

func (m *IntOrString) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IntOrString) XXX_Merge Uses

func (m *IntOrString) XXX_Merge(src proto.Message)

func (*IntOrString) XXX_Size Uses

func (m *IntOrString) XXX_Size() int

func (*IntOrString) XXX_Unmarshal Uses

func (m *IntOrString) XXX_Unmarshal(b []byte) error

type Type Uses

type Type int64

Type represents the stored type of IntOrString.

const (
    Int    Type = iota // The IntOrString holds an int.
    String             // The IntOrString holds a string.

Package intstr imports 12 packages (graph) and is imported by 2380 packages. Updated 2020-05-17. Refresh now. Tools for package owners.