Documentation
¶
Index ¶
- func CheckInterval(p *CheckParams, interval time.Duration, cb func(*CheckResponse, error)) chan struct{}
- func Report(ctx context.Context, r *ReportParams) error
- func ReportRequest(r *ReportParams) (*http.Request, error)
- type CheckAlert
- type CheckParams
- type CheckResponse
- type ReportParams
- type VersionsParams
- type VersionsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckInterval ¶
func CheckInterval(p *CheckParams, interval time.Duration, cb func(*CheckResponse, error)) chan struct{}
CheckInterval is used to check for a response on a given interval duration. The interval is not exact, and checks are randomized to prevent a thundering herd. However, it is expected that on average one check is performed per interval. The returned channel may be closed to stop background checks.
func Report ¶
func Report(ctx context.Context, r *ReportParams) error
Report sends telemetry information to checkpoint
func ReportRequest ¶
func ReportRequest(r *ReportParams) (*http.Request, error)
ReportRequest creates a request object for making a report
Types ¶
type CheckAlert ¶
type CheckAlert struct { ID int `json:"id"` Date int `json:"date"` Message string `json:"message"` URL string `json:"url"` Level string `json:"level"` }
CheckAlert is a single alert message from a check request.
These never have to be manually constructed, and are typically populated into a CheckResponse as a result of the Check request.
type CheckParams ¶
type CheckParams struct { // Product and version are used to lookup the correct product and // alerts for the proper version. The version is also used to perform // a version check. Product string Version string // Arch and OS are used to filter alerts potentially only to things // affecting a specific os/arch combination. If these aren't specified, // they'll be automatically filled in. Arch string OS string // Signature is some random signature that should be stored and used // as a cookie-like value. This ensures that alerts aren't repeated. // If the signature is changed, repeat alerts may be sent down. The // signature should NOT be anything identifiable to a user (such as // a MAC address). It should be random. // // If SignatureFile is given, then the signature will be read from this // file. If the file doesn't exist, then a random signature will // automatically be generated and stored here. SignatureFile will be // ignored if Signature is given. Signature string SignatureFile string // CacheFile, if specified, will cache the result of a check. The // duration of the cache is specified by CacheDuration, and defaults // to 48 hours if not specified. If the CacheFile is newer than the // CacheDuration, than the Check will short-circuit and use those // results. // // If the CacheFile directory doesn't exist, it will be created with // permissions 0755. CacheFile string CacheDuration time.Duration // Force, if true, will force the check even if CHECKPOINT_DISABLE // is set. Within HashiCorp products, this is ONLY USED when the user // specifically requests it. This is never automatically done without // the user's consent. Force bool }
CheckParams are the parameters for configuring a check request.
type CheckResponse ¶
type CheckResponse struct { Product string `json:"product"` CurrentVersion string `json:"current_version"` CurrentReleaseDate int `json:"current_release_date"` CurrentDownloadURL string `json:"current_download_url"` CurrentChangelogURL string `json:"current_changelog_url"` ProjectWebsite string `json:"project_website"` Outdated bool `json:"outdated"` Alerts []*CheckAlert `json:"alerts"` }
CheckResponse is the response for a check request.
func Check ¶
func Check(p *CheckParams) (*CheckResponse, error)
Check checks for alerts and new version information.
type ReportParams ¶
type ReportParams struct { // Signature is some random signature that should be stored and used // as a cookie-like value. This ensures that alerts aren't repeated. // If the signature is changed, repeat alerts may be sent down. The // signature should NOT be anything identifiable to a user (such as // a MAC address). It should be random. // // If SignatureFile is given, then the signature will be read from this // file. If the file doesn't exist, then a random signature will // automatically be generated and stored here. SignatureFile will be // ignored if Signature is given. Signature string `json:"signature"` SignatureFile string `json:"-"` StartTime time.Time `json:"start_time"` EndTime time.Time `json:"end_time"` Arch string `json:"arch"` OS string `json:"os"` Payload interface{} `json:"payload,omitempty"` Product string `json:"product"` RunID string `json:"run_id"` SchemaVersion string `json:"schema_version"` Version string `json:"version"` }
ReportParams are the parameters for configuring a telemetry report.
type VersionsParams ¶
type VersionsParams struct { // Service is used to lookup the correct service. Service string // Product is used to filter the version contraints. Product string // Force, if true, will force the check even if CHECKPOINT_DISABLE // is set. Within HashiCorp products, this is ONLY USED when the user // specifically requests it. This is never automatically done without // the user's consent. Force bool }
VersionsParams are the parameters for a versions request.
type VersionsResponse ¶
type VersionsResponse struct { Service string `json:"service"` Product string `json:"product"` Minimum string `json:"minimum"` Maximum string `json:"maximum"` Excluding []string `json:"excluding"` }
VersionsResponse is the response for a versions request.
func Versions ¶
func Versions(p *VersionsParams) (*VersionsResponse, error)
Versions returns the version constrains for a given service and product.