github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/apiserver/params/usermanager.go (about)

     1  // Copyright 2014 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package params
     5  
     6  import (
     7  	"time"
     8  )
     9  
    10  // UserInfo holds information on a user.
    11  type UserInfo struct {
    12  	Username       string     `json:"username"`
    13  	DisplayName    string     `json:"display-name"`
    14  	Access         string     `json:"access"`
    15  	CreatedBy      string     `json:"created-by"`
    16  	DateCreated    time.Time  `json:"date-created"`
    17  	LastConnection *time.Time `json:"last-connection,omitempty"`
    18  	Disabled       bool       `json:"disabled"`
    19  }
    20  
    21  // UserInfoResult holds the result of a UserInfo call.
    22  type UserInfoResult struct {
    23  	Result *UserInfo `json:"result,omitempty"`
    24  	Error  *Error    `json:"error,omitempty"`
    25  }
    26  
    27  // UserInfoResults holds the result of a bulk UserInfo API call.
    28  type UserInfoResults struct {
    29  	Results []UserInfoResult `json:"results"`
    30  }
    31  
    32  // UserInfoRequest defines the users to return.  An empty
    33  // Entities list indicates that all matching users should be returned.
    34  type UserInfoRequest struct {
    35  	Entities        []Entity `json:"entities"`
    36  	IncludeDisabled bool     `json:"include-disabled"`
    37  }
    38  
    39  // AddUsers holds the parameters for adding new users.
    40  type AddUsers struct {
    41  	Users []AddUser `json:"users"`
    42  }
    43  
    44  // AddUser stores the parameters to add one user.
    45  type AddUser struct {
    46  	Username    string `json:"username"`
    47  	DisplayName string `json:"display-name"`
    48  
    49  	// Password is optional. If it is empty, then
    50  	// a secret key will be generated for the user
    51  	// and returned in AddUserResult. It will not
    52  	// be possible to login with a password until
    53  	// registration with the secret key is completed.
    54  	Password string `json:"password,omitempty"`
    55  }
    56  
    57  // AddUserResults holds the results of the bulk AddUser API call.
    58  type AddUserResults struct {
    59  	Results []AddUserResult `json:"results"`
    60  }
    61  
    62  // AddUserResult returns the tag of the newly created user
    63  // and the secret key required to complete registration,
    64  // or an error.
    65  type AddUserResult struct {
    66  	Tag       string `json:"tag,omitempty"`
    67  	SecretKey []byte `json:"secret-key,omitempty"`
    68  	Error     *Error `json:"error,omitempty"`
    69  }