// Get a single Pipeline object in the GoCD API.
965432
func (pcs *PipelineConfigsService) Get(ctx context.Context, name string) (p *Pipeline, resp *APIResponse, err error) {

	apiVersion, err := pcs.client.getAPIVersion(ctx, "admin/pipelines/:pipeline_name")
	if err != nil {
		return nil, nil, err
	}

	p = &Pipeline{}
	_, resp, err = pcs.client.getAction(ctx, &APIClientRequest{
		Path:         "admin/pipelines/" + name,
		APIVersion:   apiVersion,
		ResponseBody: p,
	})

	return
}
923442
func Getcd(skip int) string {
	if dir := Geted(); strings.HasPrefix(dir, os.TempDir()) {
		pc, _, _, _ := runtime.Caller(skip + 1)
		function := runtime.FuncForPC(pc)
		filename, _ := function.FileLine(0)
		return path.Dir(filename)

	} else {
		return dir
	}
}
880645
func (ss *segmentStack) get(key []byte, segStart int, base *segmentStack,
	readOptions ReadOptions) ([]byte, error) {
	if segStart >= 0 {
		ss.ensureSorted(0, segStart)

		for seg := segStart; seg >= 0; seg-- {
			b := ss.a[seg]

			op, val, err := b.Get(key)
			if err != nil {
				return nil, err
			}
			if val != nil {
				if op == OperationDel {
					return nil, nil
				}
				if op == OperationMerge {
					return ss.getMerged(key, val, seg-1, base, readOptions)
				}
				return val, nil
			}
		}
	}

	if base != nil {
		return base.Get(key, readOptions)
	}

	if !readOptions.SkipLowerLevel && ss.lowerLevelSnapshot != nil {
		return ss.lowerLevelSnapshot.Get(key, readOptions)
	} // TODO: else add a special return error indicating cache-miss!

	return nil, nil
}
20933
func (cg *CgroupV1) GetCPUData(pid int, cgPath string) (*rspec.LinuxCPU, error) {
	if filepath.IsAbs(cgPath) {
		path := filepath.Join(cg.MountPath, "cpu", cgPath)
		if _, err := os.Stat(path); err != nil {
			if os.IsNotExist(err) {
				return nil, specerror.NewError(specerror.CgroupsAbsPathRelToMount, fmt.Errorf("In the case of an absolute path, the runtime MUST take the path to be relative to the cgroups mount point"), rspec.Version)
			}
			return nil, err
		}
	}
	lc := &rspec.LinuxCPU{}
	names := []string{"shares", "cfs_quota_us", "cfs_period_us"}
	for i, name := range names {
		fileName := strings.Join([]string{"cpu", name}, ".")
		filePath := filepath.Join(cg.MountPath, "cpu", cgPath, fileName)
		if !filepath.IsAbs(cgPath) {
			subPath, err := GetSubsystemPath(pid, "cpu")
			if err != nil {
				return nil, err
			}
			if !strings.Contains(subPath, cgPath) {
				return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "cpu")
			}
			filePath = filepath.Join(cg.MountPath, "cpu", subPath, fileName)
		}
		contents, err := ioutil.ReadFile(filePath)
		if err != nil {
			if os.IsNotExist(err) {
				return nil, specerror.NewError(specerror.CgroupsPathAttach, fmt.Errorf("The runtime MUST consistently attach to the same place in the cgroups hierarchy given the same value of `cgroupsPath`"), rspec.Version)
			}

			return nil, err
		}
		switch i {
		case 0:
			res, err := strconv.ParseUint(strings.TrimSpace(string(contents)), 10, 64)
			if err != nil {
				return nil, err
			}
			shares := res
			lc.Shares = &shares
		case 1:
			res, err := strconv.ParseInt(strings.TrimSpace(string(contents)), 10, 64)
			if err != nil {
				return nil, err
			}
			quota := res
			lc.Quota = &quota
		case 2:
			res, err := strconv.ParseUint(strings.TrimSpace(string(contents)), 10, 64)
			if err != nil {
				return nil, err
			}
			period := res
			lc.Period = &period
		}
	}
	// CONFIG_RT_GROUP_SCHED may be not set
	// Can always get rt data from /proc
	contents, err := ioutil.ReadFile("/proc/sys/kernel/sched_rt_period_us")
	if err != nil {
		return nil, err
	}
	rtPeriod, err := strconv.ParseUint(strings.TrimSpace(string(contents)), 10, 64)
	if err != nil {
		return nil, err
	}
	lc.RealtimePeriod = &rtPeriod
	contents, err = ioutil.ReadFile("/proc/sys/kernel/sched_rt_runtime_us")
	if err != nil {
		return nil, err
	}
	rtQuota, err := strconv.ParseInt(strings.TrimSpace(string(contents)), 10, 64)
	if err != nil {
		return nil, err
	}
	lc.RealtimeRuntime = &rtQuota

	names = []string{"cpus", "mems"}
	for i, name := range names {
		fileName := strings.Join([]string{"cpuset", name}, ".")
		filePath := filepath.Join(cg.MountPath, "cpuset", cgPath, fileName)
		if !filepath.IsAbs(cgPath) {
			subPath, err := GetSubsystemPath(pid, "cpuset")
			if err != nil {
				return nil, err
			}
			if !strings.Contains(subPath, cgPath) {
				return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "cpuset")
			}
			filePath = filepath.Join(cg.MountPath, "cpuset", subPath, fileName)
		}
		contents, err := ioutil.ReadFile(filePath)
		if err != nil {
			return nil, err
		}
		switch i {
		case 0:
			lc.Cpus = strings.TrimSpace(string(contents))
		case 1:
			lc.Mems = strings.TrimSpace(string(contents))
		}
	}

	return lc, nil
}
991923
func (pts *PipelineTemplatesService) Get(ctx context.Context, name string) (pt *PipelineTemplate, resp *APIResponse, err error) {
	apiVersion, err := pts.client.getAPIVersion(ctx, "admin/templates/:template_name")
	if err != nil {
		return nil, nil, err
	}

	pt = &PipelineTemplate{}
	_, resp, err = pts.client.getAction(ctx, &APIClientRequest{
		Path:         "admin/templates/" + name,
		APIVersion:   apiVersion,
		ResponseBody: pt,
	})

	return
}
481669
func (os *OpenStack) getVolume(volumeID string) (Volume, error) {
	volumes, err := os.volumeService("")
	if err != nil {
		return Volume{}, fmt.Errorf("unable to initialize cinder client for region: %s, err: %v", os.region, err)
	}
	return volumes.getVolume(volumeID)
}
1274391
func (d *DeviceMapperDriver) Get(volumeName string) (volume.Volume, error) {
	glog.V(2).Infof("Get() (%s) START", volumeName)
	defer glog.V(2).Infof("Get() (%s) END", volumeName)
	glog.V(2).Infof("Getting devicemapper volume %s", volumeName)
	vol, err := d.getVolume(volumeName, false)
	if err != nil {
		glog.Errorf("Error getting devicemapper volume: %s", err)
		if err == ErrNoMetadata {
			err = volume.ErrVolumeNotExists
		}
		return nil, err
	}
	if mounted, _ := devmapper.Mounted(vol.Path()); !mounted {
		deviceHash := vol.deviceHash()
		mountpoint := vol.Path()
		label := vol.Tenant()

		if err := d.DeviceSet.MountDevice(deviceHash, mountpoint, label); err != nil {
			glog.Errorf("Error mounting device %q on %q for volume %q: %s", deviceHash, mountpoint, volumeName, err)
			return nil, err
		}
		glog.V(2).Infof("Mounted device %s to %s", deviceHash, mountpoint)
	} else {
		glog.V(2).Infof("%s is already a mount point", vol.Path())
	}
	return vol, nil
}
1213394
func (c *Tx) Pipeline() Pipeliner {
	pipe := Pipeline{
		exec: c.processTxPipeline,
	}
	pipe.statefulCmdable.setProcessor(pipe.Process)
	return &pipe
}
1127752
func (c ChannelAwareFakeClient) Get(path string, value interface{}) error {
	return c.charmstore.Get(path, value)
}
885750
func (c *Client) GoGetTimestamp() *PipelineRequest {
	pr := newPipelineRequest()
	c.requests <- pr
	return pr
}
251490
func (v Uint) Get(deflt uint) uint {
	if !v.Defined {
		return deflt
	}
	return v.V
}
763840
func (e *CombinedEtcdClient) Get(version *EtcdVersion, key string) (string, error) {
	if version.Major == 2 {
		v2client, err := e.clientV2()
		if err != nil {
			return "", err
		}
		resp, err := v2client.Get(context.Background(), key, nil)
		if err != nil {
			return "", err
		}
		return resp.Node.Value, nil
	}
	v3client, err := e.clientV3()
	if err != nil {
		return "", err
	}
	defer v3client.Close()
	resp, err := v3client.KV.Get(context.Background(), key)
	if err != nil {
		return "", err
	}
	kvs := resp.Kvs
	if len(kvs) != 1 {
		return "", fmt.Errorf("expected exactly one value for key %s but got %d", key, len(kvs))
	}

	return string(kvs[0].Value), nil
}
154954
func (s *UpdateByQueryService) Pipeline(pipeline string) *UpdateByQueryService {
	s.pipeline = pipeline
	return s
}
217645
func getPipelineCommand() *cli.Command {
	return &cli.Command{
		Name:     GetPipelineCommandName,
		Usage:    GetPipelineCommandUsage,
		Category: "Pipelines",
		Flags: []cli.Flag{
			cli.StringFlag{Name: "name"},
		},
		Action: ActionWrapper(getPipelineAction),
	}
}
1279578
func getCD(config *config.Config) string {
	for _, option := range config.ExecOptions {
		key, val, err := parsers.ParseKeyValueOpt(option)
		if err != nil || !strings.EqualFold(key, "native.cgroupdriver") {
			continue
		}
		return val
	}
	return ""
}
582550
func (db *Database) Pipeline() (*Pipeline, error) {
	db.mux.Lock()
	defer db.mux.Unlock()
	return newPipeline(db)
}
855140
func Get() (procs *Processors, err error) {
	stdMu.Lock()
	defer stdMu.Unlock()
	if std == nil {
		std, err = NewProfiler()
		if err != nil {
			return nil, err
		}
	}
	return std.Get()
}