// Same as Res() Method, but returns a Resource with url resource/:id
549181
func (r *Resource) Id(options ...interface{}) *Resource {
	if len(options) > 0 {
		id := ""
		switch v := options[0].(type) {
		default:
			id = v.(string)
		case int:
			id = strconv.Itoa(v)
		case int64:
			id = strconv.FormatInt(v, 10)
		}
		url := r.Url + "/" + id
		header := r.Headers
		if header == nil {
			header = http.Header{}
		}
		newR := &Resource{id: id, Url: url, Api: r.Api, Headers: header, Response: &r.Response}

		if len(options) > 1 {
			newR.Response = options[1]
		}
		return newR
	}
	return r
}
362487
func (s *Search) Resource(resource string, params *url.Values) (*[]byte, error) {
	if s.conn == nil {
		return nil, fmt.Errorf("No connection found for making request to solr")
	}
	return s.conn.Resource(resource, params)
}
275591
func ResourceID(arn string) (string, error) {
	a, err := Parse(arn)
	if err != nil {
		return "", err
	}

	_, id, err := SplitResource(a.Resource)
	return id, err
}
524210
func Post(url string, v ...interface{}) (*Resp, error) {
	return std.Post(url, v...)
}
784272
func (n Name) Resource() string {
	name := n.Underscore()
	x := strings.FieldsFunc(name, func(r rune) bool {
		return r == '_' || r == '/'
	})

	for i, w := range x {
		if i == len(x)-1 {
			x[i] = Camelize(Pluralize(strings.ToLower(w)))
			continue
		}

		x[i] = Camelize(w)
	}

	return strings.Join(x, "")
}
946735
func (a *attributes) GetResource() string {
	if a.event.ObjectRef == nil {
		return ""
	}
	return a.event.ObjectRef.Resource
}
569498
func NewResourceByStringID(id string) *Resource {
	intID, err := strconv.ParseInt(id, 10, 64)
	if err != nil {
		panic(err)
	}
	return &Resource{ID: intID}
}
373470
func (r *BulkUpdateRequest) Id(id string) *BulkUpdateRequest {
	r.id = id
	r.source = nil
	return r
}
7461
func WithResourceID(id int64) MarshalOption {
	return func(c *MarshalConfig) error {
		c.ID = id
		return nil
	}
}
616771
func (c *Client) GetResource(providerID, resourceID string) (*ct.Resource, error) {
	res := &ct.Resource{}
	err := c.Get(fmt.Sprintf("/providers/%s/resources/%s", providerID, resourceID), res)
	return res, err
}
1218940
func (d *ResourceData) Id() string {
	var result string

	if d.state != nil {
		result = d.state.ID
		if result == "" {
			result = d.state.Attributes["id"]
		}
	}

	if d.newState != nil {
		result = d.newState.ID
		if result == "" {
			result = d.newState.Attributes["id"]
		}
	}

	return result
}
762132
func SplitResource(r string) (resource, id string, err error) {
	p := strings.Split(r, "/")

	if len(p) != 2 {
		err = ErrInvalidResource
		return
	}

	resource = p[0]
	id = p[1]

	return
}
677474
func API2Resource(apiRes params.Resource) (resource.Resource, error) {
	var res resource.Resource

	charmRes, err := API2CharmResource(apiRes.CharmResource)
	if err != nil {
		return res, errors.Trace(err)
	}

	res = resource.Resource{
		Resource:      charmRes,
		ID:            apiRes.ID,
		PendingID:     apiRes.PendingID,
		ApplicationID: apiRes.ApplicationID,
		Username:      apiRes.Username,
		Timestamp:     apiRes.Timestamp,
	}

	if err := res.Validate(); err != nil {
		return res, errors.Trace(err)
	}

	return res, nil
}
794800
func (d *DNS) GetResourcesByType(domainID int, res_type string) ([]*Resource, error) {
	resources, err := d.GetDomainResources(domainID)
	if err != nil {
		return nil, err
	}

	list := []*Resource{}
	for _, r := range resources {
		if strings.EqualFold(r.Type, res_type) {
			list = append(list, r)
		}
	}

	return list, nil
}
233307
func (c csclientImpl) GetResource(channel csparams.Channel, id *charm.URL, name string, revision int) (csclient.ResourceData, error) {
	client := c.WithChannel(channel)
	return client.GetResource(id, name, revision)
}
58546
func (c *Connection) Get(index string, documentType string, id string, extraArgs url.Values) (*Response, error) {
	r := Request{
		Conn:      c,
		IndexList: []string{index},
		method:    "GET",
		api:       documentType + "/" + id,
		ExtraArgs: extraArgs,
	}

	return r.Run()
}
943144
func (nu *Numbered) Get(id int64, purpose string) (val interface{}, err error) {
	nu.mu.Lock()
	defer nu.mu.Unlock()
	nw, ok := nu.resources[id]
	if !ok {
		if val, ok := nu.recentlyUnregistered.Get(fmt.Sprintf("%v", id)); ok {
			unreg := val.(*unregistered)
			return nil, fmt.Errorf("ended at %v (%v)", unreg.timeUnregistered.Format("2006-01-02 15:04:05.000 MST"), unreg.reason)
		}
		return nil, fmt.Errorf("not found")
	}
	if nw.inUse {
		return nil, fmt.Errorf("in use: %s", nw.purpose)
	}
	nw.inUse = true
	nw.purpose = purpose
	return nw.val, nil
}