github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/resource/cmd/formatted.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package cmd 5 6 import "time" 7 8 // FormattedCharmResource holds the formatted representation of a resource's info. 9 type FormattedCharmResource struct { 10 // These fields are exported for the sake of serialization. 11 Name string `json:"name" yaml:"name"` 12 Type string `json:"type" yaml:"type"` 13 Path string `json:"path" yaml:"path"` 14 Description string `json:"description,omitempty" yaml:"description,omitempty"` 15 Revision int `json:"revision,omitempty" yaml:"revision,omitempty"` 16 Fingerprint string `json:"fingerprint" yaml:"fingerprint"` 17 Size int64 `json:"size" yaml:"size"` 18 Origin string `json:"origin" yaml:"origin"` 19 } 20 21 // FormattedServiceInfo holds the formatted representation of the information 22 // about an application's resources. 23 type FormattedServiceInfo struct { 24 Resources []FormattedSvcResource `json:"resources,omitempty" yaml:"resources,omitempty"` 25 Updates []FormattedCharmResource `json:"updates,omitempty" yaml:"updates,omitempty"` 26 } 27 28 // FormattedSvcResource holds the formatted representation of a resource's info. 29 type FormattedSvcResource struct { 30 // These fields are exported for the sake of serialization. 31 ID string `json:"resourceid,omitempty" yaml:"resourceid,omitempty"` 32 ApplicationID string `json:"applicationId,omitempty" yaml:"applicationId,omitempty"` 33 Name string `json:"name" yaml:"name"` 34 Type string `json:"type" yaml:"type"` 35 Path string `json:"path" yaml:"path"` 36 Description string `json:"description,omitempty" yaml:"description,omitempty"` 37 Revision int `json:"revision,omitempty" yaml:"revision,omitempty"` 38 Fingerprint string `json:"fingerprint" yaml:"fingerprint"` 39 Size int64 `json:"size" yaml:"size"` 40 Origin string `json:"origin" yaml:"origin"` 41 Used bool `json:"used" yaml:"used"` 42 Timestamp time.Time `json:"timestamp,omitempty" yaml:"timestamp,omitempty"` 43 Username string `json:"username,omitempty" yaml:"username,omitempty"` 44 45 // These fields are not exported so they won't be serialized, since they are 46 // specific to the tabular output. 47 combinedRevision string 48 usedYesNo string 49 combinedOrigin string 50 } 51 52 // FormattedUnitResource holds the formatted representation of a resource's info. 53 type FormattedUnitResource FormattedSvcResource 54 55 // FormattedDetailResource is the data for a single line of tabular output for 56 // juju resources <application> --details. 57 type FormattedDetailResource struct { 58 UnitID string `json:"unitID" yaml:"unitID"` 59 Unit FormattedSvcResource `json:"unit" yaml:"unit"` 60 Expected FormattedSvcResource `json:"expected" yaml:"expected"` 61 Progress int64 `json:"progress,omitempty" yaml:"progress,omitempty"` 62 unitNumber int 63 progress string 64 revProgress string 65 } 66 67 // FormattedServiceDetails is the data for the tabular output for juju resources 68 // <application> --details. 69 type FormattedServiceDetails struct { 70 Resources []FormattedDetailResource `json:"resources,omitempty" yaml:"resources,omitempty"` 71 Updates []FormattedCharmResource `json:"updates,omitempty" yaml:"updates,omitempty"` 72 } 73 74 // FormattedDetailResource is the data for the tabular output for juju resources 75 // <unit> --details. 76 type FormattedUnitDetails []FormattedDetailResource