MCPcopy Create free account
hub / github.com/cloudfoundry/cli / Update

Method Update

cf/api/applications/applications.go:95–111  ·  view source on GitHub ↗
(appGUID string, params models.AppParams)

Source from the content-addressed store, hash-verified

93}
94
95func (repo CloudControllerRepository) Update(appGUID string, params models.AppParams) (updatedApp models.Application, apiErr error) {
96 appResource := resources.NewApplicationEntityFromAppParams(params)
97 data, err := json.Marshal(appResource)
98 if err != nil {
99 return models.Application{}, fmt.Errorf("%s: %s", T("Failed to marshal JSON"), err.Error())
100 }
101
102 path := fmt.Sprintf("/v2/apps/%s?inline-relations-depth=1", appGUID)
103 resource := new(resources.ApplicationResource)
104 apiErr = repo.gateway.UpdateResource(repo.config.APIEndpoint(), path, bytes.NewReader(data), resource)
105 if apiErr != nil {
106 return
107 }
108
109 updatedApp = resource.ToModel()
110 return
111}
112
113func (repo CloudControllerRepository) Delete(appGUID string) (apiErr error) {
114 path := fmt.Sprintf("/v2/apps/%s?recursive=true", appGUID)

Callers

nothing calls this directly

Calls 5

UpdateResourceMethod · 0.80
ErrorMethod · 0.65
APIEndpointMethod · 0.65
ToModelMethod · 0.45

Tested by

no test coverage detected