github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/cmd/juju/resource/formatted.go (about) 1 // Copyright 2015 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package resource 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 // FormattedApplicationInfo holds the formatted representation of the information 22 // about an application's resources. 23 type FormattedApplicationInfo struct { 24 Resources []FormattedAppResource `json:"resources,omitempty" yaml:"resources,omitempty"` 25 Updates []FormattedCharmResource `json:"updates,omitempty" yaml:"updates,omitempty"` 26 } 27 28 // FormattedAppResource holds the formatted representation of a resource's info. 29 type FormattedAppResource 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 string `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 CombinedRevision string `json:"-"` 46 UsedYesNo string `json:"-"` 47 CombinedOrigin string `json:"-"` 48 } 49 50 // FormattedDetailResource is the data for a single line of tabular output for 51 // juju resources <application> --details. 52 type FormattedDetailResource struct { 53 UnitID string `json:"unitID" yaml:"unitID"` 54 Unit FormattedAppResource `json:"unit" yaml:"unit"` 55 Expected FormattedAppResource `json:"expected" yaml:"expected"` 56 Progress int64 `json:"progress,omitempty" yaml:"progress,omitempty"` 57 UnitNumber int `json:"-"` 58 RevProgress string `json:"-"` 59 } 60 61 // FormattedApplicationDetails is the data for the tabular output for juju resources 62 // <application> --details. 63 type FormattedApplicationDetails struct { 64 Resources []FormattedDetailResource `json:"resources,omitempty" yaml:"resources,omitempty"` 65 Updates []FormattedCharmResource `json:"updates,omitempty" yaml:"updates,omitempty"` 66 } 67 68 // FormattedDetailResource is the data for the tabular output for juju resources 69 // <unit> --details. 70 type FormattedUnitDetails []FormattedDetailResource