MCPcopy Index your code
hub / github.com/cloudfoundry/cli / FindByName

Method FindByName

cf/api/buildpacks.go:50–69  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

48}
49
50func (repo CloudControllerBuildpackRepository) FindByName(name string) (buildpack models.Buildpack, apiErr error) {
51 found := 0
52
53 apiErr = repo.gateway.ListPaginatedResources(
54 repo.config.APIEndpoint(),
55 fmt.Sprintf("%s?q=%s", buildpacksPath, url.QueryEscape("name:"+name)),
56 resources.BuildpackResource{},
57 func(resource interface{}) bool {
58 found++
59 buildpack = resource.(resources.BuildpackResource).ToFields()
60 return true
61 })
62
63 if found == 0 {
64 apiErr = errors.NewModelNotFoundError("Buildpack", name)
65 } else if found > 1 {
66 apiErr = errors.NewAmbiguousModelError("Buildpack", name)
67 }
68 return
69}
70
71func (repo CloudControllerBuildpackRepository) FindByNameAndStack(name, stack string) (buildpack models.Buildpack, apiErr error) {
72 foundIt := false

Callers

nothing calls this directly

Calls 5

NewModelNotFoundErrorFunction · 0.92
NewAmbiguousModelErrorFunction · 0.92
APIEndpointMethod · 0.65
ToFieldsMethod · 0.65

Tested by

no test coverage detected