github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/apiserver/params/controller.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package params 5 6 // DestroyControllerArgs holds the arguments for destroying a controller. 7 type DestroyControllerArgs struct { 8 // DestroyModels specifies whether or not the hosted models 9 // should be destroyed as well. If this is not specified, and there are 10 // other hosted models, the destruction of the controller will fail. 11 DestroyModels bool `json:"destroy-models"` 12 } 13 14 // ModelBlockInfo holds information about an model and its 15 // current blocks. 16 type ModelBlockInfo struct { 17 Name string `json:"name"` 18 UUID string `json:"model-uuid"` 19 OwnerTag string `json:"owner-tag"` 20 Blocks []string `json:"blocks"` 21 } 22 23 // ModelBlockInfoList holds information about the blocked models 24 // for a controller. 25 type ModelBlockInfoList struct { 26 Models []ModelBlockInfo `json:"models,omitempty"` 27 } 28 29 // RemoveBlocksArgs holds the arguments for the RemoveBlocks command. It is a 30 // struct to facilitate the easy addition of being able to remove blocks for 31 // individual models at a later date. 32 type RemoveBlocksArgs struct { 33 All bool `json:"all"` 34 } 35 36 // ModelStatus holds information about the status of a juju model. 37 type ModelStatus struct { 38 ModelTag string `json:"model-tag"` 39 Life Life `json:"life"` 40 HostedMachineCount int `json:"hosted-machine-count"` 41 ApplicationCount int `json:"application-count"` 42 OwnerTag string `json:"owner-tag"` 43 Machines []ModelMachineInfo `json:"machines,omitempty"` 44 } 45 46 // ModelStatusResults holds status information about a group of models. 47 type ModelStatusResults struct { 48 Results []ModelStatus `json:"models"` 49 } 50 51 // ModifyControllerAccessRequest holds the parameters for making grant and revoke controller calls. 52 type ModifyControllerAccessRequest struct { 53 Changes []ModifyControllerAccess `json:"changes"` 54 } 55 56 type ModifyControllerAccess struct { 57 UserTag string `json:"user-tag"` 58 Action ControllerAction `json:"action"` 59 Access string `json:"access"` 60 } 61 62 // UserAccess holds the level of access a user 63 // has on a controller or model. 64 type UserAccess struct { 65 UserTag string `json:"user-tag"` 66 Access string `json:"access"` 67 } 68 69 // UserAccessResult holds an access level for 70 // a user, or an error. 71 type UserAccessResult struct { 72 Result *UserAccess `json:"result,omitempty"` 73 Error *Error `json:"error,omitempty"` 74 } 75 76 // UserAccessResults holds the results of an api 77 // call to look up access for users. 78 type UserAccessResults struct { 79 Results []UserAccessResult `json:"results,omitempty"` 80 } 81 82 // ControllerAction is an action that can be performed on a model. 83 type ControllerAction string 84 85 // Actions that can be preformed on a model. 86 const ( 87 GrantControllerAccess ControllerAction = "grant" 88 RevokeControllerAccess ControllerAction = "revoke" 89 )