Documentation
¶
Index ¶
- func ProjectsToConfig(projects []Project, exclude map[string]bool) ([]byte, error)
- func UnmarshalConfigYAML(data []byte, config *Config) error
- type AddDeployTargetConfigInput
- type AddDeployTargetInput
- type AddDeployTargetResponse
- type AddEnvironmentInput
- type AddGroupInput
- type AddNotificationEmailInput
- type AddNotificationMicrosoftTeamsInput
- type AddNotificationRocketChatInput
- type AddNotificationSlackInput
- type AddNotificationToProjectInput
- type AddProjectInput
- type AddRestoreInput
- type AddSSHKeyInput
- type AddUserInput
- type Backup
- type Config
- type Currency
- type DeleteDeployTargetConfig
- type DeleteDeployTargetInput
- type DeleteDeployTargetResponse
- type DeployEnvironmentBranch
- type DeployEnvironmentBranchInput
- type DeployEnvironmentLatest
- type DeployEnvironmentLatestInput
- type DeployEnvironmentPromote
- type DeployEnvironmentPromoteInput
- type DeployEnvironmentPullrequest
- type DeployEnvironmentPullrequestInput
- type DeployTarget
- type DeployTargetConfig
- type EnvKeyValue
- type EnvVariableInput
- type Environment
- type EnvironmentConfig
- type EnvironmentInput
- type Group
- type GroupConfig
- type GroupInput
- type Groups
- type LagoonSchema
- type LagoonVersion
- type NotificationEmail
- type NotificationMicrosoftTeams
- type NotificationRocketChat
- type NotificationSlack
- type Notifications
- type NotificationsConfig
- type OpenshiftID
- type Project
- type ProjectAvailability
- type ProjectConfig
- type ProjectGroupsInput
- type ProjectInput
- type ProjectMetadata
- type ProjectNotifications
- type Restore
- type SSHKey
- type Task
- type UpdateDeployTargetConfigInput
- type UpdateDeployTargetInput
- type UpdateDeployTargetResponse
- type User
- type UserGroupRoleInput
- type UserRoleConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProjectsToConfig ¶
ProjectsToConfig translates an array of Projects to Lagoon Config data. It assumes a list of unique Projects.
func UnmarshalConfigYAML ¶
UnmarshalConfigYAML takes config data in YAML format and unmarshals it into a Config struct.
Types ¶
type AddDeployTargetConfigInput ¶ added in v0.12.3
type AddDeployTargetConfigInput struct {
ID uint `json:"id,omitempty"`
Project uint `json:"project,omitempty"`
Weight uint `json:"weight,omitempty"`
Branches string `json:"branches,omitempty"`
Pullrequests string `json:"pullrequests,omitempty"`
DeployTarget uint `json:"deployTarget,omitempty"`
DeployTargetProjectPattern string `json:"deployTargetProjectPattern,omitempty"`
}
AddDeployTargetConfigInput .
type AddDeployTargetInput ¶ added in v0.15.0
type AddDeployTargetInput struct {
ID uint `json:"id,omitempty"`
Name string `json:"name,omitempty"`
ConsoleURL string `json:"consoleUrl,omitempty"`
Token string `json:"token,omitempty"`
RouterPattern string `json:"routerPattern,omitempty"`
SSHHost string `json:"sshHost,omitempty"`
SSHPort string `json:"sshPort,omitempty"`
BuildImage string `json:"buildImage,omitempty"`
Created string `json:"created,omitempty"`
MonitoringConfig string `json:"monitoringConfig,omitempty"`
FriendlyName string `json:"friendlyName,omitempty"`
CloudProvider string `json:"cloudProvider,omitempty"`
CloudRegion string `json:"cloudRegion,omitempty"`
}
AddDeployTargetInput is based on the input to addDeployTarget.
type AddDeployTargetResponse ¶ added in v0.15.0
type AddDeployTargetResponse struct {
DeployTarget
}
type AddEnvironmentInput ¶
type AddEnvironmentInput struct {
ID uint `json:"id,omitempty"`
Name string `json:"name"`
ProjectID uint `json:"project"`
DeployType api.DeployType `json:"deployType"`
DeployBaseRef string `json:"deployBaseRef"`
DeployHeadRef string `json:"deployHeadRef,omitempty"`
DeployTitle string `json:"deployTitle,omitempty"`
EnvironmentType api.EnvType `json:"environmentType"`
OpenshiftProjectName string `json:"openshiftProjectName"`
}
AddEnvironmentInput is based on the input to addOrUpdateEnvironment.
type AddGroupInput ¶
type AddGroupInput struct {
Name string `json:"name"`
ParentGroup *GroupInput `json:"parentGroup,omitempty"`
}
AddGroupInput is based on the input to addGroup.
type AddNotificationEmailInput ¶
type AddNotificationEmailInput struct {
Name string `json:"name"`
EmailAddress string `json:"emailAddress"`
}
AddNotificationEmailInput is based on the Lagoon API type.
type AddNotificationMicrosoftTeamsInput ¶
type AddNotificationMicrosoftTeamsInput struct {
Name string `json:"name"`
Webhook string `json:"webhook"`
}
AddNotificationMicrosoftTeamsInput is based on the Lagoon API type.
type AddNotificationRocketChatInput ¶
type AddNotificationRocketChatInput struct {
Name string `json:"name"`
Webhook string `json:"webhook"`
Channel string `json:"channel"`
}
AddNotificationRocketChatInput is based on the Lagoon API type.
type AddNotificationSlackInput ¶
type AddNotificationSlackInput struct {
Name string `json:"name"`
Webhook string `json:"webhook"`
Channel string `json:"channel"`
}
AddNotificationSlackInput is based on the Lagoon API type.
type AddNotificationToProjectInput ¶
type AddNotificationToProjectInput struct {
Project string `json:"project"`
NotificationType api.NotificationType `json:"notificationType"`
NotificationName string `json:"notificationName"`
}
AddNotificationToProjectInput is based on the input to addNotificationToProject.
type AddProjectInput ¶
type AddProjectInput struct {
ID uint `json:"id,omitempty"`
Name string `json:"name"`
GitURL string `json:"gitUrl"`
Subfolder string `json:"subfolder,omitempty"`
Openshift uint `json:"openshift"`
OpenshiftProjectPattern string `json:"openshiftProjectPattern,omitempty"`
Branches string `json:"branches,omitempty"`
PullRequests string `json:"pullrequests,omitempty"`
ProductionEnvironment string `json:"productionEnvironment"`
StandbyProductionEnvironment string `json:"standbyProductionEnvironment,omitempty"`
Availability ProjectAvailability `json:"availability,omitempty"`
// AutoIdle and StorageCalc can't be omitempty because their zero-values are
// significant - Lagoon uses it as a boolean (0/1).
AutoIdle uint `json:"autoIdle"`
StorageCalc uint `json:"storageCalc"`
DevelopmentEnvironmentsLimit uint `json:"developmentEnvironmentsLimit,omitempty"`
PrivateKey string `json:"privateKey,omitempty"`
}
AddProjectInput is based on the Lagoon API type.
type AddRestoreInput ¶ added in v0.12.2
type AddRestoreInput struct {
ID uint `json:"id,omitempty"`
Status string `json:"status"`
Created string `json:"created"`
BackupID string `json:"backupId"`
RestoreLocation string `json:"restoreLocation"`
Execute bool `json:"execute"`
}
AddRestoreInput is based on the input to addRestore.
type AddSSHKeyInput ¶
AddSSHKeyInput is based on the Lagoon API type.
type AddUserInput ¶
type AddUserInput struct {
Email string `json:"email"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
Comment string `json:"comment,omitempty"`
GitlabID uint `json:"gitlabId,omitempty"`
}
AddUserInput is based on the Lagoon API type.
type Backup ¶ added in v0.12.2
type Backup struct {
ID int `json:"id"`
Source string `json:"source"`
BackupID string `json:"backupId"`
Created string `json:"created"`
Deleted string `json:"deleted"`
Restore Restore `json:"restore"`
}
Backup is the Lagoon API Backup object.
type Config ¶
type Config struct {
// API objects
Projects []ProjectConfig `json:"projects,omitempty"`
Groups []GroupConfig `json:"groups,omitempty"`
Users []User `json:"users,omitempty"`
Notifications *NotificationsConfig `json:"notifications,omitempty"`
}
Config represents a collection of Lagoon platform configuration. Fields for comprising structs are dictated by the add* Lagoon APIs.
func (*Config) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface to control how lagoon config files are unmarshaled.
type DeleteDeployTargetConfig ¶ added in v0.12.3
type DeleteDeployTargetConfig struct {
DeleteDeployTargetConfig string `json:"deleteDeployTargetConfig"`
}
DeleteDeployTargetConfig is the response.
type DeleteDeployTargetInput ¶ added in v0.15.0
type DeleteDeployTargetResponse ¶ added in v0.15.0
type DeleteDeployTargetResponse struct {
DeleteDeployTarget string `json:"deleteDeployTarget,omitempty"`
}
type DeployEnvironmentBranch ¶
type DeployEnvironmentBranch struct {
DeployEnvironmentBranch string `json:"deployEnvironmentBranch"`
}
DeployEnvironmentBranch is the response.
type DeployEnvironmentBranchInput ¶
type DeployEnvironmentBranchInput struct {
Project string `json:"project"`
Branch string `json:"branch"`
BranchRef string `json:"branchRef"`
ReturnData bool `json:"returnData"`
}
DeployEnvironmentBranchInput is used as the input for deploying a branch.
type DeployEnvironmentLatest ¶
type DeployEnvironmentLatest struct {
DeployEnvironmentLatest string `json:"deployEnvironmentLatest"`
}
DeployEnvironmentLatest is the response.
type DeployEnvironmentLatestInput ¶
type DeployEnvironmentLatestInput struct {
Environment EnvironmentInput `json:"environment"`
ReturnData bool `json:"returnData"`
}
DeployEnvironmentLatestInput is used as the input for deploying an environment.
type DeployEnvironmentPromote ¶
type DeployEnvironmentPromote struct {
DeployEnvironmentPromote string `json:"deployEnvironmentPromote"`
}
DeployEnvironmentPromote is the response.
type DeployEnvironmentPromoteInput ¶
type DeployEnvironmentPromoteInput struct {
Project string `json:"project"`
SourceEnvironment string `json:"sourceEnvironment"`
DestinationEnvironment string `json:"destinationEnvironment"`
ReturnData bool `json:"returnData"`
}
DeployEnvironmentPromoteInput is used as the input for promoting one environment to another.
type DeployEnvironmentPullrequest ¶
type DeployEnvironmentPullrequest struct {
DeployEnvironmentPullrequest string `json:"deployEnvironmentPullrequest"`
}
DeployEnvironmentPullrequest is the response.
type DeployEnvironmentPullrequestInput ¶
type DeployEnvironmentPullrequestInput struct {
Project ProjectInput `json:"project"`
Number uint `json:"number"`
Title string `json:"title"`
BaseBranchName string `json:"baseBranchName"`
BaseBranchRef string `json:"baseBranchRef"`
HeadBranchName string `json:"headBranchName"`
HeadBranchRef string `json:"headBranchRef"`
ReturnData bool `json:"returnData"`
}
DeployEnvironmentPullrequestInput is used as the input for deploying a pull request.
type DeployTarget ¶ added in v0.12.3
type DeployTarget struct {
AddDeployTargetInput
}
type DeployTargetConfig ¶ added in v0.12.3
type DeployTargetConfig struct {
ID uint `json:"id"`
Project Project `json:"project"`
Weight uint `json:"weight"`
Branches string `json:"branches"`
Pullrequests string `json:"pullrequests"`
DeployTarget DeployTarget `json:"deployTarget"`
DeployTargetProjectPattern string `json:"deployTargetProjectPattern"`
}
DeployTargetConfig .
type EnvKeyValue ¶
type EnvKeyValue struct {
ID uint `json:"id,omitempty"`
Scope api.EnvVariableScope `json:"scope"`
Name string `json:"name"`
Value string `json:"value"`
}
EnvKeyValue is the base type of Environment variable.
type EnvVariableInput ¶
type EnvVariableInput struct {
EnvKeyValue
Type api.EnvVariableType `json:"type"`
TypeID uint `json:"typeId"`
}
EnvVariableInput is based on the Lagoon API type.
type Environment ¶
type Environment struct {
AddEnvironmentInput
AutoIdle uint `json:"autoIdle"`
EnvVariables []EnvKeyValue `json:"envVariables,omitempty"`
Route string `json:"route,omitempty"`
Routes string `json:"routes,omitempty"`
Backups []Backup `json:"backups,omitempty"`
// TODO use a unixtime type
Updated string `json:"updated,omitempty"`
Created string `json:"created,omitempty"`
Deleted string `json:"deleted,omitempty"`
}
Environment is the Lagoon API Environment object.
type EnvironmentConfig ¶
type EnvironmentConfig struct {
Environment
// override embedded AddEnvironmentInput.ProjectID to omitempty
ProjectID uint `json:"project,omitempty"`
}
EnvironmentConfig contains Environment configuration.
type EnvironmentInput ¶
type EnvironmentInput struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Project ProjectInput `json:"project"`
}
EnvironmentInput is based on the Lagoon API type.
type Group ¶
type Group struct {
AddGroupInput
ID *uuid.UUID `json:"id,omitempty"`
Members []struct {
User User `json:"user"`
Role api.GroupRole `json:"role"`
} `json:"members,omitempty"`
}
Group provides for unmarshalling the groups contained with a Project.
type GroupConfig ¶
type GroupConfig struct {
AddGroupInput
Users []UserRoleConfig `json:"users,omitempty"`
}
GroupConfig embeds AddGroupInput as well as a list of members.
type Groups ¶
type Groups struct {
Groups []Group
}
Groups represents possible Lagoon group types. These are unmarshalled from a projectByName query response.
func (*Groups) UnmarshalJSON ¶
UnmarshalJSON unmashals a quoted json string to the Notification values.
type LagoonSchema ¶
type LagoonSchema struct {
QueryType struct {
Name string `json:"name"`
} `json:"queryType"`
MutationType struct {
Name string `json:"name"`
} `json:"mutationType"`
SubscriptionType struct {
Name string `json:"name"`
} `json:"subscriptionType"`
Types []struct {
Kind string `json:"kind"`
Name string `json:"name"`
Description string `json:"description"`
Fields []struct {
Name string `json:"name"`
Description string `json:"description"`
Args []interface{} `json:"args"`
Type struct {
Kind string `json:"kind"`
Name string `json:"name"`
OfType interface{} `json:"ofType"`
} `json:"type"`
IsDeprecated bool `json:"isDeprecated"`
DeprecationReason interface{} `json:"deprecationReason"`
} `json:"fields"`
InputFields interface{} `json:"inputFields"`
Interfaces []interface{} `json:"interfaces"`
EnumValues interface{} `json:"enumValues"`
PossibleTypes interface{} `json:"possibleTypes"`
} `json:"types"`
Directives []struct {
Name string `json:"name"`
Description string `json:"description"`
Locations []string `json:"locations"`
Args []struct {
Name string `json:"name"`
Description string `json:"description"`
Type struct {
Kind string `json:"kind"`
Name interface{} `json:"name"`
OfType struct {
Kind string `json:"kind"`
Name string `json:"name"`
OfType interface{} `json:"ofType"`
} `json:"ofType"`
} `json:"type"`
DefaultValue interface{} `json:"defaultValue"`
} `json:"args"`
} `json:"directives"`
}
LagoonSchema is the supported schema for a lagoon
type LagoonVersion ¶
type LagoonVersion struct {
LagoonVersion string `json:"lagoonVersion,omitempty"`
}
LagoonVersion is for the lagoon API version.
type NotificationEmail ¶
type NotificationEmail struct {
AddNotificationEmailInput
ID uint `json:"id,omitempty"`
}
NotificationEmail is based on the Lagoon API type.
type NotificationMicrosoftTeams ¶
type NotificationMicrosoftTeams struct {
AddNotificationMicrosoftTeamsInput
ID uint `json:"id,omitempty"`
}
NotificationMicrosoftTeams is based on the Lagoon API type.
type NotificationRocketChat ¶
type NotificationRocketChat struct {
AddNotificationRocketChatInput
ID uint `json:"id,omitempty"`
}
NotificationRocketChat is based on the Lagoon API type.
type NotificationSlack ¶
type NotificationSlack struct {
AddNotificationSlackInput
ID uint `json:"id,omitempty"`
}
NotificationSlack is based on the Lagoon API type.
type Notifications ¶
type Notifications struct {
Slack []AddNotificationSlackInput
RocketChat []AddNotificationRocketChatInput
Email []AddNotificationEmailInput
MicrosoftTeams []AddNotificationMicrosoftTeamsInput
}
Notifications represents possible Lagoon notification types. These are unmarshalled from a projectByName query response.
func (*Notifications) UnmarshalJSON ¶
func (n *Notifications) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the Notification values returned from the Lagoon API.
type NotificationsConfig ¶
type NotificationsConfig struct {
Notifications
}
NotificationsConfig represents possible Lagoon notification types and (un)marshals to the config file format.
func (*NotificationsConfig) MarshalJSON ¶
func (n *NotificationsConfig) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Notifications as a quoted json string.
func (*NotificationsConfig) UnmarshalJSON ¶
func (n *NotificationsConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the Notification values.
type OpenshiftID ¶
type OpenshiftID struct {
ID uint `json:"id,omitempty"`
}
OpenshiftID is unmarshalled during export.
type Project ¶
type Project struct {
AddProjectInput
Environments []EnvironmentConfig `json:"environments,omitempty"`
EnvVariables []EnvKeyValue `json:"envVariables,omitempty"`
// Notifications is unmarshalled during export.
Notifications *Notifications `json:"notifications,omitempty"`
// Openshift is unmarshalled during export.
OpenshiftID *OpenshiftID `json:"openshift,omitempty"`
// Groups are unmarshalled during export.
Groups *Groups `json:"groups,omitempty"`
}
Project is the Lagoon API Project object.
type ProjectAvailability ¶
type ProjectAvailability string
ProjectAvailability determines the number of pods used to run a project.
const ( High ProjectAvailability = "HIGH" Standard ProjectAvailability = "STANDARD" )
High tells Lagoon to load balance across multiple pods. Standard tells Lagoon to use a single pod for the site.
type ProjectConfig ¶
type ProjectConfig struct {
Project
// ProjectNotifications are (un)marshalled during import.
Notifications *ProjectNotifications `json:"notifications,omitempty"`
// Group are (un)marshalled during import.
Groups []string `json:"groups,omitempty"`
// Users are members of the project.
// Note that in Lagoon this is implemented as being a member of the
// project-<projectname> group.
Users []UserRoleConfig `json:"users,omitempty"`
}
ProjectConfig contains project configuration.
type ProjectGroupsInput ¶
type ProjectGroupsInput struct {
Project ProjectInput `json:"project"`
Groups []GroupInput `json:"groups"`
}
ProjectGroupsInput is based on the input to addGroupsToProject.
type ProjectInput ¶
ProjectInput is based on the Lagoon API type.
type ProjectMetadata ¶ added in v0.12.0
ProjectMetadata .
type ProjectNotifications ¶
type ProjectNotifications struct {
Slack []string `json:"slack,omitempty"`
RocketChat []string `json:"rocketChat,omitempty"`
Email []string `json:"email,omitempty"`
MicrosoftTeams []string `json:"microsoftTeams,omitempty"`
}
ProjectNotifications lists the notifications for a project within a ProjectConfig.
type Restore ¶ added in v0.12.2
type Restore struct {
ID int `json:"id"`
Status string `json:"status"`
Created string `json:"created"`
BackupID string `json:"backupId"`
RestoreLocation string `json:"restoreLocation"`
}
Restore is the Lagoon API Restore object.
type SSHKey ¶
type SSHKey struct {
Name string `json:"name"`
KeyValue string `json:"keyValue"`
Created string `json:"created"`
KeyType api.SSHKeyType `json:"keyType"`
KeyFingerprint string `json:"keyFingerprint"`
}
SSHKey is the basic SSH key information, used by both config and API data. @TODO: once Lagoon API returns proper TZ, fix up `Created` to time.Time.
type Task ¶
type Task struct {
ID uint `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Status string `json:"status,omitempty"`
Created string `json:"created,omitempty"`
Started string `json:"started,omitempty"`
Completed string `json:"completed,omitempty"`
Service string `json:"service,omitempty"`
Command string `json:"command,omitempty"`
RemoteID string `json:"remoteId,omitempty"`
Logs string `json:"logs,omitempty"`
Environment Environment `json:"environment,omitempty"`
}
Task is based on the Lagoon API type.
type UpdateDeployTargetConfigInput ¶ added in v0.12.3
type UpdateDeployTargetConfigInput struct {
ID uint `json:"id,omitempty"`
Weight uint `json:"weight,omitempty"`
Branches string `json:"branches,omitempty"`
Pullrequests string `json:"pullrequests,omitempty"`
DeployTarget uint `json:"deployTarget,omitempty"`
DeployTargetProjectPattern string `json:"deployTargetProjectPattern,omitempty"`
}
UpdateDeployTargetConfigInput .
type UpdateDeployTargetInput ¶ added in v0.15.0
type UpdateDeployTargetInput struct {
AddDeployTargetInput
}
UpdateDeployTargetInput is based on the input to addDeployTarget.
type UpdateDeployTargetResponse ¶ added in v0.15.0
type UpdateDeployTargetResponse struct {
DeployTarget
}
type User ¶
type User struct {
AddUserInput
ID *uuid.UUID `json:"id,omitempty"`
SSHKeys []SSHKey `json:"sshKeys,omitempty"`
}
User provides for unmarshalling the users contained withing a Group.
type UserGroupRoleInput ¶
type UserGroupRoleInput struct {
UserEmail string `json:"userEmail"`
GroupName string `json:"groupName"`
GroupRole api.GroupRole `json:"groupRole"`
}
UserGroupRoleInput is based on the Lagoon API type.
type UserRoleConfig ¶
UserRoleConfig stores a user/role config within a group.