github.com/LukasHeimann/cloudfoundrycli@v7.1.0+incompatible/api/cloudcontroller/ccv3/application_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  type SSHEnabled struct {
     9  	Enabled bool
    10  	Reason  string
    11  }
    12  
    13  func (client *Client) GetAppFeature(appGUID string, featureName string) (resources.ApplicationFeature, Warnings, error) {
    14  	var responseBody resources.ApplicationFeature
    15  
    16  	_, warnings, err := client.MakeRequest(RequestParams{
    17  		RequestName:  internal.GetApplicationFeaturesRequest,
    18  		URIParams:    internal.Params{"app_guid": appGUID, "name": featureName},
    19  		ResponseBody: &responseBody,
    20  	})
    21  
    22  	return responseBody, warnings, err
    23  }
    24  
    25  func (client *Client) GetSSHEnabled(appGUID string) (SSHEnabled, Warnings, error) {
    26  	var responseBody SSHEnabled
    27  
    28  	_, warnings, err := client.MakeRequest(RequestParams{
    29  		RequestName:  internal.GetSSHEnabled,
    30  		URIParams:    internal.Params{"app_guid": appGUID},
    31  		ResponseBody: &responseBody,
    32  	})
    33  
    34  	return responseBody, warnings, err
    35  }
    36  
    37  // UpdateAppFeature enables/disables the ability to ssh for a given application.
    38  func (client *Client) UpdateAppFeature(appGUID string, enabled bool, featureName string) (Warnings, error) {
    39  	_, warnings, err := client.MakeRequest(RequestParams{
    40  		RequestName: internal.PatchApplicationFeaturesRequest,
    41  		RequestBody: struct {
    42  			Enabled bool `json:"enabled"`
    43  		}{Enabled: enabled},
    44  		URIParams: internal.Params{"app_guid": appGUID, "name": featureName},
    45  	})
    46  
    47  	return warnings, err
    48  }