github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/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  	// DestroyStorage controls whether or not storage in the model (and
    14  	// hosted models, if DestroyModels is true) should be destroyed.
    15  	//
    16  	// This is ternary: nil, false, or true. If nil and there is persistent
    17  	// storage in the model (or hosted models), an error with the code
    18  	// params.CodeHasPersistentStorage will be returned.
    19  	DestroyStorage *bool `json:"destroy-storage,omitempty"`
    20  }
    21  
    22  // ModelBlockInfo holds information about an model and its
    23  // current blocks.
    24  type ModelBlockInfo struct {
    25  	Name     string   `json:"name"`
    26  	UUID     string   `json:"model-uuid"`
    27  	OwnerTag string   `json:"owner-tag"`
    28  	Blocks   []string `json:"blocks"`
    29  }
    30  
    31  // ModelBlockInfoList holds information about the blocked models
    32  // for a controller.
    33  type ModelBlockInfoList struct {
    34  	Models []ModelBlockInfo `json:"models,omitempty"`
    35  }
    36  
    37  // RemoveBlocksArgs holds the arguments for the RemoveBlocks command. It is a
    38  // struct to facilitate the easy addition of being able to remove blocks for
    39  // individual models at a later date.
    40  type RemoveBlocksArgs struct {
    41  	All bool `json:"all"`
    42  }
    43  
    44  // ModelStatus holds information about the status of a juju model.
    45  type ModelStatus struct {
    46  	ModelTag           string                `json:"model-tag"`
    47  	Life               Life                  `json:"life"`
    48  	HostedMachineCount int                   `json:"hosted-machine-count"`
    49  	ApplicationCount   int                   `json:"application-count"`
    50  	OwnerTag           string                `json:"owner-tag"`
    51  	Machines           []ModelMachineInfo    `json:"machines,omitempty"`
    52  	Volumes            []ModelVolumeInfo     `json:"volumes,omitempty"`
    53  	Filesystems        []ModelFilesystemInfo `json:"filesystems,omitempty"`
    54  	Error              *Error                `json:"error,omitempty"`
    55  }
    56  
    57  // ModelStatusResults holds status information about a group of models.
    58  type ModelStatusResults struct {
    59  	Results []ModelStatus `json:"models"`
    60  }
    61  
    62  // ModifyControllerAccessRequest holds the parameters for making grant and revoke controller calls.
    63  type ModifyControllerAccessRequest struct {
    64  	Changes []ModifyControllerAccess `json:"changes"`
    65  }
    66  
    67  type ModifyControllerAccess struct {
    68  	UserTag string           `json:"user-tag"`
    69  	Action  ControllerAction `json:"action"`
    70  	Access  string           `json:"access"`
    71  }
    72  
    73  // UserAccess holds the level of access a user
    74  // has on a controller or model.
    75  type UserAccess struct {
    76  	UserTag string `json:"user-tag"`
    77  	Access  string `json:"access"`
    78  }
    79  
    80  // UserAccessResult holds an access level for
    81  // a user, or an error.
    82  type UserAccessResult struct {
    83  	Result *UserAccess `json:"result,omitempty"`
    84  	Error  *Error      `json:"error,omitempty"`
    85  }
    86  
    87  // UserAccessResults holds the results of an api
    88  // call to look up access for users.
    89  type UserAccessResults struct {
    90  	Results []UserAccessResult `json:"results,omitempty"`
    91  }
    92  
    93  // ControllerConfigSet holds new config values for
    94  // Controller.ConfigSet.
    95  type ControllerConfigSet struct {
    96  	Config map[string]interface{} `json:"config"`
    97  }
    98  
    99  // ControllerAction is an action that can be performed on a model.
   100  type ControllerAction string
   101  
   102  // Actions that can be preformed on a model.
   103  const (
   104  	GrantControllerAccess  ControllerAction = "grant"
   105  	RevokeControllerAccess ControllerAction = "revoke"
   106  )