Documentation ¶
Overview ¶
The params package holds types that are a part of the charm store's external contract - they will be marshalled (or unmarshalled) as JSON and delivered through the HTTP API.
Index ¶
- Constants
- func NewError(code ErrorCode, f string, a ...interface{}) error
- type ArchiveSizeResponse
- type ArchiveUploadResponse
- type ArchiveUploadTimeResponse
- type BundleCount
- type DebugStatus
- type Error
- type ErrorCode
- type ExpandedId
- type HashResponse
- type IdNameResponse
- type IdResponse
- type IdRevisionResponse
- type IdSeriesResponse
- type IdUserResponse
- type Log
- type LogLevel
- type LogResponse
- type LogType
- type ManifestFile
- type MetaAnyResponse
- type PermRequest
- type PermResponse
- type PromulgateRequest
- type PromulgatedResponse
- type Published
- type RelatedResponse
- type RevisionInfoResponse
- type SearchResponse
- type SearchResult
- type Statistic
- type StatsCount
- type StatsResponse
- type TagsResponse
- type WhoAmIResponse
Constants ¶
const ( // ContentHashHeader specifies the header attribute // that will hold the content hash for archive GET responses. ContentHashHeader = "Content-Sha384" // EntityIdHeader specifies the header attribute that will hold the // id of the entity for archive GET responses. EntityIdHeader = "Entity-Id" )
const ( Everyone = "everyone" Admin = "admin" )
Special user/group names.
const ( // BzrDigestKey is the extra-info key used to store the Bazaar digest BzrDigestKey = "bzr-digest" // LegacyDownloadStats is the extra-info key used to store the legacy // download counts, and to retrieve them when // charmstore.LegacyDownloadCountsEnabled is set to true. // TODO (frankban): remove this constant when removing the legacy counts // logic. LegacyDownloadStats = "legacy-download-stats" )
const ( IngestionType LogType = "ingestion" LegacyStatisticsType LogType = "legacyStatistics" IngestionStart = "ingestion started" IngestionComplete = "ingestion completed" LegacyStatisticsImportStart = "legacy statistics import started" LegacyStatisticsImportComplete = "legacy statistics import completed" )
const ( StatsArchiveDownload = "archive-download" StatsArchiveDelete = "archive-delete" StatsArchiveFailedUpload = "archive-failed-upload" StatsArchiveUpload = "archive-upload" // The following kinds are in use in the legacy API. StatsCharmInfo = "charm-info" StatsCharmMissing = "charm-missing" StatsCharmEvent = "charm-event" )
Define the kinds to be included in stats keys.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArchiveSizeResponse ¶
type ArchiveSizeResponse struct {
Size int64
}
ArchiveSizeResponse holds the result of an id/meta/archive-size GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetaarchive-size
type ArchiveUploadResponse ¶
type ArchiveUploadResponse struct { Id *charm.Reference PromulgatedId *charm.Reference `json:",omitempty"` }
ArchiveUploadResponse holds the result of a post or a put to /id/archive. See https://github.com/juju/charmstore/blob/v4/docs/API.md#post-idarchive
type ArchiveUploadTimeResponse ¶
ArchiveUploadTimeResponse holds the result of an id/meta/archive-upload-time GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetaarchive-upload-time
type BundleCount ¶
type BundleCount struct {
Count int
}
BundleCount holds the result of an id/meta/bundle-unit-count or bundle-machine-count GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetabundle-unit-count and https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetabundle-machine-count
type DebugStatus ¶
type DebugStatus debugstatus.CheckResult
DebugStatus holds the result of the status checks. This is defined for backward compatibility: new clients should use debugstatus.CheckResult directly.
type Error ¶
Error represents an error - it is returned for any response that fails. See https://github.com/juju/charmstore/blob/v4/docs/API.md#errors
type ErrorCode ¶
type ErrorCode string
ErrorCode holds the class of an error in machine-readable format. It is also an error in its own right.
const ( ErrNotFound ErrorCode = "not found" ErrMetadataNotFound ErrorCode = "metadata not found" ErrForbidden ErrorCode = "forbidden" ErrBadRequest ErrorCode = "bad request" // TODO change to ErrAlreadyExists ErrDuplicateUpload ErrorCode = "duplicate upload" ErrMultipleErrors ErrorCode = "multiple errors" ErrMethodNotAllowed ErrorCode = "method not allowed" )
type ExpandedId ¶
type ExpandedId struct {
Id string
}
ExpandedId holds a charm or bundle fully qualified id. A slice of ExpandedId is used as response for id/expand-id GET requests.
type HashResponse ¶
type HashResponse struct {
Sum string
}
HashResponse holds the result of id/meta/hash and id/meta/hash256 GET requests. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetahash and https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetahash256
type IdNameResponse ¶
type IdNameResponse struct {
Name string
}
IdNameResponse holds the result of an id/meta/id-name GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetaid-name
type IdResponse ¶
type IdResponse struct { Id *charm.Reference User string `json:",omitempty"` Series string `json:",omitempty"` Name string Revision int }
IdResponse holds the result of an id/meta/id GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetaid
type IdRevisionResponse ¶
type IdRevisionResponse struct {
Revision int
}
IdRevisionResponse holds the result of an id/meta/id-revision GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetaid-revision
type IdSeriesResponse ¶
type IdSeriesResponse struct {
Series string
}
IdSeriesResponse holds the result of an id/meta/id-series GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetaid-series
type IdUserResponse ¶
type IdUserResponse struct {
User string
}
IdUserResponse holds the result of an id/meta/id-user GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetaid-user
type Log ¶
type Log struct { // Data holds the log message as a JSON-encoded value. Data *json.RawMessage // Level holds the log level as a string. Level LogLevel // Type holds the log type as a string. Type LogType // URLs holds a slice of entity URLs associated with the log message. URLs []*charm.Reference `json:",omitempty"` }
Log holds the representation of a log message. This is used by clients to store log events in the charm store.
type LogLevel ¶
type LogLevel string
LogLevel defines log levels (e.g. "info" or "error") to be used in log requests and responses.
type LogResponse ¶
type LogResponse struct { // Data holds the log message as a JSON-encoded value. Data json.RawMessage // Level holds the log level as a string. Level LogLevel // Type holds the log type as a string. Type LogType // URLs holds a slice of entity URLs associated with the log message. URLs []*charm.Reference `json:",omitempty"` // Time holds the time of the log. Time time.Time }
LogResponse represents a single log message and is used in the responses to /log GET requests. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-log
type LogType ¶
type LogType string
LogType defines log types (e.g. "ingestion") to be used in log requests and responses.
type ManifestFile ¶
ManifestFile holds information about a charm or bundle file. A slice of ManifestFile is used as response for id/meta/manifest GET requests. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetamanifest
type MetaAnyResponse ¶
type MetaAnyResponse struct { Id *charm.Reference Meta map[string]interface{} `json:",omitempty"` }
MetaAnyResponse holds the result of a meta/any request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetaany
type PermRequest ¶
PermRequest holds the request of an id/meta/perm PUT request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#put-idmetaperm
type PermResponse ¶
PermResponse holds the result of an id/meta/perm GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetaperm
type PromulgateRequest ¶
type PromulgateRequest struct {
Promulgated bool
}
PromulgateRequest holds the request of an id/promulgate PUT request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#put-idpromulgate
type PromulgatedResponse ¶
type PromulgatedResponse struct {
Promulgated bool
}
PromulgatedResponse holds the result of an id/meta/promulgated GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetapromulgated
type Published ¶
Published holds the result of a changes/published GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-changespublished
type RelatedResponse ¶
type RelatedResponse struct { // Requires holds an entry for each interface provided by // the charm, containing all charms that require that interface. Requires map[string][]MetaAnyResponse `json:",omitempty"` // Provides holds an entry for each interface required by the // the charm, containing all charms that provide that interface. Provides map[string][]MetaAnyResponse `json:",omitempty"` }
RelatedResponse holds the result of an id/meta/charm-related GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetacharm-related
type RevisionInfoResponse ¶
type RevisionInfoResponse struct {
Revisions []*charm.Reference
}
RevisionInfoResponse holds the result of an id/meta/revision-info GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetarevision-info
type SearchResponse ¶
type SearchResponse struct { SearchTime time.Duration Total int Results []SearchResult }
SearchResponse holds the response from a search operation.
type SearchResult ¶
type SearchResult struct { Id *charm.Reference // Meta holds at most one entry for each meta value // specified in the include flags, holding the // data that would be returned by reading /meta/meta?id=id. // Metadata not relevant to a particular result will not // be included. Meta map[string]interface{} `json:",omitempty"` }
SearchResult holds a single result from a search operation.
type Statistic ¶
type Statistic struct { Key string `json:",omitempty"` Date string `json:",omitempty"` Count int64 }
Statistic holds one element of a stats/counter response. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-statscounter
type StatsCount ¶
type StatsCount struct { Total int64 // Total count over all time. Day int64 // Count over the last day. Week int64 // Count over the last week. Month int64 // Count over the last month. }
StatsCount holds stats counts and is used as part of StatsResponse.
type StatsResponse ¶
type StatsResponse struct { // ArchiveDownloadCount is superceded by ArchiveDownload but maintained for // backward compatibility. ArchiveDownloadCount int64 // ArchiveDownload holds the downloads count for a specific revision of the // entity. ArchiveDownload StatsCount // ArchiveDownloadAllRevisions holds the downloads count for all revisions // of the entity. ArchiveDownloadAllRevisions StatsCount }
StatsResponse holds the result of an id/meta/stats GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetastats
type TagsResponse ¶
type TagsResponse struct {
Tags []string
}
TagsResponse holds the result of an id/meta/tags GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#get-idmetatags
type WhoAmIResponse ¶
WhoAmIResponse holds the result of a whoami GET request. See https://github.com/juju/charmstore/blob/v4/docs/API.md#whoami