forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
job_url.go
55 lines (44 loc) · 1.81 KB
/
job_url.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package ccv3
import (
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal"
)
// JobURL is the URL to a given Job.
type JobURL string
// DeleteApplication deletes the app with the given app GUID. Returns back a
// resulting job URL to poll.
func (client *Client) DeleteApplication(appGUID string) (JobURL, Warnings, error) {
jobURL, warnings, err := client.MakeRequest(RequestParams{
RequestName: internal.DeleteApplicationRequest,
URIParams: internal.Params{"app_guid": appGUID},
})
return jobURL, warnings, err
}
// UpdateApplicationApplyManifest applies the manifest to the given
// application. Returns back a resulting job URL to poll.
func (client *Client) UpdateApplicationApplyManifest(appGUID string, rawManifest []byte) (JobURL, Warnings, error) {
responseLocation, warnings, err := client.MakeRequestSendRaw(
internal.PostApplicationActionApplyManifest,
internal.Params{"app_guid": appGUID},
rawManifest,
"application/x-yaml",
nil,
)
return JobURL(responseLocation), warnings, err
}
// UpdateSpaceApplyManifest - Is there a better name for this, since ...
// -- The Space resource is not actually updated.
// -- Instead what this ApplyManifest may do is to Create or Update Applications instead.
// Applies the manifest to the given space. Returns back a resulting job URL to poll.
// For each app specified in the manifest, the server-side handles:
// (1) Finding or creating this app.
// (2) Applying manifest properties to this app.
func (client *Client) UpdateSpaceApplyManifest(spaceGUID string, rawManifest []byte) (JobURL, Warnings, error) {
responseLocation, warnings, err := client.MakeRequestSendRaw(
internal.PostSpaceActionApplyManifestRequest,
internal.Params{"space_guid": spaceGUID},
rawManifest,
"application/x-yaml",
nil,
)
return JobURL(responseLocation), warnings, err
}