// NewProjectFromPath returns Project with specified absolute path to
// package.
329300
func NewProjectFromPath(absPath string) *Project {
	if absPath == "" {
		er("can't create project: absPath can't be blank")
	}
	if !filepath.IsAbs(absPath) {
		er("can't create project: absPath is not absolute")
	}

	// If absPath is symlink, use its destination.
	fi, err := os.Lstat(absPath)
	if err != nil {
		er("can't read path info: " + err.Error())
	}
	if fi.Mode()&os.ModeSymlink != 0 {
		path, err := os.Readlink(absPath)
		if err != nil {
			er("can't read the destination of symlink: " + err.Error())
		}
		absPath = path
	}

	p := new(Project)
	p.absPath = strings.TrimSuffix(absPath, findCmdDir(absPath))
	p.name = filepath.ToSlash(trimSrcPath(p.absPath, p.SrcPath()))
	return p
}
303084
func (c *FakeProjectRequests) Create(projectRequest *project.ProjectRequest) (result *project.Project, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootCreateAction(projectrequestsResource, projectRequest), &project.Project{})
	if obj == nil {
		return nil, err
	}
	return obj.(*project.Project), err
}
1061713
func (s *ProjectService) NewCreateProjectParams(displaytext string, name string) *CreateProjectParams {
	p := &CreateProjectParams{}
	p.p = make(map[string]interface{})
	p.p["displaytext"] = displaytext
	p.p["name"] = name
	return p
}
23835
func newAppProjects(c *ArgoprojV1alpha1Client, namespace string) *appProjects {
	return &appProjects{
		client: c.RESTClient(),
		ns:     namespace,
	}
}
659205
func (c *Client) ActivateProject(p *ActivateProjectParameter) (*Project, error) {
	obj, err := c.Request("activateProject", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Project), err
}
1361526
func (c *FakeProjects) Create(projectResource *project.Project) (result *project.Project, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootCreateAction(projectsResource, projectResource), &project.Project{})
	if obj == nil {
		return nil, err
	}
	return obj.(*project.Project), err
}
817157
func ProjectDir() string {
	_, filePath, _, _ := runtime.Caller(1)
	return filepath.Dir(filepath.Dir(filePath))
}
446656
func (s *ProjectService) NewListProjectsParams() *ListProjectsParams {
	p := &ListProjectsParams{}
	p.p = make(map[string]interface{})
	return p
}
1227457
func (s *ProjectsService) GetProject(projectName string) (*ProjectInfo, *Response, error) {
	u := fmt.Sprintf("projects/%s", url.QueryEscape(projectName))

	v := new(ProjectInfo)
	resp, err := s.client.Call("GET", u, nil, v)
	return v, resp, err
}
784216
func (a *API) ImportPath() string {
	return path.Join(a.BaseImportPath, a.PackageName())
}
984410
func (l *Location) buildFindPath(endpoint string) string {
	path := fmt.Sprintf("%s/v1/locations/", endpoint)

	if l.Provider != "" {
		path = fmt.Sprintf("%s%s", path, l.Provider)

		if l.Region != "" {
			path = fmt.Sprintf("%s/%s", path, l.Region)
		}
	}

	return path
}
751327
func (s *ProjectService) CreateProject(p *CreateProjectParams) (*CreateProjectResponse, error) {
	resp, err := s.cs.newRequest("createProject", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r CreateProjectResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = getRawValue(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
582451
func CreateProject(name string, composeFiles ...string) (*Project, error) {
	// FIXME(vdemeester) temporarly normalize the project name, should not be needed.
	r := regexp.MustCompile("[^a-z0-9]+")
	name = r.ReplaceAllString(strings.ToLower(name), "")

	apiClient, err := client.NewEnvClient()
	if err != nil {
		return nil, err
	}

	ping := types.Ping{APIVersion: d.CurrentAPIVersion}
	apiClient.NegotiateAPIVersionPing(ping)

	composeProject, err := docker.NewProject(&ctx.Context{
		Context: project.Context{
			ComposeFiles: composeFiles,
			ProjectName:  name,
		},
	}, &config.ParseOptions{
		Interpolate: true,
		Validate:    true,
	})
	if err != nil {
		return nil, err
	}
	p := &Project{
		composeFiles:   composeFiles,
		composeProject: composeProject,
		name:           name,
		listenChan:     make(chan events.Event),
		started:        make(chan struct{}),
		stopped:        make(chan struct{}),
		deleted:        make(chan struct{}),
		client:         apiClient,
		hasOpenedChan:  true,
	}

	// Listen to compose events
	go p.startListening()
	p.composeProject.AddListener(p.listenChan)

	return p, nil
}
992304
func NewPathFromWKB(wkb []byte) *Path {
	p := NewPath()
	if err := p.PointSet.unmarshalWKB(wkb); err != nil {
		return nil
	}

	return p
}
1160922
func ListProjectPaths(projectDir string, include, exclude matcher.Matcher) ([]string, error) {
	wd, err := os.Getwd()
	if err != nil {
		return nil, errors.Wrapf(err, "failed to determine working directory")
	}
	if !filepath.IsAbs(projectDir) {
		projectDir = path.Join(wd, projectDir)
	}
	relPathPrefix, err := filepath.Rel(wd, projectDir)
	if err != nil {
		return nil, errors.Wrapf(err, "failed to determine relative path")
	}

	files, err := matcher.ListFiles(projectDir, include, exclude)
	if err != nil {
		return nil, err
	}
	if relPathPrefix != "" {
		for i, file := range files {
			files[i] = path.Join(relPathPrefix, file)
		}
	}
	return files, nil
}
258563
func (pkg *Package) pkgpath() string {
	importpath := filepath.FromSlash(pkg.ImportPath) + ".a"
	switch {
	case pkg.isCrossCompile():
		return filepath.Join(pkg.Pkgdir(), importpath)
	case pkg.Goroot && pkg.race:
		// race enabled standard lib
		return filepath.Join(runtime.GOROOT(), "pkg", pkg.gotargetos+"_"+pkg.gotargetarch+"_race", importpath)
	case pkg.Goroot:
		// standard lib
		return filepath.Join(runtime.GOROOT(), "pkg", pkg.gotargetos+"_"+pkg.gotargetarch, importpath)
	default:
		return filepath.Join(pkg.Pkgdir(), importpath)
	}
}
556439
func NewPartial(org, project string, envs, services, identities, instances []string) (*PathExp, error) {
	return newPathexp(org, project, envs, services, identities, instances, false)
}