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

Method Create

cf/api/applications/applications.go:44–58  ·  view source on GitHub ↗
(params models.AppParams)

Source from the content-addressed store, hash-verified

42}
43
44func (repo CloudControllerRepository) Create(params models.AppParams) (models.Application, error) {
45 appResource := resources.NewApplicationEntityFromAppParams(params)
46 data, err := json.Marshal(appResource)
47 if err != nil {
48 return models.Application{}, fmt.Errorf("%s: %s", T("Failed to marshal JSON"), err.Error())
49 }
50
51 resource := new(resources.ApplicationResource)
52 err = repo.gateway.CreateResource(repo.config.APIEndpoint(), "/v2/apps", bytes.NewReader(data), resource)
53 if err != nil {
54 return models.Application{}, err
55 }
56
57 return resource.ToModel(), nil
58}
59
60func (repo CloudControllerRepository) GetApp(appGUID string) (app models.Application, apiErr error) {
61 path := fmt.Sprintf("%s/v2/apps/%s", repo.config.APIEndpoint(), appGUID)

Callers

nothing calls this directly

Calls 5

CreateResourceMethod · 0.80
ErrorMethod · 0.65
APIEndpointMethod · 0.65
ToModelMethod · 0.45

Tested by

no test coverage detected