github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/apiserver/params/charms.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package params
     5  
     6  // CharmsList stores parameters for a charms.List call
     7  type CharmsList struct {
     8  	Names []string `json:"names"`
     9  }
    10  
    11  // CharmsListResult stores result from a charms.List call
    12  type CharmsListResult struct {
    13  	CharmURLs []string `json:"charm-urls"`
    14  }
    15  
    16  // IsMeteredResult stores result from a charms.IsMetered call
    17  type IsMeteredResult struct {
    18  	Metered bool `json:"metered"`
    19  }
    20  
    21  // CharmOption mirrors charm.Option
    22  type CharmOption struct {
    23  	Type        string      `json:"type"`
    24  	Description string      `json:"description,omitempty"`
    25  	Default     interface{} `json:"default,omitempty"`
    26  }
    27  
    28  // CharmRelation mirrors charm.Relation.
    29  type CharmRelation struct {
    30  	Name      string `json:"name"`
    31  	Role      string `json:"role"`
    32  	Interface string `json:"interface"`
    33  	Optional  bool   `json:"optional"`
    34  	Limit     int    `json:"limit"`
    35  	Scope     string `json:"scope"`
    36  }
    37  
    38  // CharmStorage mirrors charm.Storage.
    39  type CharmStorage struct {
    40  	Name        string   `json:"name"`
    41  	Description string   `json:"description"`
    42  	Type        string   `json:"type"`
    43  	Shared      bool     `json:"shared"`
    44  	ReadOnly    bool     `json:"read-only"`
    45  	CountMin    int      `json:"count-min"`
    46  	CountMax    int      `json:"count-max"`
    47  	MinimumSize uint64   `json:"minimum-size"`
    48  	Location    string   `json:"location,omitempty"`
    49  	Properties  []string `json:"properties,omitempty"`
    50  }
    51  
    52  // CharmPayloadClass mirrors charm.PayloadClass.
    53  type CharmPayloadClass struct {
    54  	Name string `json:"name"`
    55  	Type string `json:"type"`
    56  }
    57  
    58  // CharmResourceMeta mirrors charm.ResourceMeta.
    59  type CharmResourceMeta struct {
    60  	Name        string `json:"name"`
    61  	Type        string `json:"type"`
    62  	Path        string `json:"path"`
    63  	Description string `json:"description"`
    64  }
    65  
    66  // CharmMeta mirrors charm.Meta.
    67  type CharmMeta struct {
    68  	Name           string                       `json:"name"`
    69  	Summary        string                       `json:"summary"`
    70  	Description    string                       `json:"description"`
    71  	Subordinate    bool                         `json:"subordinate"`
    72  	Provides       map[string]CharmRelation     `json:"provides,omitempty"`
    73  	Requires       map[string]CharmRelation     `json:"requires,omitempty"`
    74  	Peers          map[string]CharmRelation     `json:"peers,omitempty"`
    75  	ExtraBindings  map[string]string            `json:"extra-bindings,omitempty"`
    76  	Categories     []string                     `json:"categories,omitempty"`
    77  	Tags           []string                     `json:"tags,omitempty"`
    78  	Series         []string                     `json:"series,omitempty"`
    79  	Storage        map[string]CharmStorage      `json:"storage,omitempty"`
    80  	PayloadClasses map[string]CharmPayloadClass `json:"payload-classes,omitempty"`
    81  	Resources      map[string]CharmResourceMeta `json:"resources,omitempty"`
    82  	Terms          []string                     `json:"terms,omitempty"`
    83  	MinJujuVersion string                       `json:"min-juju-version,omitempty"`
    84  }
    85  
    86  // CharmInfo holds all the charm data that the client needs.
    87  // To be honest, it probably returns way more than what is actually needed.
    88  type CharmInfo struct {
    89  	Revision int                    `json:"revision"`
    90  	URL      string                 `json:"url"`
    91  	Config   map[string]CharmOption `json:"config"`
    92  	Meta     *CharmMeta             `json:"meta,omitempty"`
    93  	Actions  *CharmActions          `json:"actions,omitempty"`
    94  	Metrics  *CharmMetrics          `json:"metrics,omitempty"`
    95  }
    96  
    97  // CharmActions mirrors charm.Actions.
    98  type CharmActions struct {
    99  	ActionSpecs map[string]CharmActionSpec `json:"specs,omitempty"`
   100  }
   101  
   102  // CharmActionSpec mirrors charm.ActionSpec.
   103  type CharmActionSpec struct {
   104  	Description string                 `json:"description"`
   105  	Params      map[string]interface{} `json:"params"`
   106  }
   107  
   108  // CharmMetric mirrors charm.Metric.
   109  type CharmMetric struct {
   110  	Type        string `json:"type"`
   111  	Description string `json:"description"`
   112  }
   113  
   114  // CharmPlan mirrors charm.Plan
   115  type CharmPlan struct {
   116  	Required bool `json:"required"`
   117  }
   118  
   119  // CharmMetrics mirrors charm.Metrics.
   120  type CharmMetrics struct {
   121  	Metrics map[string]CharmMetric `json:"metrics"`
   122  	Plan    CharmPlan              `json:"plan"`
   123  }