platform

package
v0.1.0-dev.20260817193007 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package platform provides access to platform information by graph actions and executing receivers.

Index

Constants

View Source
const (
	Arch     op.ActionName = "platform.arch"
	Distro   op.ActionName = "platform.distro"
	Hostname op.ActionName = "platform.hostname"
	OS       op.ActionName = "platform.os"
	Version  op.ActionName = "platform.version"
)

Action-name constants for the platform provider's plan-mode actions.

Each constant is the short dotted action label its method dispatches under. Pass these to plan.Plan, op.ReceiverRegistry().BuildAction, RuntimeEnvironment.ActionByName, or WithActionNamed in place of a string literal so a typo is a compile error and rename / find-references work through the constant.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	op.ProviderBase
}

Provider exposes host platform metadata to Starlark scripts and graph actions.

All accessors delegate to the platform capability (`platform.Platform`) on the provider's op.RuntimeEnvironment. When the context has no platform (nil), accessors return zero values.

+devlore:access=both

func NewProvider

func NewProvider(runtimeEnvironment *op.RuntimeEnvironment) *Provider

NewProvider returns a new platform Provider with the given runtime environment.

Parameters:

  • `runtimeEnvironment`: the execution context (must carry a non-nil Platform for accessors to return data).

Returns:

  • `*Provider`: the configured provider.

func (*Provider) Arch

func (p *Provider) Arch() string

Arch returns the CPU architecture (e.g., "amd64", "arm64").

Returns:

  • `string`: the architecture identifier, or "" if platform is nil.

func (*Provider) Distro

func (p *Provider) Distro() string

Distro returns the OS distribution (e.g., "Ubuntu", "Fedora").

Returns:

  • `string`: the distribution name, or "" if unavailable or platform is nil.

func (*Provider) Hostname

func (p *Provider) Hostname() string

Hostname returns the machine hostname.

Returns:

  • `string`: the hostname, or "" if unavailable or platform is nil.

func (*Provider) OS

func (p *Provider) OS() string

OS returns the operating system name (e.g., "darwin", "linux", "windows").

Returns:

  • `string`: the OS identifier, or "" if platform is nil.

func (*Provider) Version

func (p *Provider) Version() string

Version returns the OS version string.

Returns:

  • `string`: the version, or "" if unavailable or platform is nil.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL