github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/charmhub/transport/info.go (about)

     1  // Copyright 2020 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package transport
     5  
     6  // InfoResponse is the result from an information query.
     7  type InfoResponse struct {
     8  	Type           Type             `json:"type"`
     9  	ID             string           `json:"id"`
    10  	Name           string           `json:"name"`
    11  	Entity         Entity           `json:"result"`
    12  	ChannelMap     []InfoChannelMap `json:"channel-map"`
    13  	DefaultRelease InfoChannelMap   `json:"default-release,omitempty"`
    14  	ErrorList      APIErrors        `json:"error-list,omitempty"`
    15  }
    16  
    17  // InfoChannelMap returns the information channel map. This defines a unique
    18  // revision for a given channel from an info response.
    19  type InfoChannelMap struct {
    20  	Channel  Channel      `json:"channel,omitempty"`
    21  	Revision InfoRevision `json:"revision,omitempty"`
    22  }
    23  
    24  // InfoRevision is different from FindRevision.  It has additional
    25  // fields of ConfigYAML and MetadataYAML.
    26  // NOTE: InfoRevision will be filled in with the CharmHub api response
    27  // differently within the InfoResponse.ChannelMap and the
    28  // InfoResponse.DefaultRelease.  The DefaultRelease InfoRevision will
    29  // include ConfigYAML, MetadataYAML and BundleYAML
    30  // NOTE 2: actions-yaml is a possible response for the DefaultRelease
    31  // InfoRevision, but not implemented.
    32  type InfoRevision struct {
    33  	ConfigYAML string `json:"config-yaml"`
    34  	CreatedAt  string `json:"created-at"`
    35  	// Via filters, only Download.Size will be available.
    36  	Download     Download `json:"download"`
    37  	MetadataYAML string   `json:"metadata-yaml"`
    38  	BundleYAML   string   `json:"bundle-yaml"`
    39  	Bases        []Base   `json:"bases"`
    40  	Revision     int      `json:"revision"`
    41  	Version      string   `json:"version"`
    42  }