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) String() string
- 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, string, CreateOptions) (*ConfigurationVersion, error)
- func (f *FakeService) Get(context.Context, string) (*ConfigurationVersion, error)
- func (f *FakeService) GetLatest(context.Context, string) (*ConfigurationVersion, error)
- func (f *FakeService) UploadConfig(context.Context, string, []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 string, opts CreateOptions) (*ConfigurationVersion, error)
- func (s *Service) Delete(ctx context.Context, cvID string) error
- func (s *Service) DownloadConfig(ctx context.Context, cvID string) ([]byte, error)
- func (s *Service) Get(ctx context.Context, cvID string) (*ConfigurationVersion, error)
- func (s *Service) GetLatest(ctx context.Context, workspaceID string) (*ConfigurationVersion, error)
- func (s *Service) List(ctx context.Context, workspaceID string, opts ListOptions) (*resource.Page[*ConfigurationVersion], error)
- func (s *Service) UploadConfig(ctx context.Context, cvID string, 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 string CreatedAt time.Time AutoQueueRuns bool Source Source Speculative bool Status ConfigurationStatus StatusTimestamps []ConfigurationVersionStatusTimestamp WorkspaceID string IngressAttributes *IngressAttributes }
ConfigurationVersion is a representation of an uploaded or ingressed Terraform configuration.
func NewConfigurationVersion ¶
func NewConfigurationVersion(workspaceID string, 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) String ¶
func (cv *ConfigurationVersion) String() string
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 *string // Get latest config version for this workspace ID WorkspaceID *string // 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, string, CreateOptions) (*ConfigurationVersion, error)
func (*FakeService) Get ¶ added in v0.2.2
func (f *FakeService) Get(context.Context, string) (*ConfigurationVersion, error)
func (*FakeService) GetLatest ¶ added in v0.2.2
func (f *FakeService) GetLatest(context.Context, string) (*ConfigurationVersion, error)
func (*FakeService) UploadConfig ¶ added in v0.2.2
type IngressAttributes ¶
type IngressAttributes struct { // ID string 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 ¶
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 string, opts CreateOptions) (*ConfigurationVersion, error)
func (*Service) DownloadConfig ¶
DownloadConfig retrieves a tarball from the db