Documentation
¶
Overview ¶
Package configversion handles terraform configurations.
Index ¶
- Constants
- type Client
- type ConfigurationStatus
- type ConfigurationVersion
- type ConfigurationVersionGetOptions
- type CreateOptions
- type FakeService
- func (f *FakeService) Create(context.Context, resource.TfeID, CreateOptions) (*ConfigurationVersion, error)
- func (f *FakeService) Get(context.Context, resource.TfeID) (*ConfigurationVersion, error)
- func (f *FakeService) GetLatest(context.Context, resource.TfeID) (*ConfigurationVersion, error)
- func (f *FakeService) UploadConfig(context.Context, resource.TfeID, []byte) error
- type IngressAttributes
- type IngressAttributesModel
- type ListOptions
- type Options
- type Service
- func (s *Service) AddHandlers(r *mux.Router)
- func (s *Service) Create(ctx context.Context, workspaceID resource.TfeID, opts CreateOptions) (*ConfigurationVersion, error)
- func (s *Service) Delete(ctx context.Context, cvID resource.TfeID) error
- func (s *Service) DownloadConfig(ctx context.Context, cvID resource.TfeID) ([]byte, error)
- func (s *Service) Get(ctx context.Context, id resource.TfeID) (*ConfigurationVersion, error)
- func (s *Service) GetLatest(ctx context.Context, workspaceID resource.TfeID) (*ConfigurationVersion, error)
- func (s *Service) List(ctx context.Context, workspaceID resource.TfeID, opts ListOptions) (*resource.Page[*ConfigurationVersion], error)
- func (s *Service) UploadConfig(ctx context.Context, cvID resource.TfeID, config []byte) error
- type Source
- type StatusTimestamp
- type TFECVStatusTimestamps
- type TFEConfigurationVersion
- type TFEConfigurationVersionCreateOptions
- type TFEConfigurationVersionList
- type TFEIngressAttributes
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 ConfigurationStatus ¶
type ConfigurationStatus string
ConfigurationStatus represents a configuration version status.
type ConfigurationVersion ¶
type ConfigurationVersion struct {
ID resource.TfeID
CreatedAt time.Time
AutoQueueRuns bool
Source Source
Speculative bool
Status ConfigurationStatus
StatusTimestamps []StatusTimestamp
WorkspaceID resource.TfeID
IngressAttributes *IngressAttributes
}
ConfigurationVersion is a representation of an uploaded or ingressed Terraform configuration.
func NewConfigurationVersion ¶
func NewConfigurationVersion(workspaceID resource.TfeID, opts CreateOptions) *ConfigurationVersion
NewConfigurationVersion creates a ConfigurationVersion object from scratch
func (*ConfigurationVersion) StatusTimestamp ¶
func (cv *ConfigurationVersion) StatusTimestamp(status ConfigurationStatus) (time.Time, error)
type ConfigurationVersionGetOptions ¶
type ConfigurationVersionGetOptions struct {
// ID of config version to retrieve
ID *resource.TfeID
// Get latest config version for this workspace ID
WorkspaceID *resource.TfeID
// 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 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.TfeID, CreateOptions) (*ConfigurationVersion, error)
func (*FakeService) Get ¶ added in v0.2.2
func (f *FakeService) Get(context.Context, resource.TfeID) (*ConfigurationVersion, error)
func (*FakeService) GetLatest ¶ added in v0.2.2
func (f *FakeService) GetLatest(context.Context, resource.TfeID) (*ConfigurationVersion, error)
func (*FakeService) UploadConfig ¶ added in v0.2.2
type IngressAttributes ¶
type IngressAttributes struct {
Branch string
CommitSHA string
Repo string
IsPullRequest bool
OnDefaultBranch bool
ConfigurationVersionID resource.TfeID
CommitURL string
PullRequestNumber int
PullRequestURL string
PullRequestTitle string
Tag string
SenderUsername string
SenderAvatarURL string
SenderHTMLURL string
}
type IngressAttributesModel ¶ added in v0.3.17
type IngressAttributesModel struct {
Branch string
CommitSHA string `db:"commit_sha"`
Repo string `db:"identifier"`
IsPullRequest bool `db:"is_pull_request"`
OnDefaultBranch bool `db:"on_default_branch"`
ConfigurationVersionID resource.TfeID `db:"configuration_version_id"`
CommitURL string `db:"commit_url"`
PullRequestNumber int `db:"pull_request_number"`
PullRequestURL string `db:"pull_request_url"`
PullRequestTitle string `db:"pull_request_title"`
Tag string `db:"tag"`
SenderUsername string `db:"sender_username"`
SenderAvatarURL string `db:"sender_avatar_url"`
SenderHTMLURL string `db:"sender_html_url"`
}
func (IngressAttributesModel) ToIngressAttributes ¶ added in v0.3.17
func (m IngressAttributesModel) ToIngressAttributes() *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.TfeID, opts CreateOptions) (*ConfigurationVersion, error)
func (*Service) DownloadConfig ¶
DownloadConfig retrieves a tarball from the db
type StatusTimestamp ¶ added in v0.3.17
type StatusTimestamp struct {
ConfigurationVersionID resource.TfeID `db:"-"`
Status ConfigurationStatus
Timestamp time.Time
}
type TFECVStatusTimestamps ¶ added in v0.3.17
type TFECVStatusTimestamps struct {
FinishedAt *time.Time `json:"finished-at,omitempty"`
QueuedAt *time.Time `json:"queued-at,omitempty"`
StartedAt *time.Time `json:"started-at,omitempty"`
}
CVStatusTimestamps holds the timestamps for individual configuration version statuses.
type TFEConfigurationVersion ¶ added in v0.3.17
type TFEConfigurationVersion struct {
ID resource.TfeID `jsonapi:"primary,configuration-versions"`
AutoQueueRuns bool `jsonapi:"attribute" json:"auto-queue-runs"`
Error string `jsonapi:"attribute" json:"error"`
ErrorMessage string `jsonapi:"attribute" json:"error-message"`
Source string `jsonapi:"attribute" json:"source"`
Speculative bool `jsonapi:"attribute" json:"speculative"`
Status string `jsonapi:"attribute" json:"status"`
StatusTimestamps *TFECVStatusTimestamps `jsonapi:"attribute" json:"status-timestamps"`
UploadURL string `jsonapi:"attribute" json:"upload-url"`
// Relations
IngressAttributes *TFEIngressAttributes `jsonapi:"relationship" json:"ingress-attributes"`
}
TFEConfigurationVersion is an uploaded or ingressed Terraform configuration. A workspace must have at least one configuration version before any runs may be queued on it.
type TFEConfigurationVersionCreateOptions ¶ added in v0.3.17
type TFEConfigurationVersionCreateOptions struct {
// Type is a public field utilized by JSON:API to
// set the resource type via the field tag.
// It is not a user-defined value and does not need to be set.
// https://jsonapi.org/format/#crud-creating
Type string `jsonapi:"primary,configuration-versions"`
// When true, runs are queued automatically when the configuration version
// is uploaded.
AutoQueueRuns *bool `jsonapi:"attribute" json:"auto-queue-runs,omitempty"`
// When true, this configuration version can only be used for planning.
Speculative *bool `jsonapi:"attribute" json:"speculative,omitempty"`
}
ConfigurationVersionCreateOptions represents the options for creating a configuration version.
type TFEConfigurationVersionList ¶ added in v0.3.17
type TFEConfigurationVersionList struct {
*types.Pagination
Items []*TFEConfigurationVersion
}
ConfigurationVersionList represents a list of configuration versions.
type TFEIngressAttributes ¶ added in v0.3.17
type TFEIngressAttributes struct {
ID resource.TfeID `jsonapi:"primary,ingress-attributes"`
Branch string `jsonapi:"attribute" json:"branch"`
CloneURL string `jsonapi:"attribute" json:"clone-url"`
CommitMessage string `jsonapi:"attribute" json:"commit-message"`
CommitSHA string `jsonapi:"attribute" json:"commit-sha"`
CommitURL string `jsonapi:"attribute" json:"commit-url"`
CompareURL string `jsonapi:"attribute" json:"compare-url"`
Identifier string `jsonapi:"attribute" json:"identifier"`
IsPullRequest bool `jsonapi:"attribute" json:"is-pull-request"`
OnDefaultBranch bool `jsonapi:"attribute" json:"on-default-branch"`
PullRequestNumber int `jsonapi:"attribute" json:"pull-request-number"`
PullRequestURL string `jsonapi:"attribute" json:"pull-request-url"`
PullRequestTitle string `jsonapi:"attribute" json:"pull-request-title"`
PullRequestBody string `jsonapi:"attribute" json:"pull-request-body"`
Tag string `jsonapi:"attribute" json:"tag"`
SenderUsername string `jsonapi:"attribute" json:"sender-username"`
SenderAvatarURL string `jsonapi:"attribute" json:"sender-avatar-url"`
SenderHTMLURL string `jsonapi:"attribute" json:"sender-html-url"`
}