-
Notifications
You must be signed in to change notification settings - Fork 944
/
Copy pathapplication_feature.go
49 lines (39 loc) · 1.47 KB
/
application_feature.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
package ccv3
import (
ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal"
"code.cloudfoundry.org/cli/api/internal"
"code.cloudfoundry.org/cli/resources"
)
type SSHEnabled struct {
Enabled bool
Reason string
}
func (client *Client) GetAppFeature(appGUID string, featureName string) (resources.ApplicationFeature, Warnings, error) {
var responseBody resources.ApplicationFeature
_, warnings, err := client.MakeRequest(RequestParams{
RequestName: ccv3internal.GetApplicationFeaturesRequest,
URIParams: internal.Params{"app_guid": appGUID, "name": featureName},
ResponseBody: &responseBody,
})
return responseBody, warnings, err
}
func (client *Client) GetSSHEnabled(appGUID string) (SSHEnabled, Warnings, error) {
var responseBody SSHEnabled
_, warnings, err := client.MakeRequest(RequestParams{
RequestName: ccv3internal.GetSSHEnabled,
URIParams: internal.Params{"app_guid": appGUID},
ResponseBody: &responseBody,
})
return responseBody, warnings, err
}
// UpdateAppFeature enables/disables the ability to ssh for a given application.
func (client *Client) UpdateAppFeature(appGUID string, enabled bool, featureName string) (Warnings, error) {
_, warnings, err := client.MakeRequest(RequestParams{
RequestName: ccv3internal.PatchApplicationFeaturesRequest,
RequestBody: struct {
Enabled bool `json:"enabled"`
}{Enabled: enabled},
URIParams: internal.Params{"app_guid": appGUID, "name": featureName},
})
return warnings, err
}