// GetResource returns the extended, model-related info for the non-pending
// resource.
425684
func (p ResourcePersistence) GetResource(id string) (res resource.Resource, storagePath string, _ error) {
	doc, err := p.getOne(id)
	if err != nil {
		return res, "", errors.Trace(err)
	}

	stored, err := doc2resource(doc)
	if err != nil {
		return res, "", errors.Trace(err)
	}

	return stored.Resource, stored.storagePath, nil
}
780456
func (c *Client) Get(fs afero.Fs, filename string) (resource.Resource, error) {
	filename = filepath.Clean(filename)
	return c.rs.ResourceCache.GetOrCreate(resources.ResourceKeyPartition(filename), filename, func() (resource.Resource, error) {
		return c.rs.NewForFs(fs,
			resources.ResourceSourceDescriptor{
				LazyPublish:    true,
				SourceFilename: filename})
	})

}
863047
func (s *Snapshot) GetResources(typ string) map[string]Resource {
	if s == nil {
		return nil
	}
	switch typ {
	case EndpointType:
		return s.Endpoints.Items
	case ClusterType:
		return s.Clusters.Items
	case RouteType:
		return s.Routes.Items
	case ListenerType:
		return s.Listeners.Items
	case SecretType:
		return s.Secrets.Items
	}
	return nil
}
778560
func GetResourceParams(r *raml.Resource) []string {
	params := []string{}
	return _getResourceParams(r, params)
}
471176
func (st resourceState) GetResource(applicationID, name string) (resource.Resource, error) {
	id := newResourceID(applicationID, name)
	res, _, err := st.persist.GetResource(id)
	if err != nil {
		if err := st.raw.VerifyApplication(applicationID); err != nil {
			return resource.Resource{}, errors.Trace(err)
		}
		return res, errors.Trace(err)
	}
	return res, nil
}
312803
func (rc *ResourceController) LoadResource(c *gin.Context) (interface{}, error) {
	result, err := rc.DAL.Get(c.Param("id"), rc.Name)
	if err != nil {
		return nil, err
	}

	c.Set(rc.Name, result)
	c.Set("Resource", rc.Name)
	return result, nil
}
220635
func (p Protos) GetResource(resourceID string) (*resource.Resource, error) {
	url := p.createURL("resource/" + resourceID)
	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		return nil, err
	}

	res, err := p.makeRequest(req)
	if err != nil {
		return nil, err
	}

	rsc := resource.Resource{}
	err = json.Unmarshal(res, &rsc)
	if err != nil {
		return nil, err
	}
	return &rsc, nil
}
111136
func getResourceFieldRef(from *corev1.EnvVarSource, c *corev1.Container) (string, error) {
	return resource.ExtractContainerResourceValue(from.ResourceFieldRef, c)
}
10013
func (s *customResourceDefinitionLister) Get(name string) (*apiextensions.CustomResourceDefinition, error) {
	obj, exists, err := s.indexer.GetByKey(name)
	if err != nil {
		return nil, err
	}
	if !exists {
		return nil, errors.NewNotFound(apiextensions.Resource("customresourcedefinition"), name)
	}
	return obj.(*apiextensions.CustomResourceDefinition), nil
}
391415
func GetResourceHealth(obj *unstructured.Unstructured, resourceOverrides map[string]appv1.ResourceOverride) (*appv1.HealthStatus, error) {

	if obj.GetDeletionTimestamp() != nil {
		return &appv1.HealthStatus{
			Status:  appv1.HealthStatusProgressing,
			Message: "Pending deletion",
		}, nil
	}

	health, err := getResourceHealthFromLuaScript(obj, resourceOverrides)
	if err != nil {
		health = &appv1.HealthStatus{
			Status:  appv1.HealthStatusUnknown,
			Message: err.Error(),
		}
		return health, err
	}
	if health != nil {
		return health, nil
	}

	gvk := obj.GroupVersionKind()
	switch gvk.Group {
	case "apps", "extensions":
		switch gvk.Kind {
		case kube.DeploymentKind:
			health, err = getDeploymentHealth(obj)
		case kube.IngressKind:
			health, err = getIngressHealth(obj)
		case kube.StatefulSetKind:
			health, err = getStatefulSetHealth(obj)
		case kube.ReplicaSetKind:
			health, err = getReplicaSetHealth(obj)
		case kube.DaemonSetKind:
			health, err = getDaemonSetHealth(obj)
		}
	case "argoproj.io":
		switch gvk.Kind {
		case "Application":
			health, err = getApplicationHealth(obj)
		}
	case "":
		switch gvk.Kind {
		case kube.ServiceKind:
			health, err = getServiceHealth(obj)
		case kube.PersistentVolumeClaimKind:
			health, err = getPVCHealth(obj)
		case kube.PodKind:
			health, err = getPodHealth(obj)
		}
	case "batch":
		switch gvk.Kind {
		case kube.JobKind:
			health, err = getJobHealth(obj)
		}
	}
	if err != nil {
		health = &appv1.HealthStatus{
			Status:  appv1.HealthStatusUnknown,
			Message: err.Error(),
		}
	}
	return health, err
}
53789
func (m *MockResources) Get(arg0 string) facade.Resource {
	ret := m.ctrl.Call(m, "Get", arg0)
	ret0, _ := ret[0].(facade.Resource)
	return ret0
}
742416
func NewResource(context hap.Context, imgFn GetImageFunc) *Resource {
	r := Resource{
		context: context,
		imgFn:   imgFn,
	}

	return &r
}
41042
func (rm *StateResourceManager) findResource(id, desc string) (core.Resource, bool, error) {
	alreadyExists := false
	rsrcType, ok := resourceRegistry[desc]
	if !ok {
		return nil, alreadyExists,
			core.Errorf("No resource found for description: %q", desc)
	}

	val := reflect.New(rsrcType)
	// sanity checks
	if !val.Elem().FieldByName("CommonState").IsValid() {
		return nil, false, core.Errorf("The state structure %v is missing core.CommonState", rsrcType)
	}
	//the following works as every core.State is expected to embed core.CommonState struct
	val.Elem().FieldByName("CommonState").FieldByName("StateDriver").Set(reflect.ValueOf(rm.stateDriver))
	val.Elem().FieldByName("CommonState").FieldByName("ID").Set(reflect.ValueOf(id))

	rsrc := val.Interface().(core.Resource)
	rsrcs, err := rsrc.ReadAll()
	if core.ErrIfKeyExists(err) != nil {
		return nil, alreadyExists, err
	} else if err != nil {
		// set the slice as empty in case of 'key not found' error
		rsrcs = []core.State{}
	}

	for _, r := range rsrcs {
		//the following works as every core.State is expected to embed core.CommonState struct
		cs := reflect.ValueOf(r).Elem().FieldByName("CommonState").Interface().(core.CommonState)
		if cs.ID == id {
			alreadyExists = true
			return r.(core.Resource), alreadyExists, nil
		}
	}
	return rsrc, alreadyExists, nil
}
377146
func (p Protos) GetResources() (map[string]*resource.Resource, error) {

	resources := Resources{}
	resourcesReq, err := http.NewRequest("GET", p.createURL("resource/provider"), nil)
	if err != nil {
		return resources, err
	}

	payload, err := p.makeRequest(resourcesReq)
	if err != nil {
		return resources, err
	}

	err = json.Unmarshal(payload, &resources)
	if err != nil {
		return resources, err
	}

	return resources, nil
}
1135057
func (rr *RoundRobin) Get() (resource Resource, err error) {
	return rr.get(true)
}
413895
func (r Network_Storage_Allowed_Host_IpAddress) GetResource() (resp datatypes.Network_Subnet_IpAddress, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Storage_Allowed_Host_IpAddress", "getResource", nil, &r.Options, &resp)
	return
}
107503
func GetResource(r rest.Getter, e rest.Exporter, scope *RequestScope) http.HandlerFunc {
	return getResourceHandler(scope,
		func(ctx context.Context, name string, req *http.Request, trace *utiltrace.Trace) (runtime.Object, error) {
			// check for export
			options := metav1.GetOptions{}
			if values := req.URL.Query(); len(values) > 0 {
				exports := metav1.ExportOptions{}
				if err := metainternalversion.ParameterCodec.DecodeParameters(values, scope.MetaGroupVersion, &exports); err != nil {
					err = errors.NewBadRequest(err.Error())
					return nil, err
				}
				if exports.Export {
					if e == nil {
						return nil, errors.NewBadRequest(fmt.Sprintf("export of %q is not supported", scope.Resource.Resource))
					}
					return e.Export(ctx, name, exports)
				}
				if err := metainternalversion.ParameterCodec.DecodeParameters(values, scope.MetaGroupVersion, &options); err != nil {
					err = errors.NewBadRequest(err.Error())
					return nil, err
				}
			}
			if trace != nil {
				trace.Step("About to Get from storage")
			}
			return r.Get(ctx, name, &options)
		})
}