github.com/cloudfoundry/cli@v7.1.0+incompatible/actor/v2action/service_plan_visibility.go (about)

     1  package v2action
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2"
     5  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/constant"
     6  )
     7  
     8  type ServicePlanVisibility ccv2.ServicePlanVisibility
     9  
    10  // GetServicePlanVisibilities fetches service plan visibilities for a plan by GUID.
    11  func (actor *Actor) GetServicePlanVisibilities(planGUID string) ([]ServicePlanVisibility, Warnings, error) {
    12  	visibilities, warnings, err := actor.CloudControllerClient.GetServicePlanVisibilities(ccv2.Filter{
    13  		Type:     constant.ServicePlanGUIDFilter,
    14  		Operator: constant.EqualOperator,
    15  		Values:   []string{planGUID},
    16  	})
    17  	if err != nil {
    18  		return nil, Warnings(warnings), err
    19  	}
    20  
    21  	var visibilitesToReturn []ServicePlanVisibility
    22  	for _, v := range visibilities {
    23  		visibilitesToReturn = append(visibilitesToReturn, ServicePlanVisibility(v))
    24  	}
    25  
    26  	return visibilitesToReturn, Warnings(warnings), nil
    27  }