// GetDroplet returns a droplet with the given GUID.
7687
func (client *Client) GetDroplet(dropletGUID string) (Droplet, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetDropletRequest,
		URIParams:   map[string]string{"droplet_guid": dropletGUID},
	})
	if err != nil {
		return Droplet{}, nil, err
	}

	var responseDroplet Droplet
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &responseDroplet,
	}
	err = client.connection.Make(request, &response)

	return responseDroplet, response.Warnings, err
}
1022542
func GetDroplets(token string) (*DropletsResponse, error) {
	client := &http.Client{}
	req, err := BuildRequest(token, "GET", apiBaseURL+apiDropletURL, nil)
	if err != nil {
		return nil, err
	}
	rsp, err := client.Do(req)
	if err != nil {
		return nil, err
	}
	defer rsp.Body.Close()
	b, err := ioutil.ReadAll(rsp.Body)
	if err != nil {
		return nil, err
	}
	if rsp.Status[0] != StatusOk {
		return nil, fmt.Errorf("Error: %s: %s", rsp.Status, string(b))
	}

	r := &DropletsResponse{}
	err = json.Unmarshal(b, r)
	if err != nil {
		return nil, err
	}
	return r, nil
}
589641
func getUserUIDGID(_ string) (int, int, error) {
	u, err := user.Lookup(libvirtUser)
	if err != nil {
		return -1, -1, errors.Trace(err)
	}
	uid, err := strconv.ParseUint(u.Uid, 10, 32)
	if err != nil {
		return -1, -1, errors.Trace(err)
	}
	gid, err := strconv.ParseUint(u.Gid, 10, 32)
	if err != nil {
		return -1, -1, errors.Trace(err)
	}
	return int(uid), int(gid), nil
}
755995
func (c *Client) DropletID() (int, error) {
	dropletID := new(int)
	err := c.doGet("id", func(r io.Reader) error {
		_, err := fmt.Fscanf(r, "%d", dropletID)
		return err
	})
	return *dropletID, err
}
1261905
func (d *Driver) Get(id, mountLabel string) (string, error) {
	mp := path.Join(d.home, "mnt", id)

	uid, gid, err := idtools.GetRootUIDGID(d.uidMaps, d.gidMaps)
	if err != nil {
		return "", err
	}
	// Create the target directories if they don't exist
	if err := idtools.MkdirAllAs(path.Join(d.home, "mnt"), 0755, uid, gid); err != nil && !os.IsExist(err) {
		return "", err
	}
	if err := idtools.MkdirAs(mp, 0755, uid, gid); err != nil && !os.IsExist(err) {
		return "", err
	}

	// Mount the device
	if err := d.DeviceSet.MountDevice(id, mp, mountLabel); err != nil {
		return "", err
	}

	rootFs := path.Join(mp, "rootfs")
	if err := idtools.MkdirAllAs(rootFs, 0755, uid, gid); err != nil && !os.IsExist(err) {
		d.DeviceSet.UnmountDevice(id, mp)
		return "", err
	}

	idFile := path.Join(mp, "id")
	if _, err := os.Stat(idFile); err != nil && os.IsNotExist(err) {
		// Create an "id" file with the container/image id in it to help reconstruct this in case
		// of later problems
		if err := ioutil.WriteFile(idFile, []byte(id), 0600); err != nil {
			d.DeviceSet.UnmountDevice(id, mp)
			return "", err
		}
	}

	return rootFs, nil
}
432090
func (v *Service) GetModuleID() (o ModuleID) {
	if v != nil {
		o = v.ModuleID
	}
	return
}
1332549
func (s *Server) GetNode(ctx context.Context, request *api.GetNodeRequest) (*api.GetNodeResponse, error) {
	if request.NodeID == "" {
		return nil, status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
	}

	var node *api.Node
	s.store.View(func(tx store.ReadTx) {
		node = store.GetNode(tx, request.NodeID)
	})
	if node == nil {
		return nil, status.Errorf(codes.NotFound, "node %s not found", request.NodeID)
	}

	if s.raft != nil {
		memberlist := s.raft.GetMemberlist()
		for _, member := range memberlist {
			if member.NodeID == node.ID {
				node.ManagerStatus = &api.ManagerStatus{
					RaftID:       member.RaftID,
					Addr:         member.Addr,
					Leader:       member.Status.Leader,
					Reachability: member.Status.Reachability,
				}
				break
			}
		}
	}

	return &api.GetNodeResponse{
		Node: node,
	}, nil
}
890059
func (api *Client) GetApplication(id string) (*Application, error) {
	result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", api.concatUserPath(applicationsPath), id), &Application{})
	if err != nil {
		return nil, err
	}
	return result.(*Application), nil
}
150936
func GetSessionByUID(uid string) *Session {
	// TODO: Block this operation in backend servers
	if val, ok := sessionsByUID.Load(uid); ok {
		return val.(*Session)
	}
	return nil
}
1274898
func (d *Daemon) GetIDByName(name string) (string, error) {
	return d.inspectFieldWithError(name, "Id")
}
944076
func (client *Client) GetBuild(guid string) (Build, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetBuildRequest,
		URIParams:   internal.Params{"build_guid": guid},
	})
	if err != nil {
		return Build{}, nil, err
	}

	var responseBuild Build
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &responseBuild,
	}
	err = client.connection.Make(request, &response)

	return responseBuild, response.Warnings, err
}
497482
func (c *Client) GetVolume(id string, name string) (Volume, error) {
	volume, err := c.api.GetVolume(id, name)
	if err != nil {
		return nil, err
	}
	return volume.Content, nil
}
152468
func (u *UserLDAPMapping) GetID() int64 {
	if u == nil || u.ID == nil {
		return 0
	}
	return *u.ID
}
551704
func GetDropletInternalIP() (net.IP, error) {
	addr, err := getMetadata(dropletInternalIPMetadataURL)
	if err != nil {
		return nil, err
	}

	return net.ParseIP(addr), nil
}
810893
func (actor Actor) GetStack(guid string) (Stack, Warnings, error) {
	stack, warnings, err := actor.CloudControllerClient.GetStack(guid)

	if _, ok := err.(ccerror.ResourceNotFoundError); ok {
		return Stack{}, Warnings(warnings), actionerror.StackNotFoundError{GUID: guid}
	}

	return Stack(stack), Warnings(warnings), err
}
856181
func IsDrop(e Element) bool {
	// Specified in the last value recorded value and since deleted from the local
	removed := e.HasRecorded() && !e.HasLocal()

	// Specified locally and explicitly set to null
	setToNil := e.HasLocal() && e.GetLocal() == nil

	return removed || setToNil
}
1215929
func (c *Client) GetSecGroup(guid string) (*SecGroup, error) {
	//Perform the GET and check for errors
	resp, err := c.DoRequest(c.NewRequest("GET", "/v2/security_groups/"+guid))
	if err != nil {
		return nil, err
	}
	if resp.StatusCode != 200 {
		return nil, fmt.Errorf("CF API returned with status code %d", resp.StatusCode)
	}
	//get the json out of the response body
	return respBodyToSecGroup(resp.Body, c)
}