MCPcopy
hub / github.com/cloudfoundry/cli / Create

Method Create

cf/api/buildpacks.go:110–126  ·  view source on GitHub ↗
(name string, position *int, enabled *bool, locked *bool)

Source from the content-addressed store, hash-verified

108}
109
110func (repo CloudControllerBuildpackRepository) Create(name string, position *int, enabled *bool, locked *bool) (createdBuildpack models.Buildpack, apiErr error) {
111 entity := resources.BuildpackEntity{Name: name, Position: position, Enabled: enabled, Locked: locked}
112 body, err := json.Marshal(entity)
113 if err != nil {
114 apiErr = fmt.Errorf("%s: %s", T("Could not serialize information"), err.Error())
115 return
116 }
117
118 resource := new(resources.BuildpackResource)
119 apiErr = repo.gateway.CreateResource(repo.config.APIEndpoint(), buildpacksPath, bytes.NewReader(body), resource)
120 if apiErr != nil {
121 return
122 }
123
124 createdBuildpack = resource.ToFields()
125 return
126}
127
128func (repo CloudControllerBuildpackRepository) Delete(buildpackGUID string) (apiErr error) {
129 path := fmt.Sprintf("%s/%s", buildpacksPath, buildpackGUID)

Callers

nothing calls this directly

Calls 4

CreateResourceMethod · 0.80
ErrorMethod · 0.65
APIEndpointMethod · 0.65
ToFieldsMethod · 0.65

Tested by

no test coverage detected