Documentation
¶
Index ¶
- func ValidateURL(urlStr string) error
- type APIError
- type BuildOptions
- type Client
- func (c *Client) BuildImage(environmentID int, ctxTar io.Reader, opts BuildOptions, onLine func(string)) error
- func (c *Client) CreateStack(name, composeContent string, environmentID int) (*Stack, error)
- func (c *Client) GetContainerLogs(environmentID int, containerID string, tail int) (string, error)
- func (c *Client) GetDockerInfo(environmentID int) (map[string]interface{}, error)
- func (c *Client) GetEnvironments() ([]Environment, error)
- func (c *Client) GetStack(name string, environmentID int) (*Stack, error)
- func (c *Client) GetStackContainers(environmentID int, stackName string) ([]Container, error)
- func (c *Client) GetStackDetails(stackID int) (*StackDetails, error)
- func (c *Client) ImageExists(environmentID int, imageTag string) (bool, error)
- func (c *Client) LoadImage(environmentID int, imageTar io.Reader, onProgress func(string)) error
- func (c *Client) UpdateStack(stackID int, composeContent string, pullImages bool, environmentID int) error
- type Container
- type CreateStackRequest
- type EnvVar
- type Environment
- type Port
- type Stack
- type StackDetails
- type UpdateStackRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateURL ¶
ValidateURL checks if the provided URL is valid
Types ¶
type BuildOptions ¶
type BuildOptions struct {
Tag string
Dockerfile string // relative to context
BuildArgs map[string]string // optional
Target string // optional
NoCache bool // optional - set to true to disable build cache
}
BuildOptions represents options for building an image
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles communication with the Portainer API
func NewClientWithTLS ¶
NewClientWithTLS creates a new Portainer API client with TLS verification control
func (*Client) BuildImage ¶
func (c *Client) BuildImage(environmentID int, ctxTar io.Reader, opts BuildOptions, onLine func(string)) error
BuildImage builds an image using the Docker Build API via Portainer proxy
func (*Client) CreateStack ¶
CreateStack creates a new stack in Portainer
func (*Client) GetContainerLogs ¶
GetContainerLogs retrieves logs for a specific container via Docker proxy
func (*Client) GetDockerInfo ¶
GetDockerInfo retrieves Docker engine information via Portainer proxy
func (*Client) GetEnvironments ¶
func (c *Client) GetEnvironments() ([]Environment, error)
GetEnvironments retrieves all available environments from Portainer
func (*Client) GetStackContainers ¶
GetStackContainers retrieves containers for a specific stack via Docker proxy
func (*Client) GetStackDetails ¶
func (c *Client) GetStackDetails(stackID int) (*StackDetails, error)
GetStackDetails retrieves detailed stack information by ID
func (*Client) ImageExists ¶
ImageExists checks if an image exists on the remote Docker engine
type Container ¶
type Container struct {
ID string `json:"Id"`
Names []string `json:"Names"`
Image string `json:"Image"`
Status string `json:"Status"`
State string `json:"State"`
Created int64 `json:"Created"`
Labels map[string]string `json:"Labels"`
Ports []Port `json:"Ports"`
}
Container represents a Docker container
type CreateStackRequest ¶
type CreateStackRequest struct {
Name string `json:"Name"`
StackFileContent string `json:"StackFileContent"`
Env []EnvVar `json:"Env"`
}
CreateStackRequest represents the request payload for creating a stack
type Environment ¶
Environment represents a Portainer environment/endpoint
type Port ¶
type Port struct {
PrivatePort int `json:"PrivatePort"`
PublicPort int `json:"PublicPort"`
Type string `json:"Type"`
IP string `json:"IP"`
}
Port represents container port mapping
type Stack ¶
type Stack struct {
ID int `json:"Id"`
Name string `json:"Name"`
StackFile string `json:"StackFile"`
EnvironmentID int `json:"EndpointId"`
Status int `json:"Status"`
}
Stack represents a Portainer stack
type StackDetails ¶
type StackDetails struct {
ID int `json:"Id"`
Name string `json:"Name"`
Status int `json:"Status"`
EnvironmentID int `json:"EndpointId"`
CreatedAt int64 `json:"creationDate"`
UpdatedAt int64 `json:"updateDate"`
CreatedBy string `json:"createdBy"`
UpdatedBy string `json:"updatedBy"`
ProjectPath string `json:"projectPath"`
EntryPoint string `json:"EntryPoint"`
}
StackDetails represents detailed stack information from Portainer
type UpdateStackRequest ¶
type UpdateStackRequest struct {
StackFile string `json:"StackFile"`
PullImage bool `json:"PullImage"`
Prune bool `json:"Prune"`
}
UpdateStackRequest represents the request payload for updating a stack