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

     1  package v2action
     2  
     3  import "code.cloudfoundry.org/cli/api/cloudcontroller/ccv2"
     4  
     5  // User represents a CLI user.
     6  type User ccv2.User
     7  
     8  // CreateUser creates a new user in UAA and registers it with cloud controller.
     9  func (actor Actor) CreateUser(username string, password string, origin string) (User, Warnings, error) {
    10  	uaaUser, err := actor.UAAClient.CreateUser(username, password, origin)
    11  	if err != nil {
    12  		return User{}, nil, err
    13  	}
    14  
    15  	ccUser, ccWarnings, err := actor.CloudControllerClient.CreateUser(uaaUser.ID)
    16  
    17  	return User(ccUser), Warnings(ccWarnings), err
    18  }