mirror of https://github.com/harness/drone.git
feat: [CDE-693]: mv message map to enum package (#3636)
* fix: [CDE-693]: mv message map to enum packagemain
parent
f2245fa79c
commit
205a25900f
|
@ -28,7 +28,7 @@ import (
|
|||
var eventMessageMap map[enum.GitspaceEventType]string
|
||||
|
||||
func init() {
|
||||
eventMessageMap = eventsMessageMapping()
|
||||
eventMessageMap = enum.EventsMessageMapping()
|
||||
}
|
||||
|
||||
func (c *Controller) Events(
|
||||
|
@ -79,79 +79,3 @@ func (c *Controller) Events(
|
|||
|
||||
return result, count, nil
|
||||
}
|
||||
|
||||
func eventsMessageMapping() map[enum.GitspaceEventType]string {
|
||||
var gitspaceConfigsMap = map[enum.GitspaceEventType]string{
|
||||
enum.GitspaceEventTypeGitspaceActionStart: "Starting gitspace...",
|
||||
enum.GitspaceEventTypeGitspaceActionStartCompleted: "Started gitspace",
|
||||
enum.GitspaceEventTypeGitspaceActionStartFailed: "Starting gitspace failed",
|
||||
|
||||
enum.GitspaceEventTypeGitspaceActionStop: "Stopping gitspace...",
|
||||
enum.GitspaceEventTypeGitspaceActionStopCompleted: "Stopped gitspace",
|
||||
enum.GitspaceEventTypeGitspaceActionStopFailed: "Stopping gitspace failed",
|
||||
|
||||
enum.GitspaceEventTypeFetchDevcontainerStart: "Fetching devcontainer config...",
|
||||
enum.GitspaceEventTypeFetchDevcontainerCompleted: "Fetched devcontainer config",
|
||||
enum.GitspaceEventTypeFetchDevcontainerFailed: "Fetching devcontainer config failed",
|
||||
|
||||
enum.GitspaceEventTypeFetchConnectorsDetailsStart: "Fetching platform connectors details...",
|
||||
enum.GitspaceEventTypeFetchConnectorsDetailsCompleted: "Fetched platform connectors details",
|
||||
enum.GitspaceEventTypeFetchConnectorsDetailsFailed: "Fetching platform connectors details failed",
|
||||
|
||||
enum.GitspaceEventTypeInfraProvisioningStart: "Provisioning infrastructure...",
|
||||
enum.GitspaceEventTypeInfraProvisioningCompleted: "Provisioning infrastructure completed",
|
||||
enum.GitspaceEventTypeInfraProvisioningFailed: "Provisioning infrastructure failed",
|
||||
|
||||
enum.GitspaceEventTypeInfraGatewayRouteStart: "Updating gateway routing...",
|
||||
enum.GitspaceEventTypeInfraGatewayRouteCompleted: "Updating gateway routing completed",
|
||||
enum.GitspaceEventTypeInfraGatewayRouteFailed: "Updating gateway routing failed",
|
||||
|
||||
enum.GitspaceEventTypeInfraStopStart: "Stopping infrastructure...",
|
||||
enum.GitspaceEventTypeInfraStopCompleted: "Stopping infrastructure completed",
|
||||
enum.GitspaceEventTypeInfraStopFailed: "Stopping infrastructure failed",
|
||||
|
||||
enum.GitspaceEventTypeInfraDeprovisioningStart: "Deprovisioning infrastructure...",
|
||||
enum.GitspaceEventTypeInfraDeprovisioningCompleted: "Deprovisioning infrastructure completed",
|
||||
enum.GitspaceEventTypeInfraDeprovisioningFailed: "Deprovisioning infrastructure failed",
|
||||
|
||||
enum.GitspaceEventTypeAgentConnectStart: "Connecting to the gitspace agent...",
|
||||
enum.GitspaceEventTypeAgentConnectCompleted: "Connected to the gitspace agent",
|
||||
enum.GitspaceEventTypeAgentConnectFailed: "Failed connecting to the gitspace agent",
|
||||
|
||||
enum.GitspaceEventTypeAgentGitspaceCreationStart: "Setting up the gitspace...",
|
||||
enum.GitspaceEventTypeAgentGitspaceCreationCompleted: "Successfully setup the gitspace",
|
||||
enum.GitspaceEventTypeAgentGitspaceCreationFailed: "Failed to setup the gitspace",
|
||||
|
||||
enum.GitspaceEventTypeAgentGitspaceStopStart: "Stopping the gitspace...",
|
||||
enum.GitspaceEventTypeAgentGitspaceStopCompleted: "Successfully stopped the gitspace",
|
||||
enum.GitspaceEventTypeAgentGitspaceStopFailed: "Failed to stop the gitspace",
|
||||
|
||||
enum.GitspaceEventTypeAgentGitspaceDeletionStart: "Removing the gitspace...",
|
||||
enum.GitspaceEventTypeAgentGitspaceDeletionCompleted: "Successfully removed the gitspace",
|
||||
enum.GitspaceEventTypeAgentGitspaceDeletionFailed: "Failed to remove the gitspace",
|
||||
enum.GitspaceEventTypeAgentGitspaceStateReportRunning: "Gitspace is running",
|
||||
enum.GitspaceEventTypeAgentGitspaceStateReportStopped: "Gitspace is stopped",
|
||||
enum.GitspaceEventTypeAgentGitspaceStateReportUnknown: "Gitspace is in unknown state",
|
||||
enum.GitspaceEventTypeAgentGitspaceStateReportError: "Gitspace has an error",
|
||||
|
||||
enum.GitspaceEventTypeGitspaceAutoStop: "Triggering auto-stopping due to inactivity...",
|
||||
|
||||
enum.GitspaceEventTypeInfraCleanupStart: "Cleaning up infrastructure...",
|
||||
enum.GitspaceEventTypeInfraCleanupCompleted: "Successfully cleaned up infrastructure",
|
||||
enum.GitspaceEventTypeInfraCleanupFailed: "Failed to cleaned up infrastructure",
|
||||
|
||||
enum.GitspaceEventTypeInfraResetStart: "Resetting the gitspace infrastructure...",
|
||||
enum.GitspaceEventTypeInfraResetFailed: "Failed to reset the gitspace infrastructure",
|
||||
|
||||
enum.GitspaceEventTypeDelegateTaskSubmitted: "Delegate task submitted",
|
||||
|
||||
enum.GitspaceEventTypeInfraVMCreationStart: "creating VM...",
|
||||
enum.GitspaceEventTypeInfraVMCreationCompleted: "Successfully created VM",
|
||||
enum.GitspaceEventTypeInfraVMCreationFailed: "Failed to created VM",
|
||||
|
||||
enum.GitspaceEventTypeInfraPublishGatewayCompleted: "Published machine port mapping to Gateway",
|
||||
enum.GitspaceEventTypeInfraPublishGatewayFailed: "Failed to publish machine port mapping to Gateway",
|
||||
}
|
||||
|
||||
return gitspaceConfigsMap
|
||||
}
|
||||
|
|
|
@ -157,3 +157,79 @@ const (
|
|||
GitspaceEventTypeInfraPublishGatewayCompleted GitspaceEventType = "infra_publish_gateway_completed"
|
||||
GitspaceEventTypeInfraPublishGatewayFailed GitspaceEventType = "infra_publish_gateway_failed"
|
||||
)
|
||||
|
||||
func EventsMessageMapping() map[GitspaceEventType]string {
|
||||
var gitspaceConfigsMap = map[GitspaceEventType]string{
|
||||
GitspaceEventTypeGitspaceActionStart: "Starting gitspace...",
|
||||
GitspaceEventTypeGitspaceActionStartCompleted: "Started gitspace",
|
||||
GitspaceEventTypeGitspaceActionStartFailed: "Starting gitspace failed",
|
||||
|
||||
GitspaceEventTypeGitspaceActionStop: "Stopping gitspace...",
|
||||
GitspaceEventTypeGitspaceActionStopCompleted: "Stopped gitspace",
|
||||
GitspaceEventTypeGitspaceActionStopFailed: "Stopping gitspace failed",
|
||||
|
||||
GitspaceEventTypeFetchDevcontainerStart: "Fetching devcontainer config...",
|
||||
GitspaceEventTypeFetchDevcontainerCompleted: "Fetched devcontainer config",
|
||||
GitspaceEventTypeFetchDevcontainerFailed: "Fetching devcontainer config failed",
|
||||
|
||||
GitspaceEventTypeFetchConnectorsDetailsStart: "Fetching platform connectors details...",
|
||||
GitspaceEventTypeFetchConnectorsDetailsCompleted: "Fetched platform connectors details",
|
||||
GitspaceEventTypeFetchConnectorsDetailsFailed: "Fetching platform connectors details failed",
|
||||
|
||||
GitspaceEventTypeInfraProvisioningStart: "Provisioning infrastructure...",
|
||||
GitspaceEventTypeInfraProvisioningCompleted: "Provisioning infrastructure completed",
|
||||
GitspaceEventTypeInfraProvisioningFailed: "Provisioning infrastructure failed",
|
||||
|
||||
GitspaceEventTypeInfraGatewayRouteStart: "Updating gateway routing...",
|
||||
GitspaceEventTypeInfraGatewayRouteCompleted: "Updating gateway routing completed",
|
||||
GitspaceEventTypeInfraGatewayRouteFailed: "Updating gateway routing failed",
|
||||
|
||||
GitspaceEventTypeInfraStopStart: "Stopping infrastructure...",
|
||||
GitspaceEventTypeInfraStopCompleted: "Stopping infrastructure completed",
|
||||
GitspaceEventTypeInfraStopFailed: "Stopping infrastructure failed",
|
||||
|
||||
GitspaceEventTypeInfraDeprovisioningStart: "Deprovisioning infrastructure...",
|
||||
GitspaceEventTypeInfraDeprovisioningCompleted: "Deprovisioning infrastructure completed",
|
||||
GitspaceEventTypeInfraDeprovisioningFailed: "Deprovisioning infrastructure failed",
|
||||
|
||||
GitspaceEventTypeAgentConnectStart: "Connecting to the gitspace agent...",
|
||||
GitspaceEventTypeAgentConnectCompleted: "Connected to the gitspace agent",
|
||||
GitspaceEventTypeAgentConnectFailed: "Failed connecting to the gitspace agent",
|
||||
|
||||
GitspaceEventTypeAgentGitspaceCreationStart: "Setting up the gitspace...",
|
||||
GitspaceEventTypeAgentGitspaceCreationCompleted: "Successfully setup the gitspace",
|
||||
GitspaceEventTypeAgentGitspaceCreationFailed: "Failed to setup the gitspace",
|
||||
|
||||
GitspaceEventTypeAgentGitspaceStopStart: "Stopping the gitspace...",
|
||||
GitspaceEventTypeAgentGitspaceStopCompleted: "Successfully stopped the gitspace",
|
||||
GitspaceEventTypeAgentGitspaceStopFailed: "Failed to stop the gitspace",
|
||||
|
||||
GitspaceEventTypeAgentGitspaceDeletionStart: "Removing the gitspace...",
|
||||
GitspaceEventTypeAgentGitspaceDeletionCompleted: "Successfully removed the gitspace",
|
||||
GitspaceEventTypeAgentGitspaceDeletionFailed: "Failed to remove the gitspace",
|
||||
GitspaceEventTypeAgentGitspaceStateReportRunning: "Gitspace is running",
|
||||
GitspaceEventTypeAgentGitspaceStateReportStopped: "Gitspace is stopped",
|
||||
GitspaceEventTypeAgentGitspaceStateReportUnknown: "Gitspace is in unknown state",
|
||||
GitspaceEventTypeAgentGitspaceStateReportError: "Gitspace has an error",
|
||||
|
||||
GitspaceEventTypeGitspaceAutoStop: "Triggering auto-stopping due to inactivity...",
|
||||
|
||||
GitspaceEventTypeInfraCleanupStart: "Cleaning up infrastructure...",
|
||||
GitspaceEventTypeInfraCleanupCompleted: "Successfully cleaned up infrastructure",
|
||||
GitspaceEventTypeInfraCleanupFailed: "Failed to cleaned up infrastructure",
|
||||
|
||||
GitspaceEventTypeInfraResetStart: "Resetting the gitspace infrastructure...",
|
||||
GitspaceEventTypeInfraResetFailed: "Failed to reset the gitspace infrastructure",
|
||||
|
||||
GitspaceEventTypeDelegateTaskSubmitted: "Delegate task submitted",
|
||||
|
||||
GitspaceEventTypeInfraVMCreationStart: "creating VM...",
|
||||
GitspaceEventTypeInfraVMCreationCompleted: "Successfully created VM",
|
||||
GitspaceEventTypeInfraVMCreationFailed: "Failed to created VM",
|
||||
|
||||
GitspaceEventTypeInfraPublishGatewayCompleted: "Published machine port mapping to Gateway",
|
||||
GitspaceEventTypeInfraPublishGatewayFailed: "Failed to publish machine port mapping to Gateway",
|
||||
}
|
||||
|
||||
return gitspaceConfigsMap
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue