github.com/lukasheimann/cloudfoundrycli@v7.1.0+incompatible/actor/v7action/application_feature.go (about)

     1  package v7action
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3"
     5  	"code.cloudfoundry.org/cli/resources"
     6  )
     7  
     8  func (actor Actor) GetAppFeature(appGUID string, featureName string) (resources.ApplicationFeature, Warnings, error) {
     9  	appFeature, warnings, err := actor.CloudControllerClient.GetAppFeature(appGUID, featureName)
    10  
    11  	return appFeature, Warnings(warnings), err
    12  }
    13  
    14  func (actor Actor) GetSSHEnabled(appGUID string) (ccv3.SSHEnabled, Warnings, error) {
    15  	sshEnabled, warnings, err := actor.CloudControllerClient.GetSSHEnabled(appGUID)
    16  	return sshEnabled, Warnings(warnings), err
    17  }
    18  
    19  func (actor Actor) GetSSHEnabledByAppName(appName string, spaceGUID string) (ccv3.SSHEnabled, Warnings, error) {
    20  	var allWarnings Warnings
    21  
    22  	app, warnings, err := actor.CloudControllerClient.GetApplicationByNameAndSpace(appName, spaceGUID)
    23  	allWarnings = append(allWarnings, warnings...)
    24  	if err != nil {
    25  		return ccv3.SSHEnabled{}, allWarnings, err
    26  	}
    27  
    28  	sshEnabled, warnings, err := actor.CloudControllerClient.GetSSHEnabled(app.GUID)
    29  	allWarnings = append(allWarnings, warnings...)
    30  	if err != nil {
    31  		return ccv3.SSHEnabled{}, allWarnings, err
    32  	}
    33  
    34  	return sshEnabled, allWarnings, nil
    35  }
    36  
    37  func (actor Actor) UpdateAppFeature(app resources.Application, enabled bool, featureName string) (Warnings, error) {
    38  	warnings, err := actor.CloudControllerClient.UpdateAppFeature(app.GUID, enabled, featureName)
    39  	return Warnings(warnings), err
    40  }