Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContextWithDetailer ¶
NewContextWithDetailer returns a copy of the specified Context associated with the specified Detailer.
Types ¶
type Detail ¶
type Detail struct {
// Type is the type of detail: info, warning or error.
Type DetailType `json:"type"`
// Message is the message of the detail.
Message string `json:"msg"`
}
Detail represents additional information produced during the deployment of an configuration.
type DetailType ¶ added in v2.20.0
type DetailType = string
const ( // DetailTypeInfo indicates a detail of type info. DetailTypeInfo DetailType = "INFO" // DetailTypeWarn indicates a detail of type warning. DetailTypeWarn DetailType = "WARN" // DetailTypeError indicates a detail of type error. DetailTypeError DetailType = "ERROR" )
type Detailer ¶
type Detailer interface {
// Add adds a Detail to the Detailer.
Add(d Detail)
// GetAll gets all Details stored by the Detailer.
GetAll() []Detail
}
// Reporter is a minimal interface for recording and retrieving details.
func GetDetailerFromContextOrDiscard ¶
GetDetailerFromContextOrDiscard gets the Detailer associated with the Context or returns a discarding Detailer if none is available.
func NewDefaultDetailer ¶
func NewDefaultDetailer() Detailer
NewDefaultDetailer creates a Detailer that simply stores Details in a slice.
type JSONTime ¶
JSONTime represents a time.Time value that is serialized as a string in RFC3339 format.
func (JSONTime) MarshalJSON ¶
MarshalJSON marshals a JSONTime value into a RFC3339 string.
func (*JSONTime) UnmarshalJSON ¶
UnmarshalJSON unmarshals a JSONTime value from a RFC3339 string.
type Record ¶
type Record struct {
// Type is the type of record, currently TypeDeploy and TypeLoad.
Type RecordType `json:"type"`
// Time is the time associated with the Record.
Time JSONTime `json:"time"`
// Config provides the config ID, project and type of the config associated with the Record.
Config *coordinate.Coordinate `json:"config,omitempty"`
ObjectID string `json:"objectId,omitempty"`
// State is the result of the deployment of the config, currently StateSuccess, StateInfo, StateError, StateExcluded, StateSkipped.
State RecordState `json:"state"`
// Details optionally provides Detail log entries associated with the record.
Details []Detail `json:"details,omitempty"`
// Error optionally provides the string representation of any error associated with the Record.
Error string `json:"error,omitempty"`
// Message optionally info message
Message string `json:"message,omitempty"`
}
Record is a single entry in a report.
type RecordState ¶ added in v2.20.0
type RecordState = string
const ( // StateInfo indicates some debug information (e.g., used Monaco version) StateInfo RecordState = "INFO" // StateSuccess indicates a config was successfully deployed/validated. StateSuccess RecordState = "SUCCESS" // StateWarn indicates a config warning, e.g., "account resource file skipped". StateWarn RecordState = "WARNING" // StateError indicates a config could not be validated or deployed due to an error. StateError RecordState = "ERROR" // StateExcluded indicates no attempt was made to deploy a config because it was marked by the user to skip. StateExcluded RecordState = "EXCLUDED" // StateSkipped indicates no attempt was made to deploy a config because one or more dependencies were skipped or excluded. StateSkipped RecordState = "SKIPPED" )
type RecordType ¶ added in v2.20.0
type RecordType = string
const ( TypeDeploy RecordType = "DEPLOY" TypeLoad RecordType = "LOAD" TypeCache RecordType = "CACHE" TypeInfo RecordType = "INFO" )
type Reporter ¶
type Reporter interface {
// ReportSuccessfulDeployment reports the successful result of deploying a config.
ReportSuccessfulDeployment(config coordinate.Coordinate, objectID string, details []Detail)
// ReportExcludedDeployment reports that a config was excluded from deployment.
ReportExcludedDeployment(config coordinate.Coordinate, details []Detail)
// ReportSkippedDeployment reports that a config was skipped from deployment.
ReportSkippedDeployment(config coordinate.Coordinate, details []Detail)
// ReportFailedDeployment reports that a config failed to deploy.
ReportFailedDeployment(config coordinate.Coordinate, details []Detail, err error)
// ReportLoading reports the result of a load config
ReportLoading(state RecordState, err error, message string, config *coordinate.Coordinate)
// ReportCaching reports the result of caching actions, like settings.
ReportCaching(state RecordState, message string)
// ReportInfo reports info messages like monaco version or that the deployment succeeded
ReportInfo(message string)
// GetSummary returns a summary of all seen events as a string.
GetSummary() string
// Stop shuts down the Reporter, writing out all records.
Stop()
}
Reporter is a minimal interface for reporting events and retrieving summaries.
func GetReporterFromContextOrDiscard ¶
GetReporterFromContextOrDiscard gets the Reporter associated with the Context or returns a discarding Reporter if none is available.