github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/api/base/types.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package base
     5  
     6  import (
     7  	"time"
     8  
     9  	"github.com/juju/version"
    10  
    11  	"github.com/juju/juju/core/instance"
    12  	"github.com/juju/juju/core/model"
    13  	"github.com/juju/juju/core/status"
    14  )
    15  
    16  // UserModel holds information about a model and the last
    17  // time the model was accessed for a particular user. This is a client
    18  // side structure that translates the owner tag into a user facing string.
    19  type UserModel struct {
    20  	Name           string
    21  	UUID           string
    22  	Type           model.ModelType
    23  	Owner          string
    24  	LastConnection *time.Time
    25  }
    26  
    27  // ModelStatus holds information about the status of a juju model.
    28  type ModelStatus struct {
    29  	UUID               string
    30  	Life               string
    31  	Owner              string
    32  	TotalMachineCount  int
    33  	CoreCount          int
    34  	HostedMachineCount int
    35  	ApplicationCount   int
    36  	Machines           []Machine
    37  	Volumes            []Volume
    38  	Filesystems        []Filesystem
    39  	Error              error
    40  }
    41  
    42  // Machine holds information about a machine in a juju model.
    43  type Machine struct {
    44  	Id          string
    45  	InstanceId  string
    46  	DisplayName string
    47  	HasVote     bool
    48  	WantsVote   bool
    49  	Status      string
    50  	Message     string
    51  	Hardware    *instance.HardwareCharacteristics
    52  }
    53  
    54  // ModelInfo holds information about a model.
    55  type ModelInfo struct {
    56  	Name            string
    57  	UUID            string
    58  	Type            model.ModelType
    59  	ControllerUUID  string
    60  	IsController    bool
    61  	ProviderType    string
    62  	DefaultSeries   string
    63  	Cloud           string
    64  	CloudRegion     string
    65  	CloudCredential string
    66  	Owner           string
    67  	Life            string
    68  	Status          Status
    69  	Users           []UserInfo
    70  	Machines        []Machine
    71  	AgentVersion    *version.Number
    72  }
    73  
    74  // Status represents the status of a machine, application, or unit.
    75  type Status struct {
    76  	Status status.Status
    77  	Info   string
    78  	Data   map[string]interface{}
    79  	Since  *time.Time
    80  }
    81  
    82  // UserInfo holds information about a user in a juju model.
    83  type UserInfo struct {
    84  	UserName       string
    85  	DisplayName    string
    86  	LastConnection *time.Time
    87  	Access         string
    88  }
    89  
    90  // Volume holds information about a volume in a juju model.
    91  type Volume struct {
    92  	Id         string
    93  	ProviderId string
    94  	Status     string
    95  	Message    string
    96  	Detachable bool
    97  }
    98  
    99  // Filesystem holds information about a filesystem in a juju model.
   100  type Filesystem struct {
   101  	Id         string
   102  	ProviderId string
   103  	Status     string
   104  	Message    string
   105  	Detachable bool
   106  }
   107  
   108  // UserModelSummary holds summary about a model for a user.
   109  type UserModelSummary struct {
   110  	Name               string
   111  	UUID               string
   112  	Type               model.ModelType
   113  	ControllerUUID     string
   114  	IsController       bool
   115  	ProviderType       string
   116  	DefaultSeries      string
   117  	Cloud              string
   118  	CloudRegion        string
   119  	CloudCredential    string
   120  	Owner              string
   121  	Life               string
   122  	Status             Status
   123  	ModelUserAccess    string
   124  	UserLastConnection *time.Time
   125  	Counts             []EntityCount
   126  	AgentVersion       *version.Number
   127  	Error              error
   128  	Migration          *MigrationSummary
   129  	SLA                *SLASummary
   130  }
   131  
   132  // EntityCount holds a count for a particular entity, for example machines or core count.
   133  type EntityCount struct {
   134  	Entity string
   135  	Count  int64
   136  }
   137  
   138  // MigrationSummary holds information about a current migration attempt
   139  // if there is one on progress.
   140  type MigrationSummary struct {
   141  	Status    string
   142  	StartTime *time.Time
   143  	EndTime   *time.Time
   144  }
   145  
   146  // SLASummary holds information about SLA.
   147  type SLASummary struct {
   148  	Level string
   149  	Owner string
   150  }
   151  
   152  // StoredCredential contains information about the cloud credential stored on the controller
   153  // and used by models.
   154  type StoredCredential struct {
   155  	// CloudCredential is a cloud credential id that identifies cloud credential on the controller.
   156  	// The value is what CloudCredentialTag.Id() returns.
   157  	CloudCredential string
   158  
   159  	// Valid is a flag that indicates whether the credential is valid.
   160  	Valid bool
   161  }