Documentation ¶
Index ¶
- Constants
- func GetTranslatedStackType(t portainer.StackType) string
- type AuthenticateUserOptions
- type AuthenticateUserRequest
- type AuthenticateUserResponse
- type Config
- type GenericError
- type PortainerClient
- type ResourceControlCreateOptions
- type ResourceControlCreateRequest
- type ResourceControlUpdateOptions
- type ResourceControlUpdateRequest
- type ResourceType
- type StackCreateComposeOptions
- type StackCreateRequest
- type StackCreateSwarmOptions
- type StackFileInspectResponse
- type StackListFilter
- type StackListOptions
- type StackUpdateOptions
- type StackUpdateRequest
Constants ¶
const ( // ResourceContainer represents a Docker resource of type container ResourceContainer = ResourceType("container") // ResourceService represents a Docker resource of type service ResourceService = ResourceType("service") // ResourceVolume represents a Docker resource of type volume ResourceVolume = ResourceType("volume") // ResourceNetwork represents a Docker resource of type network ResourceNetwork = ResourceType("network") // ResourceSecret represents a Docker resource of type secret ResourceSecret = ResourceType("secret") // ResourceConfig represents a Docker resource of type config ResourceConfig = ResourceType("config") // ResourceStack represents a Portainer resource of type stack // A Portainer stack is pretty much like a Docker stack, but not the same ResourceStack = ResourceType("stack") )
Variables ¶
This section is empty.
Functions ¶
func GetTranslatedStackType ¶
GetTranslatedStackType returns a stack's Type field (int) translated to it's human readable form (string)
Types ¶
type AuthenticateUserOptions ¶
AuthenticateUserOptions represents options passed to PortainerClient.AuthenticateUser()
type AuthenticateUserRequest ¶
AuthenticateUserRequest represents the body of a request to POST /auth
type AuthenticateUserResponse ¶
type AuthenticateUserResponse struct {
Jwt string
}
AuthenticateUserResponse represents the body of a response for a request to POST /auth
type Config ¶
type Config struct { URL *url.URL User string Password string Token string UserAgent string DoNotUseToken bool }
Config represents a Portainer client configuration
type GenericError ¶
GenericError represents the body of a generic error returned by the Portainer API
func (GenericError) Error ¶
func (e GenericError) Error() string
type PortainerClient ¶
type PortainerClient interface { // AuthenticateUser a user to get an auth token AuthenticateUser(options AuthenticateUserOptions) (token string, err error) // Get endpoints EndpointList() ([]portainer.Endpoint, error) // Get endpoint groups EndpointGroupList() ([]portainer.EndpointGroup, error) // Get stacks, optionally filtered by swarmId and endpointId StackList(options StackListOptions) ([]portainer.Stack, error) // Create swarm stack StackCreateSwarm(options StackCreateSwarmOptions) (stack portainer.Stack, err error) // Create compose stack StackCreateCompose(options StackCreateComposeOptions) (stack portainer.Stack, err error) // Update stack StackUpdate(options StackUpdateOptions) error // Delete stack StackDelete(stackID portainer.StackID) error // Get stack file content StackFileInspect(stackID portainer.StackID) (content string, err error) // Get endpoint Docker info EndpointDockerInfo(endpointID portainer.EndpointID) (info map[string]interface{}, err error) // Get Portainer status info Status() (portainer.Status, error) // Run a function before sending a request to Portainer BeforeRequest(hook func(req *http.Request) (err error)) // Run a function after receiving a response from Portainer AfterResponse(hook func(resp *http.Response) (err error)) // Proxy proxies a request to /endpoint/{id}/docker and returns its result Proxy(endpointID portainer.EndpointID, req *http.Request) (resp *http.Response, err error) // ResourceControlCreate creates a resource control ResourceControlCreate(options ResourceControlCreateOptions) (resourceControl portainer.ResourceControl, err error) // ResourceControlUpdate updates a resource control ResourceControlUpdate(options ResourceControlUpdateOptions) (resourceControl portainer.ResourceControl, err error) // ResourceControlDelete deletes a resource control ResourceControlDelete(resourceControlID portainer.ResourceControlID) (err error) // UserList retrieves a list of users UserList() (users []portainer.User, err error) // GetUsername returns the user name used by the client GetUsername() string // DoJSONWithToken makes an HTTP request with a JSON body and an auth token DoJSONWithToken(uri, method string, headers http.Header, request interface{}, response interface{}) (err error) }
PortainerClient represents a Portainer API client
type ResourceControlCreateOptions ¶
type ResourceControlCreateOptions struct { ResourceID string Type ResourceType Public bool Users []portainer.UserID Teams []portainer.TeamID SubResourceIDs []string }
ResourceControlCreateOptions represents options passed to PortainerClient.ResourceControlCreate()
type ResourceControlCreateRequest ¶
type ResourceControlCreateRequest struct { ResourceID string Type ResourceType Public bool `json:",omitempty"` Users []portainer.UserID `json:",omitempty"` Teams []portainer.TeamID `json:",omitempty"` SubResourceIDs []string `json:",omitempty"` }
ResourceControlCreateRequest represents the body of a request to POST /resource_controls
type ResourceControlUpdateOptions ¶
type ResourceControlUpdateOptions struct { ID portainer.ResourceControlID Public bool Users []portainer.UserID Teams []portainer.TeamID }
ResourceControlUpdateOptions represents options passed to PortainerClient.ResourceControlUpdate()
type ResourceControlUpdateRequest ¶
type ResourceControlUpdateRequest struct { Public bool `json:",omitempty"` Users []portainer.UserID `json:",omitempty"` Teams []portainer.TeamID `json:",omitempty"` }
ResourceControlUpdateRequest represents the body of a request to PUT /resource_controls/{id}
type ResourceType ¶
type ResourceType string
ResourceType represents a type of Docker or Portainer resource
type StackCreateComposeOptions ¶
type StackCreateComposeOptions struct { StackName string EnvironmentVariables []portainer.Pair StackFileContent string EndpointID portainer.EndpointID }
StackCreateComposeOptions represents options passed to PortainerClient.StackCreateCompose()
type StackCreateRequest ¶
type StackCreateRequest struct { Name string SwarmID string StackFileContent string Env []portainer.Pair `json:",omitempty"` }
StackCreateRequest represents the body of a request to POST /stacks
type StackCreateSwarmOptions ¶
type StackCreateSwarmOptions struct { StackName string EnvironmentVariables []portainer.Pair StackFileContent string SwarmClusterID string EndpointID portainer.EndpointID }
StackCreateSwarmOptions represents options passed to PortainerClient.StackCreateSwarm()
type StackFileInspectResponse ¶
type StackFileInspectResponse struct {
StackFileContent string
}
StackFileInspectResponse represents the body of a response for a request to GET /stack/{id}/file
type StackListFilter ¶
type StackListFilter struct { SwarmID string `json:"SwarmId,omitempty"` EndpointID portainer.EndpointID `json:"EndpointId,omitempty"` }
StackListFilter represents a filter for a stack list
type StackListOptions ¶
type StackListOptions struct {
Filter StackListFilter
}
StackListOptions represents options passed to PortainerClient.StackList()
type StackUpdateOptions ¶
type StackUpdateOptions struct { Stack portainer.Stack EnvironmentVariables []portainer.Pair StackFileContent string Prune bool EndpointID portainer.EndpointID }
StackUpdateOptions represents options passed to PortainerClient.StackUpdate()
Source Files ¶
- auth.go
- client.go
- endpointGroup_list.go
- endpoint_docker_info.go
- endpoint_docker_proxy.go
- endpoint_list.go
- errors.go
- resourceControl_create.go
- resourceControl_delete.go
- resourceControl_update.go
- resources.go
- stackFile_inspect.go
- stack_create.go
- stack_delete.go
- stack_list.go
- stack_update.go
- status.go
- user_list.go
- utils.go