Documentation
¶
Index ¶
- func BuildHTTPClient(timeout float64, options *agent.Options) *edgeHTTPClient
- type APIClient
- type AsyncCommand
- type AsyncRequest
- type AsyncResponse
- type ContainerCommandData
- type EdgeConfig
- type EdgeConfigID
- type EdgeConfigStateType
- type EdgeJobData
- type EdgeStackLog
- type EndpointLog
- type ImageCommandData
- type LogCommandData
- type MetaFields
- type NonOkResponseError
- type NormalStackCommandData
- type PollStatusResponse
- type PortainerAsyncClient
- func (client *PortainerAsyncClient) DeleteEdgeStackStatus(edgeStackID int) error
- func (client *PortainerAsyncClient) EnqueueLogCollectionForStack(logCmd LogCommandData)
- 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) SetTimeout(t time.Duration)
- type PortainerClient
- type PortainerEdgeClient
- func (client *PortainerEdgeClient) EnqueueLogCollectionForStack(logCmd LogCommandData)
- 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)
- 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"` }
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 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"` }
type EndpointLog ¶
type ImageCommandData ¶
type ImageCommandData struct { ImageName string ImageRemoveOptions image.RemoveOptions ImageOperation string }
type LogCommandData ¶
type LogCommandData struct { EdgeStackID portainer.EdgeStackID EdgeStackName string Tail int }
type MetaFields ¶
type NonOkResponseError ¶
type NonOkResponseError struct {
// contains filtered or unexported fields
}
func (*NonOkResponseError) Error ¶
func (e *NonOkResponseError) Error() string
type NormalStackCommandData ¶
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"` // 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) *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) 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) SetTimeout ¶
func (client *PortainerAsyncClient) SetTimeout(t time.Duration)
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) }
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) *PortainerEdgeClient
NewPortainerEdgeClient returns a pointer to a new PortainerEdgeClient instance
func (*PortainerEdgeClient) EnqueueLogCollectionForStack ¶
func (client *PortainerEdgeClient) EnqueueLogCollectionForStack(logCmd LogCommandData)
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)