mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
docs(api): document apis with swagger (#4678)
* feat(api): introduce swagger * feat(api): anottate api * chore(api): tag endpoints * chore(api): remove tags * chore(api): add docs for oauth auth * chore(api): document create endpoint api * chore(api): document endpoint inspect and list * chore(api): document endpoint update and snapshots * docs(endpointgroups): document groups api * docs(auth): document auth api * chore(build): introduce a yarn script to build api docs * docs(api): document auth * docs(customtemplates): document customtemplates api * docs(tags): document api * docs(api): document the use of token * docs(dockerhub): document dockerhub api * docs(edgegroups): document edgegroups api * docs(edgejobs): document api * docs(edgestacks): doc api * docs(http/upload): add security * docs(api): document edge templates * docs(edge): document edge jobs * docs(endpointgroups): change description * docs(endpoints): document missing apis * docs(motd): doc api * docs(registries): doc api * docs(resourcecontrol): api doc * docs(role): add swagger docs * docs(settings): add swagger docs * docs(api/status): add swagger docs * docs(api/teammembership): add swagger docs * docs(api/teams): add swagger docs * docs(api/templates): add swagger docs * docs(api/users): add swagger docs * docs(api/webhooks): add swagger docs * docs(api/webscokets): add swagger docs * docs(api/stacks): swagger * docs(api): fix missing apis * docs(swagger): regen * chore(build): remove docs from build * docs(api): update tags * docs(api): document tags * docs(api): add description * docs(api): rename jwt token * docs(api): add info about types * docs(api): document types * docs(api): update request types annotation * docs(api): doc registry and resource control * chore(docs): add snippet * docs(api): add description to role * docs(api): add types for settings * docs(status): add types * style(swagger): remove documented code * docs(http/upload): update docs with types * docs(http/tags): add types * docs(api/custom_templates): add types * docs(api/teammembership): add types * docs(http/teams): add types * docs(http/stacks): add types * docs(edge): add types to edgestack * docs(http/teammembership): remove double returns * docs(api/user): add types * docs(http): fixes to make file built * chore(snippets): add scope to swagger snippet * chore(deps): install swag * chore(swagger): remove handler * docs(api): add description * docs(api): ignore docs folder * docs(api): add contributing guidelines * docs(api): cleanup handler * chore(deps): require swaggo * fix(auth): fix typo * fix(docs): make http ids pascal case * feat(edge): add ids to http handlers * fix(docs): add ids * fix(docs): show correct api version * chore(deps): remove swaggo dependency * chore(docs): add install script for swag
This commit is contained in:
parent
90f5a6cd0d
commit
50b57614cf
125 changed files with 8264 additions and 4833 deletions
513
api/portainer.go
513
api/portainer.go
|
@ -8,7 +8,8 @@ import (
|
|||
type (
|
||||
// AccessPolicy represent a policy that can be associated to a user or team
|
||||
AccessPolicy struct {
|
||||
RoleID RoleID `json:"RoleId"`
|
||||
// Role identifier. Reference the role that will be associated to this access policy
|
||||
RoleID RoleID `json:"RoleId" example:"1"`
|
||||
}
|
||||
|
||||
// AgentPlatform represents a platform type for an Agent
|
||||
|
@ -26,9 +27,12 @@ type (
|
|||
// AzureCredentials represents the credentials used to connect to an Azure
|
||||
// environment.
|
||||
AzureCredentials struct {
|
||||
ApplicationID string `json:"ApplicationID"`
|
||||
TenantID string `json:"TenantID"`
|
||||
AuthenticationKey string `json:"AuthenticationKey"`
|
||||
// Azure application ID
|
||||
ApplicationID string `json:"ApplicationID" example:"eag7cdo9-o09l-9i83-9dO9-f0b23oe78db4"`
|
||||
// Azure tenant ID
|
||||
TenantID string `json:"TenantID" example:"34ddc78d-4fel-2358-8cc1-df84c8o839f5"`
|
||||
// Azure authentication key
|
||||
AuthenticationKey string `json:"AuthenticationKey" example:"cOrXoK/1D35w8YQ8nH1/8ZGwzz45JIYD5jxHKXEQknk="`
|
||||
}
|
||||
|
||||
// CLIFlags represents the available flags on the CLI
|
||||
|
@ -59,17 +63,28 @@ type (
|
|||
|
||||
// CustomTemplate represents a custom template
|
||||
CustomTemplate struct {
|
||||
ID CustomTemplateID `json:"Id"`
|
||||
Title string `json:"Title"`
|
||||
Description string `json:"Description"`
|
||||
ProjectPath string `json:"ProjectPath"`
|
||||
EntryPoint string `json:"EntryPoint"`
|
||||
CreatedByUserID UserID `json:"CreatedByUserId"`
|
||||
Note string `json:"Note"`
|
||||
Platform CustomTemplatePlatform `json:"Platform"`
|
||||
Logo string `json:"Logo"`
|
||||
Type StackType `json:"Type"`
|
||||
ResourceControl *ResourceControl `json:"ResourceControl"`
|
||||
// CustomTemplate Identifier
|
||||
ID CustomTemplateID `json:"Id" example:"1"`
|
||||
// Title of the template
|
||||
Title string `json:"Title" example:"Nginx"`
|
||||
// Description of the template
|
||||
Description string `json:"Description" example:"High performance web server"`
|
||||
// Path on disk to the repository hosting the Stack file
|
||||
ProjectPath string `json:"ProjectPath" example:"/data/custom_template/3"`
|
||||
// Path to the Stack file
|
||||
EntryPoint string `json:"EntryPoint" example:"docker-compose.yml"`
|
||||
// User identifier who created this template
|
||||
CreatedByUserID UserID `json:"CreatedByUserId" example:"3"`
|
||||
// A note that will be displayed in the UI. Supports HTML content
|
||||
Note string `json:"Note" example:"This is my <b>custom</b> template"`
|
||||
// Platform associated to the template.
|
||||
// Valid values are: 1 - 'linux', 2 - 'windows'
|
||||
Platform CustomTemplatePlatform `json:"Platform" example:"1" enums:"1,2"`
|
||||
// URL of the template's logo
|
||||
Logo string `json:"Logo" example:"https://cloudinovasi.id/assets/img/logos/nginx.png"`
|
||||
// Type of created stack (1 - swarm, 2 - compose)
|
||||
Type StackType `json:"Type" example:"1"`
|
||||
ResourceControl *ResourceControl `json:"ResourceControl"`
|
||||
}
|
||||
|
||||
// CustomTemplateID represents a custom template identifier
|
||||
|
@ -81,9 +96,12 @@ type (
|
|||
// DockerHub represents all the required information to connect and use the
|
||||
// Docker Hub
|
||||
DockerHub struct {
|
||||
Authentication bool `json:"Authentication"`
|
||||
Username string `json:"Username"`
|
||||
Password string `json:"Password,omitempty"`
|
||||
// Is authentication against DockerHub enabled
|
||||
Authentication bool `json:"Authentication" example:"true"`
|
||||
// Username used to authenticate against the DockerHub
|
||||
Username string `json:"Username" example:"user"`
|
||||
// Password used to authenticate against the DockerHub
|
||||
Password string `json:"Password,omitempty" example:"passwd"`
|
||||
}
|
||||
|
||||
// DockerSnapshot represents a snapshot of a specific Docker endpoint at a specific time
|
||||
|
@ -116,7 +134,8 @@ type (
|
|||
|
||||
// EdgeGroup represents an Edge group
|
||||
EdgeGroup struct {
|
||||
ID EdgeGroupID `json:"Id"`
|
||||
// EdgeGroup Identifier
|
||||
ID EdgeGroupID `json:"Id" example:"1"`
|
||||
Name string `json:"Name"`
|
||||
Dynamic bool `json:"Dynamic"`
|
||||
TagIDs []TagID `json:"TagIds"`
|
||||
|
@ -129,7 +148,8 @@ type (
|
|||
|
||||
// EdgeJob represents a job that can run on Edge environments.
|
||||
EdgeJob struct {
|
||||
ID EdgeJobID `json:"Id"`
|
||||
// EdgeJob Identifier
|
||||
ID EdgeJobID `json:"Id" example:"1"`
|
||||
Created int64 `json:"Created"`
|
||||
CronExpression string `json:"CronExpression"`
|
||||
Endpoints map[EndpointID]EdgeJobEndpointMeta `json:"Endpoints"`
|
||||
|
@ -154,7 +174,8 @@ type (
|
|||
// EdgeSchedule represents a scheduled job that can run on Edge environments.
|
||||
// Deprecated in favor of EdgeJob
|
||||
EdgeSchedule struct {
|
||||
ID ScheduleID `json:"Id"`
|
||||
// EdgeSchedule Identifier
|
||||
ID ScheduleID `json:"Id" example:"1"`
|
||||
CronExpression string `json:"CronExpression"`
|
||||
Script string `json:"Script"`
|
||||
Version int `json:"Version"`
|
||||
|
@ -163,7 +184,8 @@ type (
|
|||
|
||||
//EdgeStack represents an edge stack
|
||||
EdgeStack struct {
|
||||
ID EdgeStackID `json:"Id"`
|
||||
// EdgeStack Identifier
|
||||
ID EdgeStackID `json:"Id" example:"1"`
|
||||
Name string `json:"Name"`
|
||||
Status map[EndpointID]EdgeStackStatus `json:"Status"`
|
||||
CreationDate int64 `json:"CreationDate"`
|
||||
|
@ -190,26 +212,43 @@ type (
|
|||
// Endpoint represents a Docker endpoint with all the info required
|
||||
// to connect to it
|
||||
Endpoint struct {
|
||||
ID EndpointID `json:"Id"`
|
||||
Name string `json:"Name"`
|
||||
Type EndpointType `json:"Type"`
|
||||
URL string `json:"URL"`
|
||||
GroupID EndpointGroupID `json:"GroupId"`
|
||||
PublicURL string `json:"PublicURL"`
|
||||
TLSConfig TLSConfiguration `json:"TLSConfig"`
|
||||
Extensions []EndpointExtension `json:"Extensions"`
|
||||
AzureCredentials AzureCredentials `json:"AzureCredentials,omitempty"`
|
||||
TagIDs []TagID `json:"TagIds"`
|
||||
Status EndpointStatus `json:"Status"`
|
||||
Snapshots []DockerSnapshot `json:"Snapshots"`
|
||||
UserAccessPolicies UserAccessPolicies `json:"UserAccessPolicies"`
|
||||
TeamAccessPolicies TeamAccessPolicies `json:"TeamAccessPolicies"`
|
||||
EdgeID string `json:"EdgeID,omitempty"`
|
||||
EdgeKey string `json:"EdgeKey"`
|
||||
EdgeCheckinInterval int `json:"EdgeCheckinInterval"`
|
||||
Kubernetes KubernetesData `json:"Kubernetes"`
|
||||
ComposeSyntaxMaxVersion string `json:"ComposeSyntaxMaxVersion"`
|
||||
SecuritySettings EndpointSecuritySettings
|
||||
// Endpoint Identifier
|
||||
ID EndpointID `json:"Id" example:"1"`
|
||||
// Endpoint name
|
||||
Name string `json:"Name" example:"my-endpoint"`
|
||||
// Endpoint environment type. 1 for a Docker environment, 2 for an agent on Docker environment or 3 for an Azure environment.
|
||||
Type EndpointType `json:"Type" example:"1"`
|
||||
// URL or IP address of the Docker host associated to this endpoint
|
||||
URL string `json:"URL" example:"docker.mydomain.tld:2375"`
|
||||
// Endpoint group identifier
|
||||
GroupID EndpointGroupID `json:"GroupId" example:"1"`
|
||||
// URL or IP address where exposed containers will be reachable
|
||||
PublicURL string `json:"PublicURL" example:"docker.mydomain.tld:2375"`
|
||||
TLSConfig TLSConfiguration `json:"TLSConfig"`
|
||||
Extensions []EndpointExtension `json:"Extensions" example:""`
|
||||
AzureCredentials AzureCredentials `json:"AzureCredentials,omitempty" example:""`
|
||||
// List of tag identifiers to which this endpoint is associated
|
||||
TagIDs []TagID `json:"TagIds"`
|
||||
// The status of the endpoint (1 - up, 2 - down)
|
||||
Status EndpointStatus `json:"Status" example:"1"`
|
||||
// List of snapshots
|
||||
Snapshots []DockerSnapshot `json:"Snapshots" example:""`
|
||||
// List of user identifiers authorized to connect to this endpoint
|
||||
UserAccessPolicies UserAccessPolicies `json:"UserAccessPolicies"`
|
||||
// List of team identifiers authorized to connect to this endpoint
|
||||
TeamAccessPolicies TeamAccessPolicies `json:"TeamAccessPolicies" example:""`
|
||||
// The identifier of the edge agent associated with this endpoint
|
||||
EdgeID string `json:"EdgeID,omitempty" example:""`
|
||||
// The key which is used to map the agent to Portainer
|
||||
EdgeKey string `json:"EdgeKey" example:""`
|
||||
// The check in interval for edge agent (in seconds)
|
||||
EdgeCheckinInterval int `json:"EdgeCheckinInterval" example:"5"`
|
||||
// Associated Kubernetes data
|
||||
Kubernetes KubernetesData `json:"Kubernetes" example:""`
|
||||
// Maximum version of docker-compose
|
||||
ComposeSyntaxMaxVersion string `json:"ComposeSyntaxMaxVersion" example:"3.8"`
|
||||
// Endpoint specific security settings
|
||||
SecuritySettings EndpointSecuritySettings
|
||||
|
||||
// Deprecated fields
|
||||
// Deprecated in DBVersion == 4
|
||||
|
@ -242,12 +281,16 @@ type (
|
|||
|
||||
// EndpointGroup represents a group of endpoints
|
||||
EndpointGroup struct {
|
||||
ID EndpointGroupID `json:"Id"`
|
||||
Name string `json:"Name"`
|
||||
Description string `json:"Description"`
|
||||
UserAccessPolicies UserAccessPolicies `json:"UserAccessPolicies"`
|
||||
TeamAccessPolicies TeamAccessPolicies `json:"TeamAccessPolicies"`
|
||||
TagIDs []TagID `json:"TagIds"`
|
||||
// Endpoint group Identifier
|
||||
ID EndpointGroupID `json:"Id" example:"1"`
|
||||
// Endpoint group name
|
||||
Name string `json:"Name" example:"my-endpoint-group"`
|
||||
// Description associated to the endpoint group
|
||||
Description string `json:"Description" example:"Endpoint group description"`
|
||||
UserAccessPolicies UserAccessPolicies `json:"UserAccessPolicies" example:""`
|
||||
TeamAccessPolicies TeamAccessPolicies `json:"TeamAccessPolicies" example:""`
|
||||
// List of tags associated to this endpoint group
|
||||
TagIDs []TagID `json:"TagIds"`
|
||||
|
||||
// Deprecated fields
|
||||
Labels []Pair `json:"Labels"`
|
||||
|
@ -275,14 +318,22 @@ type (
|
|||
|
||||
// EndpointSecuritySettings represents settings for an endpoint
|
||||
EndpointSecuritySettings struct {
|
||||
AllowBindMountsForRegularUsers bool `json:"allowBindMountsForRegularUsers"`
|
||||
AllowPrivilegedModeForRegularUsers bool `json:"allowPrivilegedModeForRegularUsers"`
|
||||
AllowVolumeBrowserForRegularUsers bool `json:"allowVolumeBrowserForRegularUsers"`
|
||||
AllowHostNamespaceForRegularUsers bool `json:"allowHostNamespaceForRegularUsers"`
|
||||
AllowDeviceMappingForRegularUsers bool `json:"allowDeviceMappingForRegularUsers"`
|
||||
AllowStackManagementForRegularUsers bool `json:"allowStackManagementForRegularUsers"`
|
||||
AllowContainerCapabilitiesForRegularUsers bool `json:"allowContainerCapabilitiesForRegularUsers"`
|
||||
EnableHostManagementFeatures bool `json:"enableHostManagementFeatures"`
|
||||
// Whether non-administrator should be able to use bind mounts when creating containers
|
||||
AllowBindMountsForRegularUsers bool `json:"AllowBindMountsForRegularUsers" example:"false"`
|
||||
// Whether non-administrator should be able to use privileged mode when creating containers
|
||||
AllowPrivilegedModeForRegularUsers bool `json:"AllowPrivilegedModeForRegularUsers" example:"false"`
|
||||
// Whether non-administrator should be able to browse volumes
|
||||
AllowVolumeBrowserForRegularUsers bool `json:"AllowVolumeBrowserForRegularUsers" example:""`
|
||||
// Whether non-administrator should be able to use the host pid
|
||||
AllowHostNamespaceForRegularUsers bool `json:"AllowHostNamespaceForRegularUsers" example:""`
|
||||
// Whether non-administrator should be able to use device mapping
|
||||
AllowDeviceMappingForRegularUsers bool `json:"AllowDeviceMappingForRegularUsers" example:""`
|
||||
// Whether non-administrator should be able to manage stacks
|
||||
AllowStackManagementForRegularUsers bool `json:"AllowStackManagementForRegularUsers" example:""`
|
||||
// Whether non-administrator should be able to use container capabilities
|
||||
AllowContainerCapabilitiesForRegularUsers bool `json:"AllowContainerCapabilitiesForRegularUsers" example:""`
|
||||
// Whether host management features are enabled
|
||||
EnableHostManagementFeatures bool `json:"EnableHostManagementFeatures" example:""`
|
||||
}
|
||||
|
||||
// EndpointType represents the type of an endpoint
|
||||
|
@ -296,7 +347,8 @@ type (
|
|||
|
||||
// Extension represents a deprecated Portainer extension
|
||||
Extension struct {
|
||||
ID ExtensionID `json:"Id"`
|
||||
// Extension Identifier
|
||||
ID ExtensionID `json:"Id" example:"1"`
|
||||
Enabled bool `json:"Enabled"`
|
||||
Name string `json:"Name,omitempty"`
|
||||
ShortDescription string `json:"ShortDescription,omitempty"`
|
||||
|
@ -366,29 +418,41 @@ type (
|
|||
|
||||
// LDAPGroupSearchSettings represents settings used to search for groups in a LDAP server
|
||||
LDAPGroupSearchSettings struct {
|
||||
GroupBaseDN string `json:"GroupBaseDN"`
|
||||
GroupFilter string `json:"GroupFilter"`
|
||||
GroupAttribute string `json:"GroupAttribute"`
|
||||
// The distinguished name of the element from which the LDAP server will search for groups
|
||||
GroupBaseDN string `json:"GroupBaseDN" example:"dc=ldap,dc=domain,dc=tld"`
|
||||
// The LDAP search filter used to select group elements, optional
|
||||
GroupFilter string `json:"GroupFilter" example:"(objectClass=account"`
|
||||
// LDAP attribute which denotes the group membership
|
||||
GroupAttribute string `json:"GroupAttribute" example:"member"`
|
||||
}
|
||||
|
||||
// LDAPSearchSettings represents settings used to search for users in a LDAP server
|
||||
LDAPSearchSettings struct {
|
||||
BaseDN string `json:"BaseDN"`
|
||||
Filter string `json:"Filter"`
|
||||
UserNameAttribute string `json:"UserNameAttribute"`
|
||||
// The distinguished name of the element from which the LDAP server will search for users
|
||||
BaseDN string `json:"BaseDN" example:"dc=ldap,dc=domain,dc=tld"`
|
||||
// Optional LDAP search filter used to select user elements
|
||||
Filter string `json:"Filter" example:"(objectClass=account)"`
|
||||
// LDAP attribute which denotes the username
|
||||
UserNameAttribute string `json:"UserNameAttribute" example:"uid"`
|
||||
}
|
||||
|
||||
// LDAPSettings represents the settings used to connect to a LDAP server
|
||||
LDAPSettings struct {
|
||||
AnonymousMode bool `json:"AnonymousMode"`
|
||||
ReaderDN string `json:"ReaderDN"`
|
||||
Password string `json:"Password,omitempty"`
|
||||
URL string `json:"URL"`
|
||||
TLSConfig TLSConfiguration `json:"TLSConfig"`
|
||||
StartTLS bool `json:"StartTLS"`
|
||||
// Enable this option if the server is configured for Anonymous access. When enabled, ReaderDN and Password will not be used
|
||||
AnonymousMode bool `json:"AnonymousMode" example:"true"`
|
||||
// Account that will be used to search for users
|
||||
ReaderDN string `json:"ReaderDN" example:"cn=readonly-account,dc=ldap,dc=domain,dc=tld"`
|
||||
// Password of the account that will be used to search users
|
||||
Password string `json:"Password,omitempty" example:"readonly-password"`
|
||||
// URL or IP address of the LDAP server
|
||||
URL string `json:"URL" example:"myldap.domain.tld:389"`
|
||||
TLSConfig TLSConfiguration `json:"TLSConfig"`
|
||||
// Whether LDAP connection should use StartTLS
|
||||
StartTLS bool `json:"StartTLS" example:"true"`
|
||||
SearchSettings []LDAPSearchSettings `json:"SearchSettings"`
|
||||
GroupSearchSettings []LDAPGroupSearchSettings `json:"GroupSearchSettings"`
|
||||
AutoCreateUsers bool `json:"AutoCreateUsers"`
|
||||
// Automatically provision users and assign them to matching LDAP group names
|
||||
AutoCreateUsers bool `json:"AutoCreateUsers" example:"true"`
|
||||
}
|
||||
|
||||
// LicenseInformation represents information about an extension license
|
||||
|
@ -418,20 +482,27 @@ type (
|
|||
|
||||
// Pair defines a key/value string pair
|
||||
Pair struct {
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
Name string `json:"name" example:"name"`
|
||||
Value string `json:"value" example:"value"`
|
||||
}
|
||||
|
||||
// Registry represents a Docker registry with all the info required
|
||||
// to connect to it
|
||||
Registry struct {
|
||||
ID RegistryID `json:"Id"`
|
||||
Type RegistryType `json:"Type"`
|
||||
Name string `json:"Name"`
|
||||
URL string `json:"URL"`
|
||||
Authentication bool `json:"Authentication"`
|
||||
Username string `json:"Username"`
|
||||
Password string `json:"Password,omitempty"`
|
||||
// Registry Identifier
|
||||
ID RegistryID `json:"Id" example:"1"`
|
||||
// Registry Type (1 - Quay, 2 - Azure, 3 - Custom, 4 - Gitlab)
|
||||
Type RegistryType `json:"Type" enums:"1,2,3,4"`
|
||||
// Registry Name
|
||||
Name string `json:"Name" example:"my-registry"`
|
||||
// URL or IP address of the Docker registry
|
||||
URL string `json:"URL" example:"registry.mydomain.tld:2375"`
|
||||
// Is authentication against this registry enabled
|
||||
Authentication bool `json:"Authentication" example:"true"`
|
||||
// Username used to authenticate against this registry
|
||||
Username string `json:"Username" example:"registry user"`
|
||||
// Password used to authenticate against this registry
|
||||
Password string `json:"Password,omitempty" example:"registry_password"`
|
||||
ManagementConfiguration *RegistryManagementConfiguration `json:"ManagementConfiguration"`
|
||||
Gitlab GitlabRegistryData `json:"Gitlab"`
|
||||
UserAccessPolicies UserAccessPolicies `json:"UserAccessPolicies"`
|
||||
|
@ -464,15 +535,23 @@ type (
|
|||
|
||||
// ResourceControl represent a reference to a Docker resource with specific access controls
|
||||
ResourceControl struct {
|
||||
ID ResourceControlID `json:"Id"`
|
||||
ResourceID string `json:"ResourceId"`
|
||||
SubResourceIDs []string `json:"SubResourceIds"`
|
||||
Type ResourceControlType `json:"Type"`
|
||||
UserAccesses []UserResourceAccess `json:"UserAccesses"`
|
||||
TeamAccesses []TeamResourceAccess `json:"TeamAccesses"`
|
||||
Public bool `json:"Public"`
|
||||
AdministratorsOnly bool `json:"AdministratorsOnly"`
|
||||
System bool `json:"System"`
|
||||
// ResourceControl Identifier
|
||||
ID ResourceControlID `json:"Id" example:"1"`
|
||||
// Docker resource identifier on which access control will be applied.\
|
||||
// In the case of a resource control applied to a stack, use the stack name as identifier
|
||||
ResourceID string `json:"ResourceId" example:"617c5f22bb9b023d6daab7cba43a57576f83492867bc767d1c59416b065e5f08"`
|
||||
// List of Docker resources that will inherit this access control
|
||||
SubResourceIDs []string `json:"SubResourceIds" example:"617c5f22bb9b023d6daab7cba43a57576f83492867bc767d1c59416b065e5f08"`
|
||||
// Type of Docker resource. Valid values are: 1- container, 2 -service
|
||||
// 3 - volume, 4 - secret, 5 - stack, 6 - config or 7 - custom template
|
||||
Type ResourceControlType `json:"Type" example:"1"`
|
||||
UserAccesses []UserResourceAccess `json:"UserAccesses" example:""`
|
||||
TeamAccesses []TeamResourceAccess `json:"TeamAccesses" example:""`
|
||||
// Permit access to the associated resource to any user
|
||||
Public bool `json:"Public" example:"true"`
|
||||
// Permit access to resource only to admins
|
||||
AdministratorsOnly bool `json:"AdministratorsOnly" example:"true"`
|
||||
System bool `json:"System" example:""`
|
||||
|
||||
// Deprecated fields
|
||||
// Deprecated in DBVersion == 2
|
||||
|
@ -489,9 +568,13 @@ type (
|
|||
// Role represents a set of authorizations that can be associated to a user or
|
||||
// to a team.
|
||||
Role struct {
|
||||
ID RoleID `json:"Id"`
|
||||
Name string `json:"Name"`
|
||||
Description string `json:"Description"`
|
||||
// Role Identifier
|
||||
ID RoleID `json:"Id" example:"1"`
|
||||
// Role name
|
||||
Name string `json:"Name" example:"HelpDesk"`
|
||||
// Role description
|
||||
Description string `json:"Description" example:"Read-only access of all resources in an endpoint"`
|
||||
// Authorizations associated to a role
|
||||
Authorizations Authorizations `json:"Authorizations"`
|
||||
Priority int `json:"Priority"`
|
||||
}
|
||||
|
@ -505,7 +588,8 @@ type (
|
|||
// NOTE: The Recurring option is only used by ScriptExecutionJob at the moment
|
||||
// Deprecated in favor of EdgeJob
|
||||
Schedule struct {
|
||||
ID ScheduleID `json:"Id"`
|
||||
// Schedule Identifier
|
||||
ID ScheduleID `json:"Id" example:"1"`
|
||||
Name string
|
||||
CronExpression string
|
||||
Recurring bool
|
||||
|
@ -529,17 +613,26 @@ type (
|
|||
|
||||
// Settings represents the application settings
|
||||
Settings struct {
|
||||
LogoURL string `json:"LogoURL"`
|
||||
BlackListedLabels []Pair `json:"BlackListedLabels"`
|
||||
AuthenticationMethod AuthenticationMethod `json:"AuthenticationMethod"`
|
||||
LDAPSettings LDAPSettings `json:"LDAPSettings"`
|
||||
OAuthSettings OAuthSettings `json:"OAuthSettings"`
|
||||
SnapshotInterval string `json:"SnapshotInterval"`
|
||||
TemplatesURL string `json:"TemplatesURL"`
|
||||
EdgeAgentCheckinInterval int `json:"EdgeAgentCheckinInterval"`
|
||||
EnableEdgeComputeFeatures bool `json:"EnableEdgeComputeFeatures"`
|
||||
UserSessionTimeout string `json:"UserSessionTimeout"`
|
||||
EnableTelemetry bool `json:"EnableTelemetry"`
|
||||
// URL to a logo that will be displayed on the login page as well as on top of the sidebar. Will use default Portainer logo when value is empty string
|
||||
LogoURL string `json:"LogoURL" example:"https://mycompany.mydomain.tld/logo.png"`
|
||||
// A list of label name & value that will be used to hide containers when querying containers
|
||||
BlackListedLabels []Pair `json:"BlackListedLabels"`
|
||||
// Active authentication method for the Portainer instance. Valid values are: 1 for internal, 2 for LDAP, or 3 for oauth
|
||||
AuthenticationMethod AuthenticationMethod `json:"AuthenticationMethod" example:"1"`
|
||||
LDAPSettings LDAPSettings `json:"LDAPSettings" example:""`
|
||||
OAuthSettings OAuthSettings `json:"OAuthSettings" example:""`
|
||||
// The interval in which endpoint snapshots are created
|
||||
SnapshotInterval string `json:"SnapshotInterval" example:"5m"`
|
||||
// URL to the templates that will be displayed in the UI when navigating to App Templates
|
||||
TemplatesURL string `json:"TemplatesURL" example:"https://raw.githubusercontent.com/portainer/templates/master/templates.json"`
|
||||
// The default check in interval for edge agent (in seconds)
|
||||
EdgeAgentCheckinInterval int `json:"EdgeAgentCheckinInterval" example:"5"`
|
||||
// Whether edge compute features are enabled
|
||||
EnableEdgeComputeFeatures bool `json:"EnableEdgeComputeFeatures" example:""`
|
||||
// The duration of a user session
|
||||
UserSessionTimeout string `json:"UserSessionTimeout" example:"5m"`
|
||||
// Whether telemetry is enabled
|
||||
EnableTelemetry bool `json:"EnableTelemetry" example:"false"`
|
||||
|
||||
// Deprecated fields
|
||||
DisplayDonationHeader bool
|
||||
|
@ -564,20 +657,34 @@ type (
|
|||
|
||||
// Stack represents a Docker stack created via docker stack deploy
|
||||
Stack struct {
|
||||
ID StackID `json:"Id"`
|
||||
Name string `json:"Name"`
|
||||
Type StackType `json:"Type"`
|
||||
EndpointID EndpointID `json:"EndpointId"`
|
||||
SwarmID string `json:"SwarmId"`
|
||||
EntryPoint string `json:"EntryPoint"`
|
||||
Env []Pair `json:"Env"`
|
||||
ResourceControl *ResourceControl `json:"ResourceControl"`
|
||||
Status StackStatus `json:"Status"`
|
||||
CreationDate int64
|
||||
CreatedBy string
|
||||
UpdateDate int64
|
||||
UpdatedBy string
|
||||
ProjectPath string
|
||||
// Stack Identifier
|
||||
ID StackID `json:"Id" example:"1"`
|
||||
// Stack name
|
||||
Name string `json:"Name" example:"myStack"`
|
||||
// Stack type. 1 for a Swarm stack, 2 for a Compose stack
|
||||
Type StackType `json:"Type" example:"2"`
|
||||
// Endpoint identifier. Reference the endpoint that will be used for deployment
|
||||
EndpointID EndpointID `json:"EndpointId" example:"1"`
|
||||
// Cluster identifier of the Swarm cluster where the stack is deployed
|
||||
SwarmID string `json:"SwarmId" example:"jpofkc0i9uo9wtx1zesuk649w"`
|
||||
// Path to the Stack file
|
||||
EntryPoint string `json:"EntryPoint" example:"docker-compose.yml"`
|
||||
// A list of environment variables used during stack deployment
|
||||
Env []Pair `json:"Env" example:""`
|
||||
//
|
||||
ResourceControl *ResourceControl `json:"ResourceControl" example:""`
|
||||
// Stack status (1 - active, 2 - inactive)
|
||||
Status StackStatus `json:"Status" example:"1"`
|
||||
// Path on disk to the repository hosting the Stack file
|
||||
ProjectPath string `example:"/data/compose/myStack_jpofkc0i9uo9wtx1zesuk649w"`
|
||||
// The date in unix time when stack was created
|
||||
CreationDate int64 `example:"1587399600"`
|
||||
// The username which created this stack
|
||||
CreatedBy string `example:"admin"`
|
||||
// The date in unix time when stack was last updated
|
||||
UpdateDate int64 `example:"1587399600"`
|
||||
// The username which last updated this stack
|
||||
UpdatedBy string `example:"bob"`
|
||||
}
|
||||
|
||||
// StackID represents a stack identifier (it must be composed of Name + "_" + SwarmID to create a unique identifier)
|
||||
|
@ -591,14 +698,19 @@ type (
|
|||
|
||||
// Status represents the application status
|
||||
Status struct {
|
||||
Version string `json:"Version"`
|
||||
// Portainer API version
|
||||
Version string `json:"Version" example:"2.0.0"`
|
||||
}
|
||||
|
||||
// Tag represents a tag that can be associated to a resource
|
||||
Tag struct {
|
||||
ID TagID
|
||||
Name string `json:"Name"`
|
||||
Endpoints map[EndpointID]bool `json:"Endpoints"`
|
||||
// Tag identifier
|
||||
ID TagID `example:"1"`
|
||||
// Tag name
|
||||
Name string `json:"Name" example:"org/acme"`
|
||||
// A set of endpoint ids that have this tag
|
||||
Endpoints map[EndpointID]bool `json:"Endpoints"`
|
||||
// A set of endpoint group ids that have this tag
|
||||
EndpointGroups map[EndpointGroupID]bool `json:"EndpointGroups"`
|
||||
}
|
||||
|
||||
|
@ -607,8 +719,10 @@ type (
|
|||
|
||||
// Team represents a list of user accounts
|
||||
Team struct {
|
||||
ID TeamID `json:"Id"`
|
||||
Name string `json:"Name"`
|
||||
// Team Identifier
|
||||
ID TeamID `json:"Id" example:"1"`
|
||||
// Team name
|
||||
Name string `json:"Name" example:"developers"`
|
||||
}
|
||||
|
||||
// TeamAccessPolicies represent the association of an access policy and a team
|
||||
|
@ -619,10 +733,14 @@ type (
|
|||
|
||||
// TeamMembership represents a membership association between a user and a team
|
||||
TeamMembership struct {
|
||||
ID TeamMembershipID `json:"Id"`
|
||||
UserID UserID `json:"UserID"`
|
||||
TeamID TeamID `json:"TeamID"`
|
||||
Role MembershipRole `json:"Role"`
|
||||
// Membership Identifier
|
||||
ID TeamMembershipID `json:"Id" example:"1"`
|
||||
// User identifier
|
||||
UserID UserID `json:"UserID" example:"1"`
|
||||
// Team identifier
|
||||
TeamID TeamID `json:"TeamID" example:"1"`
|
||||
// Team role (1 for team leader and 2 for team member)
|
||||
Role MembershipRole `json:"Role" example:"1"`
|
||||
}
|
||||
|
||||
// TeamMembershipID represents a team membership identifier
|
||||
|
@ -638,58 +756,92 @@ type (
|
|||
// or an Edge template
|
||||
Template struct {
|
||||
// Mandatory container/stack fields
|
||||
ID TemplateID `json:"Id"`
|
||||
Type TemplateType `json:"type"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
AdministratorOnly bool `json:"administrator_only"`
|
||||
// Template Identifier
|
||||
ID TemplateID `json:"Id" example:"1"`
|
||||
// Template type. Valid values are: 1 (container), 2 (Swarm stack) or 3 (Compose stack)
|
||||
Type TemplateType `json:"type" example:"1"`
|
||||
// Title of the template
|
||||
Title string `json:"title" example:"Nginx"`
|
||||
// Description of the template
|
||||
Description string `json:"description" example:"High performance web server"`
|
||||
// Whether the template should be available to administrators only
|
||||
AdministratorOnly bool `json:"administrator_only" example:"true"`
|
||||
|
||||
// Mandatory container fields
|
||||
Image string `json:"image"`
|
||||
// Image associated to a container template. Mandatory for a container template
|
||||
Image string `json:"image" example:"nginx:latest"`
|
||||
|
||||
// Mandatory stack fields
|
||||
Repository TemplateRepository `json:"repository"`
|
||||
|
||||
// Mandatory Edge stack fields
|
||||
// Stack file used for this template
|
||||
StackFile string `json:"stackFile"`
|
||||
|
||||
// Optional stack/container fields
|
||||
Name string `json:"name,omitempty"`
|
||||
Logo string `json:"logo,omitempty"`
|
||||
Env []TemplateEnv `json:"env,omitempty"`
|
||||
Note string `json:"note,omitempty"`
|
||||
Platform string `json:"platform,omitempty"`
|
||||
Categories []string `json:"categories,omitempty"`
|
||||
// Default name for the stack/container to be used on deployment
|
||||
Name string `json:"name,omitempty" example:"mystackname"`
|
||||
// URL of the template's logo
|
||||
Logo string `json:"logo,omitempty" example:"https://cloudinovasi.id/assets/img/logos/nginx.png"`
|
||||
// A list of environment variables used during the template deployment
|
||||
Env []TemplateEnv `json:"env,omitempty"`
|
||||
// A note that will be displayed in the UI. Supports HTML content
|
||||
Note string `json:"note,omitempty" example:"This is my <b>custom</b> template"`
|
||||
// Platform associated to the template.
|
||||
// Valid values are: 'linux', 'windows' or leave empty for multi-platform
|
||||
Platform string `json:"platform,omitempty" example:"linux"`
|
||||
// A list of categories associated to the template
|
||||
Categories []string `json:"categories,omitempty" example:"database"`
|
||||
|
||||
// Optional container fields
|
||||
Registry string `json:"registry,omitempty"`
|
||||
Command string `json:"command,omitempty"`
|
||||
Network string `json:"network,omitempty"`
|
||||
Volumes []TemplateVolume `json:"volumes,omitempty"`
|
||||
Ports []string `json:"ports,omitempty"`
|
||||
Labels []Pair `json:"labels,omitempty"`
|
||||
Privileged bool `json:"privileged,omitempty"`
|
||||
Interactive bool `json:"interactive,omitempty"`
|
||||
RestartPolicy string `json:"restart_policy,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
// The URL of a registry associated to the image for a container template
|
||||
Registry string `json:"registry,omitempty" example:"quay.io"`
|
||||
// The command that will be executed in a container template
|
||||
Command string `json:"command,omitempty" example:"ls -lah"`
|
||||
// Name of a network that will be used on container deployment if it exists inside the environment
|
||||
Network string `json:"network,omitempty" example:"mynet"`
|
||||
// A list of volumes used during the container template deployment
|
||||
Volumes []TemplateVolume `json:"volumes,omitempty"`
|
||||
// A list of ports exposed by the container
|
||||
Ports []string `json:"ports,omitempty" example:"8080:80/tcp"`
|
||||
// Container labels
|
||||
Labels []Pair `json:"labels,omitempty" example:""`
|
||||
// Whether the container should be started in privileged mode
|
||||
Privileged bool `json:"privileged,omitempty" example:"true"`
|
||||
// Whether the container should be started in
|
||||
// interactive mode (-i -t equivalent on the CLI)
|
||||
Interactive bool `json:"interactive,omitempty" example:"true"`
|
||||
// Container restart policy
|
||||
RestartPolicy string `json:"restart_policy,omitempty" example:"on-failure"`
|
||||
// Container hostname
|
||||
Hostname string `json:"hostname,omitempty" example:"mycontainer"`
|
||||
}
|
||||
|
||||
// TemplateEnv represents a template environment variable configuration
|
||||
TemplateEnv struct {
|
||||
Name string `json:"name"`
|
||||
Label string `json:"label,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Default string `json:"default,omitempty"`
|
||||
Preset bool `json:"preset,omitempty"`
|
||||
Select []TemplateEnvSelect `json:"select,omitempty"`
|
||||
// name of the environment variable
|
||||
Name string `json:"name" example:"MYSQL_ROOT_PASSWORD"`
|
||||
// Text for the label that will be generated in the UI
|
||||
Label string `json:"label,omitempty" example:"Root password"`
|
||||
// Content of the tooltip that will be generated in the UI
|
||||
Description string `json:"description,omitempty" example:"MySQL root account password"`
|
||||
// Default value that will be set for the variable
|
||||
Default string `json:"default,omitempty" example:"default_value"`
|
||||
// If set to true, will not generate any input for this variable in the UI
|
||||
Preset bool `json:"preset,omitempty" example:"false"`
|
||||
// A list of name/value that will be used to generate a dropdown in the UI
|
||||
Select []TemplateEnvSelect `json:"select,omitempty"`
|
||||
}
|
||||
|
||||
// TemplateEnvSelect represents text/value pair that will be displayed as a choice for the
|
||||
// template user
|
||||
TemplateEnvSelect struct {
|
||||
Text string `json:"text"`
|
||||
Value string `json:"value"`
|
||||
Default bool `json:"default"`
|
||||
// Some text that will displayed as a choice
|
||||
Text string `json:"text" example:"text value"`
|
||||
// A value that will be associated to the choice
|
||||
Value string `json:"value" example:"value"`
|
||||
// Will set this choice as the default choice
|
||||
Default bool `json:"default" example:"false"`
|
||||
}
|
||||
|
||||
// TemplateID represents a template identifier
|
||||
|
@ -697,8 +849,10 @@ type (
|
|||
|
||||
// TemplateRepository represents the git repository configuration for a template
|
||||
TemplateRepository struct {
|
||||
URL string `json:"url"`
|
||||
StackFile string `json:"stackfile"`
|
||||
// URL of a git repository used to deploy a stack template. Mandatory for a Swarm/Compose stack template
|
||||
URL string `json:"url" example:"https://github.com/portainer/portainer-compose"`
|
||||
// Path to the stack file inside the git repository
|
||||
StackFile string `json:"stackfile" example:"./subfolder/docker-compose.yml"`
|
||||
}
|
||||
|
||||
// TemplateType represents the type of a template
|
||||
|
@ -706,18 +860,26 @@ type (
|
|||
|
||||
// TemplateVolume represents a template volume configuration
|
||||
TemplateVolume struct {
|
||||
Container string `json:"container"`
|
||||
Bind string `json:"bind,omitempty"`
|
||||
ReadOnly bool `json:"readonly,omitempty"`
|
||||
// Path inside the container
|
||||
Container string `json:"container" example:"/data"`
|
||||
// Path on the host
|
||||
Bind string `json:"bind,omitempty" example:"/tmp"`
|
||||
// Whether the volume used should be readonly
|
||||
ReadOnly bool `json:"readonly,omitempty" example:"true"`
|
||||
}
|
||||
|
||||
// TLSConfiguration represents a TLS configuration
|
||||
TLSConfiguration struct {
|
||||
TLS bool `json:"TLS"`
|
||||
TLSSkipVerify bool `json:"TLSSkipVerify"`
|
||||
TLSCACertPath string `json:"TLSCACert,omitempty"`
|
||||
TLSCertPath string `json:"TLSCert,omitempty"`
|
||||
TLSKeyPath string `json:"TLSKey,omitempty"`
|
||||
// Use TLS
|
||||
TLS bool `json:"TLS" example:"true"`
|
||||
// Skip the verification of the server TLS certificate
|
||||
TLSSkipVerify bool `json:"TLSSkipVerify" example:"false"`
|
||||
// Path to the TLS CA certificate file
|
||||
TLSCACertPath string `json:"TLSCACert,omitempty" example:"/data/tls/ca.pem"`
|
||||
// Path to the TLS client certificate file
|
||||
TLSCertPath string `json:"TLSCert,omitempty" example:"/data/tls/cert.pem"`
|
||||
// Path to the TLS client key file
|
||||
TLSKeyPath string `json:"TLSKey,omitempty" example:"/data/tls/key.pem"`
|
||||
}
|
||||
|
||||
// TLSFileType represents a type of TLS file required to connect to a Docker endpoint.
|
||||
|
@ -747,10 +909,12 @@ type (
|
|||
|
||||
// User represents a user account
|
||||
User struct {
|
||||
ID UserID `json:"Id"`
|
||||
Username string `json:"Username"`
|
||||
Password string `json:"Password,omitempty"`
|
||||
Role UserRole `json:"Role"`
|
||||
// User Identifier
|
||||
ID UserID `json:"Id" example:"1"`
|
||||
Username string `json:"Username" example:"bob"`
|
||||
Password string `json:"Password,omitempty" example:"passwd"`
|
||||
// User role (1 for administrator account and 2 for regular account)
|
||||
Role UserRole `json:"Role" example:"1"`
|
||||
|
||||
// Deprecated fields
|
||||
// Deprecated in DBVersion == 25
|
||||
|
@ -776,7 +940,8 @@ type (
|
|||
|
||||
// Webhook represents a url webhook that can be used to update a service
|
||||
Webhook struct {
|
||||
ID WebhookID `json:"Id"`
|
||||
// Webhook Identifier
|
||||
ID WebhookID `json:"Id" example:"1"`
|
||||
Token string `json:"Token"`
|
||||
ResourceID string `json:"ResourceId"`
|
||||
EndpointID EndpointID `json:"EndpointId"`
|
||||
|
@ -1317,7 +1482,7 @@ const (
|
|||
StackResourceControl
|
||||
// ConfigResourceControl represents a resource control associated to a Docker config
|
||||
ConfigResourceControl
|
||||
// CustomTemplateResourceControl represents a resource control associated to a custom template
|
||||
// CustomTemplateResourceControl represents a resource control associated to a custom template
|
||||
CustomTemplateResourceControl
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue