Documentation
¶
Index ¶
- Constants
- func TagName(kind ResourceKind) string
- type ConfigEntry
- type ConfigFile
- type Container
- type GetContainersOptions
- type Image
- type Options
- type Platform
- func (p *Platform) GetContainers(ctx context.Context, options *GetContainersOptions) ([]Container, error)
- func (p *Platform) GetImage(ctx context.Context, nameOrID string) (*Image, error)
- func (p *Platform) Graph(ctx context.Context) (*graph.Graph[platform.Node], error)
- func (p *Platform) Version() Version
- type Resource
- type ResourceKind
- type Version
Constants ¶
const ( ResourceKindHost = "host" ResourceKindContainer = "container" ResourceKindSwarmTask = "swarm/task" ResourceKindSwarmService = "swarm/service" ResourceKindSwarmNamespace = "swarm/namespace" ResourceKindComposeProject = "compose/project" ResourceKindComposeService = "compose/service" )
Variables ¶
This section is empty.
Functions ¶
func TagName ¶
func TagName(kind ResourceKind) string
TagName returns the human-readable name of a tag representing the resource. Panics if ResourceKind.IsSupported returns false.
Types ¶
type ConfigEntry ¶ added in v0.16.0
type ConfigEntry struct { Auth string `json:"auth,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Email string `json:"email,omitempty"` }
ConfigEntry is an entry for a specific pattern, as defined in a ConfigFile.
type ConfigFile ¶ added in v0.16.0
type ConfigFile struct { Auths map[string]ConfigEntry `json:"auths"` HttpHeaders map[string]string `json:"HttpHeaders,omitempty"` }
ConfigFile implements config file format used by Docker (and Kubernetes) for registry secrets and auth.
type Container ¶
type Container struct { ID string `json:"Id"` Names []string Image string ImageID string Labels map[string]string }
Container is a container as defined by the Docker runtime API.
type GetContainersOptions ¶
type Options ¶
type Options struct { // IncludeAllContainers will graph all containers, no matter their state. // Defaults to false - only include running containers. IncludeAllContainers bool // TLSClientConfig sets the TLSClientConfig of the underlying client. // Only used if scheme is tcp or https. TLSClientConfig *tls.Config }
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform implements graphing for the Docker platform.
func NewPlatform ¶
NewPlatform initializes a new Platform.
- dockerURI is the URI to the docker socket. Such as unix://docker.sock, tcp://127.0.0.1:8080, http://127.0.0.1:8080 or https://127.0.0.1:8080.
func (*Platform) GetContainers ¶
func (p *Platform) GetContainers(ctx context.Context, options *GetContainersOptions) ([]Container, error)
GetContainers retrieves container information from the Docker runtime.
func (*Platform) GetImage ¶
GetImage retrieves container image information from the Docker runtime by name or id. Returns an error if the image does not exist.
func (*Platform) Graph ¶
Graph implements platform.Platform.
SEE: https://docs.docker.com/reference/api/engine/version/v1.47/
type Resource ¶
type Resource interface { platform.Node // Kind returns the type of resource. Kind() ResourceKind // Name returns the name of the resource. Name() string // String returns a textual representation of the resource. String() string }
Resource is a Docker resource found on the platform.
type ResourceKind ¶
type ResourceKind string
ResourceKind defines the types of resources exposed by the platform.
func (ResourceKind) IsSupported ¶ added in v0.18.0
func (r ResourceKind) IsSupported() bool
IsSupported returns whether or not the resource is supported.
type Version ¶ added in v0.20.0
type Version struct { // Version is the version of Docker. Version string `json:"Version"` OS string `json:"Os"` Architecture string `json:"Arch"` // MinimumAPIVersion is the minimum support API version. MinimumAPIVersion string `json:"MinAPIVersion"` // APIVersion is the current API version. APIVersion string `json:"ApiVersion"` }