Documentation ¶
Index ¶
- Constants
- func GetAuthenticatorURL() (*url.URL, error)
- func GetRiverURL() (*url.URL, error)
- func PrintPublicEndpoints(writer io.Writer, endpoints []APIPublicEndpoint)
- type APICluster
- type APICodeReference
- type APIComponent
- type APIEnvironment
- type APIFlow
- type APIMembership
- type APIPublicEndpoint
- type APIPublicEndpointPort
- type APIRemoteEnvironmentStatus
- type APIRepository
- type APITeam
- type APITide
- type APITideTeam
- type APIUser
- type CpAPI
- func (c CpAPI) CancelRunningTide(flowID string, remoteEnvironmentID string) error
- func (c CpAPI) CancelTide(tideID string) error
- func (c CpAPI) GetAPIEnvironments(flowID string) ([]APIEnvironment, error)
- func (c CpAPI) GetAPIFlows(project string) ([]APIFlow, error)
- func (c CpAPI) GetAPITeams() ([]APITeam, error)
- func (c CpAPI) GetAPIUser(user string) (*APIUser, error)
- func (c CpAPI) GetRemoteEnvironmentStatus(flowID string, environmentID string) (*APIRemoteEnvironmentStatus, error)
- func (c CpAPI) RemoteDevelopmentEnvironmentDestroy(flowID string, remoteEnvironmentID string) error
- func (c CpAPI) RemoteEnvironmentBuild(remoteEnvironmentFlowID string, gitBranch string) error
- func (c CpAPI) RemoteEnvironmentDestroy(flowID string, environment string, cluster string) error
- func (c CpAPI) RemoteEnvironmentRunningAndExists(flowID string, environmentID string) (bool, error)
- func (c *CpAPI) SetAPIKey(apiKey string)
- type DataProvider
- type MultipleChoiceCpEntityAnswer
- type MultipleChoiceCpEntityOption
- type MultipleChoiceCpEntityQuestioner
Constants ¶
const ErrorFailedToGetEnvironmentsList = "failed to get the environments list"
const RemoteEnvironmentRunning = "Running"
RemoteEnvironmentRunning is the status for a running remove environment
const RemoteEnvironmentTideFailed = "TideFailed"
RemoteEnvironmentTideFailed is the status for a tide that failed
const RemoteEnvironmentTideNotStarted = "NotStarted"
RemoteEnvironmentTideNotStarted is the status for at tide that has not been started yet
const RemoteEnvironmentTideRunning = "TideRunning"
RemoteEnvironmentTideRunning is the status for a tide that is running
const TideRunning = "running"
TideRunning is the status of a running tide
Variables ¶
This section is empty.
Functions ¶
func GetAuthenticatorURL ¶
func GetRiverURL ¶
func PrintPublicEndpoints ¶
func PrintPublicEndpoints(writer io.Writer, endpoints []APIPublicEndpoint)
PrintPublicEndpoints given a list of public api endpoints it prints them on the given writer
Types ¶
type APICluster ¶
type APICluster struct { Identifier string `json:"identifier"` Address string `json:"address"` Version string `json:"version"` Username string `json:"username"` Password string `json:"password"` Type string `json:"type"` }
APICluster holds the data expected from the cp api for this entity
type APICodeReference ¶
type APICodeReference struct { Branch string `json:"branch"` CodeRepository interface{} `json:"code_repository"` Sha1 string `json:"sha1"` }
APICodeReference holds the data expected from the cp api for this entity
type APIComponent ¶
type APIComponent struct { DeploymentStrategy interface{} `json:"deployment_strategy"` Endpoints []interface{} `json:"endpoints"` Extensions []interface{} `json:"extensions"` Identifier string `json:"identifier"` Labels interface{} `json:"labels"` Name string `json:"name"` Specification interface{} `json:"specification"` Status interface{} `json:"status"` }
APIComponent holds the data expected from the cp api for this entity
type APIEnvironment ¶
type APIEnvironment struct { Cluster string `json:"cluster"` Components []APIComponent `json:"components"` Identifier string `json:"identifier"` }
APIEnvironment holds the data expected from the cp api for this entity
type APIFlow ¶
type APIFlow struct { UUID string `json:"uuid"` Configuration interface{} `json:"configuration"` Pipelines interface{} `json:"pipelines"` Repository APIRepository `json:"repository"` Team APITeam `json:"team"` Tides []APITide `json:"tides"` User APIUser `json:"user"` }
APIFlow holds the data expected from the cp api for this entity
type APIMembership ¶
type APIMembership struct { Team APITeam `json:"team"` User APIUser `json:"user"` Permissions []string `json:"permissions"` }
APIMembership holds the data expected from the cp api for this entity
type APIPublicEndpoint ¶
type APIPublicEndpoint struct { Address string `json:"address"` Name string `json:"name"` Ports []APIPublicEndpointPort `json:"ports"` }
APIPublicEndpoint holds the data expected from the cp api for this entity
type APIPublicEndpointPort ¶
APIPublicEndpointPort holds the data expected from the cp api for this entity
type APIRemoteEnvironmentStatus ¶
type APIRemoteEnvironmentStatus struct { Status string `json:"status"` KubeEnvironmentName string `json:"environment_name"` ClusterIdentifier string `json:"cluster_identifier"` PublicEndpoints []APIPublicEndpoint `json:"public_endpoints"` LastTide APITide `json:"last_tide"` }
APIRemoteEnvironmentStatus holds the data expected from the cp api for this entity
type APIRepository ¶
type APIRepository struct { Address string `json:"address"` Identifier string `json:"identifier"` Name string `json:"name"` Organisation string `json:"organisation"` Private bool `json:"private"` Type string `json:"type"` }
APIRepository holds the data expected from the cp api for this entity
type APITeam ¶
type APITeam struct { Slug string `json:"slug"` Name string `json:"name"` BucketUUID string `json:"bucket_uuid"` //Should be []APIMembership although there is a bug on the api where a list of object with keys "1", "2" is returned //instead of being a json array Memberships []interface{} `json:"memberships"` }
APITeam holds the data expected from the cp api for this entity
type APITide ¶
type APITide struct { CodeReference APICodeReference `json:"code_reference"` Configuration interface{} `json:"configuration"` CreationDate string `json:"creation_date"` FinishDate string `json:"finish_date"` FlowUUID string `json:"flow_uuid"` GenerationUUID string `json:"generation_uuid"` LogID string `json:"log_id"` StartDate string `json:"start_date"` Status string `json:"status"` Tasks []interface{} `json:"tasks"` Team APITideTeam `json:"team"` User interface{} `json:"user"` UUID string `json:"uuid"` }
APITide holds the data expected from the cp api for this entity
type APITideTeam ¶
type APITideTeam struct { Slug string `json:"slug"` Name string `json:"name"` BucketUUID string `json:"bucket_uuid"` }
APITideTeam holds the data expected from the cp api for this entity
type APIUser ¶
type APIUser struct { Username string `json:"username"` Email string `json:"email"` BucketUUID string `json:"bucket_uuid"` Roles []string `json:"roles"` }
APIUser holds the data expected from the cp api for this entity
type CpAPI ¶
type CpAPI struct {
// contains filtered or unexported fields
}
CpAPI holds the dependencies required to do the api calls
func (CpAPI) CancelRunningTide ¶
CancelRunningTide find the tide id associated with the branch and cancel the tide
func (CpAPI) CancelTide ¶
CancelTide send a request to the cp api to cancel the tide specified
func (CpAPI) GetAPIEnvironments ¶
func (c CpAPI) GetAPIEnvironments(flowID string) ([]APIEnvironment, error)
GetAPIEnvironments sends a request to the cp api to fetch the cp environments list for the user
func (CpAPI) GetAPIFlows ¶
GetAPIFlows sends a request to the cp api to fetch the list of flows
func (CpAPI) GetAPITeams ¶
GetAPITeams sends a request to the cp api to fetch the list of teams for the user
func (CpAPI) GetAPIUser ¶
GetAPIUser sends a request to the cp api to fetch the cp user information
func (CpAPI) GetRemoteEnvironmentStatus ¶
func (c CpAPI) GetRemoteEnvironmentStatus(flowID string, environmentID string) (*APIRemoteEnvironmentStatus, error)
GetRemoteEnvironmentStatus sends a request to the cp api to retrieve information about the remote environment
func (CpAPI) RemoteDevelopmentEnvironmentDestroy ¶
RemoteDevelopmentEnvironmentDestroy send a request to the cp api to destroy the environment
func (CpAPI) RemoteEnvironmentBuild ¶
RemoteEnvironmentBuild sends a request to the cp api to request to build a new remote environment
func (CpAPI) RemoteEnvironmentDestroy ¶
RemoteEnvironmentDestroy sends a request to the cp api to request to destroy the remote environment
func (CpAPI) RemoteEnvironmentRunningAndExists ¶
RemoteEnvironmentRunningAndExists get the remote environment status and the list of all environments to ensure that the environment actually exists
type DataProvider ¶
type DataProvider interface { SetAPIKey(apiKey string) GetAPITeams() ([]APITeam, error) GetAPIFlows(project string) ([]APIFlow, error) GetAPIUser(user string) (*APIUser, error) GetAPIEnvironments(flowID string) ([]APIEnvironment, error) GetRemoteEnvironmentStatus(flowID string, environmentID string) (*APIRemoteEnvironmentStatus, error) RemoteEnvironmentBuild(remoteEnvironmentFlowID string, gitBranch string) error CancelRunningTide(flowID string, remoteEnvironmentID string) error RemoteEnvironmentRunningAndExists(flowID string, environmentID string) (bool, error) RemoteEnvironmentDestroy(flowID string, environment string, cluster string) error RemoteDevelopmentEnvironmentDestroy(flowID string, remoteEnvironmentID string) error CancelTide(tideID string) error }
DataProvider collects all cp api methods
type MultipleChoiceCpEntityAnswer ¶
type MultipleChoiceCpEntityAnswer struct { Project MultipleChoiceCpEntityOption Flow MultipleChoiceCpEntityOption Environment MultipleChoiceCpEntityOption Pod MultipleChoiceCpEntityOption }
MultipleChoiceCpEntityAnswer for each entity holds the option selected by the user
type MultipleChoiceCpEntityOption ¶
MultipleChoiceCpEntityOption holds an option that will be presented to the user
type MultipleChoiceCpEntityQuestioner ¶
type MultipleChoiceCpEntityQuestioner struct {
// contains filtered or unexported fields
}
MultipleChoiceCpEntityQuestioner presents the user with a list of option for cp entities (project, flows, environments, pods) to choose from and requests to select a single one
func NewMultipleChoiceCpEntityQuestioner ¶
func NewMultipleChoiceCpEntityQuestioner() *MultipleChoiceCpEntityQuestioner
NewMultipleChoiceCpEntityQuestioner returns a *MultipleChoiceCpEntityQuestioner struct
func (*MultipleChoiceCpEntityQuestioner) SetAPIKey ¶
func (q *MultipleChoiceCpEntityQuestioner) SetAPIKey(apiKey string)
SetAPIKey sets the cp api key
func (*MultipleChoiceCpEntityQuestioner) WhichEntities ¶
func (q *MultipleChoiceCpEntityQuestioner) WhichEntities() (project APITeam, flow APIFlow, environment APIEnvironment, pod APIComponent, suggestion string, err error)
WhichEntities triggers an api request to the cp api based on the arguments and presents to the user a list of options to choose from, it then stores the user response