github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/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  	CreatedBy      string     `json:"created-by"`
    15  	DateCreated    time.Time  `json:"date-created"`
    16  	LastConnection *time.Time `json:"last-connection,omitempty"`
    17  	Disabled       bool       `json:"disabled"`
    18  }
    19  
    20  // UserInfoResult holds the result of a UserInfo call.
    21  type UserInfoResult struct {
    22  	Result *UserInfo `json:"result,omitempty"`
    23  	Error  *Error    `json:"error,omitempty"`
    24  }
    25  
    26  // UserInfoResults holds the result of a bulk UserInfo API call.
    27  type UserInfoResults struct {
    28  	Results []UserInfoResult `json:"results"`
    29  }
    30  
    31  // UserInfoRequest defines the users to return.  An empty
    32  // Entities list indicates that all matching users should be returned.
    33  type UserInfoRequest struct {
    34  	Entities        []Entity `json:"entities"`
    35  	IncludeDisabled bool     `json:"include-disabled"`
    36  }
    37  
    38  // AddUsers holds the parameters for adding new users.
    39  type AddUsers struct {
    40  	Users []AddUser `json:"users"`
    41  }
    42  
    43  // AddUser stores the parameters to add one user.
    44  type AddUser struct {
    45  	Username        string   `json:"username"`
    46  	DisplayName     string   `json:"display-name"`
    47  	SharedModelTags []string `json:"shared-model-tags"`
    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  	// ModelAccess is the permission that the user will have to access the models.
    57  	ModelAccess ModelAccessPermission `json:"model-access-permission,omitempty"`
    58  }
    59  
    60  // AddUserResults holds the results of the bulk AddUser API call.
    61  type AddUserResults struct {
    62  	Results []AddUserResult `json:"results"`
    63  }
    64  
    65  // AddUserResult returns the tag of the newly created user
    66  // and the secret key required to complete registration,
    67  // or an error.
    68  type AddUserResult struct {
    69  	Tag       string `json:"tag,omitempty"`
    70  	SecretKey []byte `json:"secret-key,omitempty"`
    71  	Error     *Error `json:"error,omitempty"`
    72  }