forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspace_feature.go
30 lines (24 loc) · 950 Bytes
/
space_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
package ccv3
import (
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal"
"code.cloudfoundry.org/cli/resources"
)
func (client *Client) GetSpaceFeature(spaceGUID string, featureName string) (bool, Warnings, error) {
var responseBody resources.SpaceFeature
_, warnings, err := client.MakeRequest(RequestParams{
RequestName: internal.GetSpaceFeatureRequest,
URIParams: internal.Params{"space_guid": spaceGUID, "feature": featureName},
ResponseBody: &responseBody,
})
return responseBody.Enabled, warnings, err
}
func (client *Client) UpdateSpaceFeature(spaceGUID string, enabled bool, featureName string) (Warnings, error) {
_, warnings, err := client.MakeRequest(RequestParams{
RequestName: internal.PatchSpaceFeaturesRequest,
URIParams: internal.Params{"space_guid": spaceGUID, "feature": featureName},
RequestBody: struct {
Enabled bool `json:"enabled"`
}{Enabled: enabled},
})
return warnings, err
}