github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/cloudcontroller/ccv2/feature_flag.go (about)

     1  package ccv2
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/api/cloudcontroller"
     5  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/internal"
     6  )
     7  
     8  type FeatureFlagName string
     9  
    10  const (
    11  	FeatureFlagServiceInstanceSharing FeatureFlagName = "service_instance_sharing"
    12  )
    13  
    14  // FeatureFlag represents a Cloud Controller feature flag.
    15  type FeatureFlag struct {
    16  	// Name is a string representation of the Cloud Controller
    17  	// feature flag's name.
    18  	Name string `json:"name"`
    19  
    20  	// Enabled is the status of the Cloud Controller feature
    21  	// flag.
    22  	Enabled bool `json:"enabled"`
    23  }
    24  
    25  // GetConfigFeatureFlags retrieves a list of FeatureFlag from the Cloud
    26  // Controller.
    27  func (client Client) GetConfigFeatureFlags() ([]FeatureFlag, Warnings, error) {
    28  	request, err := client.newHTTPRequest(requestOptions{
    29  		RequestName: internal.GetConfigFeatureFlagsRequest,
    30  	})
    31  	if err != nil {
    32  		return nil, nil, err
    33  	}
    34  
    35  	var featureFlags []FeatureFlag
    36  	response := cloudcontroller.Response{
    37  		Result: &featureFlags,
    38  	}
    39  
    40  	err = client.connection.Make(request, &response)
    41  	return featureFlags, response.Warnings, err
    42  }