// UpdateResource updates an existing resource object in the store.
// Returns ErrNotExist if the object doesn't exist.
180310
func UpdateResource(tx Tx, r *api.Resource) error {
	if err := confirmExtension(tx, r); err != nil {
		return err
	}
	return tx.update(tableResource, resourceEntry{r})
}
1348122
func NewResource(in interface{}, context *compiler.Context) (*Resource, error) {
	errors := make([]error, 0)
	x := &Resource{}
	m, ok := compiler.UnpackMap(in)
	if !ok {
		message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
		errors = append(errors, compiler.NewError(context, message))
	} else {
		allowedKeys := []string{"methods", "resources"}
		var allowedPatterns []*regexp.Regexp
		invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
		if len(invalidKeys) > 0 {
			message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
			errors = append(errors, compiler.NewError(context, message))
		}
		// Methods methods = 1;
		v1 := compiler.MapValueForKey(m, "methods")
		if v1 != nil {
			var err error
			x.Methods, err = NewMethods(v1, compiler.NewContext("methods", context))
			if err != nil {
				errors = append(errors, err)
			}
		}
		// Resources resources = 2;
		v2 := compiler.MapValueForKey(m, "resources")
		if v2 != nil {
			var err error
			x.Resources, err = NewResources(v2, compiler.NewContext("resources", context))
			if err != nil {
				errors = append(errors, err)
			}
		}
	}
	return x, compiler.NewErrorGroupOrNil(errors)
}
1122663
func (a APIObjectVersioner) UpdateObject(obj runtime.Object, resourceVersion uint64) error {
	accessor, err := meta.Accessor(obj)
	if err != nil {
		return err
	}
	versionString := ""
	if resourceVersion != 0 {
		versionString = strconv.FormatUint(resourceVersion, 10)
	}
	accessor.SetResourceVersion(versionString)
	return nil
}
916224
func (c *Client) UploadResource(modelUUID string, res resource.Resource, r io.ReadSeeker) error {
	args := makeResourceArgs(res)
	args.Add("application", res.ApplicationID)
	err := c.resourcePost(modelUUID, args, r)
	return errors.Trace(err)
}
182078
func (res *Resource) Patch(storage store.Update) {
	res.HandleFuncC(
		pat.Patch(patID),
		func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
			res.patchHandler(ctx, w, r, storage)
		},
	)

	res.addRoute(patch, patID)
}
742416
func NewResource(context hap.Context, imgFn GetImageFunc) *Resource {
	r := Resource{
		context: context,
		imgFn:   imgFn,
	}

	return &r
}
331976
func (c *Compiler) AddResource(url string, r io.Reader) error {
	res, err := newResource(url, r)
	if err != nil {
		return err
	}
	c.resources[res.url] = res
	return nil
}
1148091
func (s *ActivityScheduledEventDetails) SetResource(v string) *ActivityScheduledEventDetails {
	s.Resource = &v
	return s
}
1181060
func (s *SourceService) UpdateSource(ctx context.Context, id platform.ID, upd platform.SourceUpdate) (*platform.Source, error) {
	return s.UpdateSourceFn(ctx, id, upd)
}
166726
func (s *TaskSubmittedEventDetails) SetResource(v string) *TaskSubmittedEventDetails {
	s.Resource = &v
	return s
}
1238183
func (s *TaskFailedEventDetails) SetResource(v string) *TaskFailedEventDetails {
	s.Resource = &v
	return s
}
19713
func (s *UpdateGroupQueryInput) SetResourceQuery(v *ResourceQuery) *UpdateGroupQueryInput {
	s.ResourceQuery = v
	return s
}
941084
func (s *UntagResourceInput) SetResource(v string) *UntagResourceInput {
	s.Resource = &v
	return s
}
612746
func (s *KinesisStreamsOutputUpdate) SetResourceARNUpdate(v string) *KinesisStreamsOutputUpdate {
	s.ResourceARNUpdate = &v
	return s
}
854679
func (_m *Store) UpdateNodeResource(ctx context.Context, node *types.Node, cpu types.CPUMap, quota float64, mem int64, action string) error {
	ret := _m.Called(ctx, node, cpu, quota, mem, action)

	var r0 error
	if rf, ok := ret.Get(0).(func(context.Context, *types.Node, types.CPUMap, float64, int64, string) error); ok {
		r0 = rf(ctx, node, cpu, quota, mem, action)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
1318415
func (c *Client) DomainResourceUpdate(resourceID int, conf DomainResourceUpdateOpts) error {
	args, err := c.argMarshal(conf)
	if err != nil {
		return err
	}
	args["ResourceID"] = resourceID

	_, err = c.apiCall("domain.resource.update", args)
	if err != nil {
		return err
	}

	return nil
}
858770
func (client *Client) UpdateResourceMatch(resourcesToMatch []Resource) ([]Resource, Warnings, error) {
	body, err := json.Marshal(resourcesToMatch)
	if err != nil {
		return nil, nil, err
	}

	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.PutResourceMatchRequest,
		Body:        bytes.NewReader(body),
	})
	if err != nil {
		return nil, nil, err
	}

	request.Header.Set("Content-Type", "application/json")

	var matchedResources []Resource
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &matchedResources,
	}

	err = client.connection.Make(request, &response)
	return matchedResources, response.Warnings, err
}