(name string)
| 48 | } |
| 49 | |
| 50 | func (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 | |
| 71 | func (repo CloudControllerBuildpackRepository) FindByNameAndStack(name, stack string) (buildpack models.Buildpack, apiErr error) { |
| 72 | foundIt := false |
nothing calls this directly
no test coverage detected