# Packages
# README
Go API client for swagger
Portainer API is an HTTP API served by Portainer. It is used by the Portainer UI and everything you can do with the UI can be done using the HTTP API. Examples are available at https://gist.github.com/deviantony/77026d402366b4b43fa5918d41bc42f8 You can find out more about Portainer at http://portainer.io and get some support on Slack. # Authentication Most of the API endpoints require to be authenticated as well as some level of authorization to be used. Portainer API uses JSON Web Token to manage authentication and thus requires you to provide a token in the Authorization header of each request with the Bearer authentication mechanism. Example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOjEsImV4cCI6MTQ5OTM3NjE1NH0.NJ6vE8FY1WG6jsRQzfMqeatJ4vh2TWAeeYfDhP71YEE
# Security Each API endpoint has an associated access policy, it is documented in the description of each endpoint. Different access policies are available: * Public access * Authenticated access * Restricted access * Administrator access ### Public access No authentication is required to access the endpoints with this access policy. ### Authenticated access Authentication is required to access the endpoints with this access policy. ### Restricted access Authentication is required to access the endpoints with this access policy. Extra-checks might be added to ensure access to the resource is granted. Returned data might also be filtered. ### Administrator access Authentication as well as an administrator role are required to access the endpoints with this access policy. # Execute Docker requests Portainer DO NOT expose specific endpoints to manage your Docker resources (create a container, remove a volume, etc...). Instead, it acts as a reverse-proxy to the Docker HTTP API. This means that you can execute Docker requests via the Portainer HTTP API. To do so, you can use the /endpoints/{id}/docker
Portainer API endpoint (which is not documented below due to Swagger limitations). This endpoint has a restricted access policy so you still need to be authenticated to be able to query this endpoint. Any query on this endpoint will be proxied to the Docker API of the associated endpoint (requests and responses objects are the same as documented in the Docker API). NOTE: You can find more information on how to query the Docker API in the Docker official documentation as well as in this Portainer example.
Overview
This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.
- API version: 1.23.1
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.GoClientCodegen
Installation
Put the package under your project folder and add the following in import:
import "./swagger"
Documentation for API Endpoints
All URIs are relative to http://portainer.domain/api
Class | Method | HTTP request | Description |
---|---|---|---|
AuthApi | AuthenticateUser | Post /auth | Authenticate a user |
DockerhubApi | DockerHubInspect | Get /dockerhub | Retrieve DockerHub information |
DockerhubApi | DockerHubUpdate | Put /dockerhub | Update DockerHub information |
EndpointGroupsApi | EndpointGroupAddEndpoint | Put /endpoint_groups/{id}/endpoints/{endpointId} | Add an endpoint to an endpoint group |
EndpointGroupsApi | EndpointGroupCreate | Post /endpoint_groups | Create a new endpoint |
EndpointGroupsApi | EndpointGroupDelete | Delete /endpoint_groups/{id} | Remove an endpoint group |
EndpointGroupsApi | EndpointGroupDeleteEndpoint | Delete /endpoint_groups/{id}/endpoints/{endpointId} | Remove an endpoint group |
EndpointGroupsApi | EndpointGroupInspect | Get /endpoint_groups/{id} | Inspect an endpoint group |
EndpointGroupsApi | EndpointGroupList | Get /endpoint_groups | List endpoint groups |
EndpointGroupsApi | EndpointGroupUpdate | Put /endpoint_groups/{id} | Update an endpoint group |
EndpointsApi | EndpointCreate | Post /endpoints | Create a new endpoint |
EndpointsApi | EndpointDelete | Delete /endpoints/{id} | Remove an endpoint |
EndpointsApi | EndpointInspect | Get /endpoints/{id} | Inspect an endpoint |
EndpointsApi | EndpointJob | Post /endpoints/{id}/job | Execute a job on the endpoint host |
EndpointsApi | EndpointList | Get /endpoints | List endpoints |
EndpointsApi | EndpointUpdate | Put /endpoints/{id} | Update an endpoint |
ExtensionsApi | ExtensionCreate | Post /extensions | Enable an extension |
ExtensionsApi | ExtensionDelete | Delete /extensions/{id} | Disable an extension |
ExtensionsApi | ExtensionInspect | Get /extensions/{id} | Inspect an extension |
ExtensionsApi | ExtensionList | Get /extensions | List extensions |
ExtensionsApi | ExtensionUpdate | Put /extensions/{id} | Update an extension |
RegistriesApi | RegistryCreate | Post /registries | Create a new registry |
RegistriesApi | RegistryDelete | Delete /registries/{id} | Remove a registry |
RegistriesApi | RegistryInspect | Get /registries/{id} | Inspect a registry |
RegistriesApi | RegistryList | Get /registries | List registries |
RegistriesApi | RegistryUpdate | Put /registries/{id} | Update a registry |
ResourceControlsApi | ResourceControlCreate | Post /resource_controls | Create a new resource control |
ResourceControlsApi | ResourceControlDelete | Delete /resource_controls/{id} | Remove a resource control |
ResourceControlsApi | ResourceControlUpdate | Put /resource_controls/{id} | Update a resource control |
RolesApi | RoleList | Get /roles | List roles |
SettingsApi | PublicSettingsInspect | Get /settings/public | Retrieve Portainer public settings |
SettingsApi | SettingsInspect | Get /settings | Retrieve Portainer settings |
SettingsApi | SettingsLDAPCheck | Put /settings/authentication/checkLDAP | Test LDAP connectivity |
SettingsApi | SettingsUpdate | Put /settings | Update Portainer settings |
StacksApi | StackCreate | Post /stacks | Deploy a new stack |
StacksApi | StackDelete | Delete /stacks/{id} | Remove a stack |
StacksApi | StackFileInspect | Get /stacks/{id}/file | Retrieve the content of the Stack file for the specified stack |
StacksApi | StackInspect | Get /stacks/{id} | Inspect a stack |
StacksApi | StackList | Get /stacks | List stacks |
StacksApi | StackMigrate | Post /stacks/{id}/migrate | Migrate a stack to another endpoint |
StacksApi | StackUpdate | Put /stacks/{id} | Update a stack |
StatusApi | StatusInspect | Get /status | Check Portainer status |
TagsApi | TagCreate | Post /tags | Create a new tag |
TagsApi | TagDelete | Delete /tags/{id} | Remove a tag |
TagsApi | TagList | Get /tags | List tags |
TeamMembershipsApi | TeamMembershipCreate | Post /team_memberships | Create a new team membership |
TeamMembershipsApi | TeamMembershipDelete | Delete /team_memberships/{id} | Remove a team membership |
TeamMembershipsApi | TeamMembershipList | Get /team_memberships | List team memberships |
TeamMembershipsApi | TeamMembershipUpdate | Put /team_memberships/{id} | Update a team membership |
TeamsApi | TeamCreate | Post /teams | Create a new team |
TeamsApi | TeamDelete | Delete /teams/{id} | Remove a team |
TeamsApi | TeamInspect | Get /teams/{id} | Inspect a team |
TeamsApi | TeamList | Get /teams | List teams |
TeamsApi | TeamMembershipsInspect | Get /teams/{id}/memberships | Inspect a team memberships |
TeamsApi | TeamUpdate | Put /teams/{id} | Update a team |
TemplatesApi | TemplateCreate | Post /templates | Create a new template |
TemplatesApi | TemplateDelete | Delete /templates/{id} | Remove a template |
TemplatesApi | TemplateInspect | Get /templates/{id} | Inspect a template |
TemplatesApi | TemplateList | Get /templates | List available templates |
TemplatesApi | TemplateUpdate | Put /templates/{id} | Update a template |
UploadApi | UploadTLS | Post /upload/tls/{certificate} | Upload TLS files |
UsersApi | UserAdminCheck | Get /users/admin/check | Check administrator account existence |
UsersApi | UserAdminInit | Post /users/admin/init | Initialize administrator account |
UsersApi | UserCreate | Post /users | Create a new user |
UsersApi | UserDelete | Delete /users/{id} | Remove a user |
UsersApi | UserInspect | Get /users/{id} | Inspect a user |
UsersApi | UserList | Get /users | List users |
UsersApi | UserMembershipsInspect | Get /users/{id}/memberships | Inspect a user memberships |
UsersApi | UserPasswordCheck | Post /users/{id}/passwd | Check password validity for a user |
UsersApi | UserUpdate | Put /users/{id} | Update a user |
Documentation For Models
- AccessPolicy
- AuthenticateUserRequest
- AuthenticateUserResponse
- Authorizations
- AzureCredentials
- DockerHub
- DockerHubSubset
- DockerHubUpdateRequest
- Endpoint
- EndpointGroup
- EndpointGroupCreateRequest
- EndpointGroupListResponse
- EndpointGroupUpdateRequest
- EndpointJobRequest
- EndpointListResponse
- EndpointSubset
- EndpointUpdateRequest
- Extension
- ExtensionCreateRequest
- ExtensionListResponse
- ExtensionUpdateRequest
- GenericError
- LdapGroupSearchSettings
- LdapSearchSettings
- LdapSettings
- LicenseInformation
- Pair
- PublicSettingsInspectResponse
- Registry
- RegistryCreateRequest
- RegistryListResponse
- RegistrySubset
- RegistryUpdateRequest
- ResourceControl
- ResourceControlCreateRequest
- ResourceControlUpdateRequest
- Role
- RoleListResponse
- Settings
- SettingsBlackListedLabels
- SettingsLdapCheckRequest
- SettingsUpdateRequest
- Stack
- StackCreateRequest
- StackEnv
- StackFileInspectResponse
- StackListResponse
- StackMigrateRequest
- StackUpdateRequest
- Status
- Tag
- TagCreateRequest
- TagListResponse
- Team
- TeamAccessPolicies
- TeamCreateRequest
- TeamListResponse
- TeamMembership
- TeamMembershipCreateRequest
- TeamMembershipListResponse
- TeamMembershipUpdateRequest
- TeamMembershipsResponse
- TeamUpdateRequest
- Template
- TemplateCreateRequest
- TemplateEnv
- TemplateEnvSelect
- TemplateListResponse
- TemplateRepository
- TemplateUpdateRequest
- TemplateVolume
- TlsConfiguration
- User
- UserAccessPolicies
- UserAdminInitRequest
- UserCreateRequest
- UserListResponse
- UserMembershipsResponse
- UserPasswordCheckRequest
- UserPasswordCheckResponse
- UserSubset
- UserUpdateRequest
Documentation For Authorization
jwt
- Type: API key
Example
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)