Documentation ¶
Overview ¶
Package configversion handles terraform configurations.
Index ¶
- Constants
- func NewService(opts Options) *service
- type Client
- type ConfigUploader
- type ConfigurationSource
- 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 ConfigurationVersionCreateOptions
- type ConfigurationVersionGetOptions
- type ConfigurationVersionListOptions
- type ConfigurationVersionService
- type ConfigurationVersionStatusTimestamp
- type IngressAttributes
- type Options
- type Service
Constants ¶
const ( DefaultConfigurationSource = "tfe-api" 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 ¶
func NewService ¶
func NewService(opts Options) *service
Types ¶
type Client ¶
type Client struct {
internal.JSONAPIClient
}
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 ConfigurationSource ¶
type ConfigurationSource string
ConfigurationSource represents a source of a configuration version.
type ConfigurationStatus ¶
type ConfigurationStatus string
ConfigurationStatus represents a configuration version status.
type ConfigurationVersion ¶
type ConfigurationVersion struct { ID string CreatedAt time.Time AutoQueueRuns bool Source ConfigurationSource 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 ConfigurationVersionCreateOptions) (*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 ConfigurationVersionCreateOptions ¶
type ConfigurationVersionCreateOptions struct { AutoQueueRuns *bool Speculative *bool *IngressAttributes }
ConfigurationVersionCreateOptions represents the options for creating a configuration version. See jsonapi.ConfigurationVersionCreateOptions for more details.
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 ConfigurationVersionListOptions ¶
type ConfigurationVersionListOptions struct { // A list of relations to include Include *string `schema:"include"` resource.PageOptions }
ConfigurationVersionListOptions are options for paginating and filtering a list of configuration versions
type ConfigurationVersionService ¶
type ConfigurationVersionService = Service
namespaced for disambiguation from other services
type ConfigurationVersionStatusTimestamp ¶
type ConfigurationVersionStatusTimestamp struct { Status ConfigurationStatus Timestamp time.Time }
type IngressAttributes ¶
type Service ¶
type Service interface { CreateConfigurationVersion(ctx context.Context, workspaceID string, opts ConfigurationVersionCreateOptions) (*ConfigurationVersion, error) GetConfigurationVersion(ctx context.Context, id string) (*ConfigurationVersion, error) GetLatestConfigurationVersion(ctx context.Context, workspaceID string) (*ConfigurationVersion, error) ListConfigurationVersions(ctx context.Context, workspaceID string, opts ConfigurationVersionListOptions) (*resource.Page[*ConfigurationVersion], error) // Upload handles verification and upload of the config tarball, updating // the config version upon success or failure. UploadConfig(ctx context.Context, id string, config []byte) error // Download retrieves the config tarball for the given config version ID. DownloadConfig(ctx context.Context, id string) ([]byte, error) DeleteConfigurationVersion(ctx context.Context, cvID string) error }