Documentation
¶
Index ¶
- type BoolOrString
- func (boolstr *BoolOrString) Boolean() (bool, error)
- func (boolstr *BoolOrString) Fuzz(c fuzz.Continue)
- func (boolstr *BoolOrString) IsEmpty() bool
- func (boolstr BoolOrString) MarshalJSON() ([]byte, error)
- func (boolstr BoolOrString) MarshalYAML() (interface{}, error)
- func (BoolOrString) OpenAPISchemaFormat() string
- func (BoolOrString) OpenAPISchemaType() []string
- func (boolstr *BoolOrString) String() string
- func (boolstr *BoolOrString) UnmarshalJSON(value []byte) error
- type BoolOrStringType
- type QuotedBool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoolOrString ¶
type BoolOrString struct { Type BoolOrStringType `protobuf:"varbool,1,opt,name=type,casttype=Type" json:"-"` BoolVal bool `protobuf:"varbool,2,opt,name=boolVal" json:"-"` StrVal string `protobuf:"bytes,3,opt,name=strVal" json:"-"` }
BoolOrString is a type that can hold an bool 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 booolean string or raw bool.
+protobuf=true +protobuf.options.(gogoproto.goproto_stringer)=false +k8s:openapi-gen=true +kubebuilder:validation:Type=BoolString
func FromBool ¶
func FromBool(val bool) BoolOrString
FromBool creates an BoolOrString object with a bool value.
func FromString ¶
func FromString(val string) BoolOrString
FromString creates an BoolOrString object with a string value.
func (*BoolOrString) Boolean ¶
func (boolstr *BoolOrString) Boolean() (bool, error)
Converts string to boolean if needed and returns its value
func (*BoolOrString) Fuzz ¶
func (boolstr *BoolOrString) Fuzz(c fuzz.Continue)
func (*BoolOrString) IsEmpty ¶
func (boolstr *BoolOrString) IsEmpty() bool
Returns true if type is String and the value is the empty string
func (BoolOrString) MarshalJSON ¶
func (boolstr BoolOrString) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface.
func (BoolOrString) MarshalYAML ¶
func (boolstr BoolOrString) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaller interface https://godoc.org/gopkg.in/yaml.v3#Marshaler
func (BoolOrString) OpenAPISchemaFormat ¶
func (BoolOrString) OpenAPISchemaFormat() string
OpenAPISchemaFormat is used by the kube-openapi generator when constructing the OpenAPI spec of this type.
func (BoolOrString) OpenAPISchemaType ¶
func (BoolOrString) 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 (*BoolOrString) String ¶
func (boolstr *BoolOrString) String() string
String returns the string value, '1' for true, or '0' for false.
func (*BoolOrString) UnmarshalJSON ¶
func (boolstr *BoolOrString) UnmarshalJSON(value []byte) error
UnmarshalJSON implements the json.Unmarshaller boolerface.
type BoolOrStringType ¶
type BoolOrStringType int
Type represents the stored type of BoolOrString.
const ( String BoolOrStringType = iota // The BoolOrString holds a string. Bool // The BoolOrString holds an bool. )
type QuotedBool ¶
type QuotedBool string
QuotedBool is a string type that can also unmarshal raw yaml bools.
+protobuf=true +protobuf.options.(gogoproto.goproto_stringer)=false +k8s:openapi-gen=true +kubebuilder:validation:Type=QuotedBool
func (QuotedBool) OpenAPISchemaFormat ¶
func (QuotedBool) OpenAPISchemaFormat() string
OpenAPISchemaFormat is used by the kube-openapi generator when constructing the OpenAPI spec of this type.
func (QuotedBool) OpenAPISchemaType ¶
func (QuotedBool) 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 (*QuotedBool) UnmarshalJSON ¶
func (b *QuotedBool) UnmarshalJSON(value []byte) error
UnmarshalJSON implements the json.Unmarshaller interface.
func (*QuotedBool) UnmarshalYAML ¶
func (b *QuotedBool) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalJSON implements the yaml.Unmarshaller interface.