Documentation
¶
Index ¶
Constants ¶
const AWSIPRangesURL = "https://ip-ranges.amazonaws.com/ip-ranges.json"
Variables ¶
This section is empty.
Functions ¶
func DiscardAfterClose ¶
func DiscardAfterClose(wc io.WriteCloser) io.WriteCloser
DiscardAfterClose is an io.WriteCloser that discards writes after it is closed without errors. It is useful as a target for a slog.Sink such that an underlying WriteCloser, like a file, can be cleaned up without race conditions from still-active loggers.
func Hostname ¶ added in v2.5.0
func Hostname() string
Hostname returns the hostname of the machine, lowercased, with any trailing domain suffix stripped. It is cached after the first call. If the hostname cannot be determined, for any reason, localhost will be returned instead.
func NewLicenseFormatter ¶ added in v2.24.0
func NewLicenseFormatter() *cliui.OutputFormatter
NewLicenseFormatter returns a new license formatter. The formatter will return a table and JSON output.
func WarnMatchedProvisioners ¶ added in v2.18.1
func WarnMatchedProvisioners(w io.Writer, mp *codersdk.MatchedProvisioners, job codersdk.ProvisionerJob)
WarnMatchedProvisioners warns the user if there are no provisioners that match the requested tags for a given provisioner job. If the job is not pending, it is ignored.
Types ¶
type AWSIPRanges ¶ added in v2.15.0
func FetchAWSIPRanges ¶ added in v2.15.0
func FetchAWSIPRanges(ctx context.Context, url string) (*AWSIPRanges, error)
type Queue ¶ added in v2.24.0
type Queue[T any] struct { // contains filtered or unexported fields }
Queue is a FIFO queue with a fixed size. If the size is exceeded, the first item is dropped.
func (*Queue[T]) Close ¶ added in v2.24.0
func (q *Queue[T]) Close()
Close aborts any pending pops and makes future pushes error.
func (*Queue[T]) Pop ¶ added in v2.24.0
Pop removes and returns the first item from the queue, waiting until there is something to pop if necessary. If closed, returns false.
func (*Queue[T]) Push ¶ added in v2.24.0
Push adds an item to the queue. If closed, returns an error.
func (*Queue[T]) WithPredicate ¶ added in v2.24.0
WithPredicate adds the given predicate function, which can control what is pushed to the queue.
type StatusQueue ¶ added in v2.24.0
type StatusQueue struct { Queue[reportTask] // contains filtered or unexported fields }
statusQueue is a Queue that: 1. Only pushes items that are not duplicates. 2. Preserves the existing message and URI when one a message is not provided. 3. Ignores "working" updates from the status watcher.
func (*StatusQueue) Push ¶ added in v2.24.0
func (q *StatusQueue) Push(report reportTask) error