code.cloudfoundry.org/cli@v7.1.0+incompatible/actor/v2action/router_group.go (about)

     1  package v2action
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/actor/actionerror"
     5  
     6  	"code.cloudfoundry.org/cli/api/router"
     7  	"code.cloudfoundry.org/cli/api/router/routererror"
     8  )
     9  
    10  type RouterGroup router.RouterGroup
    11  
    12  func (actor Actor) GetRouterGroupByName(routerGroupName string, client RouterClient) (RouterGroup, error) {
    13  	routerGroup, err := client.GetRouterGroupByName(routerGroupName)
    14  	if err != nil {
    15  		if _, ok := err.(routererror.ResourceNotFoundError); ok {
    16  			return RouterGroup{}, actionerror.RouterGroupNotFoundError{Name: routerGroupName}
    17  		}
    18  		return RouterGroup{}, err
    19  	}
    20  
    21  	return RouterGroup(routerGroup), nil
    22  }