// objectMetaAndKind retrieves kind and ObjectMeta from a runtime object, or returns an error.
514032
func objectMetaAndKind(typer runtime.ObjectTyper, obj runtime.Object) (*api.ObjectMeta, string, error) {
	objectMeta, err := api.ObjectMetaFor(obj)
	if err != nil {
		return nil, "", errors.NewInternalError(err)
	}
	_, kind, err := typer.ObjectVersionAndKind(obj)
	if err != nil {
		return nil, "", errors.NewInternalError(err)
	}
	return objectMeta, kind, nil
}
1061876
func containsKind(kinds []reflect.Kind, kind reflect.Kind) bool {
	for i := 0; i < len(kinds); i++ {
		if kind == kinds[i] {
			return true
		}
	}

	return false
}
1166477
func ListMetaFor(obj runtime.Object) (*unversioned.ListMeta, error) {
	v, err := conversion.EnforcePtr(obj)
	if err != nil {
		return nil, err
	}
	var meta *unversioned.ListMeta
	err = runtime.FieldPtr(v, "ListMeta", &meta)
	return meta, err
}
1186975
func (m MultiRESTMapper) KindFor(resource unversioned.GroupVersionResource) (gvk unversioned.GroupVersionKind, err error) {
	for _, t := range m {
		gvk, err = t.KindFor(resource)
		if err == nil {
			return
		}
	}
	return
}
1208946
func (s *Scheme) DataVersionAndKind(data []byte) (version, kind string, err error) {
	return s.MetaFactory.Interpret(data)
}
1100129
func NewTodoQueryBuilderWithKind(kind string) *TodoQueryBuilder {
	q := datastore.NewQuery(kind)
	bldr := &TodoQueryBuilder{q: q}
	bldr.ID = &TodoQueryProperty{
		bldr: bldr,
		name: "__key__",
	}
	bldr.Text = &TodoQueryProperty{
		bldr: bldr,
		name: "Text",
	}
	bldr.Done = &TodoQueryProperty{
		bldr: bldr,
		name: "Done",
	}
	bldr.UpdatedAt = &TodoQueryProperty{
		bldr: bldr,
		name: "UpdatedAt",
	}
	bldr.CreatedAt = &TodoQueryProperty{
		bldr: bldr,
		name: "CreatedAt",
	}

	if plugger, ok := interface{}(bldr).(qbgutils.Plugger); ok {
		bldr.plugin = plugger.Plugin()
		bldr.plugin.Init("Todo")
	}

	return bldr
}
19833
func Metadatify(i interface{}) (Metadata, error) {
	value := reflect.ValueOf(i)
	if value.Kind() == reflect.Map {
		m := map[string]interface{}{}
		for _, k := range value.MapKeys() {
			m[k.String()] = value.MapIndex(k).Interface()
		}
		return Metadata(m), nil
	}
	return nil, errors.New("is not a map")
}
1177565
func (f *FS) getObjectMeta(ctx context.Context, objectname string) (*object, error) {

	req := &s3.HeadObjectInput{
		Key:    aws.String(objectname),
		Bucket: aws.String(f.bucket),
	}

	res, err := f.client.HeadObjectWithContext(ctx, req)
	if err != nil {
		// translate the string error to typed error
		if strings.Contains(err.Error(), "Not Found") {
			return nil, cloudstorage.ErrObjectNotFound
		}
		return nil, err
	}

	return newObjectFromHead(f, objectname, res), nil
}
640386
func (obj *TypeMeta) GroupVersionKind() schema.GroupVersionKind {
	return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind)
}
41249
func newAEDataQueryBuilderWithKind(kind string) *aeDataQueryBuilder {
	q := datastore.NewQuery(kind)
	bldr := &aeDataQueryBuilder{q: q}
	bldr.Foo = &aeDataQueryProperty{
		bldr: bldr,
		name: "Foo",
	}

	if plugger, ok := interface{}(bldr).(qbgutils.Plugger); ok {
		bldr.plugin = plugger.Plugin()
		bldr.plugin.Init("AEData")
	}

	return bldr
}
180504
func (g Graph) NodesByKind(nodeKinds ...string) []graph.Node {
	ret := []graph.Node{}

	kinds := sets.NewString(nodeKinds...)
	for _, node := range g.internal.Nodes() {
		if kinds.Has(g.Kind(node)) {
			ret = append(ret, node)
		}
	}

	return ret
}
450298
func (p *Parser) objectType() (*ast.ObjectType, error) {
	defer un(trace(p, "ParseObjectType"))

	// we assume that the currently scanned token is a LBRACE
	o := &ast.ObjectType{}

	l, err := p.objectList()

	// if we hit RBRACE, we are good to go (means we parsed all Items), if it's
	// not a RBRACE, it's an syntax error and we just return it.
	if err != nil && p.tok.Type != token.RBRACE {
		return nil, err
	}

	o.List = l
	return o, nil
}
1364361
func (h *healSequence) healMinioSysMeta(metaPrefix string) func() error {
	return func() error {
		// Get current object layer instance.
		objectAPI := newObjectLayerFn()
		if objectAPI == nil {
			return errServerNotInitialized
		}

		// NOTE: Healing on meta is run regardless
		// of any bucket being selected, this is to ensure that
		// meta are always upto date and correct.
		return objectAPI.HealObjects(h.ctx, minioMetaBucket, metaPrefix, func(bucket string, object string) error {
			if h.isQuitting() {
				return errHealStopSignalled
			}
			res, herr := objectAPI.HealObject(h.ctx, bucket, object, h.settings.DryRun, h.settings.Remove, h.settings.ScanMode)
			// Object might have been deleted, by the time heal
			// was attempted we ignore this object an move on.
			if isErrObjectNotFound(herr) {
				return nil
			}
			if herr != nil {
				return herr
			}
			res.Type = madmin.HealItemBucketMetadata
			return h.pushHealResultItem(res)
		})
	}
}
148809
func Kind(kind model.Kind) SpanOption {
	return func(t *Tracer, s *spanImpl) {
		s.Kind = kind
	}
}
830745
func (L *State) CallMeta(obj int, e string) int {
	Ce := C.CString(e)
	defer C.free(unsafe.Pointer(Ce))
	return int(C.luaL_callmeta(L.s, C.int(obj), Ce))
}
921803
func SetMetaDataAnnotation(obj *ObjectMeta, ann string, value string) {
	if obj.Annotations == nil {
		obj.Annotations = make(map[string]string)
	}
	obj.Annotations[ann] = value
}
85489
func (c *customMetricsClient) qualResourceForKind(groupKind schema.GroupKind) (string, error) {
	mapping, err := c.mapper.RESTMapping(groupKind)
	if err != nil {
		return "", fmt.Errorf("unable to map kind %s to resource: %v", groupKind.String(), err)
	}

	gr := mapping.Resource.GroupResource()
	return gr.String(), nil
}