github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/cloudcontroller/ccv3/space_feature.go (about)

     1  package ccv3
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal"
     5  	"code.cloudfoundry.org/cli/resources"
     6  )
     7  
     8  func (client *Client) GetSpaceFeature(spaceGUID string, featureName string) (bool, Warnings, error) {
     9  	var responseBody resources.SpaceFeature
    10  
    11  	_, warnings, err := client.MakeRequest(RequestParams{
    12  		RequestName:  internal.GetSpaceFeatureRequest,
    13  		URIParams:    internal.Params{"space_guid": spaceGUID, "feature": featureName},
    14  		ResponseBody: &responseBody,
    15  	})
    16  
    17  	return responseBody.Enabled, warnings, err
    18  }
    19  
    20  func (client *Client) UpdateSpaceFeature(spaceGUID string, enabled bool, featureName string) (Warnings, error) {
    21  	_, warnings, err := client.MakeRequest(RequestParams{
    22  		RequestName: internal.PatchSpaceFeaturesRequest,
    23  		URIParams:   internal.Params{"space_guid": spaceGUID, "feature": featureName},
    24  		RequestBody: struct {
    25  			Enabled bool `json:"enabled"`
    26  		}{Enabled: enabled},
    27  	})
    28  
    29  	return warnings, err
    30  }