package report

import "github.com/open-policy-agent/opa/internal/report"

Package report provides functions to report OPA's version information to an external service and process the response.

Index

Types

type DataResponse

type DataResponse struct {
	Latest ReleaseDetails `json:"latest,omitempty"`
}

DataResponse represents the data returned by the external service

func (*DataResponse) IsSet

func (dr *DataResponse) IsSet() bool

IsSet returns true if dr is populated.

func (*DataResponse) Pretty

func (dr *DataResponse) Pretty() string

Pretty returns OPA release information in a human-readable format.

func (*DataResponse) Slice

func (dr *DataResponse) Slice() [][2]string

Slice returns the dr as a slice of key-value string pairs. If dr is nil, this function returns an empty slice.

type ReleaseDetails

type ReleaseDetails struct {
	Download      string `json:"download,omitempty"`       // link to download the OPA release
	ReleaseNotes  string `json:"release_notes,omitempty"`  // link to the OPA release notes
	LatestRelease string `json:"latest_release,omitempty"` // latest OPA released version
	OPAUpToDate   bool   `json:"opa_up_to_date,omitempty"` // is running OPA version greater than or equal to the latest released
}

ReleaseDetails holds information about the latest OPA release

type Reporter

type Reporter struct {
	// contains filtered or unexported fields
}

Reporter reports the version of the running OPA instance to an external service

func New

func New(id string) (*Reporter, error)

New returns an instance of the Reporter

func (*Reporter) SendReport

func (r *Reporter) SendReport(ctx context.Context) (*DataResponse, error)

SendReport sends the version report to the external service

Source Files

report.go

Version
v0.20.1
Published
May 21, 2020
Platform
js/wasm
Imports
10 packages
Last checked
46 minutes ago

Tools for package owners.