Documentation ¶
Overview ¶
Package configversion handles terraform configurations.
Index ¶
- Constants
- type Client
- type ConfigUploader
- type ConfigurationStatus
- type ConfigurationVersion
- func (cv *ConfigurationVersion) AddStatusTimestamp(status ConfigurationStatus, timestamp time.Time)
- func (cv *ConfigurationVersion) StatusTimestamp(status ConfigurationStatus) (time.Time, error)
- func (cv *ConfigurationVersion) Upload(ctx context.Context, config []byte, uploader ConfigUploader) error
- type ConfigurationVersionGetOptions
- type ConfigurationVersionStatusTimestamp
- type CreateOptions
- type FakeService
- func (f *FakeService) Create(context.Context, resource.ID, CreateOptions) (*ConfigurationVersion, error)
- func (f *FakeService) Get(context.Context, resource.ID) (*ConfigurationVersion, error)
- func (f *FakeService) GetLatest(context.Context, resource.ID) (*ConfigurationVersion, error)
- func (f *FakeService) UploadConfig(context.Context, resource.ID, []byte) error
- type IngressAttributes
- type ListOptions
- type Options
- type Service
- func (s *Service) AddHandlers(r *mux.Router)
- func (s *Service) Create(ctx context.Context, workspaceID resource.ID, opts CreateOptions) (*ConfigurationVersion, error)
- func (s *Service) Delete(ctx context.Context, cvID resource.ID) error
- func (s *Service) DownloadConfig(ctx context.Context, cvID resource.ID) ([]byte, error)
- func (s *Service) Get(ctx context.Context, cvID resource.ID) (*ConfigurationVersion, error)
- func (s *Service) GetLatest(ctx context.Context, workspaceID resource.ID) (*ConfigurationVersion, error)
- func (s *Service) List(ctx context.Context, workspaceID resource.ID, opts ListOptions) (*resource.Page[*ConfigurationVersion], error)
- func (s *Service) UploadConfig(ctx context.Context, cvID resource.ID, config []byte) error
- type Source
Constants ¶
const ( DefaultAutoQueueRuns = true // List all available configuration version statuses. ConfigurationErrored ConfigurationStatus = "errored" ConfigurationPending ConfigurationStatus = "pending" ConfigurationUploaded ConfigurationStatus = "uploaded" // Default maximum config size is 10mb. DefaultConfigMaxSize int64 = 1024 * 1024 * 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigUploader ¶
type ConfigUploader interface { // Upload uploads the config tarball and returns a status indicating success // or failure. Upload(ctx context.Context, config []byte) (ConfigurationStatus, error) // SetErrored sets the config version status to 'errored' in the store. SetErrored(ctx context.Context) error }
ConfigUploader uploads a config
type ConfigurationStatus ¶
type ConfigurationStatus string
ConfigurationStatus represents a configuration version status.
type ConfigurationVersion ¶
type ConfigurationVersion struct { ID resource.ID CreatedAt time.Time AutoQueueRuns bool Source Source Speculative bool Status ConfigurationStatus StatusTimestamps []ConfigurationVersionStatusTimestamp WorkspaceID resource.ID IngressAttributes *IngressAttributes }
ConfigurationVersion is a representation of an uploaded or ingressed Terraform configuration.
func NewConfigurationVersion ¶
func NewConfigurationVersion(workspaceID resource.ID, opts CreateOptions) (*ConfigurationVersion, error)
NewConfigurationVersion creates a ConfigurationVersion object from scratch
func (*ConfigurationVersion) AddStatusTimestamp ¶
func (cv *ConfigurationVersion) AddStatusTimestamp(status ConfigurationStatus, timestamp time.Time)
func (*ConfigurationVersion) StatusTimestamp ¶
func (cv *ConfigurationVersion) StatusTimestamp(status ConfigurationStatus) (time.Time, error)
func (*ConfigurationVersion) Upload ¶
func (cv *ConfigurationVersion) Upload(ctx context.Context, config []byte, uploader ConfigUploader) error
Upload saves the config to the db and updates status accordingly.
type ConfigurationVersionGetOptions ¶
type ConfigurationVersionGetOptions struct { // ID of config version to retrieve ID *resource.ID // Get latest config version for this workspace ID WorkspaceID *resource.ID // A list of relations to include Include *string `schema:"include"` }
ConfigurationVersionGetOptions are options for retrieving a single config version. Either ID *or* WorkspaceID must be specfiied.
type ConfigurationVersionStatusTimestamp ¶
type ConfigurationVersionStatusTimestamp struct { Status ConfigurationStatus Timestamp time.Time }
type CreateOptions ¶ added in v0.2.2
type CreateOptions struct { AutoQueueRuns *bool Speculative *bool Source Source *IngressAttributes }
CreateOptions represents the options for creating a configuration version. See jsonapi.CreateOptions for more details.
type FakeService ¶ added in v0.2.2
type FakeService struct {
// contains filtered or unexported fields
}
func (*FakeService) Create ¶ added in v0.2.2
func (f *FakeService) Create(context.Context, resource.ID, CreateOptions) (*ConfigurationVersion, error)
func (*FakeService) Get ¶ added in v0.2.2
func (f *FakeService) Get(context.Context, resource.ID) (*ConfigurationVersion, error)
func (*FakeService) GetLatest ¶ added in v0.2.2
func (f *FakeService) GetLatest(context.Context, resource.ID) (*ConfigurationVersion, error)
func (*FakeService) UploadConfig ¶ added in v0.2.2
type IngressAttributes ¶
type IngressAttributes struct { // ID resource.ID Branch string // CloneURL string // CommitMessage string CommitSHA string CommitURL string // CompareURL string Repo string IsPullRequest bool OnDefaultBranch bool PullRequestNumber int PullRequestURL string PullRequestTitle string // PullRequestBody string Tag string SenderUsername string SenderAvatarURL string SenderHTMLURL string }
func NewIngressFromRow ¶ added in v0.1.6
func NewIngressFromRow(row *sqlc.IngressAttribute) *IngressAttributes
type ListOptions ¶ added in v0.2.2
type ListOptions struct { // A list of relations to include Include *string `schema:"include"` resource.PageOptions }
ListOptions are options for paginating and filtering a list of configuration versions
type Service ¶
type Service struct { logr.Logger *authz.Authorizer // contains filtered or unexported fields }
func NewService ¶
func (*Service) AddHandlers ¶ added in v0.2.2
func (*Service) Create ¶ added in v0.2.2
func (s *Service) Create(ctx context.Context, workspaceID resource.ID, opts CreateOptions) (*ConfigurationVersion, error)
func (*Service) DownloadConfig ¶
DownloadConfig retrieves a tarball from the db