Documentation ¶
Index ¶
- Constants
- func DefaultHTTPClient() *http.Client
- type AssignedLabels
- type BasicAuthTransport
- type Client
- type ClientOption
- type ClockMonitor
- type Computer
- type Crumbs
- type DiskSpaceMonitor
- type Executors
- type JNLPLauncher
- type KnownHostsFileKeyVerificationStrategy
- type Labels
- type Launcher
- type LoadStatistics
- type ManuallyProvidedKeyVerificationStrategy
- type ManuallyProvidedKeyVerificationStrategyKey
- type ManuallyTrustedKeyVerificationStrategy
- type MonitorData
- type Node
- type NodeMode
- type NodeProperties
- type NodeRequest
- type NodeType
- type NodesListResponse
- type NodesService
- func (s *NodesService) Create(ctx context.Context, node *Node) (*Node, *http.Response, error)
- func (s *NodesService) Delete(ctx context.Context, name string) (*http.Response, error)
- func (s *NodesService) Get(ctx context.Context, name string) (*Node, *http.Response, error)
- func (s *NodesService) List(ctx context.Context) ([]Node, *http.Response, error)
- func (s *NodesService) Update(ctx context.Context, node *Node) (*Node, *http.Response, error)
- type NonVerifyingKeyVerificationStrategy
- type ResponseTimeMonitor
- type RetentionsStrategy
- type SSHHostKeyVerificationStrategy
- type SSHLauncher
- type SwapSpaceMonitor
- type TemporarySpaceMonitor
- type WorkDirSettings
Constants ¶
const ( // NodeModeNormal sets node usage as "Use this node as much as possible" NodeModeNormal NodeMode = "NORMAL" // NodeModeExclusive sets node usage as "Only build jobs with label expressions matching this node" NodeModeExclusive NodeMode = "EXCLUSIVE" // NodesCreateURL is the URL to create a new node NodesCreateURL = "/computer/doCreateItem" // NodesListURL is the URL to list all nodes NodesListURL = "/computer/api/json" // NodesGetURL is the URL to get a node NodesGetURL = "/computer/%s/config.xml" // NodesDeleteURL is the URL to delete a node NodesDeleteURL = "/computer/%s/doDelete" )
Variables ¶
This section is empty.
Functions ¶
func DefaultHTTPClient ¶
DefaultHTTPClient returns a default http client.
Types ¶
type AssignedLabels ¶
type AssignedLabels struct {
Name string `json:"name"`
}
AssignedLabels represents a Jenkins assigned labels.
type BasicAuthTransport ¶
BasicAuthTransport is a http.RoundTripper that authenticates all requests
type Client ¶
type Client struct { UserAgent string Nodes *NodesService // contains filtered or unexported fields }
A Client manages communication with the Jenkins API.
func NewClient ¶
func NewClient(opts ...ClientOption) (*Client, error)
NewClient returns a new Jenkins API client.
type ClientOption ¶
ClientOption represents an option for the Jenkins client.
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL sets the base URL for the Jenkins client.
func WithClient ¶
func WithClient(client *http.Client) ClientOption
WithClient sets the http client for the Jenkins client.
func WithUserPassword ¶
func WithUserPassword(userName, password string) ClientOption
WithUserPassword sets the password for the Jenkins client.
func WithUserToken ¶
func WithUserToken(userName, apiToken string) ClientOption
WithUserToken sets the API token for the Jenkins client.
type ClockMonitor ¶
ClockMonitor checks clock of a node to detect out of sync clocks.
type Computer ¶
type Computer struct { Class string `json:"_class"` Actions []interface{} `json:"actions"` AssignedLabels []AssignedLabels `json:"assignedLabels"` Description string `json:"description"` DisplayName string `json:"displayName"` Executors []Executors `json:"executors"` Icon string `json:"icon"` IconClassName string `json:"iconClassName"` Idle bool `json:"idle"` JnlpAgent bool `json:"jnlpAgent"` LaunchSupported bool `json:"launchSupported"` LoadStatistics LoadStatistics `json:"loadStatistics"` ManualLaunchAllowed bool `json:"manualLaunchAllowed"` MonitorData MonitorData `json:"monitorData"` NumExecutors int `json:"numExecutors"` Offline bool `json:"offline"` OfflineCause interface{} `json:"offlineCause"` OfflineCauseReason string `json:"offlineCauseReason"` OneOffExecutors []interface{} `json:"oneOffExecutors"` TemporarilyOffline bool `json:"temporarilyOffline"` AbsoluteRemotePath interface{} `json:"absoluteRemotePath,omitempty"` }
Computer represents a Jenkins node/agent.
type DiskSpaceMonitor ¶
type DiskSpaceMonitor struct { Class string `json:"_class"` Timestamp int64 `json:"timestamp"` Path string `json:"path"` Size int64 `json:"size"` }
DiskSpaceMonitor checks available disk space of the remote FS root.
type JNLPLauncher ¶
type JNLPLauncher struct { StaplerClass string `json:"stapler-class" xml:"class,attr"` WebSocket bool `json:"websocket" xml:"websocket,omitempty"` WorkDirSettings WorkDirSettings `json:"workDirSettings,omitempty" xml:"workDirSettings,omitempty"` }
JNLPLauncher represents a Jenkins JNLP launcher.
func DefaultJNLPLauncher ¶
func DefaultJNLPLauncher() *JNLPLauncher
DefaultJNLPLauncher returns the default JNLP launcher.
type KnownHostsFileKeyVerificationStrategy ¶
type KnownHostsFileKeyVerificationStrategy struct {
StaplerClass string `json:"stapler-class" xml:"class,attr"`
}
KnownHostsFileKeyVerificationStrategy represents the Jenkins node known hosts file key verification strategy.
type Labels ¶
type Labels []string
Labels represents Jenkins node labels.
func (Labels) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface. Concatenates all labels with a space.
type LoadStatistics ¶
type LoadStatistics struct {
Class string `json:"_class"`
}
LoadStatistics represents a Jenkins load statistics.
type ManuallyProvidedKeyVerificationStrategy ¶
type ManuallyProvidedKeyVerificationStrategy struct { StaplerClass string `json:"stapler-class" xml:"class,attr"` Key ManuallyProvidedKeyVerificationStrategyKey `json:"key" xml:"key"` }
ManuallyProvidedKeyVerificationStrategy represents the Jenkins node manually provided key verification strategy.
type ManuallyProvidedKeyVerificationStrategyKey ¶
type ManuallyProvidedKeyVerificationStrategyKey struct { Algorithm string `json:"algorithm" xml:"algorithm"` Key string `json:"key" xml:"key"` }
ManuallyProvidedKeyVerificationStrategyKey represents the Jenkins node manually provided key verification strategy key.
type ManuallyTrustedKeyVerificationStrategy ¶
type ManuallyTrustedKeyVerificationStrategy struct { StaplerClass string `json:"stapler-class" xml:"class,attr"` RequireInitialManualTrust bool `json:"requireInitialManualTrust,omitempty" xml:"requireInitialManualTrust,omitempty"` }
ManuallyTrustedKeyVerificationStrategy represents the Jenkins node manually trusted key verification strategy.
type MonitorData ¶
type MonitorData struct { SwapSpaceMonitor SwapSpaceMonitor `json:"hudson.node_monitors.SwapSpaceMonitor"` TemporarySpaceMonitor TemporarySpaceMonitor `json:"hudson.node_monitors.TemporarySpaceMonitor"` DiskSpaceMonitor DiskSpaceMonitor `json:"hudson.node_monitors.DiskSpaceMonitor"` ArchitectureMonitor string `json:"hudson.node_monitors.ArchitectureMonitor"` ResponseTimeMonitor ResponseTimeMonitor `json:"hudson.node_monitors.ResponseTimeMonitor"` ClockMonitor ClockMonitor `json:"hudson.node_monitors.ClockMonitor"` }
MonitorData expose monitoring data
type Node ¶
type Node struct { XMLName xml.Name `xml:"slave" json:"-"` Name string `json:"name" xml:"name"` Description string `json:"nodeDescription" xml:"description"` RemoteFS string `json:"remoteFS" xml:"remoteFS"` NumExecutors int `json:"numExecutors" xml:"numExecutors"` Mode NodeMode `json:"mode" xml:"mode"` Type NodeType `json:"type" xml:"type"` Labels Labels `json:"labelString" xml:"label"` RetentionsStrategy *RetentionsStrategy `json:"retentionsStrategy" xml:"retentionsStrategy"` Properties *NodeProperties `json:"nodeProperties" xml:"nodeProperties"` Launcher Launcher `json:"launcher" xml:"launcher"` }
Node represents a Jenkins node.
func (*Node) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface. It decodes the XML attributes into the corresponding struct fields. It also decodes the XML child Launcher nodes into the corresponding struct fields.
type NodeMode ¶
type NodeMode string
NodeMode represents a Jenkins node mode. Could be either NORMAL or EXCLUSIVE.
type NodeProperties ¶
type NodeProperties struct {
StaplerClassBag string `json:"stapler-class-bag"`
}
NodeProperties represents a Jenkins node properties.
func DefaultNodeProperties ¶
func DefaultNodeProperties() *NodeProperties
DefaultNodeProperties returns the default node properties.
type NodeRequest ¶
type NodeRequest struct { Name string `json:"name"` Type NodeType `json:"type"` JSON string `json:"json"` }
NodeRequest represents a Jenkins node request.
type NodeType ¶
type NodeType string
NodeType represents a Jenkins node type.
func DefaultNodeType ¶
func DefaultNodeType() NodeType
DefaultNodeType represents the default Jenkins node type.
type NodesListResponse ¶
type NodesListResponse struct { Class string `json:"_class"` BusyExecutors int `json:"busyExecutors"` Computer []Computer `json:"computer"` DisplayName string `json:"displayName"` TotalExecutors int `json:"totalExecutors"` }
NodesListResponse represents a Jenkins node list response.
type NodesService ¶
type NodesService service
NodesService handles communication with the node related methods of the Jenkins API
type NonVerifyingKeyVerificationStrategy ¶
type NonVerifyingKeyVerificationStrategy struct {
StaplerClass string `json:"stapler-class" xml:"class,attr"`
}
NonVerifyingKeyVerificationStrategy represents the Jenkins node non-verifying key verification strategy.
func NewNonVerifyingKeyVerificationStrategy ¶
func NewNonVerifyingKeyVerificationStrategy() *NonVerifyingKeyVerificationStrategy
type ResponseTimeMonitor ¶
type ResponseTimeMonitor struct { Class string `json:"_class"` Timestamp int64 `json:"timestamp"` Average int `json:"average"` }
ResponseTimeMonitor monitors the round-trip response time to this agent.
type RetentionsStrategy ¶
type RetentionsStrategy struct {
StaplerClass string `json:"stapler-class" xml:"class,attr"`
}
RetentionsStrategy represents a Jenkins node retention strategy.
func DefaultRetentionsStrategy ¶
func DefaultRetentionsStrategy() *RetentionsStrategy
DefaultRetentionsStrategy represents the default retention strategy.
type SSHHostKeyVerificationStrategy ¶
type SSHHostKeyVerificationStrategy interface{}
SSHHostKeyVerificationStrategy represents the Jenkins node SSH host key verification strategy.
type SSHLauncher ¶
type SSHLauncher struct { StaplerClass string `json:"stapler-class" xml:"class,attr"` Host string `json:"host" xml:"host"` Port int `json:"port" xml:"port"` CredentialID string `json:"credentialId" xml:"credentialId"` LaunchTimeoutSeconds int `json:"launchTimeoutSeconds" xml:"launchTimeoutSeconds"` MaxNumRetries int `json:"maxNumRetries" xml:"maxNumRetries"` RetryWaitTime int `json:"retryWaitTime" xml:"retryWaitTime"` TCPNoDelay bool `json:"tcpNoDelay" xml:"tcpNoDelay"` SSHHostKeyVerificationStrategy SSHHostKeyVerificationStrategy `json:"sshHostKeyVerificationStrategy" xml:"sshHostKeyVerificationStrategy"` }
SSHLauncher represents a Jenkins SSH launcher.
func NewSSHLauncher ¶
func (*SSHLauncher) UnmarshalXML ¶
func (n *SSHLauncher) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface. It decodes the XML attributes into the corresponding struct fields. It also decodes the XML child SSHHostKeyVerificationStrategy nodes into the corresponding struct fields.
type SwapSpaceMonitor ¶
type SwapSpaceMonitor struct { Class string `json:"_class"` AvailablePhysicalMemory int64 `json:"availablePhysicalMemory"` AvailableSwapSpace int `json:"availableSwapSpace"` TotalPhysicalMemory int64 `json:"totalPhysicalMemory"` TotalSwapSpace int `json:"totalSwapSpace"` }
SwapSpaceMonitor checks the swap space availability.
type TemporarySpaceMonitor ¶
type TemporarySpaceMonitor struct { Class string `json:"_class"` Timestamp int64 `json:"timestamp"` Path string `json:"path"` Size int64 `json:"size"` }
TemporarySpaceMonitor monitors the disk space of "/tmp".
type WorkDirSettings ¶
type WorkDirSettings struct { Disabled bool `json:"disabled" xml:"disabled"` InternalDir string `json:"internalDir" xml:"internalDir"` FailIfWorkDirIsMissing bool `json:"failIfWorkDirIsMissing" xml:"failIfWorkDirIsMissing"` }
WorkDirSettings represents the Jenkins node work directory settings.