// PutResource updates a resource.
498266
func (c *Client) PutResource(resource *ct.Resource) error {
	if resource.ID == "" || resource.ProviderID == "" {
		return errors.New("controller: missing id and/or provider id")
	}
	return c.Put(fmt.Sprintf("/providers/%s/resources/%s", resource.ProviderID, resource.ID), resource, resource)
}
1321191
func (s *LambdaOutputUpdate) SetResourceARNUpdate(v string) *LambdaOutputUpdate {
	s.ResourceARNUpdate = &v
	return s
}
572883
func (s *Change) SetResourceChange(v *ResourceChange) *Change {
	s.ResourceChange = v
	return s
}
922499
func (s *Event) SetResources(v []*Resource) *Event {
	s.Resources = v
	return s
}
135047
func (s *SourceAuth) SetResource(v string) *SourceAuth {
	s.Resource = &v
	return s
}
349304
func (s *CreateClusterInput) SetResources(v *JobResource) *CreateClusterInput {
	s.Resources = v
	return s
}
1306413
func (s *AddTagsOutput) SetResourceType(v string) *AddTagsOutput {
	s.ResourceType = &v
	return s
}
4303
func (rr *RoundRobin) Put(resource Resource) {
	rr.mu.Lock()
	defer rr.available.Signal()
	defer rr.mu.Unlock()

	if rr.size > int64(cap(rr.resources)) {
		if resource != nil {
			go resource.Close()
		}
		rr.size--
	} else if resource == nil {
		rr.size--
	} else {
		if len(rr.resources) == cap(rr.resources) {
			panic("unexpected")
		}
		rr.resources <- fifoWrapper{resource, time.Now()}
	}
}
1361997
func UploadResource(resource interface{}, baseURL string) (string, error) {
	// FYI: We can post resource w/ bogus id because it doesn't get serialized
	json, _ := json.Marshal(resource)
	body := bytes.NewReader(json)
	url := baseURL + "/" + reflect.TypeOf(resource).Elem().Name()
	response, err := http.Post(url, "application/json+fhir", body)
	if err != nil {
		return "", err
	}
	defer response.Body.Close()
	loc := response.Header.Get("Location")

	regs := []string{".*/([^/]+)/_history/.*", ".*/([^/]+)"}
	for _, reg := range regs {
		creg := regexp.MustCompile(reg)
		if matches := creg.FindStringSubmatch(loc); matches != nil {
			setId(resource, matches[1])
			break
		}
	}

	return loc, nil
}
214371
func (s *RoleUsageType) SetResources(v []*string) *RoleUsageType {
	s.Resources = v
	return s
}
1291119
func (t *Template) AddResource(name string, resource ResourceProperties) *Resource {
	templateResource := &Resource{Properties: resource}
	t.Resources[name] = templateResource
	return templateResource
}
495490
func (p ResourcePersistence) SetUnitResource(unitID string, res resource.Resource) error {
	if res.PendingID != "" {
		return errors.Errorf("pending resources not allowed")
	}
	return p.setUnitResource(unitID, res, nil)
}
1105207
func updateResource(res charmresource.Resource, fp charmresource.Fingerprint, size int64) (charmresource.Resource, error) {
	res.Origin = charmresource.OriginUpload
	res.Revision = 0
	res.Fingerprint = fp
	res.Size = size

	if err := res.Validate(); err != nil {
		return res, errors.Trace(err)
	}
	return res, nil
}
111036
func (s *PutEventsRequestEntry) SetResources(v []*string) *PutEventsRequestEntry {
	s.Resources = v
	return s
}
170197
func (s *Version) SetResourcesSupported(v bool) *Version {
	s.ResourcesSupported = &v
	return s
}
419930
func (s *TaskTimedOutEventDetails) SetResource(v string) *TaskTimedOutEventDetails {
	s.Resource = &v
	return s
}
821659
func (s *CreateApplicationVersionOutput) SetResourcesSupported(v bool) *CreateApplicationVersionOutput {
	s.ResourcesSupported = &v
	return s
}