Documentation
¶
Index ¶
- func BuildHTTPClient(timeout float64, options *agent.Options) *edgeHTTPClient
- type APIClient
- type AsyncCommand
- type AsyncRequest
- type AsyncResponse
- type ContainerCommandData
- type DockerSnapshotter
- type EdgeConfig
- type EdgeConfigID
- type EdgeConfigStateType
- type EdgeJobData
- type EdgeStackLog
- type EndpointLog
- type HelmChartStatusPayload
- type ImageCommandData
- type LiveLogCollector
- type LogCommandData
- type MetaFields
- type NonOkResponseError
- type NormalStackCommandData
- type Option
- type PollStatusResponse
- type PortainerAsyncClient
- func (client *PortainerAsyncClient) DeleteEdgeStackStatus(edgeStackID int) error
- func (client *PortainerAsyncClient) EnqueueLogCollectionForStack(logCmd LogCommandData)
- func (client *PortainerAsyncClient) GetCharts(chartNames []string) ([]portainer.PolicyChartBundle, portainer.RestoreSettingsBundle, error)
- func (client *PortainerAsyncClient) GetEdgeConfig(id EdgeConfigID) (*EdgeConfig, error)
- func (client *PortainerAsyncClient) GetEdgeStackConfig(edgeStackID int, version *int) (*edge.StackPayload, error)
- func (client *PortainerAsyncClient) GetEnvironmentID() (portainer.EndpointID, error)
- func (client *PortainerAsyncClient) GetEnvironmentStatus(flags ...string) (*PollStatusResponse, error)
- func (client *PortainerAsyncClient) SetEdgeConfigState(id EdgeConfigID, state EdgeConfigStateType) error
- func (client *PortainerAsyncClient) SetEdgeJobStatus(edgeJobStatus agent.EdgeJobStatus) error
- func (client *PortainerAsyncClient) SetEdgeStackStatus(edgeStackID, version int, edgeStackStatus portainer.EdgeStackStatusType, ...) error
- func (client *PortainerAsyncClient) SetLastCommandTimestamp(timestamp time.Time)
- func (client *PortainerAsyncClient) SetPendingCommand(id portainer.EdgeStackID, version int, timestamp time.Time)
- func (client *PortainerAsyncClient) SetTimeout(t time.Duration)
- func (client *PortainerAsyncClient) UpdatePolicyChartStatuses(statuses []portainer.PolicyChartStatus) error
- type PortainerClient
- type PortainerEdgeClient
- func (client *PortainerEdgeClient) EnqueueLogCollectionForStack(logCmd LogCommandData)
- func (client *PortainerEdgeClient) GetCharts(chartNames []string) ([]portainer.PolicyChartBundle, portainer.RestoreSettingsBundle, error)
- func (client *PortainerEdgeClient) GetEdgeConfig(id EdgeConfigID) (*EdgeConfig, error)
- func (client *PortainerEdgeClient) GetEdgeStackConfig(edgeStackID int, version *int) (*edge.StackPayload, error)
- func (client *PortainerEdgeClient) GetEnvironmentID() (portainer.EndpointID, error)
- func (client *PortainerEdgeClient) GetEnvironmentStatus(flags ...string) (*PollStatusResponse, error)
- func (client *PortainerEdgeClient) ProcessAsyncCommands() error
- func (client *PortainerEdgeClient) SetEdgeConfigState(id EdgeConfigID, state EdgeConfigStateType) error
- func (client *PortainerEdgeClient) SetEdgeJobStatus(edgeJobStatus agent.EdgeJobStatus) error
- func (client *PortainerEdgeClient) SetEdgeStackStatus(edgeStackID, version int, edgeStackStatus portainer.EdgeStackStatusType, ...) error
- func (client *PortainerEdgeClient) SetLastCommandTimestamp(timestamp time.Time)
- func (client *PortainerEdgeClient) SetTimeout(t time.Duration)
- func (client *PortainerEdgeClient) UpdatePolicyChartStatuses(statuses []portainer.PolicyChartStatus) error
- type StackStatus
- type VolumeCommandData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildHTTPClient ¶
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient is used to execute HTTP requests against the agent API
func NewAPIClient ¶
func NewAPIClient() *APIClient
NewAPIClient returns a pointer to a new APIClient instance
func (*APIClient) GetEdgeKey ¶
GetEdgeKey executes a KeyInspect operation against the specified server
func (*APIClient) SetEdgeKey ¶
SetEdgeKey executes a KeyCreate operation against the specified server
type AsyncCommand ¶
type AsyncRequest ¶
type AsyncRequest struct {
CommandTimestamp *time.Time `json:"commandTimestamp,omitempty"`
Snapshot *snapshot `json:"snapshot,omitempty"`
EndpointId portainer.EndpointID `json:"endpointId,omitempty"`
MetaFields *MetaFields `json:"metaFields,omitempty"`
}
type AsyncResponse ¶
type AsyncResponse struct {
PingInterval time.Duration `json:"pingInterval"`
SnapshotInterval time.Duration `json:"snapshotInterval"`
CommandInterval time.Duration `json:"commandInterval"`
EndpointID portainer.EndpointID `json:"endpointID"`
Commands []AsyncCommand `json:"commands"`
NeedFullSnapshot bool `json:"needFullSnapshot"`
}
type ContainerCommandData ¶
type ContainerCommandData struct {
ContainerName string
ContainerStartOptions container.StartOptions
ContainerRemoveOptions container.RemoveOptions
ContainerOperation string
}
type DockerSnapshotter ¶
type DockerSnapshotter func(edgeKey string) (*portainer.DockerSnapshot, error)
type EdgeConfig ¶
type EdgeConfig struct {
ID EdgeConfigID
Name string
BaseDir string
DirEntries []filesystem.DirEntry
Prev *EdgeConfig
Invalid bool
}
type EdgeConfigID ¶
type EdgeConfigID int
type EdgeConfigStateType ¶
type EdgeConfigStateType int
const ( EdgeConfigIdleState EdgeConfigStateType = iota EdgeConfigFailureState EdgeConfigSavingState EdgeConfigDeletingState EdgeConfigUpdatingState )
func (EdgeConfigStateType) String ¶
func (e EdgeConfigStateType) String() string
type EdgeJobData ¶
type EdgeStackLog ¶
type EdgeStackLog struct {
EdgeStackID portainer.EdgeStackID `json:"edgeStackID,omitempty"`
Logs []EndpointLog `json:"logs,omitempty"`
Append bool `json:"append,omitempty"`
}
type EndpointLog ¶
type HelmChartStatusPayload ¶
type HelmChartStatusPayload struct {
Statuses []portainer.PolicyChartStatus `json:"chartStatuses"`
}
type ImageCommandData ¶
type ImageCommandData struct {
ImageName string
ImageRemoveOptions image.RemoveOptions
ImageOperation string
}
type LiveLogCollector ¶
type LiveLogCollector struct {
// contains filtered or unexported fields
}
func StartNewLiveLogCollector ¶
func StartNewLiveLogCollector(containerName, since, until, tail string) (*LiveLogCollector, error)
type LogCommandData ¶
type MetaFields ¶
type NonOkResponseError ¶
type NonOkResponseError struct {
// contains filtered or unexported fields
}
func (*NonOkResponseError) Error ¶
func (e *NonOkResponseError) Error() string
type NormalStackCommandData ¶
type Option ¶
type Option func(*options)
func WithDockerSnapshotter ¶
func WithDockerSnapshotter(snapshotter DockerSnapshotter) Option
func WithVersion ¶
type PollStatusResponse ¶
type PollStatusResponse struct {
Status string `json:"status"`
Port int `json:"port"`
Schedules []agent.Schedule `json:"schedules"`
CheckinInterval float64 `json:"checkin"`
Credentials string `json:"credentials"`
Stacks []StackStatus `json:"stacks"`
EdgeConfigurations map[EdgeConfigID]EdgeConfigStateType `json:"edge_configurations"`
PolicyChartSummaries []portainer.PolicyChartSummary `json:"policy_chart_summaries"`
// Async mode only
EndpointID int `json:"endpointID"`
PingInterval time.Duration `json:"pingInterval"`
SnapshotInterval time.Duration `json:"snapshotInterval"`
CommandInterval time.Duration `json:"commandInterval"`
AsyncCommands []AsyncCommand `json:"commands"`
}
type PortainerAsyncClient ¶
type PortainerAsyncClient struct {
// contains filtered or unexported fields
}
PortainerAsyncClient is used to execute HTTP requests using only the /api/entrypoint/async api endpoint
func NewPortainerAsyncClient ¶
func NewPortainerAsyncClient( serverAddress string, setEIDFn setEndpointIDFn, getEIDFn getEndpointIDFn, edgeID string, edgeKey string, containerPlatform agent.ContainerPlatform, metaFields agent.EdgeMetaFields, httpClient *edgeHTTPClient, opts ...Option, ) *PortainerAsyncClient
NewPortainerAsyncClient returns a pointer to a new PortainerAsyncClient instance
func (*PortainerAsyncClient) DeleteEdgeStackStatus ¶
func (client *PortainerAsyncClient) DeleteEdgeStackStatus(edgeStackID int) error
func (*PortainerAsyncClient) EnqueueLogCollectionForStack ¶
func (client *PortainerAsyncClient) EnqueueLogCollectionForStack(logCmd LogCommandData)
func (*PortainerAsyncClient) GetCharts ¶
func (client *PortainerAsyncClient) GetCharts(chartNames []string) ([]portainer.PolicyChartBundle, portainer.RestoreSettingsBundle, error)
GetCharts retrieves the chart contents for the specified charts from the Portainer server
func (*PortainerAsyncClient) GetEdgeConfig ¶
func (client *PortainerAsyncClient) GetEdgeConfig(id EdgeConfigID) (*EdgeConfig, error)
func (*PortainerAsyncClient) GetEdgeStackConfig ¶
func (client *PortainerAsyncClient) GetEdgeStackConfig(edgeStackID int, version *int) (*edge.StackPayload, error)
GetEdgeStackConfig retrieves the configuration associated to an Edge stack
func (*PortainerAsyncClient) GetEnvironmentID ¶
func (client *PortainerAsyncClient) GetEnvironmentID() (portainer.EndpointID, error)
func (*PortainerAsyncClient) GetEnvironmentStatus ¶
func (client *PortainerAsyncClient) GetEnvironmentStatus(flags ...string) (*PollStatusResponse, error)
func (*PortainerAsyncClient) SetEdgeConfigState ¶
func (client *PortainerAsyncClient) SetEdgeConfigState(id EdgeConfigID, state EdgeConfigStateType) error
func (*PortainerAsyncClient) SetEdgeJobStatus ¶
func (client *PortainerAsyncClient) SetEdgeJobStatus(edgeJobStatus agent.EdgeJobStatus) error
SetEdgeJobStatus sends the jobID log to the Portainer server
func (*PortainerAsyncClient) SetEdgeStackStatus ¶
func (client *PortainerAsyncClient) SetEdgeStackStatus(edgeStackID, version int, edgeStackStatus portainer.EdgeStackStatusType, rollbackTo *int, err string) error
SetEdgeStackStatus updates the status of an Edge stack on the Portainer server
func (*PortainerAsyncClient) SetLastCommandTimestamp ¶
func (client *PortainerAsyncClient) SetLastCommandTimestamp(timestamp time.Time)
func (*PortainerAsyncClient) SetPendingCommand ¶
func (client *PortainerAsyncClient) SetPendingCommand(id portainer.EdgeStackID, version int, timestamp time.Time)
SetPendingCommand stores the latest command timestamp for a given stack ID
func (*PortainerAsyncClient) SetTimeout ¶
func (client *PortainerAsyncClient) SetTimeout(t time.Duration)
func (*PortainerAsyncClient) UpdatePolicyChartStatuses ¶
func (client *PortainerAsyncClient) UpdatePolicyChartStatuses(statuses []portainer.PolicyChartStatus) error
type PortainerClient ¶
type PortainerClient interface {
GetEnvironmentID() (portainer.EndpointID, error)
GetEnvironmentStatus(flags ...string) (*PollStatusResponse, error)
GetEdgeStackConfig(edgeStackID int, version *int) (*edge.StackPayload, error)
SetEdgeStackStatus(edgeStackID, version int, edgeStackStatus portainer.EdgeStackStatusType, rollbackTo *int, errMessage string) error
SetEdgeJobStatus(edgeJobStatus agent.EdgeJobStatus) error
GetEdgeConfig(id EdgeConfigID) (*EdgeConfig, error)
SetEdgeConfigState(id EdgeConfigID, state EdgeConfigStateType) error
SetTimeout(t time.Duration)
SetLastCommandTimestamp(timestamp time.Time)
EnqueueLogCollectionForStack(logCmd LogCommandData)
GetCharts(chartNames []string) ([]portainer.PolicyChartBundle, portainer.RestoreSettingsBundle, error)
UpdatePolicyChartStatuses(statuses []portainer.PolicyChartStatus) error
}
func NewPortainerClient ¶
func NewPortainerClient(serverAddress string, setEIDFn setEndpointIDFn, getEIDFn getEndpointIDFn, edgeID string, edgeKey string, edgeAsyncMode bool, agentPlatform agent.ContainerPlatform, metaFields agent.EdgeMetaFields, httpClient *edgeHTTPClient) PortainerClient
NewPortainerClient returns a pointer to a new PortainerClient instance
type PortainerEdgeClient ¶
type PortainerEdgeClient struct {
// contains filtered or unexported fields
}
PortainerEdgeClient is used to execute HTTP requests against the Portainer API
func NewPortainerEdgeClient ¶
func NewPortainerEdgeClient( serverAddress string, setEIDFn setEndpointIDFn, getEIDFn getEndpointIDFn, edgeID string, agentPlatform agent.ContainerPlatform, metaFields agent.EdgeMetaFields, httpClient *edgeHTTPClient, opts ...Option, ) *PortainerEdgeClient
NewPortainerEdgeClient returns a pointer to a new PortainerEdgeClient instance
func (*PortainerEdgeClient) EnqueueLogCollectionForStack ¶
func (client *PortainerEdgeClient) EnqueueLogCollectionForStack(logCmd LogCommandData)
func (*PortainerEdgeClient) GetCharts ¶
func (client *PortainerEdgeClient) GetCharts(chartNames []string) ([]portainer.PolicyChartBundle, portainer.RestoreSettingsBundle, error)
GetCharts retrieves the chart contents for the specified charts from the Portainer server
func (*PortainerEdgeClient) GetEdgeConfig ¶
func (client *PortainerEdgeClient) GetEdgeConfig(id EdgeConfigID) (*EdgeConfig, error)
func (*PortainerEdgeClient) GetEdgeStackConfig ¶
func (client *PortainerEdgeClient) GetEdgeStackConfig(edgeStackID int, version *int) (*edge.StackPayload, error)
GetEdgeStackConfig retrieves the configuration associated to an Edge stack
func (*PortainerEdgeClient) GetEnvironmentID ¶
func (client *PortainerEdgeClient) GetEnvironmentID() (portainer.EndpointID, error)
func (*PortainerEdgeClient) GetEnvironmentStatus ¶
func (client *PortainerEdgeClient) GetEnvironmentStatus(flags ...string) (*PollStatusResponse, error)
func (*PortainerEdgeClient) ProcessAsyncCommands ¶
func (client *PortainerEdgeClient) ProcessAsyncCommands() error
func (*PortainerEdgeClient) SetEdgeConfigState ¶
func (client *PortainerEdgeClient) SetEdgeConfigState(id EdgeConfigID, state EdgeConfigStateType) error
func (*PortainerEdgeClient) SetEdgeJobStatus ¶
func (client *PortainerEdgeClient) SetEdgeJobStatus(edgeJobStatus agent.EdgeJobStatus) error
SetEdgeJobStatus sends the jobID log to the Portainer server
func (*PortainerEdgeClient) SetEdgeStackStatus ¶
func (client *PortainerEdgeClient) SetEdgeStackStatus( edgeStackID, version int, edgeStackStatus portainer.EdgeStackStatusType, rollbackTo *int, error string, ) error
SetEdgeStackStatus updates the status of an Edge stack on the Portainer server
func (*PortainerEdgeClient) SetLastCommandTimestamp ¶
func (client *PortainerEdgeClient) SetLastCommandTimestamp(timestamp time.Time)
func (*PortainerEdgeClient) SetTimeout ¶
func (client *PortainerEdgeClient) SetTimeout(t time.Duration)
func (*PortainerEdgeClient) UpdatePolicyChartStatuses ¶
func (client *PortainerEdgeClient) UpdatePolicyChartStatuses(statuses []portainer.PolicyChartStatus) error
type StackStatus ¶
type StackStatus struct {
ID int
Version int
Name string // used in async mode
CommandOperation string // used in async mode
// ForceRedeploy is used to indicate that the stack should be redeployed
// even if the version is the same this value is set by the server
ForceRedeploy bool
// RepullImage is used to indicate that the image should be re-pulled
// during the next deployment of the stack
RePullImage bool
}