github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/scripts/juju-inspect/rules/entities.go (about)

     1  // Copyright 2021 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package rules
     5  
     6  import "gopkg.in/yaml.v3"
     7  
     8  type Report struct {
     9  	Manifolds map[string]Worker `yaml:"manifolds"`
    10  }
    11  
    12  type Worker struct {
    13  	Inputs     []string    `yaml:"inputs"`
    14  	Report     interface{} `yaml:"report"`
    15  	StartCount int         `yaml:"start-count"`
    16  	Started    string      `yaml:"started"`
    17  	State      string      `yaml:"state"`
    18  }
    19  
    20  func (w Worker) UnmarshalReport(out interface{}) error {
    21  	b, err := yaml.Marshal(w.Report)
    22  	if err != nil {
    23  		return err
    24  	}
    25  	return yaml.Unmarshal(b, out)
    26  }