code
stringlengths 12
335k
| docstring
stringlengths 20
20.8k
| func_name
stringlengths 1
105
| language
stringclasses 1
value | repo
stringclasses 498
values | path
stringlengths 5
172
| url
stringlengths 43
235
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
func SetMetaDataAnnotation(obj *ObjectMeta, ann string, value string) {
if obj.Annotations == nil {
obj.Annotations = make(map[string]string)
}
obj.Annotations[ann] = value
} | SetMetaDataAnnotation sets the annotation and value | SetMetaDataAnnotation | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func HasLabel(obj ObjectMeta, label string) bool {
_, found := obj.Labels[label]
return found
} | HasLabel returns a bool if passed in label exists | HasLabel | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func SetMetaDataLabel(obj *ObjectMeta, label string, value string) {
if obj.Labels == nil {
obj.Labels = make(map[string]string)
}
obj.Labels[label] = value
} | SetMetaDataLabel sets the label and value | SetMetaDataLabel | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func SingleObject(meta ObjectMeta) ListOptions {
return ListOptions{
FieldSelector: fields.OneTermEqualSelector("metadata.name", meta.Name).String(),
ResourceVersion: meta.ResourceVersion,
}
} | SingleObject returns a ListOptions for watching a single object. | SingleObject | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func NewDeleteOptions(grace int64) *DeleteOptions {
return &DeleteOptions{GracePeriodSeconds: &grace}
} | NewDeleteOptions returns a DeleteOptions indicating the resource should
be deleted within the specified grace period. Use zero to indicate
immediate deletion. If you would prefer to use the default grace period,
use &metav1.DeleteOptions{} directly. | NewDeleteOptions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func NewPreconditionDeleteOptions(uid string) *DeleteOptions {
u := types.UID(uid)
p := Preconditions{UID: &u}
return &DeleteOptions{Preconditions: &p}
} | NewPreconditionDeleteOptions returns a DeleteOptions with a UID precondition set. | NewPreconditionDeleteOptions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func NewUIDPreconditions(uid string) *Preconditions {
u := types.UID(uid)
return &Preconditions{UID: &u}
} | NewUIDPreconditions returns a Preconditions with UID set. | NewUIDPreconditions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func NewRVDeletionPrecondition(rv string) *DeleteOptions {
p := Preconditions{ResourceVersion: &rv}
return &DeleteOptions{Preconditions: &p}
} | NewRVDeletionPrecondition returns a DeleteOptions with a ResourceVersion precondition set. | NewRVDeletionPrecondition | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func HasObjectMetaSystemFieldValues(meta Object) bool {
return !meta.GetCreationTimestamp().Time.IsZero() ||
len(meta.GetUID()) != 0
} | HasObjectMetaSystemFieldValues returns true if fields that are managed by the system on ObjectMeta have values. | HasObjectMetaSystemFieldValues | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func ResetObjectMetaForStatus(meta, existingMeta Object) {
meta.SetDeletionTimestamp(existingMeta.GetDeletionTimestamp())
meta.SetGeneration(existingMeta.GetGeneration())
meta.SetSelfLink(existingMeta.GetSelfLink())
meta.SetLabels(existingMeta.GetLabels())
meta.SetAnnotations(existingMeta.GetAnnotations())
meta.SetFinalizers(existingMeta.GetFinalizers())
meta.SetOwnerReferences(existingMeta.GetOwnerReferences())
// managedFields must be preserved since it's been modified to
// track changed fields in the status update.
//meta.SetManagedFields(existingMeta.GetManagedFields())
} | ResetObjectMetaForStatus forces the meta fields for a status update to match the meta fields
for a pre-existing object. This is opt-in for new objects with Status subresource. | ResetObjectMetaForStatus | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func (f FieldsV1) MarshalJSON() ([]byte, error) {
if f.Raw == nil {
return []byte("null"), nil
}
return f.Raw, nil
} | MarshalJSON implements json.Marshaler
MarshalJSON may get called on pointers or values, so implement MarshalJSON on value.
http://stackoverflow.com/questions/21390979/custom-marshaljson-never-gets-called-in-go | MarshalJSON | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func (f *FieldsV1) UnmarshalJSON(b []byte) error {
if f == nil {
return errors.New("metav1.Fields: UnmarshalJSON on nil pointer")
}
if !bytes.Equal(b, []byte("null")) {
f.Raw = append(f.Raw[0:0], b...)
}
return nil
} | UnmarshalJSON implements json.Unmarshaler | UnmarshalJSON | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go | Apache-2.0 |
func (obj *TypeMeta) SetGroupVersionKind(gvk schema.GroupVersionKind) {
obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind()
} | SetGroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta | SetGroupVersionKind | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go | Apache-2.0 |
func (obj *TypeMeta) GroupVersionKind() schema.GroupVersionKind {
return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind)
} | GroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta | GroupVersionKind | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go | Apache-2.0 |
func (meta *ObjectMeta) GetNamespace() string { return meta.Namespace } | Namespace implements metav1.Object for any object with an ObjectMeta typed field. Allows
fast, direct access to metadata fields for API objects. | GetNamespace | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go | Apache-2.0 |
func (d *Duration) UnmarshalJSON(b []byte) error {
var str string
err := json.Unmarshal(b, &str)
if err != nil {
return err
}
pd, err := time.ParseDuration(str)
if err != nil {
return err
}
d.Duration = pd
return nil
} | UnmarshalJSON implements the json.Unmarshaller interface. | UnmarshalJSON | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go | Apache-2.0 |
func (d Duration) MarshalJSON() ([]byte, error) {
return json.Marshal(d.Duration.String())
} | MarshalJSON implements the json.Marshaler interface. | MarshalJSON | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go | Apache-2.0 |
func (d Duration) ToUnstructured() interface{} {
return d.Duration.String()
} | ToUnstructured implements the value.UnstructuredConverter interface. | ToUnstructured | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go | Apache-2.0 |
func (_ Duration) OpenAPISchemaType() []string { return []string{"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 | OpenAPISchemaType | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go | Apache-2.0 |
func (_ Duration) OpenAPISchemaFormat() string { return "" } | OpenAPISchemaFormat is used by the kube-openapi generator when constructing
the OpenAPI spec of this type. | OpenAPISchemaFormat | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go | Apache-2.0 |
func (m *MicroTime) ProtoMicroTime() *Timestamp {
if m == nil {
return &Timestamp{}
}
// truncate precision to microseconds to match JSON marshaling/unmarshaling
truncatedNanoseconds := time.Duration(m.Time.Nanosecond()).Truncate(time.Microsecond)
return &Timestamp{
Seconds: m.Time.Unix(),
Nanos: int32(truncatedNanoseconds),
}
} | Timestamp returns the Time as a new Timestamp value. | ProtoMicroTime | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | Apache-2.0 |
func (m *MicroTime) Size() (n int) {
if m == nil || m.Time.IsZero() {
return 0
}
return m.ProtoMicroTime().Size()
} | Size implements the protobuf marshalling interface. | Size | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | Apache-2.0 |
func (m *MicroTime) Unmarshal(data []byte) error {
if len(data) == 0 {
m.Time = time.Time{}
return nil
}
p := Timestamp{}
if err := p.Unmarshal(data); err != nil {
return err
}
// truncate precision to microseconds to match JSON marshaling/unmarshaling
truncatedNanoseconds := time.Duration(p.Nanos).Truncate(time.Microsecond)
m.Time = time.Unix(p.Seconds, int64(truncatedNanoseconds)).Local()
return nil
} | Reset implements the protobuf marshalling interface. | Unmarshal | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | Apache-2.0 |
func (m *MicroTime) Marshal() (data []byte, err error) {
if m == nil || m.Time.IsZero() {
return nil, nil
}
return m.ProtoMicroTime().Marshal()
} | Marshal implements the protobuf marshalling interface. | Marshal | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | Apache-2.0 |
func (m *MicroTime) MarshalTo(data []byte) (int, error) {
if m == nil || m.Time.IsZero() {
return 0, nil
}
return m.ProtoMicroTime().MarshalTo(data)
} | MarshalTo implements the protobuf marshalling interface. | MarshalTo | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | Apache-2.0 |
func (m *MicroTime) MarshalToSizedBuffer(data []byte) (int, error) {
if m == nil || m.Time.IsZero() {
return 0, nil
}
return m.ProtoMicroTime().MarshalToSizedBuffer(data)
} | MarshalToSizedBuffer implements the protobuf marshalling interface. | MarshalToSizedBuffer | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go | Apache-2.0 |
func RegisterConversions(s *runtime.Scheme) error {
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*CreateOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_url_Values_To_v1_CreateOptions(a.(*url.Values), b.(*CreateOptions), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*DeleteOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_url_Values_To_v1_DeleteOptions(a.(*url.Values), b.(*DeleteOptions), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*GetOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_url_Values_To_v1_GetOptions(a.(*url.Values), b.(*GetOptions), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*ListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_url_Values_To_v1_ListOptions(a.(*url.Values), b.(*ListOptions), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*PatchOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_url_Values_To_v1_PatchOptions(a.(*url.Values), b.(*PatchOptions), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*TableOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_url_Values_To_v1_TableOptions(a.(*url.Values), b.(*TableOptions), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*UpdateOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_url_Values_To_v1_UpdateOptions(a.(*url.Values), b.(*UpdateOptions), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*map[string]string)(nil), (*LabelSelector)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Map_string_To_string_To_v1_LabelSelector(a.(*map[string]string), b.(*LabelSelector), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((**bool)(nil), (*bool)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Pointer_bool_To_bool(a.(**bool), b.(*bool), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((**float64)(nil), (*float64)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Pointer_float64_To_float64(a.(**float64), b.(*float64), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((**int32)(nil), (*int32)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Pointer_int32_To_int32(a.(**int32), b.(*int32), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((**int64)(nil), (*int)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Pointer_int64_To_int(a.(**int64), b.(*int), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((**int64)(nil), (*int64)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Pointer_int64_To_int64(a.(**int64), b.(*int64), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((**intstr.IntOrString)(nil), (*intstr.IntOrString)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Pointer_intstr_IntOrString_To_intstr_IntOrString(a.(**intstr.IntOrString), b.(*intstr.IntOrString), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((**string)(nil), (*string)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Pointer_string_To_string(a.(**string), b.(*string), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((**Duration)(nil), (*Duration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Pointer_v1_Duration_To_v1_Duration(a.(**Duration), b.(*Duration), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*[]string)(nil), (**DeletionPropagation)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Slice_string_To_Pointer_v1_DeletionPropagation(a.(*[]string), b.(**DeletionPropagation), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*[]string)(nil), (**Time)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Slice_string_To_Pointer_v1_Time(a.(*[]string), b.(**Time), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*[]string)(nil), (*[]int32)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Slice_string_To_Slice_int32(a.(*[]string), b.(*[]int32), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*[]string)(nil), (*IncludeObjectPolicy)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Slice_string_To_v1_IncludeObjectPolicy(a.(*[]string), b.(*IncludeObjectPolicy), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*[]string)(nil), (*ResourceVersionMatch)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Slice_string_To_v1_ResourceVersionMatch(a.(*[]string), b.(*ResourceVersionMatch), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*[]string)(nil), (*Time)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_Slice_string_To_v1_Time(a.(*[]string), b.(*Time), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*bool)(nil), (**bool)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_bool_To_Pointer_bool(a.(*bool), b.(**bool), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*fields.Selector)(nil), (*string)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_fields_Selector_To_string(a.(*fields.Selector), b.(*string), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*float64)(nil), (**float64)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_float64_To_Pointer_float64(a.(*float64), b.(**float64), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*int32)(nil), (**int32)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_int32_To_Pointer_int32(a.(*int32), b.(**int32), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*int64)(nil), (**int64)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_int64_To_Pointer_int64(a.(*int64), b.(**int64), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*int)(nil), (**int64)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_int_To_Pointer_int64(a.(*int), b.(**int64), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*intstr.IntOrString)(nil), (**intstr.IntOrString)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_intstr_IntOrString_To_Pointer_intstr_IntOrString(a.(*intstr.IntOrString), b.(**intstr.IntOrString), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*intstr.IntOrString)(nil), (*intstr.IntOrString)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_intstr_IntOrString_To_intstr_IntOrString(a.(*intstr.IntOrString), b.(*intstr.IntOrString), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*labels.Selector)(nil), (*string)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_labels_Selector_To_string(a.(*labels.Selector), b.(*string), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*resource.Quantity)(nil), (*resource.Quantity)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_resource_Quantity_To_resource_Quantity(a.(*resource.Quantity), b.(*resource.Quantity), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*string)(nil), (**string)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_string_To_Pointer_string(a.(*string), b.(**string), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*string)(nil), (*fields.Selector)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_string_To_fields_Selector(a.(*string), b.(*fields.Selector), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*string)(nil), (*labels.Selector)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_string_To_labels_Selector(a.(*string), b.(*labels.Selector), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*url.Values)(nil), (*DeleteOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_url_Values_To_v1_DeleteOptions(a.(*url.Values), b.(*DeleteOptions), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*DeleteOptions)(nil), (*DeleteOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_DeleteOptions_To_v1_DeleteOptions(a.(*DeleteOptions), b.(*DeleteOptions), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*Duration)(nil), (**Duration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_Duration_To_Pointer_v1_Duration(a.(*Duration), b.(**Duration), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*InternalEvent)(nil), (*WatchEvent)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_InternalEvent_To_v1_WatchEvent(a.(*InternalEvent), b.(*WatchEvent), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*LabelSelector)(nil), (*map[string]string)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_LabelSelector_To_Map_string_To_string(a.(*LabelSelector), b.(*map[string]string), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*ListMeta)(nil), (*ListMeta)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_ListMeta_To_v1_ListMeta(a.(*ListMeta), b.(*ListMeta), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*MicroTime)(nil), (*MicroTime)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_MicroTime_To_v1_MicroTime(a.(*MicroTime), b.(*MicroTime), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*Time)(nil), (*Time)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_Time_To_v1_Time(a.(*Time), b.(*Time), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*TypeMeta)(nil), (*TypeMeta)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_TypeMeta_To_v1_TypeMeta(a.(*TypeMeta), b.(*TypeMeta), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*WatchEvent)(nil), (*InternalEvent)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_WatchEvent_To_v1_InternalEvent(a.(*WatchEvent), b.(*InternalEvent), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*WatchEvent)(nil), (*watch.Event)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_WatchEvent_To_watch_Event(a.(*WatchEvent), b.(*watch.Event), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*watch.Event)(nil), (*WatchEvent)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_watch_Event_To_v1_WatchEvent(a.(*watch.Event), b.(*WatchEvent), scope)
}); err != nil {
return err
}
return nil
} | RegisterConversions adds conversion functions to the given scheme.
Public to allow building arbitrary schemes. | RegisterConversions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | Apache-2.0 |
func Convert_url_Values_To_v1_CreateOptions(in *url.Values, out *CreateOptions, s conversion.Scope) error {
return autoConvert_url_Values_To_v1_CreateOptions(in, out, s)
} | Convert_url_Values_To_v1_CreateOptions is an autogenerated conversion function. | Convert_url_Values_To_v1_CreateOptions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | Apache-2.0 |
func Convert_url_Values_To_v1_GetOptions(in *url.Values, out *GetOptions, s conversion.Scope) error {
return autoConvert_url_Values_To_v1_GetOptions(in, out, s)
} | Convert_url_Values_To_v1_GetOptions is an autogenerated conversion function. | Convert_url_Values_To_v1_GetOptions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | Apache-2.0 |
func Convert_url_Values_To_v1_ListOptions(in *url.Values, out *ListOptions, s conversion.Scope) error {
return autoConvert_url_Values_To_v1_ListOptions(in, out, s)
} | Convert_url_Values_To_v1_ListOptions is an autogenerated conversion function. | Convert_url_Values_To_v1_ListOptions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | Apache-2.0 |
func Convert_url_Values_To_v1_PatchOptions(in *url.Values, out *PatchOptions, s conversion.Scope) error {
return autoConvert_url_Values_To_v1_PatchOptions(in, out, s)
} | Convert_url_Values_To_v1_PatchOptions is an autogenerated conversion function. | Convert_url_Values_To_v1_PatchOptions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | Apache-2.0 |
func Convert_url_Values_To_v1_TableOptions(in *url.Values, out *TableOptions, s conversion.Scope) error {
return autoConvert_url_Values_To_v1_TableOptions(in, out, s)
} | Convert_url_Values_To_v1_TableOptions is an autogenerated conversion function. | Convert_url_Values_To_v1_TableOptions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | Apache-2.0 |
func Convert_url_Values_To_v1_UpdateOptions(in *url.Values, out *UpdateOptions, s conversion.Scope) error {
return autoConvert_url_Values_To_v1_UpdateOptions(in, out, s)
} | Convert_url_Values_To_v1_UpdateOptions is an autogenerated conversion function. | Convert_url_Values_To_v1_UpdateOptions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go | Apache-2.0 |
func LabelSelectorHasInvalidLabelValue(ps *metav1.LabelSelector) bool {
if ps == nil {
return false
}
for _, e := range ps.MatchExpressions {
for _, v := range e.Values {
if len(validation.IsValidLabelValue(v)) > 0 {
return true
}
}
}
return false
} | LabelSelectorHasInvalidLabelValue returns true if the given selector contains an invalid label value in a match expression.
This is useful for determining whether AllowInvalidLabelValueInSelector should be set to true when validating an update
based on existing persisted invalid values. | LabelSelectorHasInvalidLabelValue | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | Apache-2.0 |
func ValidateLabelSelector(ps *metav1.LabelSelector, opts LabelSelectorValidationOptions, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if ps == nil {
return allErrs
}
allErrs = append(allErrs, ValidateLabels(ps.MatchLabels, fldPath.Child("matchLabels"))...)
for i, expr := range ps.MatchExpressions {
allErrs = append(allErrs, ValidateLabelSelectorRequirement(expr, opts, fldPath.Child("matchExpressions").Index(i))...)
}
return allErrs
} | ValidateLabelSelector validate the LabelSelector according to the opts and returns any validation errors.
opts.AllowInvalidLabelValueInSelector is only expected to be set to true when required for backwards compatibility with existing invalid data. | ValidateLabelSelector | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | Apache-2.0 |
func ValidateLabelSelectorRequirement(sr metav1.LabelSelectorRequirement, opts LabelSelectorValidationOptions, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
switch sr.Operator {
case metav1.LabelSelectorOpIn, metav1.LabelSelectorOpNotIn:
if len(sr.Values) == 0 {
allErrs = append(allErrs, field.Required(fldPath.Child("values"), "must be specified when `operator` is 'In' or 'NotIn'"))
}
case metav1.LabelSelectorOpExists, metav1.LabelSelectorOpDoesNotExist:
if len(sr.Values) > 0 {
allErrs = append(allErrs, field.Forbidden(fldPath.Child("values"), "may not be specified when `operator` is 'Exists' or 'DoesNotExist'"))
}
default:
allErrs = append(allErrs, field.Invalid(fldPath.Child("operator"), sr.Operator, "not a valid selector operator"))
}
allErrs = append(allErrs, ValidateLabelName(sr.Key, fldPath.Child("key"))...)
if !opts.AllowInvalidLabelValueInSelector {
for valueIndex, value := range sr.Values {
for _, msg := range validation.IsValidLabelValue(value) {
allErrs = append(allErrs, field.Invalid(fldPath.Child("values").Index(valueIndex), value, msg))
}
}
}
return allErrs
} | ValidateLabelSelectorRequirement validate the requirement according to the opts and returns any validation errors.
opts.AllowInvalidLabelValueInSelector is only expected to be set to true when required for backwards compatibility with existing invalid data. | ValidateLabelSelectorRequirement | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | Apache-2.0 |
func ValidateLabelName(labelName string, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
for _, msg := range validation.IsQualifiedName(labelName) {
allErrs = append(allErrs, field.Invalid(fldPath, labelName, msg))
}
return allErrs
} | ValidateLabelName validates that the label name is correctly defined. | ValidateLabelName | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | Apache-2.0 |
func ValidateLabels(labels map[string]string, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
for k, v := range labels {
allErrs = append(allErrs, ValidateLabelName(k, fldPath)...)
for _, msg := range validation.IsValidLabelValue(v) {
allErrs = append(allErrs, field.Invalid(fldPath, v, msg))
}
}
return allErrs
} | ValidateLabels validates that a set of labels are correctly defined. | ValidateLabels | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | Apache-2.0 |
func ValidateFieldManager(fieldManager string, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
// the field can not be set as a `*string`, so a empty string ("") is
// considered as not set and is defaulted by the rest of the process
// (unless apply is used, in which case it is required).
if len(fieldManager) > FieldManagerMaxLength {
allErrs = append(allErrs, field.TooLong(fldPath, fieldManager, FieldManagerMaxLength))
}
// Verify that all characters are printable.
for i, r := range fieldManager {
if !unicode.IsPrint(r) {
allErrs = append(allErrs, field.Invalid(fldPath, fieldManager, fmt.Sprintf("invalid character %#U (at position %d)", r, i)))
}
}
return allErrs
} | ValidateFieldManager valides that the fieldManager is the proper length and
only has printable characters. | ValidateFieldManager | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | Apache-2.0 |
func ValidateDryRun(fldPath *field.Path, dryRun []string) field.ErrorList {
allErrs := field.ErrorList{}
if !allowedDryRunValues.HasAll(dryRun...) {
allErrs = append(allErrs, field.NotSupported(fldPath, dryRun, allowedDryRunValues.List()))
}
return allErrs
} | ValidateDryRun validates that a dryRun query param only contains allowed values. | ValidateDryRun | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | Apache-2.0 |
func ValidateFieldValidation(fldPath *field.Path, fieldValidation string) field.ErrorList {
allErrs := field.ErrorList{}
if !allowedFieldValidationValues.Has(fieldValidation) {
allErrs = append(allErrs, field.NotSupported(fldPath, fieldValidation, allowedFieldValidationValues.List()))
}
return allErrs
} | ValidateFieldValidation validates that a fieldValidation query param only contains allowed values. | ValidateFieldValidation | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | Apache-2.0 |
func ValidateTableOptions(opts *metav1.TableOptions) field.ErrorList {
var allErrs field.ErrorList
switch opts.IncludeObject {
case metav1.IncludeMetadata, metav1.IncludeNone, metav1.IncludeObject, "":
default:
allErrs = append(allErrs, field.Invalid(field.NewPath("includeObject"), opts.IncludeObject, "must be 'Metadata', 'Object', 'None', or empty"))
}
return allErrs
} | ValidateTableOptions returns any invalid flags on TableOptions. | ValidateTableOptions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | Apache-2.0 |
func isValidConditionReason(value string) []string {
if !conditionReasonRegexp.MatchString(value) {
return []string{validation.RegexError(conditionReasonErrMsg, conditionReasonFmt, "my_name", "MY_NAME", "MyName", "ReasonA,ReasonB", "ReasonA:ReasonB")}
}
return nil
} | isValidConditionReason tests for a string that conforms to rules for condition reasons. This checks the format, but not the length. | isValidConditionReason | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go | Apache-2.0 |
func (u *Unstructured) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := UnstructuredJSONScheme.Encode(u, &buf)
return buf.Bytes(), err
} | MarshalJSON ensures that the unstructured object produces proper
JSON when passed to Go's standard JSON library. | MarshalJSON | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go | Apache-2.0 |
func (u *Unstructured) UnmarshalJSON(b []byte) error {
_, _, err := UnstructuredJSONScheme.Decode(b, nil, u)
return err
} | UnmarshalJSON ensures that the unstructured object properly decodes
JSON when passed to Go's standard JSON library. | UnmarshalJSON | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go | Apache-2.0 |
func (in *Unstructured) NewEmptyInstance() runtime.Unstructured {
out := new(Unstructured)
if in != nil {
out.GetObjectKind().SetGroupVersionKind(in.GetObjectKind().GroupVersionKind())
}
return out
} | NewEmptyInstance returns a new instance of the concrete type containing only kind/apiVersion and no other data.
This should be called instead of reflect.New() for unstructured types because the go type alone does not preserve kind/apiVersion info. | NewEmptyInstance | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go | Apache-2.0 |
func (u *UnstructuredList) NewEmptyInstance() runtime.Unstructured {
out := new(UnstructuredList)
if u != nil {
out.SetGroupVersionKind(u.GroupVersionKind())
}
return out
} | NewEmptyInstance returns a new instance of the concrete type containing only kind/apiVersion and no other data.
This should be called instead of reflect.New() for unstructured types because the go type alone does not preserve kind/apiVersion info. | NewEmptyInstance | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go | Apache-2.0 |
func (u *UnstructuredList) UnstructuredContent() map[string]interface{} {
out := make(map[string]interface{}, len(u.Object)+1)
// shallow copy every property
for k, v := range u.Object {
out[k] = v
}
items := make([]interface{}, len(u.Items))
for i, item := range u.Items {
items[i] = item.UnstructuredContent()
}
out["items"] = items
return out
} | UnstructuredContent returns a map contain an overlay of the Items field onto
the Object field. Items always overwrites overlay. | UnstructuredContent | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go | Apache-2.0 |
func (obj *UnstructuredList) SetUnstructuredContent(content map[string]interface{}) {
obj.Object = content
if content == nil {
obj.Items = nil
return
}
items, ok := obj.Object["items"].([]interface{})
if !ok || items == nil {
items = []interface{}{}
}
unstructuredItems := make([]Unstructured, 0, len(items))
newItems := make([]interface{}, 0, len(items))
for _, item := range items {
o, ok := item.(map[string]interface{})
if !ok {
continue
}
unstructuredItems = append(unstructuredItems, Unstructured{Object: o})
newItems = append(newItems, o)
}
obj.Items = unstructuredItems
obj.Object["items"] = newItems
} | SetUnstructuredContent obeys the conventions of List and keeps Items and the items
array in sync. If items is not an array of objects in the incoming map, then any
mismatched item will be removed. | SetUnstructuredContent | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go | Apache-2.0 |
func (u *UnstructuredList) MarshalJSON() ([]byte, error) {
var buf bytes.Buffer
err := UnstructuredJSONScheme.Encode(u, &buf)
return buf.Bytes(), err
} | MarshalJSON ensures that the unstructured list object produces proper
JSON when passed to Go's standard JSON library. | MarshalJSON | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go | Apache-2.0 |
func (u *UnstructuredList) UnmarshalJSON(b []byte) error {
_, _, err := UnstructuredJSONScheme.Decode(b, nil, u)
return err
} | UnmarshalJSON ensures that the unstructured list object properly
decodes JSON when passed to Go's standard JSON library. | UnmarshalJSON | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go | Apache-2.0 |
func (in *Unstructured) DeepCopyInto(out *Unstructured) {
clone := in.DeepCopy()
*out = *clone
return
} | DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. | DeepCopyInto | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go | Apache-2.0 |
func (in *Unstructured) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. | DeepCopyObject | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go | Apache-2.0 |
func (in *UnstructuredList) DeepCopyInto(out *UnstructuredList) {
clone := in.DeepCopy()
*out = *clone
return
} | DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. | DeepCopyInto | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go | Apache-2.0 |
func (in *UnstructuredList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. | DeepCopyObject | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go | Apache-2.0 |
func NestedFieldCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error) {
val, found, err := NestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
return runtime.DeepCopyJSONValue(val), true, nil
} | NestedFieldCopy returns a deep copy of the value of a nested field.
Returns false if the value is missing.
No error is returned for a nil field.
Note: fields passed to this function are treated as keys within the passed
object; no array/slice syntax is supported. | NestedFieldCopy | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func NestedFieldNoCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error) {
var val interface{} = obj
for i, field := range fields {
if val == nil {
return nil, false, nil
}
if m, ok := val.(map[string]interface{}); ok {
val, ok = m[field]
if !ok {
return nil, false, nil
}
} else {
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected map[string]interface{}", jsonPath(fields[:i+1]), val, val)
}
}
return val, true, nil
} | NestedFieldNoCopy returns a reference to a nested field.
Returns false if value is not found and an error if unable
to traverse obj.
Note: fields passed to this function are treated as keys within the passed
object; no array/slice syntax is supported. | NestedFieldNoCopy | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func NestedString(obj map[string]interface{}, fields ...string) (string, bool, error) {
val, found, err := NestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return "", found, err
}
s, ok := val.(string)
if !ok {
return "", false, fmt.Errorf("%v accessor error: %v is of the type %T, expected string", jsonPath(fields), val, val)
}
return s, true, nil
} | NestedString returns the string value of a nested field.
Returns false if value is not found and an error if not a string. | NestedString | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func NestedBool(obj map[string]interface{}, fields ...string) (bool, bool, error) {
val, found, err := NestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return false, found, err
}
b, ok := val.(bool)
if !ok {
return false, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected bool", jsonPath(fields), val, val)
}
return b, true, nil
} | NestedBool returns the bool value of a nested field.
Returns false if value is not found and an error if not a bool. | NestedBool | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func NestedFloat64(obj map[string]interface{}, fields ...string) (float64, bool, error) {
val, found, err := NestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return 0, found, err
}
f, ok := val.(float64)
if !ok {
return 0, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected float64", jsonPath(fields), val, val)
}
return f, true, nil
} | NestedFloat64 returns the float64 value of a nested field.
Returns false if value is not found and an error if not a float64. | NestedFloat64 | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func NestedInt64(obj map[string]interface{}, fields ...string) (int64, bool, error) {
val, found, err := NestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return 0, found, err
}
i, ok := val.(int64)
if !ok {
return 0, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected int64", jsonPath(fields), val, val)
}
return i, true, nil
} | NestedInt64 returns the int64 value of a nested field.
Returns false if value is not found and an error if not an int64. | NestedInt64 | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func NestedStringSlice(obj map[string]interface{}, fields ...string) ([]string, bool, error) {
val, found, err := NestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
m, ok := val.([]interface{})
if !ok {
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected []interface{}", jsonPath(fields), val, val)
}
strSlice := make([]string, 0, len(m))
for _, v := range m {
if str, ok := v.(string); ok {
strSlice = append(strSlice, str)
} else {
return nil, false, fmt.Errorf("%v accessor error: contains non-string key in the slice: %v is of the type %T, expected string", jsonPath(fields), v, v)
}
}
return strSlice, true, nil
} | NestedStringSlice returns a copy of []string value of a nested field.
Returns false if value is not found and an error if not a []interface{} or contains non-string items in the slice. | NestedStringSlice | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func NestedSlice(obj map[string]interface{}, fields ...string) ([]interface{}, bool, error) {
val, found, err := NestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
_, ok := val.([]interface{})
if !ok {
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected []interface{}", jsonPath(fields), val, val)
}
return runtime.DeepCopyJSONValue(val).([]interface{}), true, nil
} | NestedSlice returns a deep copy of []interface{} value of a nested field.
Returns false if value is not found and an error if not a []interface{}. | NestedSlice | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func NestedStringMap(obj map[string]interface{}, fields ...string) (map[string]string, bool, error) {
m, found, err := nestedMapNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
strMap := make(map[string]string, len(m))
for k, v := range m {
if str, ok := v.(string); ok {
strMap[k] = str
} else {
return nil, false, fmt.Errorf("%v accessor error: contains non-string value in the map under key %q: %v is of the type %T, expected string", jsonPath(fields), k, v, v)
}
}
return strMap, true, nil
} | NestedStringMap returns a copy of map[string]string value of a nested field.
Returns false if value is not found and an error if not a map[string]interface{} or contains non-string values in the map. | NestedStringMap | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func NestedMap(obj map[string]interface{}, fields ...string) (map[string]interface{}, bool, error) {
m, found, err := nestedMapNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
return runtime.DeepCopyJSON(m), true, nil
} | NestedMap returns a deep copy of map[string]interface{} value of a nested field.
Returns false if value is not found and an error if not a map[string]interface{}. | NestedMap | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func nestedMapNoCopy(obj map[string]interface{}, fields ...string) (map[string]interface{}, bool, error) {
val, found, err := NestedFieldNoCopy(obj, fields...)
if !found || err != nil {
return nil, found, err
}
m, ok := val.(map[string]interface{})
if !ok {
return nil, false, fmt.Errorf("%v accessor error: %v is of the type %T, expected map[string]interface{}", jsonPath(fields), val, val)
}
return m, true, nil
} | nestedMapNoCopy returns a map[string]interface{} value of a nested field.
Returns false if value is not found and an error if not a map[string]interface{}. | nestedMapNoCopy | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func SetNestedField(obj map[string]interface{}, value interface{}, fields ...string) error {
return setNestedFieldNoCopy(obj, runtime.DeepCopyJSONValue(value), fields...)
} | SetNestedField sets the value of a nested field to a deep copy of the value provided.
Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}. | SetNestedField | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func SetNestedStringSlice(obj map[string]interface{}, value []string, fields ...string) error {
m := make([]interface{}, 0, len(value)) // convert []string into []interface{}
for _, v := range value {
m = append(m, v)
}
return setNestedFieldNoCopy(obj, m, fields...)
} | SetNestedStringSlice sets the string slice value of a nested field.
Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}. | SetNestedStringSlice | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func SetNestedSlice(obj map[string]interface{}, value []interface{}, fields ...string) error {
return SetNestedField(obj, value, fields...)
} | SetNestedSlice sets the slice value of a nested field.
Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}. | SetNestedSlice | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func SetNestedStringMap(obj map[string]interface{}, value map[string]string, fields ...string) error {
m := make(map[string]interface{}, len(value)) // convert map[string]string into map[string]interface{}
for k, v := range value {
m[k] = v
}
return setNestedFieldNoCopy(obj, m, fields...)
} | SetNestedStringMap sets the map[string]string value of a nested field.
Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}. | SetNestedStringMap | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func SetNestedMap(obj map[string]interface{}, value map[string]interface{}, fields ...string) error {
return SetNestedField(obj, value, fields...)
} | SetNestedMap sets the map[string]interface{} value of a nested field.
Returns an error if value cannot be set because one of the nesting levels is not a map[string]interface{}. | SetNestedMap | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func RemoveNestedField(obj map[string]interface{}, fields ...string) {
m := obj
for _, field := range fields[:len(fields)-1] {
if x, ok := m[field].(map[string]interface{}); ok {
m = x
} else {
return
}
}
delete(m, fields[len(fields)-1])
} | RemoveNestedField removes the nested field from the obj. | RemoveNestedField | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go | Apache-2.0 |
func SetListOptionsDefaults(obj *ListOptions, isWatchListFeatureEnabled bool) {
if !isWatchListFeatureEnabled {
return
}
if obj.SendInitialEvents != nil || len(obj.ResourceVersionMatch) != 0 {
return
}
legacy := obj.ResourceVersion == "" || obj.ResourceVersion == "0"
if obj.Watch && legacy {
turnOnInitialEvents := true
obj.SendInitialEvents = &turnOnInitialEvents
obj.ResourceVersionMatch = metav1.ResourceVersionMatchNotOlderThan
}
} | SetListOptionsDefaults sets defaults on the provided ListOptions if applicable.
TODO(#115478): once the watch-list fg is always on we register this function in the scheme (via AddTypeDefaultingFunc).
TODO(#115478): when the function is registered in the scheme remove all callers of this method. | SetListOptionsDefaults | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/defaults.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/defaults.go | Apache-2.0 |
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
} | Kind takes an unqualified kind and returns a Group qualified GroupKind | Kind | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go | Apache-2.0 |
func addToGroupVersion(scheme *runtime.Scheme) error {
if err := scheme.AddIgnoredConversionType(&metav1.TypeMeta{}, &metav1.TypeMeta{}); err != nil {
return err
}
// ListOptions is the only options struct which needs conversion (it exposes labels and fields
// as selectors for convenience). The other types have only a single representation today.
scheme.AddKnownTypes(SchemeGroupVersion,
&ListOptions{},
&metav1.GetOptions{},
&metav1.DeleteOptions{},
&metav1.CreateOptions{},
&metav1.UpdateOptions{},
)
scheme.AddKnownTypes(SchemeGroupVersion,
&metav1.Table{},
&metav1.TableOptions{},
&metav1beta1.PartialObjectMetadata{},
&metav1beta1.PartialObjectMetadataList{},
)
if err := metav1beta1.AddMetaToScheme(scheme); err != nil {
return err
}
if err := metav1.AddMetaToScheme(scheme); err != nil {
return err
}
// Allow delete options to be decoded across all version in this scheme (we may want to be more clever than this)
scheme.AddUnversionedTypes(SchemeGroupVersion,
&metav1.DeleteOptions{},
&metav1.CreateOptions{},
&metav1.UpdateOptions{})
metav1.AddToGroupVersion(scheme, metav1.SchemeGroupVersion)
if err := metav1beta1.RegisterConversions(scheme); err != nil {
return err
}
return nil
} | addToGroupVersion registers common meta types into schemas. | addToGroupVersion | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go | Apache-2.0 |
func init() {
localSchemeBuilder.Register(addToGroupVersion)
} | Unlike other API groups, meta internal knows about all meta external versions, but keeps
the logic for conversion private. | init | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go | Apache-2.0 |
func (in *List) DeepCopyInto(out *List) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]runtime.Object, len(*in))
for i := range *in {
if (*in)[i] != nil {
(*out)[i] = (*in)[i].DeepCopyObject()
}
}
}
return
} | DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. | DeepCopyInto | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | Apache-2.0 |
func (in *List) DeepCopy() *List {
if in == nil {
return nil
}
out := new(List)
in.DeepCopyInto(out)
return out
} | DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new List. | DeepCopy | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | Apache-2.0 |
func (in *List) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. | DeepCopyObject | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | Apache-2.0 |
func (in *ListOptions) DeepCopyInto(out *ListOptions) {
*out = *in
out.TypeMeta = in.TypeMeta
if in.LabelSelector != nil {
out.LabelSelector = in.LabelSelector.DeepCopySelector()
}
if in.FieldSelector != nil {
out.FieldSelector = in.FieldSelector.DeepCopySelector()
}
if in.TimeoutSeconds != nil {
in, out := &in.TimeoutSeconds, &out.TimeoutSeconds
*out = new(int64)
**out = **in
}
if in.SendInitialEvents != nil {
in, out := &in.SendInitialEvents, &out.SendInitialEvents
*out = new(bool)
**out = **in
}
return
} | DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. | DeepCopyInto | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | Apache-2.0 |
func (in *ListOptions) DeepCopy() *ListOptions {
if in == nil {
return nil
}
out := new(ListOptions)
in.DeepCopyInto(out)
return out
} | DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListOptions. | DeepCopy | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | Apache-2.0 |
func (in *ListOptions) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
} | DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. | DeepCopyObject | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go | Apache-2.0 |
func RegisterConversions(s *runtime.Scheme) error {
if err := s.AddGeneratedConversionFunc((*List)(nil), (*v1.List)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_internalversion_List_To_v1_List(a.(*List), b.(*v1.List), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.List)(nil), (*List)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_List_To_internalversion_List(a.(*v1.List), b.(*List), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*ListOptions)(nil), (*v1.ListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_internalversion_ListOptions_To_v1_ListOptions(a.(*ListOptions), b.(*v1.ListOptions), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.ListOptions)(nil), (*ListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_ListOptions_To_internalversion_ListOptions(a.(*v1.ListOptions), b.(*ListOptions), scope)
}); err != nil {
return err
}
return nil
} | RegisterConversions adds conversion functions to the given scheme.
Public to allow building arbitrary schemes. | RegisterConversions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go | Apache-2.0 |
func Convert_internalversion_List_To_v1_List(in *List, out *v1.List, s conversion.Scope) error {
return autoConvert_internalversion_List_To_v1_List(in, out, s)
} | Convert_internalversion_List_To_v1_List is an autogenerated conversion function. | Convert_internalversion_List_To_v1_List | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go | Apache-2.0 |
func Convert_v1_List_To_internalversion_List(in *v1.List, out *List, s conversion.Scope) error {
return autoConvert_v1_List_To_internalversion_List(in, out, s)
} | Convert_v1_List_To_internalversion_List is an autogenerated conversion function. | Convert_v1_List_To_internalversion_List | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go | Apache-2.0 |
func Convert_internalversion_ListOptions_To_v1_ListOptions(in *ListOptions, out *v1.ListOptions, s conversion.Scope) error {
return autoConvert_internalversion_ListOptions_To_v1_ListOptions(in, out, s)
} | Convert_internalversion_ListOptions_To_v1_ListOptions is an autogenerated conversion function. | Convert_internalversion_ListOptions_To_v1_ListOptions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go | Apache-2.0 |
func Convert_v1_ListOptions_To_internalversion_ListOptions(in *v1.ListOptions, out *ListOptions, s conversion.Scope) error {
return autoConvert_v1_ListOptions_To_internalversion_ListOptions(in, out, s)
} | Convert_v1_ListOptions_To_internalversion_ListOptions is an autogenerated conversion function. | Convert_v1_ListOptions_To_internalversion_ListOptions | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go | Apache-2.0 |
func (e *StatusError) Error() string {
return e.ErrStatus.Message
} | Error implements the Error interface. | Error | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func (e *StatusError) Status() metav1.Status {
return e.ErrStatus
} | Status allows access to e's status without having to know the detailed workings
of StatusError. | Status | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func (e *StatusError) DebugError() (string, []interface{}) {
if out, err := json.MarshalIndent(e.ErrStatus, "", " "); err == nil {
return "server response object: %s", []interface{}{string(out)}
}
return "server response object: %#v", []interface{}{e.ErrStatus}
} | DebugError reports extended info about the error to debug output. | DebugError | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func HasStatusCause(err error, name metav1.CauseType) bool {
_, ok := StatusCause(err, name)
return ok
} | HasStatusCause returns true if the provided error has a details cause
with the provided type name.
It supports wrapped errors and returns false when the error is nil. | HasStatusCause | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func StatusCause(err error, name metav1.CauseType) (metav1.StatusCause, bool) {
status, ok := err.(APIStatus)
if (ok || errors.As(err, &status)) && status.Status().Details != nil {
for _, cause := range status.Status().Details.Causes {
if cause.Type == name {
return cause, true
}
}
}
return metav1.StatusCause{}, false
} | StatusCause returns the named cause from the provided error if it exists and
the error unwraps to the type APIStatus. Otherwise it returns false. | StatusCause | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func (u *UnexpectedObjectError) Error() string {
return fmt.Sprintf("unexpected object: %v", u.Object)
} | Error returns an error message describing 'u'. | Error | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func FromObject(obj runtime.Object) error {
switch t := obj.(type) {
case *metav1.Status:
return &StatusError{ErrStatus: *t}
case runtime.Unstructured:
var status metav1.Status
obj := t.UnstructuredContent()
if !reflect.DeepEqual(obj["kind"], "Status") {
break
}
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(t.UnstructuredContent(), &status); err != nil {
return err
}
if status.APIVersion != "v1" && status.APIVersion != "meta.k8s.io/v1" {
break
}
return &StatusError{ErrStatus: status}
} | FromObject generates an StatusError from an metav1.Status, if that is the type of obj; otherwise,
returns an UnexpecteObjectError. | FromObject | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func NewNotFound(qualifiedResource schema.GroupResource, name string) *StatusError {
return &StatusError{metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusNotFound,
Reason: metav1.StatusReasonNotFound,
Details: &metav1.StatusDetails{
Group: qualifiedResource.Group,
Kind: qualifiedResource.Resource,
Name: name,
},
Message: fmt.Sprintf("%s %q not found", qualifiedResource.String(), name),
}}
} | NewNotFound returns a new error which indicates that the resource of the kind and the name was not found. | NewNotFound | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func NewAlreadyExists(qualifiedResource schema.GroupResource, name string) *StatusError {
return &StatusError{metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusConflict,
Reason: metav1.StatusReasonAlreadyExists,
Details: &metav1.StatusDetails{
Group: qualifiedResource.Group,
Kind: qualifiedResource.Resource,
Name: name,
},
Message: fmt.Sprintf("%s %q already exists", qualifiedResource.String(), name),
}}
} | NewAlreadyExists returns an error indicating the item requested exists by that identifier. | NewAlreadyExists | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func NewGenerateNameConflict(qualifiedResource schema.GroupResource, name string, retryAfterSeconds int) *StatusError {
return &StatusError{metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusConflict,
Reason: metav1.StatusReasonAlreadyExists,
Details: &metav1.StatusDetails{
Group: qualifiedResource.Group,
Kind: qualifiedResource.Resource,
Name: name,
RetryAfterSeconds: int32(retryAfterSeconds),
},
Message: fmt.Sprintf(
"%s %q already exists, the server was not able to generate a unique name for the object",
qualifiedResource.String(), name),
}}
} | NewGenerateNameConflict returns an error indicating the server
was not able to generate a valid name for a resource. | NewGenerateNameConflict | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func NewUnauthorized(reason string) *StatusError {
message := reason
if len(message) == 0 {
message = "not authorized"
}
return &StatusError{metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusUnauthorized,
Reason: metav1.StatusReasonUnauthorized,
Message: message,
}}
} | NewUnauthorized returns an error indicating the client is not authorized to perform the requested
action. | NewUnauthorized | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func NewForbidden(qualifiedResource schema.GroupResource, name string, err error) *StatusError {
var message string
if qualifiedResource.Empty() {
message = fmt.Sprintf("forbidden: %v", err)
} else if name == "" {
message = fmt.Sprintf("%s is forbidden: %v", qualifiedResource.String(), err)
} else {
message = fmt.Sprintf("%s %q is forbidden: %v", qualifiedResource.String(), name, err)
}
return &StatusError{metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusForbidden,
Reason: metav1.StatusReasonForbidden,
Details: &metav1.StatusDetails{
Group: qualifiedResource.Group,
Kind: qualifiedResource.Resource,
Name: name,
},
Message: message,
}}
} | NewForbidden returns an error indicating the requested action was forbidden | NewForbidden | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
func NewConflict(qualifiedResource schema.GroupResource, name string, err error) *StatusError {
return &StatusError{metav1.Status{
Status: metav1.StatusFailure,
Code: http.StatusConflict,
Reason: metav1.StatusReasonConflict,
Details: &metav1.StatusDetails{
Group: qualifiedResource.Group,
Kind: qualifiedResource.Resource,
Name: name,
},
Message: fmt.Sprintf("Operation cannot be fulfilled on %s %q: %v", qualifiedResource.String(), name, err),
}}
} | NewConflict returns an error indicating the item can't be updated as provided. | NewConflict | go | k8snetworkplumbingwg/multus-cni | vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/k8s.io/apimachinery/pkg/api/errors/errors.go | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.