Documentation ¶
Overview ¶
Package models defines Phobos resources and their properties as structs.
Index ¶
- Constants
- Variables
- func GetAssignablePermissions() []string
- type Action
- type ActivityEvent
- type ActivityEventAction
- type ActivityEventCreateMembershipPayload
- type ActivityEventDeleteResourcePayload
- type ActivityEventRemoveMembershipPayload
- type ActivityEventTargetType
- type ActivityEventUpdateMembershipPayload
- type ActivityEventUpdateReleasePayload
- type ActivityEventUpdateTeamPayload
- type Agent
- type AgentSession
- type AgentType
- type ApprovalRule
- type BoundClaimsType
- type Comment
- type DefaultRoleID
- type Environment
- type EnvironmentRule
- type Job
- func (j *Job) ForceCancel(canceledBy string) error
- func (j *Job) GetForceCancelAvailableAt() time.Time
- func (j *Job) GetOrgName() string
- func (j *Job) GetStatus() JobStatus
- func (j *Job) GracefullyCancel() error
- func (j *Job) ResolveMetadata(key string) (string, error)
- func (j *Job) SetStatus(status JobStatus) error
- type JobStatus
- type JobTaskData
- type JobTimestamps
- type JobType
- type LifecycleTemplate
- type LifecycleTemplateStatus
- type LogStream
- type Membership
- type Metric
- type MetricName
- type MetricTagName
- type NestedPipeline
- type OIDCTrustPolicy
- type Organization
- type Permission
- type Pipeline
- func (p *Pipeline) BuildStateMachine() *statemachine.StateMachine
- func (p *Pipeline) CancelNode(nodePath string, force bool) ([]statemachine.NodeStatusChange, error)
- func (p *Pipeline) GetAction(path string) (*PipelineAction, bool)
- func (p *Pipeline) GetNestedPipeline(path string) (*NestedPipeline, bool)
- func (p *Pipeline) GetOrgName() string
- func (p *Pipeline) GetProjectName() string
- func (p *Pipeline) GetStage(path string) (*PipelineStage, bool)
- func (p *Pipeline) GetTask(path string) (*PipelineTask, bool)
- func (p *Pipeline) ResolveMetadata(key string) (string, error)
- func (p *Pipeline) SetNodeStatus(nodePath string, status statemachine.NodeStatus) ([]statemachine.NodeStatusChange, error)
- func (p *Pipeline) SetStatus(status statemachine.NodeStatus) ([]statemachine.NodeStatusChange, error)
- func (p *Pipeline) Validate() error
- type PipelineAction
- type PipelineActionOutput
- type PipelineAnnotation
- type PipelineApproval
- type PipelineApprovalStatus
- type PipelineApprovalType
- type PipelineStage
- type PipelineTask
- type PipelineTaskWhenCondition
- type PipelineTemplate
- type PipelineTemplateStatus
- type PipelineTimestamps
- type PipelineType
- type PipelineWhenCondition
- type Plugin
- type PluginPlatform
- type PluginVersion
- type PluginVersionDocCategory
- type PluginVersionDocFileMetadata
- type Project
- type ProjectVariable
- type ProjectVariableSet
- type Release
- type ReleaseLifecycle
- type ResourceLimit
- type ResourceMetadata
- type ResourceType
- type Role
- type SCIMToken
- type ScopeType
- type ServiceAccount
- type Team
- type TeamMember
- type Thread
- type ToDoItem
- type ToDoItemPipelineTaskApprovalPayload
- type ToDoItemTargetType
- type User
- type VCSProvider
- type VCSProviderAuthType
- type VCSProviderType
- type VariableCategory
Constants ¶
const ( // DefaultMaxJobDuration is the default max job duration DefaultMaxJobDuration = time.Hour * 12 // MaxAllowedJobDuration is the max allowed job duration MaxAllowedJobDuration = time.Hour * 24 )
const ( AddParticipantReleaseChangeType = "ADD_PARTICIPANT" RemoveParticipantReleaseChangeType = "REMOVE_PARTICIPANT" )
ReleaseChangeType constants
const AgentSessionHeartbeatInterval = time.Minute
AgentSessionHeartbeatInterval is the interval that agents should send heartbeats
const (
// MaxPluginVersionDocFiles is the maximum number of documentation files allowed for a plugin version.
MaxPluginVersionDocFiles = 100
)
const (
// PRNPrefix is the prefix for all PRNs.
PRNPrefix = "prn:"
)
const ProjectVariableEnvironmentScopeAll = "*"
ProjectVariableEnvironmentScopeAll is the environment scope for all environments
Variables ¶
var ( ViewOrganization = Permission{ResourceType: OrganizationResource, Action: ViewAction} ViewMembership = Permission{ResourceType: MembershipResource, Action: ViewAction} CreateMembership = Permission{ResourceType: MembershipResource, Action: CreateAction} UpdateMembership = Permission{ResourceType: MembershipResource, Action: UpdateAction} DeleteMembership = Permission{ResourceType: MembershipResource, Action: DeleteAction} ViewProject = Permission{ResourceType: ProjectResource, Action: ViewAction} CreateProject = Permission{ResourceType: ProjectResource, Action: CreateAction} UpdateProject = Permission{ResourceType: ProjectResource, Action: UpdateAction} DeleteProject = Permission{ResourceType: ProjectResource, Action: DeleteAction} ViewJob = Permission{ResourceType: JobResource, Action: ViewAction} ClaimJob = Permission{ResourceType: JobResource, Action: ClaimAction} UpdateJobState = Permission{ResourceType: JobResource, Action: UpdateAction} CreateTeam = Permission{ResourceType: TeamResource, Action: CreateAction} UpdateTeam = Permission{ResourceType: TeamResource, Action: UpdateAction} DeleteTeam = Permission{ResourceType: TeamResource, Action: DeleteAction} CreateUser = Permission{ResourceType: UserResource, Action: CreateAction} UpdateUser = Permission{ResourceType: UserResource, Action: UpdateAction} DeleteUser = Permission{ResourceType: UserResource, Action: DeleteAction} ViewPipelineTemplate = Permission{ResourceType: PipelineTemplateResource, Action: ViewAction} CreatePipelineTemplate = Permission{ResourceType: PipelineTemplateResource, Action: CreateAction} DeletePipelineTemplate = Permission{ResourceType: PipelineTemplateResource, Action: DeleteAction} ViewPipeline = Permission{ResourceType: PipelineResource, Action: ViewAction} ExecutePipeline = Permission{ResourceType: PipelineResource, Action: ExecuteAction} UpdatePipelineState = Permission{ResourceType: PipelineResource, Action: UpdateAction} // Special non-assignable permission. CancelPipeline = Permission{ResourceType: PipelineResource, Action: CancelAction} // Cancelling a pipeline also allows cancelling jobs. ViewAgent = Permission{ResourceType: AgentResource, Action: ViewAction} CreateAgent = Permission{ResourceType: AgentResource, Action: CreateAction} UpdateAgent = Permission{ResourceType: AgentResource, Action: UpdateAction} DeleteAgent = Permission{ResourceType: AgentResource, Action: DeleteAction} CreateAgentSession = Permission{ResourceType: AgentSessionResource, Action: CreateAction} UpdateAgentSession = Permission{ResourceType: AgentSessionResource, Action: UpdateAction} ViewEnvironment = Permission{ResourceType: EnvironmentResource, Action: ViewAction} CreateEnvironment = Permission{ResourceType: EnvironmentResource, Action: CreateAction} UpdateEnvironment = Permission{ResourceType: EnvironmentResource, Action: UpdateAction} DeleteEnvironment = Permission{ResourceType: EnvironmentResource, Action: DeleteAction} ViewServiceAccount = Permission{ResourceType: ServiceAccountResource, Action: ViewAction} CreateServiceAccount = Permission{ResourceType: ServiceAccountResource, Action: CreateAction} UpdateServiceAccount = Permission{ResourceType: ServiceAccountResource, Action: UpdateAction} DeleteServiceAccount = Permission{ResourceType: ServiceAccountResource, Action: DeleteAction} ViewApprovalRule = Permission{ResourceType: ApprovalRuleResource, Action: ViewAction} CreateApprovalRule = Permission{ResourceType: ApprovalRuleResource, Action: CreateAction} UpdateApprovalRule = Permission{ResourceType: ApprovalRuleResource, Action: UpdateAction} DeleteApprovalRule = Permission{ResourceType: ApprovalRuleResource, Action: DeleteAction} ViewLifecycleTemplate = Permission{ResourceType: LifecycleTemplateResource, Action: ViewAction} CreateLifecycleTemplate = Permission{ResourceType: LifecycleTemplateResource, Action: CreateAction} ViewReleaseLifecycle = Permission{ResourceType: ReleaseLifecycleResource, Action: ViewAction} CreateReleaseLifecycle = Permission{ResourceType: ReleaseLifecycleResource, Action: CreateAction} UpdateReleaseLifecycle = Permission{ResourceType: ReleaseLifecycleResource, Action: UpdateAction} DeleteReleaseLifecycle = Permission{ResourceType: ReleaseLifecycleResource, Action: DeleteAction} ViewRelease = Permission{ResourceType: ReleaseResource, Action: ViewAction} CreateRelease = Permission{ResourceType: ReleaseResource, Action: CreateAction} UpdateRelease = Permission{ResourceType: ReleaseResource, Action: UpdateAction} DeleteRelease = Permission{ResourceType: ReleaseResource, Action: DeleteAction} ViewVariable = Permission{ResourceType: VariableResource, Action: ViewAction} ViewPlugin = Permission{ResourceType: PluginResource, Action: ViewAction} CreatePlugin = Permission{ResourceType: PluginResource, Action: CreateAction} UpdatePlugin = Permission{ResourceType: PluginResource, Action: UpdateAction} DeletePlugin = Permission{ResourceType: PluginResource, Action: DeleteAction} ViewVCSProvider = Permission{ResourceType: VCSProviderResource, Action: ViewAction} CreateVCSProvider = Permission{ResourceType: VCSProviderResource, Action: CreateAction} UpdateVCSProvider = Permission{ResourceType: VCSProviderResource, Action: UpdateAction} DeleteVCSProvider = Permission{ResourceType: VCSProviderResource, Action: DeleteAction} ViewComment = Permission{ResourceType: CommentResource, Action: ViewAction} CreateComment = Permission{ResourceType: CommentResource, Action: CreateAction} ViewEnvironmentRule = Permission{ResourceType: EnvironmentRuleResource, Action: ViewAction} CreateEnvironmentRule = Permission{ResourceType: EnvironmentRuleResource, Action: CreateAction} UpdateEnvironmentRule = Permission{ResourceType: EnvironmentRuleResource, Action: UpdateAction} DeleteEnvironmentRule = Permission{ResourceType: EnvironmentRuleResource, Action: DeleteAction} )
All possible Permissions.
Functions ¶
func GetAssignablePermissions ¶
func GetAssignablePermissions() []string
GetAssignablePermissions returns a list of assignable permissions.
Types ¶
type Action ¶
type Action string
Action is an enum representing a CRUD action.
const ( ViewAction Action = "view" CreateAction Action = "create" UpdateAction Action = "update" DeleteAction Action = "delete" ExecuteAction Action = "execute" ClaimAction Action = "claim" CancelAction Action = "cancel" )
Action constants.
func (Action) HasViewerAccess ¶
HasViewerAccess returns true if Action is viewer access or greater.
type ActivityEvent ¶
type ActivityEvent struct { UserID *string ServiceAccountID *string OrganizationID *string ProjectID *string TargetID *string Payload []byte Action ActivityEventAction TargetType ActivityEventTargetType Metadata ResourceMetadata }
ActivityEvent represents an activity event.
func (*ActivityEvent) ResolveMetadata ¶
func (a *ActivityEvent) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
type ActivityEventAction ¶
type ActivityEventAction string
ActivityEventAction represents an action that can be performed on a resource.
const ( ActionCreate ActivityEventAction = "CREATE" ActionUpdate ActivityEventAction = "UPDATE" ActionDelete ActivityEventAction = "DELETE" ActionStart ActivityEventAction = "START" ActionRetry ActivityEventAction = "RETRY" ActionCreateMembership ActivityEventAction = "CREATE_MEMBERSHIP" ActionRemoveMembership ActivityEventAction = "REMOVE_MEMBERSHIP" ActionCancel ActivityEventAction = "CANCEL" )
ActivityEventAction constants.
type ActivityEventCreateMembershipPayload ¶
type ActivityEventCreateMembershipPayload struct { UserID *string `json:"userId"` ServiceAccountID *string `json:"serviceAccountId"` TeamID *string `json:"teamId"` Role string `json:"role"` }
ActivityEventCreateMembershipPayload represents the payload for a create membership activity event.
type ActivityEventDeleteResourcePayload ¶
type ActivityEventDeleteResourcePayload struct { Name *string `json:"name"` ID string `json:"id"` Type string `json:"type"` }
ActivityEventDeleteResourcePayload represents the payload for a delete resource activity event.
type ActivityEventRemoveMembershipPayload ¶
type ActivityEventRemoveMembershipPayload struct { UserID *string `json:"userId"` ServiceAccountID *string `json:"serviceAccountId"` TeamID *string `json:"teamId"` }
ActivityEventRemoveMembershipPayload represents the payload for a remove membership activity event.
type ActivityEventTargetType ¶
type ActivityEventTargetType string
ActivityEventTargetType represents a type of resource that can be acted upon.
const ( TargetRole ActivityEventTargetType = "ROLE" TargetOrganization ActivityEventTargetType = "ORGANIZATION" TargetProject ActivityEventTargetType = "PROJECT" TargetProjectVariableSet ActivityEventTargetType = "PROJECT_VARIABLE_SET" TargetGlobal ActivityEventTargetType = "GLOBAL" TargetMembership ActivityEventTargetType = "MEMBERSHIP" TargetAgent ActivityEventTargetType = "AGENT" TargetPipelineTemplate ActivityEventTargetType = "PIPELINE_TEMPLATE" TargetPipeline ActivityEventTargetType = "PIPELINE" TargetTeam ActivityEventTargetType = "TEAM" TargetEnvironment ActivityEventTargetType = "ENVIRONMENT" TargetServiceAccount ActivityEventTargetType = "SERVICE_ACCOUNT" TargetApprovalRule ActivityEventTargetType = "APPROVAL_RULE" TargetLifecycleTemplate ActivityEventTargetType = "LIFECYCLE_TEMPLATE" TargetReleaseLifecycle ActivityEventTargetType = "RELEASE_LIFECYCLE" TargetRelease ActivityEventTargetType = "RELEASE" TargetPlugin ActivityEventTargetType = "PLUGIN" TargetPluginVersion ActivityEventTargetType = "PLUGIN_VERSION" TargetComment ActivityEventTargetType = "COMMENT" TargetUser ActivityEventTargetType = "USER" TargetVCSProvider ActivityEventTargetType = "VCS_PROVIDER" TargetThread ActivityEventTargetType = "THREAD" TargetEnvironmentRule ActivityEventTargetType = "ENVIRONMENT_RULE" )
ActivityEventTargetType constants.
func (ActivityEventTargetType) String ¶
func (t ActivityEventTargetType) String() string
String returns the string representation of the activity event target type.
type ActivityEventUpdateMembershipPayload ¶
type ActivityEventUpdateMembershipPayload struct { PrevRole string `json:"prevRole"` NewRole string `json:"newRole"` }
ActivityEventUpdateMembershipPayload represents the payload for a update membership activity event.
type ActivityEventUpdateReleasePayload ¶
type ActivityEventUpdateReleasePayload struct { ID string `json:"id"` ChangeType string `json:"changeType"` Type string `json:"type"` }
ActivityEventUpdateReleasePayload represents the payload for a update release activity event.
type ActivityEventUpdateTeamPayload ¶
type ActivityEventUpdateTeamPayload struct { UserID string `json:"userId"` ChangeType string `json:"changeType"` Maintainer bool `json:"maintainer"` }
ActivityEventUpdateTeamPayload represents the payload for a update team activity event.
type Agent ¶
type Agent struct { OrganizationID *string Type AgentType Name string Description string CreatedBy string Metadata ResourceMetadata Tags []string Disabled bool RunUntaggedJobs bool }
Agent is responsible for claiming and executing jobs.
func (*Agent) GetOrgName ¶
GetOrgName returns the org name for the agent
func (*Agent) ResolveMetadata ¶
ResolveMetadata resolves the metadata fields for cursor-based pagination
type AgentSession ¶
type AgentSession struct { LastContactTimestamp time.Time AgentID string Metadata ResourceMetadata ErrorCount int Internal bool }
AgentSession represents a session for an agent
func (*AgentSession) Active ¶
func (a *AgentSession) Active() bool
Active returns true if the session has received a heartbeat within the last heartbeat interval
func (*AgentSession) ResolveMetadata ¶
func (a *AgentSession) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
type AgentType ¶
type AgentType string
AgentType constant
const ( OrganizationAgent AgentType = "ORGANIZATION" )
AgentType constants
type ApprovalRule ¶
type ApprovalRule struct { Scope ScopeType OrgID string // required (global scope not allowed) ProjectID *string // required if project scope; must be nil if org scope Name string Description string CreatedBy string Metadata ResourceMetadata TeamIDs []string UserIDs []string ServiceAccountIDs []string ApprovalsRequired int }
ApprovalRule represents a rule that can be used to control who can approve a task
func (*ApprovalRule) ResolveMetadata ¶
func (a *ApprovalRule) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*ApprovalRule) Validate ¶
func (a *ApprovalRule) Validate() error
Validate returns an error if the model is not valid
type BoundClaimsType ¶
type BoundClaimsType string
BoundClaimsType defines the type of comparison to be used for bound claims
const ( // BoundClaimsTypeString is used for exact string matching BoundClaimsTypeString BoundClaimsType = "STRING" // BoundClaimsTypeGlob is used for glob pattern matching (i.e. a wildcard character can be used within the claim value) BoundClaimsTypeGlob BoundClaimsType = "GLOB" )
type Comment ¶
type Comment struct { ThreadID string UserID *string ServiceAccountID *string Text string Metadata ResourceMetadata }
Comment represents a Phobos comment.
func (*Comment) ResolveMetadata ¶
ResolveMetadata resolves the metadata fields for cursor-based pagination
type DefaultRoleID ¶
type DefaultRoleID string
DefaultRoleID represents the static UUIDs for default Phobos roles.
const ( OwnerRoleID DefaultRoleID = "3e8eb414-4504-4dc5-ad81-2f0d20db6ee4" ReleaseManagerRoleID DefaultRoleID = "c78c6d31-465f-4d16-a365-51f10a4ca37d" DeveloperRoleID DefaultRoleID = "d50e782f-c82a-4e18-b68b-c7eb176f4e5e" ViewerRoleID DefaultRoleID = "2e240dba-ee81-4f0b-bd97-b8d8b15b9119" )
DefaultRoleID constants.
func (DefaultRoleID) Equals ¶
func (d DefaultRoleID) Equals(want string) bool
Equals returns true if the both IDs are the same.
func (DefaultRoleID) IsDefaultRole ¶
func (d DefaultRoleID) IsDefaultRole() bool
IsDefaultRole returns true if ID belongs to a default role.
func (DefaultRoleID) Permissions ¶
func (d DefaultRoleID) Permissions() ([]Permission, bool)
Permissions returns the Permission set for a default Phobos role.
func (DefaultRoleID) String ¶
func (d DefaultRoleID) String() string
String returns the ID as a string.
type Environment ¶
type Environment struct { ProjectID string Name string Description string CreatedBy string Metadata ResourceMetadata }
Environment is responsible for claiming and executing jobs.
func (*Environment) ResolveMetadata ¶
func (e *Environment) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*Environment) Validate ¶
func (e *Environment) Validate() error
Validate returns an error if the model is not valid
type EnvironmentRule ¶
type EnvironmentRule struct { Metadata ResourceMetadata CreatedBy string Scope ScopeType OrgID string // required ProjectID *string // required if project scope; must be nil if org scope EnvironmentName string TeamIDs []string UserIDs []string ServiceAccountIDs []string RoleIDs []string }
EnvironmentRule represents a rule that can be used to control who can approve a task
func (*EnvironmentRule) ResolveMetadata ¶
func (e *EnvironmentRule) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*EnvironmentRule) Validate ¶
func (e *EnvironmentRule) Validate() error
Validate returns an error if the model is not valid
type Job ¶
type Job struct { Timestamps JobTimestamps Data interface{} AgentType *string ForceCanceledBy *string AgentID *string Image *string // Custom image to use for the job CancelRequestedTimestamp *time.Time AgentName *string Type JobType ProjectID string Metadata ResourceMetadata Tags []string MaxJobDuration int32 ForceCanceled bool // contains filtered or unexported fields }
Job represents a unit of work that is completed as part of a pipeline or lifecycle
func (*Job) ForceCancel ¶
ForceCancel forcefully cancels the job
func (*Job) GetForceCancelAvailableAt ¶
GetForceCancelAvailableAt returns the time when this job can be forcefully canceled
func (*Job) GetOrgName ¶
GetOrgName returns the org name for the job
func (*Job) GracefullyCancel ¶
GracefullyCancel gracefully cancels the job
func (*Job) ResolveMetadata ¶
ResolveMetadata resolves the metadata fields for cursor-based pagination
type JobStatus ¶
type JobStatus string
JobStatus type
const ( JobQueued JobStatus = "queued" JobPending JobStatus = "pending" JobRunning JobStatus = "running" JobFailed JobStatus = "failed" JobSucceeded JobStatus = "succeeded" JobCanceled JobStatus = "canceled" JobCanceling JobStatus = "canceling" )
Job Status Constants
func (JobStatus) IsFinishedStatus ¶
IsFinishedStatus returns true if the job is finished (failed, succeeded, or canceled)
type JobTaskData ¶
JobTaskData is the data for a job of type task
type JobTimestamps ¶
type JobTimestamps struct { QueuedTimestamp *time.Time PendingTimestamp *time.Time RunningTimestamp *time.Time FinishedTimestamp *time.Time }
JobTimestamps includes the timestamp for each job state change
type JobType ¶
type JobType string
JobType indicates the type of job
const (
JobTaskType JobType = "task"
)
Job Types Constants
type LifecycleTemplate ¶
type LifecycleTemplate struct { CreatedBy string Scope ScopeType OrganizationID string // required (global scope not allowed) ProjectID *string // required if project scope; must be nil if org scope Status LifecycleTemplateStatus Metadata ResourceMetadata }
LifecycleTemplate represents a Phobos lifecycle template.
func (*LifecycleTemplate) ResolveMetadata ¶
func (o *LifecycleTemplate) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
type LifecycleTemplateStatus ¶
type LifecycleTemplateStatus string
LifecycleTemplateStatus represents the status of a Phobos lifecycle template.
const ( LifecycleTemplatePending LifecycleTemplateStatus = "PENDING" LifecycleTemplateUploaded LifecycleTemplateStatus = "UPLOADED" )
LifecycleTemplateStatus values.
type LogStream ¶
type LogStream struct { JobID *string AgentSessionID *string Metadata ResourceMetadata Size int Completed bool }
LogStream represents a stream of logs
type Membership ¶
type Membership struct { UserID *string TeamID *string ServiceAccountID *string ProjectID *string OrganizationID *string RoleID string Scope ScopeType Metadata ResourceMetadata }
Membership represents an association between a member and an organization or project.
func (*Membership) ResolveMetadata ¶
func (m *Membership) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
type Metric ¶
type Metric struct { Tags map[MetricTagName]string PipelineID *string ReleaseID *string ProjectID *string OrganizationID *string EnvironmentName *string Name MetricName Metadata ResourceMetadata Value float64 }
Metric represents a resource metric.
type MetricName ¶
type MetricName string
MetricName represents the type of the metric.
const ( // MetricPipelineCompleted is the number of completed pipelines MetricPipelineCompleted MetricName = "PIPELINE_COMPLETED" // MetricPipelineDuration is the time it takes for a pipeline to complete MetricPipelineDuration MetricName = "PIPELINE_DURATION" // MetricDeploymentRecoveryTime is the time it takes for a deployment to recover after it has failed MetricDeploymentRecoveryTime MetricName = "DEPLOYMENT_RECOVERY_TIME" // MetricDeploymentUpdated is the number of updates to a deployment MetricDeploymentUpdated MetricName = "DEPLOYMENT_UPDATED" // MetricPipelineLeadTime is the time from when a pipeline is created to when it is completed MetricPipelineLeadTime MetricName = "PIPELINE_LEAD_TIME" // MetricApprovalRequestWaitTime is the time it takes for an approval request to be approved MetricApprovalRequestWaitTime MetricName = "APPROVAL_REQUEST_WAIT_TIME" // MetricApprovalRequestCreated is the number of created approval requests MetricApprovalRequestCreated MetricName = "APPROVAL_REQUEST_CREATED" // MetricApprovalRequestCompleted is the number of completed approval requests MetricApprovalRequestCompleted MetricName = "APPROVAL_REQUEST_COMPLETED" )
MetricName constants.
type MetricTagName ¶
type MetricTagName string
MetricTagName represents the supported metric tag names
const ( // MetricTagNamePipelineType is the type of the pipeline MetricTagNamePipelineType MetricTagName = "PIPELINE_TYPE" // MetricTagNamePipelineStatus is the status of the pipeline MetricTagNamePipelineStatus MetricTagName = "PIPELINE_STATUS" // MetricTagNameApprovalTargetType is the type of the approval MetricTagNameApprovalTargetType MetricTagName = "APPROVAL_TARGET_TYPE" // MetricTagNameReleaseLifecycle is the name of the release lifecycle MetricTagNameReleaseLifecycle MetricTagName = "RELEASE_LIFECYCLE" )
type NestedPipeline ¶
type NestedPipeline struct { EnvironmentName *string ScheduledStartTime *time.Time OnError statemachine.OnErrorStrategy LatestPipelineID string Name string Path string Status statemachine.NodeStatus ApprovalStatus PipelineApprovalStatus Dependencies []string Errors []string }
NestedPipeline represents a nested pipeline
type OIDCTrustPolicy ¶
type OIDCTrustPolicy struct { BoundClaimsType BoundClaimsType BoundClaims map[string]string Issuer string }
OIDCTrustPolicy defined the IDP that can be used for logging into the service account
type Organization ¶
type Organization struct { Name string Description string CreatedBy string Metadata ResourceMetadata }
Organization represents a Phobos organization which users can belong to
func (*Organization) ResolveMetadata ¶
func (o *Organization) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*Organization) Validate ¶
func (o *Organization) Validate() error
Validate returns an error if the model is not valid
type Permission ¶
type Permission struct { ResourceType ResourceType `json:"resourceType"` Action Action `json:"action"` }
Permission represents a level of access a subject has to a Phobos resource.
func ParsePermissions ¶
func ParsePermissions(perms []string) ([]Permission, error)
ParsePermissions parses and normalizes a slice of permission strings and extracts a Permission that adheres to the format resource_type:action.
func (*Permission) GTE ¶
func (p *Permission) GTE(want *Permission) bool
GTE returns true if permission available is >= wanted permission.
func (*Permission) IsAssignable ¶
func (p *Permission) IsAssignable() bool
IsAssignable returns true if permission is assignable to a role.
func (*Permission) String ¶
func (p *Permission) String() string
String returns the Permission as <resource_type:action> string.
type Pipeline ¶
type Pipeline struct { ReleaseID *string ParentPipelineID *string ParentPipelineNodePath *string EnvironmentName *string CreatedBy string ProjectID string PipelineTemplateID string ApprovalStatus PipelineApprovalStatus When PipelineWhenCondition Type PipelineType Status statemachine.NodeStatus Timestamps PipelineTimestamps Metadata ResourceMetadata Stages []*PipelineStage Annotations []*PipelineAnnotation ApprovalRuleIDs []string Superseded bool }
Pipeline represents a Phobos pipeline.
func (*Pipeline) BuildStateMachine ¶
func (p *Pipeline) BuildStateMachine() *statemachine.StateMachine
BuildStateMachine builds a state machine based on the current state of the pipeline graph
func (*Pipeline) CancelNode ¶
func (p *Pipeline) CancelNode(nodePath string, force bool) ([]statemachine.NodeStatusChange, error)
CancelNode cancels the pipeline node
func (*Pipeline) GetAction ¶
func (p *Pipeline) GetAction(path string) (*PipelineAction, bool)
GetAction returns a pipeline action by its path
func (*Pipeline) GetNestedPipeline ¶
func (p *Pipeline) GetNestedPipeline(path string) (*NestedPipeline, bool)
GetNestedPipeline returns a nested pipeline by its path
func (*Pipeline) GetOrgName ¶
GetOrgName returns the org name for the pipeline
func (*Pipeline) GetProjectName ¶
GetProjectName returns the project name for the pipeline
func (*Pipeline) GetStage ¶
func (p *Pipeline) GetStage(path string) (*PipelineStage, bool)
GetStage returns a pipeline stage by its path
func (*Pipeline) GetTask ¶
func (p *Pipeline) GetTask(path string) (*PipelineTask, bool)
GetTask returns a pipeline task by its path
func (*Pipeline) ResolveMetadata ¶
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*Pipeline) SetNodeStatus ¶
func (p *Pipeline) SetNodeStatus(nodePath string, status statemachine.NodeStatus) ([]statemachine.NodeStatusChange, error)
SetNodeStatus sets the status of a node in the pipeline
func (*Pipeline) SetStatus ¶
func (p *Pipeline) SetStatus(status statemachine.NodeStatus) ([]statemachine.NodeStatusChange, error)
SetStatus sets the status of the pipeline
type PipelineAction ¶
type PipelineAction struct { Name string PluginName string ActionName string Status statemachine.NodeStatus Path string }
PipelineAction defines an action that will be executed using a provider plugin
type PipelineActionOutput ¶
type PipelineActionOutput struct { Name string PipelineID string ActionPath string Metadata ResourceMetadata Value []byte Type []byte }
PipelineActionOutput defines an output for a pipeline action
type PipelineAnnotation ¶
PipelineAnnotation represents an annotation for a pipeline
type PipelineApproval ¶
type PipelineApproval struct { UserID *string ServiceAccountID *string TaskPath *string PipelineID string Type PipelineApprovalType Metadata ResourceMetadata ApprovalRuleIDs []string }
PipelineApproval defines an approval for a pipeline or task.
func (*PipelineApproval) ResolveMetadata ¶
func (p *PipelineApproval) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
type PipelineApprovalStatus ¶
type PipelineApprovalStatus string
PipelineApprovalStatus represents the approval status of a pipeline node.
const ( ApprovalNotRequired PipelineApprovalStatus = "NOT_REQUIRED" ApprovalPending PipelineApprovalStatus = "PENDING" ApprovalApproved PipelineApprovalStatus = "APPROVED" )
ApprovalStatus enums.
type PipelineApprovalType ¶
type PipelineApprovalType string
PipelineApprovalType represents the pipeline node type the approval is for.
const ( ApprovalTypeTask PipelineApprovalType = "TASK" ApprovalTypePipeline PipelineApprovalType = "PIPELINE" // nested or non-nested )
ApprovalType enums.
type PipelineStage ¶
type PipelineStage struct { NestedPipelines []*NestedPipeline Path string Name string Status statemachine.NodeStatus Tasks []*PipelineTask }
PipelineStage represents a stage within a pipeline
type PipelineTask ¶
type PipelineTask struct { // interval between retries when this is a repeated task Interval *time.Duration // LastAttemptFinishedAt is the time the last attempt finished LastAttemptFinishedAt *time.Time // scheduled start time for the task (optional), this field can only // be set when the task is manual ScheduledStartTime *time.Time // status of the task Status statemachine.NodeStatus // approval status of the task ApprovalStatus PipelineApprovalStatus // when condition specifies when the task should be executed When PipelineTaskWhenCondition // on error specifies the behavior of the pipeline node when a task encounters an error OnError statemachine.OnErrorStrategy // latest job associated with this task LatestJobID *string // path is the path of the task within the pipeline Path string // name of the task Name string // image is the custom image to use for the task Image *string // actions are the actions that will be executed by the task Actions []*PipelineAction // list of tags to restrict which agents can run jobs for this task AgentTags []string // Dependencies are tasks needed by this task (within the same stage) Dependencies []string // optional approval rule IDs ApprovalRuleIDs []string // any errors that have occurred during initialization. Errors []string // max attempts specifies how many times a task will be retried automatically MaxAttempts int // AttemptCount is the number of times the task has been attempted AttemptCount int // indicates if the task has a success condition HasSuccessCondition bool }
PipelineTask is a task within a pipeline
func (*PipelineTask) IsRetryable ¶ added in v0.2.0
func (p *PipelineTask) IsRetryable() bool
IsRetryable returns true if the task can be retried
type PipelineTaskWhenCondition ¶
type PipelineTaskWhenCondition string
PipelineTaskWhenCondition defines the possible conditions for a task to be executed
const ( AutoPipelineTask PipelineTaskWhenCondition = "auto" ManualPipelineTask PipelineTaskWhenCondition = "manual" )
PipelineTaskWhenCondition Constants
type PipelineTemplate ¶
type PipelineTemplate struct { CreatedBy string ProjectID string Status PipelineTemplateStatus Name *string SemanticVersion *string Metadata ResourceMetadata Versioned bool Latest bool }
PipelineTemplate represents a Phobos pipeline template.
func (*PipelineTemplate) ResolveMetadata ¶
func (o *PipelineTemplate) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*PipelineTemplate) Validate ¶
func (o *PipelineTemplate) Validate() error
Validate validates the pipeline template.
type PipelineTemplateStatus ¶
type PipelineTemplateStatus string
PipelineTemplateStatus represents the status of a Phobos pipeline template.
const ( PipelineTemplatePending PipelineTemplateStatus = "pending" PipelineTemplateUploaded PipelineTemplateStatus = "uploaded" )
PipelineTemplateStatus values.
type PipelineTimestamps ¶
PipelineTimestamps includes the timestamp for each pipeline
type PipelineType ¶
type PipelineType string
PipelineType represents the type of a pipeline
const ( // RunbookPipelineType is a pipeline that is executed on demand and is not associated with an environment RunbookPipelineType PipelineType = "RUNBOOK" // ReleaseLifecyclePipelineType is a pipeline that is executed as part of a release lifecycle ReleaseLifecyclePipelineType PipelineType = "RELEASE_LIFECYCLE" // NestedPipelineType is a pipeline that is executed as a nested pipeline NestedPipelineType PipelineType = "NESTED" // DeploymentPipelineType is a pipeline that is executed as part of a deployment DeploymentPipelineType PipelineType = "DEPLOYMENT" )
PipelineType constants
type PipelineWhenCondition ¶
type PipelineWhenCondition string
PipelineWhenCondition defines the possible conditions for a pipeline to be executed
const ( AutoPipeline PipelineWhenCondition = "auto" ManualPipeline PipelineWhenCondition = "manual" )
PipelineWhenCondition Constants
type Plugin ¶
type Plugin struct { CreatedBy string Name string OrganizationID string RepositoryURL string Metadata ResourceMetadata Private bool }
Plugin represents a Phobos plugin often used to interface with external services or extend Phobos functionality.
func (*Plugin) ResolveMetadata ¶
ResolveMetadata resolves the metadata fields for cursor-based pagination
type PluginPlatform ¶
type PluginPlatform struct { PluginVersionID string OperatingSystem string Architecture string SHASum string Filename string CreatedBy string Metadata ResourceMetadata BinaryUploaded bool }
PluginPlatform represents a support platform for a plugin.
func (*PluginPlatform) ResolveMetadata ¶
func (p *PluginPlatform) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
type PluginVersion ¶
type PluginVersion struct { DocFiles map[string]*PluginVersionDocFileMetadata CreatedBy string PluginID string SemanticVersion string Metadata ResourceMetadata Protocols []string SHASumsUploaded bool ReadmeUploaded bool SchemaUploaded bool Latest bool }
PluginVersion represents a version of a Phobos plugin.
func (*PluginVersion) ResolveMetadata ¶
func (p *PluginVersion) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*PluginVersion) Validate ¶
func (p *PluginVersion) Validate() error
Validate checks if the plugin version is valid.
type PluginVersionDocCategory ¶
type PluginVersionDocCategory string
PluginVersionDocCategory represents the category of a plugin version documentation file.
const ( PluginVersionDocCategoryOverview PluginVersionDocCategory = "OVERVIEW" PluginVersionDocCategoryAction PluginVersionDocCategory = "ACTION" PluginVersionDocCategoryGuide PluginVersionDocCategory = "GUIDE" )
PluginVersionDocCategory constants
type PluginVersionDocFileMetadata ¶
type PluginVersionDocFileMetadata struct { Title string `json:"title"` Category PluginVersionDocCategory `json:"category"` Subcategory string `json:"subcategory"` Name string `json:"name"` FilePath string `json:"file_path"` }
PluginVersionDocFileMetadata represents the metadata of a plugin version documentation file.
func (*PluginVersionDocFileMetadata) Validate ¶
func (p *PluginVersionDocFileMetadata) Validate() error
Validate validates the plugin version documentation file metadata.
type Project ¶
type Project struct { Name string Description string CreatedBy string OrgID string Metadata ResourceMetadata }
Project represents a Phobos project.
func (*Project) GetOrgName ¶
GetOrgName returns the org name for the project
func (*Project) ResolveMetadata ¶
ResolveMetadata resolves the metadata fields for cursor-based pagination
type ProjectVariable ¶
type ProjectVariable struct { Key string Value string EnvironmentScope string PipelineType PipelineType CreatedBy string ProjectID string Metadata ResourceMetadata }
ProjectVariable represents a Phobos project variable
func (*ProjectVariable) FQN ¶
func (pv *ProjectVariable) FQN() string
FQN returns a fully qualified name for the project variable
func (*ProjectVariable) ResolveMetadata ¶
func (pv *ProjectVariable) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*ProjectVariable) Validate ¶
func (pv *ProjectVariable) Validate() error
Validate returns an error if the model is not valid
type ProjectVariableSet ¶
type ProjectVariableSet struct { ProjectID string Revision string Latest bool Metadata ResourceMetadata }
ProjectVariableSet represents a Phobos project variable set
func (*ProjectVariableSet) ResolveMetadata ¶
func (pvs *ProjectVariableSet) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
type Release ¶
type Release struct { DueDate *time.Time SemanticVersion string ProjectID string CreatedBy string LifecyclePRN string Metadata ResourceMetadata UserParticipantIDs []string TeamParticipantIDs []string PreRelease bool Latest bool }
Release is composed of a set of assets, a snapshot of the automation used to deploy the assets, and the state of the automation
func (*Release) ResolveMetadata ¶
ResolveMetadata resolves the metadata fields for cursor-based pagination
type ReleaseLifecycle ¶
type ReleaseLifecycle struct { Scope ScopeType OrganizationID string // required (global scope not allowed) ProjectID *string // required if project scope; must be nil if org scope Name string CreatedBy string LifecycleTemplateID string EnvironmentNames []string Metadata ResourceMetadata }
ReleaseLifecycle represents a Phobos release lifecycle.
func (*ReleaseLifecycle) GetOrgName ¶
func (r *ReleaseLifecycle) GetOrgName() string
GetOrgName returns the org name
func (*ReleaseLifecycle) ResolveMetadata ¶
func (r *ReleaseLifecycle) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*ReleaseLifecycle) Validate ¶
func (r *ReleaseLifecycle) Validate() error
Validate validates the ReleaseLifecycle model
type ResourceLimit ¶
type ResourceLimit struct { Name string Metadata ResourceMetadata Value int }
ResourceLimit represents a resource limit
type ResourceMetadata ¶
type ResourceMetadata struct { CreationTimestamp *time.Time `json:"createdAt"` LastUpdatedTimestamp *time.Time `json:"updatedAt,omitempty" ` ID string `json:"id"` PRN string `json:"prn"` Version int `json:"version"` }
ResourceMetadata contains metadata for a particular resource
type ResourceType ¶
type ResourceType string
ResourceType is an enum representing a Phobos resource type.
const ( OrganizationResource ResourceType = "organization" MembershipResource ResourceType = "membership" ProjectResource ResourceType = "project" ProjectVariableSetResource ResourceType = "project_variable_set" ProjectVariableResource ResourceType = "project_variable" JobResource ResourceType = "job" TeamResource ResourceType = "team" UserResource ResourceType = "user" PipelineTemplateResource ResourceType = "pipeline_template" PipelineResource ResourceType = "pipeline" AgentResource ResourceType = "agent" AgentSessionResource ResourceType = "agent_session" EnvironmentResource ResourceType = "environment" ServiceAccountResource ResourceType = "service_account" RoleResource ResourceType = "role" TeamMemberResource ResourceType = "team_member" ResourceLimitResource ResourceType = "resource_limit" SCIMTokenResource ResourceType = "scim_token" LogStreamResource ResourceType = "log_stream" PipelineActionOutputResource ResourceType = "pipeline_action_output" PipelineApprovalResource ResourceType = "pipeline_approval" ApprovalRuleResource ResourceType = "approval_rule" LifecycleTemplateResource ResourceType = "lifecycle_template" ReleaseLifecycleResource ResourceType = "release_lifecycle" ReleaseResource ResourceType = "release" VariableResource ResourceType = "variable" ActivityEventResource ResourceType = "activity_event" DeploymentResource ResourceType = "deployment" CommentResource ResourceType = "comment" PluginResource ResourceType = "plugin" PluginVersionResource ResourceType = "plugin_version" PluginPlatformResource ResourceType = "plugin_platform" ToDoItemResource ResourceType = "todo_item" VCSProviderResource ResourceType = "vcs_provider" ThreadResource ResourceType = "thread" EnvironmentRuleResource ResourceType = "environment_rule" MetricResource ResourceType = "metric" )
ResourceType constants.
func (ResourceType) BuildPRN ¶
func (r ResourceType) BuildPRN(a ...string) string
BuildPRN builds a PRN from a resource type and a list of path parts.
func (ResourceType) ResourcePathFromPRN ¶
func (r ResourceType) ResourcePathFromPRN(v string) (string, error)
ResourcePathFromPRN returns the resource path from a PRN.
type Role ¶
type Role struct { Name string Description string CreatedBy string Metadata ResourceMetadata // contains filtered or unexported fields }
Role defines a subject's ability to access or modify resources within Phobos. It provides a set of permissions that dictate which resources can be viewed or modified.
func (*Role) GetPermissions ¶
func (r *Role) GetPermissions() []Permission
GetPermissions returns permissions for a role.
func (*Role) ResolveMetadata ¶
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*Role) SetPermissions ¶
func (r *Role) SetPermissions(perms []Permission)
SetPermissions sets permissions for a role.
type SCIMToken ¶
type SCIMToken struct { Nonce string CreatedBy string Metadata ResourceMetadata }
SCIMToken represents a SCIM token.
type ScopeType ¶
type ScopeType string
ScopeType defines an enum representing the level at which a resource is available.
type ServiceAccount ¶
type ServiceAccount struct { Metadata ResourceMetadata Scope ScopeType OrganizationID *string // required if org or project scope ProjectID *string // required if project scope; must be nil if org scope Name string Description string CreatedBy string OIDCTrustPolicies []OIDCTrustPolicy }
ServiceAccount provides M2M authentication
func (*ServiceAccount) ResolveMetadata ¶
func (s *ServiceAccount) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*ServiceAccount) Validate ¶
func (s *ServiceAccount) Validate() error
Validate returns an error if the model is not valid
type Team ¶
type Team struct { SCIMExternalID *string Name string Description string Metadata ResourceMetadata }
Team represents a team of (human) users
func (*Team) ResolveMetadata ¶
ResolveMetadata resolves the metadata fields for cursor-based pagination
type TeamMember ¶
type TeamMember struct { UserID string TeamID string Metadata ResourceMetadata IsMaintainer bool }
TeamMember represents an association between a (human) user and a Team
func (*TeamMember) ResolveMetadata ¶
func (t *TeamMember) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
type Thread ¶
type Thread struct { PipelineID *string ReleaseID *string Metadata ResourceMetadata }
Thread represents a collection of comments.
type ToDoItem ¶
type ToDoItem struct { Payload []byte UserIDs []string TeamIDs []string ResolvedByUsers []string ProjectID *string OrganizationID string TargetID string TargetType ToDoItemTargetType Metadata ResourceMetadata AutoResolved bool Resolvable bool }
ToDoItem represents a TODO item resource.
func (*ToDoItem) IsResolved ¶
IsResolved returns true if the item was resolved.
type ToDoItemPipelineTaskApprovalPayload ¶
type ToDoItemPipelineTaskApprovalPayload struct {
TaskPath string `json:"taskPath"`
}
ToDoItemPipelineTaskApprovalPayload represents the payload of a pipeline task approval item.
type ToDoItemTargetType ¶
type ToDoItemTargetType string
ToDoItemTargetType represents the target type of a TODO item.
const ( PipelineApprovalTarget ToDoItemTargetType = "PIPELINE_APPROVAL" TaskApprovalTarget ToDoItemTargetType = "TASK_APPROVAL" )
ToDoItemTargetType constants.
type User ¶
type User struct { SCIMExternalID *string Username string Email string Metadata ResourceMetadata Admin bool Active bool }
User represents a human user account
type VCSProvider ¶
type VCSProvider struct { OAuthAccessTokenExpiresAt *time.Time URL url.URL CreatedBy string Name string Description string OrganizationID string Type VCSProviderType Scope ScopeType AuthType VCSProviderAuthType OAuthClientSecret *string OAuthClientID *string OAuthState *string OAuthAccessToken *string OAuthRefreshToken *string PersonalAccessToken *string ProjectID *string ExtraOAuthScopes []string Metadata ResourceMetadata }
VCSProvider represents a Version Control System provider.
func (*VCSProvider) GetOrgName ¶
func (v *VCSProvider) GetOrgName() string
GetOrgName returns the org name
func (*VCSProvider) ResolveMetadata ¶
func (v *VCSProvider) ResolveMetadata(key string) (string, error)
ResolveMetadata resolves the metadata fields for cursor-based pagination
func (*VCSProvider) Validate ¶
func (v *VCSProvider) Validate() error
Validate returns an error if the model is not valid
type VCSProviderAuthType ¶
type VCSProviderAuthType string
VCSProviderAuthType represents the auth type a VCS provider uses.
const ( AccessTokenType VCSProviderAuthType = "ACCESS_TOKEN" OAuthType VCSProviderAuthType = "OAUTH" )
VCSProviderAuthType enums.
type VCSProviderType ¶
type VCSProviderType string
VCSProviderType represents the vcs provider type.
const ( GitHubType VCSProviderType = "GITHUB" GitLabType VCSProviderType = "GITLAB" )
VCSProviderType enums.
type VariableCategory ¶
type VariableCategory string
VariableCategory is the type of variable category
const ( HCLVariable VariableCategory = "HCL" EnvironmentVariable VariableCategory = "ENVIRONMENT" )
VariableCategory constants
Source Files ¶
- activity_event.go
- agent.go
- agent_session.go
- approval_rule.go
- comment.go
- environment.go
- environment_rule.go
- job.go
- lifecycle_template.go
- logstream.go
- membership.go
- metric.go
- models.go
- organization.go
- permission.go
- pipeline.go
- pipeline_action_output.go
- pipeline_approval.go
- pipeline_template.go
- plugin.go
- plugin_platform.go
- plugin_version.go
- project.go
- release.go
- release_lifecycle.go
- resource.go
- resourcelimit.go
- role.go
- scim.go
- serviceaccount.go
- team.go
- teammember.go
- todo_item.go
- user.go
- variable.go
- vcs_provider.go