models

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityEvent

type ActivityEvent struct {
	UserID           *string
	ServiceAccountID *string
	NamespacePath    *string
	Payload          []byte
	TargetID         string
	Action           ActivityEventAction
	TargetType       ActivityEventTargetType
	Metadata         ResourceMetadata
}

ActivityEvent resource

type ActivityEventAction

type ActivityEventAction string

ActivityEventAction represents the type of action.

const (
	ActionAdd                 ActivityEventAction = "ADD"
	ActionAddMember           ActivityEventAction = "ADD_MEMBER"
	ActionCreateMembership    ActivityEventAction = "CREATE_MEMBERSHIP"
	ActionApply               ActivityEventAction = "APPLY"
	ActionCancel              ActivityEventAction = "CANCEL"
	ActionCreate              ActivityEventAction = "CREATE"
	ActionDeleteChildResource ActivityEventAction = "DELETE_CHILD_RESOURCE"
	ActionLock                ActivityEventAction = "LOCK"
	ActionRemove              ActivityEventAction = "REMOVE"
	ActionRemoveMember        ActivityEventAction = "REMOVE_MEMBER"
	ActionRemoveMembership    ActivityEventAction = "REMOVE_MEMBERSHIP"
	ActionSetVariables        ActivityEventAction = "SET_VARIABLES"
	ActionUnlock              ActivityEventAction = "UNLOCK"
	ActionUpdate              ActivityEventAction = "UPDATE"
	ActionUpdateMember        ActivityEventAction = "UPDATE_MEMBER"
)

ActivityEventAction Types

type ActivityEventAddTeamMemberPayload

type ActivityEventAddTeamMemberPayload struct {
	UserID     *string `json:"userId"`
	Maintainer bool    `json:"maintainer"`
}

ActivityEventAddTeamMemberPayload is the custom payload for adding a user to a team

type ActivityEventCreateNamespaceMembershipPayload

type ActivityEventCreateNamespaceMembershipPayload struct {
	UserID           *string `json:"userId"`
	ServiceAccountID *string `json:"serviceAccountId"`
	TeamID           *string `json:"teamId"`
	Role             string  `json:"role"`
}

ActivityEventCreateNamespaceMembershipPayload helps with custom payloads for activity events for namespace memberships.

type ActivityEventDeleteChildResourcePayload

type ActivityEventDeleteChildResourcePayload struct {
	Name string `json:"name"`
	ID   string `json:"id"`
	Type string `json:"type"`
}

ActivityEventDeleteChildResourcePayload holds information about the resource that was deleted. The target ID and target type of the associated activity event will be that of the group (or workspace for a workspace-level variable) the resource was in.

type ActivityEventRemoveNamespaceMembershipPayload

type ActivityEventRemoveNamespaceMembershipPayload struct {
	UserID           *string `json:"userId"`
	ServiceAccountID *string `json:"serviceAccountId"`
	TeamID           *string `json:"teamId"`
}

ActivityEventRemoveNamespaceMembershipPayload helps with custom payloads for activity events for namespace memberships.

type ActivityEventRemoveTeamMemberPayload

type ActivityEventRemoveTeamMemberPayload struct {
	UserID *string `json:"userId"`
}

ActivityEventRemoveTeamMemberPayload is the custom payload for removing a user from a team

type ActivityEventTargetType

type ActivityEventTargetType string

ActivityEventTargetType represents the type of the target of the action.

const (
	TargetGPGKey                    ActivityEventTargetType = "GPG_KEY"
	TargetGroup                     ActivityEventTargetType = "GROUP"
	TargetManagedIdentity           ActivityEventTargetType = "MANAGED_IDENTITY"
	TargetManagedIdentityAccessRule ActivityEventTargetType = "MANAGED_IDENTITY_ACCESS_RULE"
	TargetNamespaceMembership       ActivityEventTargetType = "NAMESPACE_MEMBERSHIP"
	TargetRun                       ActivityEventTargetType = "RUN"
	TargetServiceAccount            ActivityEventTargetType = "SERVICE_ACCOUNT"
	TargetStateVersion              ActivityEventTargetType = "STATE_VERSION"
	TargetTeam                      ActivityEventTargetType = "TEAM"
	TargetTerraformProvider         ActivityEventTargetType = "TERRAFORM_PROVIDER"
	TargetTerraformProviderVersion  ActivityEventTargetType = "TERRAFORM_PROVIDER_VERSION"
	TargetTerraformModule           ActivityEventTargetType = "TERRAFORM_MODULE"
	TargetTerraformModuleVersion    ActivityEventTargetType = "TERRAFORM_MODULE_VERSION"
	TargetVariable                  ActivityEventTargetType = "VARIABLE"
	TargetVCSProvider               ActivityEventTargetType = "VCS_PROVIDER"
	TargetWorkspace                 ActivityEventTargetType = "WORKSPACE"
)

ActivityEventTargetType Values

type ActivityEventUpdateNamespaceMembershipPayload

type ActivityEventUpdateNamespaceMembershipPayload struct {
	PrevRole string `json:"prevRole"`
	NewRole  string `json:"newRole"`
}

ActivityEventUpdateNamespaceMembershipPayload helps with custom payloads for activity events for namespace memberships.

type ActivityEventUpdateTeamMemberPayload

type ActivityEventUpdateTeamMemberPayload struct {
	UserID     *string `json:"userId"`
	Maintainer bool    `json:"maintainer"`
}

ActivityEventUpdateTeamMemberPayload is the custom payload for updating a member of a team

type Apply

type Apply struct {
	WorkspaceID string
	Status      ApplyStatus
	TriggeredBy string
	Comment     string
	Metadata    ResourceMetadata
}

Apply includes information related to running a terraform plan command

type ApplyStatus

type ApplyStatus string

ApplyStatus represents the various states for a Apply resource

const (
	ApplyCanceled ApplyStatus = "canceled"
	ApplyCreated  ApplyStatus = "created"
	ApplyErrored  ApplyStatus = "errored"
	ApplyFinished ApplyStatus = "finished"
	ApplyPending  ApplyStatus = "pending"
	ApplyQueued   ApplyStatus = "queued"
	ApplyRunning  ApplyStatus = "running"
)

Apply Status Types

type ConfigurationStatus

type ConfigurationStatus string

ConfigurationStatus represents the various states for a ConfigurationVersion resource

const (
	ConfigurationErrored  ConfigurationStatus = "errored"
	ConfigurationPending  ConfigurationStatus = "pending"
	ConfigurationUploaded ConfigurationStatus = "uploaded"
)

Configuration version status types

type ConfigurationVersion

type ConfigurationVersion struct {
	VCSEventID  *string
	Status      ConfigurationStatus
	WorkspaceID string
	CreatedBy   string
	Metadata    ResourceMetadata
	Speculative bool
}

ConfigurationVersion resource represents a terraform configuration that can be used by a single Run

type GPGKey

type GPGKey struct {
	CreatedBy   string
	GroupID     string
	ASCIIArmor  string
	Fingerprint string
	Metadata    ResourceMetadata
	GPGKeyID    uint64
}

GPGKey represents a GPG key used for signing

func (*GPGKey) GetHexGPGKeyID

func (g *GPGKey) GetHexGPGKeyID() string

GetHexGPGKeyID returns the GPG key ID in hex format

type Group

type Group struct {
	Name        string
	Description string
	ParentID    string
	FullPath    string
	CreatedBy   string
	Metadata    ResourceMetadata
}

Group resource

func (*Group) ExpandPath

func (g *Group) ExpandPath() []string

ExpandPath returns the expanded path list for the group. The expanded path list includes the full path for the group in addition to all parent paths

func (*Group) GetParentPath

func (g *Group) GetParentPath() string

GetParentPath returns the path for the group's immediate parent.

func (*Group) GetRootGroupPath

func (g *Group) GetRootGroupPath() string

GetRootGroupPath returns the root path for the group

func (*Group) Validate

func (g *Group) Validate() error

Validate returns an error if the model is not valid

type Job

type Job struct {
	Timestamps               JobTimestamps
	CancelRequestedTimestamp *time.Time
	Status                   JobStatus
	Type                     JobType
	WorkspaceID              string
	RunID                    string
	RunnerID                 string
	Metadata                 ResourceMetadata
	MaxJobDuration           int32
	CancelRequested          bool
}

Job represents a unit of work that needs to be completed

type JobLogDescriptor

type JobLogDescriptor struct {
	JobID    string
	Metadata ResourceMetadata
	Size     int
}

JobLogDescriptor contains metadata for job logs

type JobStatus

type JobStatus string

JobStatus type

const (
	JobQueued   JobStatus = "queued"
	JobPending  JobStatus = "pending"
	JobRunning  JobStatus = "running"
	JobFinished JobStatus = "finished"
)

Job Status Constants

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 (
	JobPlanType  JobType = "plan"
	JobApplyType JobType = "apply"
)

Job Types Constants

type ManagedIdentity

type ManagedIdentity struct {
	Metadata     ResourceMetadata
	Type         ManagedIdentityType
	ResourcePath string
	Name         string
	Description  string
	GroupID      string
	CreatedBy    string
	Data         []byte
}

ManagedIdentity is used to provide identities to terraform providers

func (*ManagedIdentity) GetGroupPath

func (m *ManagedIdentity) GetGroupPath() string

GetGroupPath returns the group path

func (*ManagedIdentity) Validate

func (m *ManagedIdentity) Validate() error

Validate returns an error if the model is not valid

type ManagedIdentityAccessRule

type ManagedIdentityAccessRule struct {
	Metadata                 ResourceMetadata
	RunStage                 JobType
	ManagedIdentityID        string
	AllowedUserIDs           []string
	AllowedServiceAccountIDs []string
	AllowedTeamIDs           []string
}

ManagedIdentityAccessRule is used to restrict access to a managed identity

type ManagedIdentityType

type ManagedIdentityType string

ManagedIdentityType represents the supported managed identity types

const (
	ManagedIdentityAzureFederated   ManagedIdentityType = "azure_federated"
	ManagedIdentityAWSFederated     ManagedIdentityType = "aws_federated"
	ManagedIdentityTharsisFederated ManagedIdentityType = "tharsis_federated"
)

Managed Identity Types

type MembershipNamespace

type MembershipNamespace struct {
	GroupID     *string
	WorkspaceID *string
	ID          string
	Path        string
}

MembershipNamespace represents a namespace which can be a group or workspace

func (MembershipNamespace) IsTopLevel

func (m MembershipNamespace) IsTopLevel() bool

IsTopLevel returns true if this is a top-level namespace

type NamespaceMembership

type NamespaceMembership struct {
	UserID           *string
	ServiceAccountID *string
	TeamID           *string
	Namespace        MembershipNamespace
	Role             Role
	Metadata         ResourceMetadata
}

NamespaceMembership represents an association between a member and a namespace

type OIDCTrustPolicy

type OIDCTrustPolicy struct {
	BoundClaims map[string]string
	Issuer      string
}

OIDCTrustPolicy defined the IDP that can be used for logging into the service account

type Plan

type Plan struct {
	WorkspaceID          string
	Status               PlanStatus
	Metadata             ResourceMetadata
	ResourceAdditions    int
	ResourceChanges      int
	ResourceDestructions int
	HasChanges           bool
}

Plan includes information related to running a terraform plan command

type PlanStatus

type PlanStatus string

PlanStatus represents the various states for a Plan resource

const (
	PlanCanceled PlanStatus = "canceled"
	PlanQueued   PlanStatus = "queued"
	PlanErrored  PlanStatus = "errored"
	PlanFinished PlanStatus = "finished"
	PlanPending  PlanStatus = "pending"
	PlanRunning  PlanStatus = "running"
)

Run Status Types

type ResourceMetadata

type ResourceMetadata struct {
	CreationTimestamp    *time.Time `json:"createdAt"`
	LastUpdatedTimestamp *time.Time `json:"updatedAt,omitempty" `
	ID                   string     `json:"id"`
	Version              int        `json:"version"`
}

ResourceMetadata contains metadata for a particular resource

type Role

type Role string

Role represents the access level a user has within a namespace

const (
	ViewerRole   Role = "viewer"
	DeployerRole Role = "deployer"
	OwnerRole    Role = "owner"
)

Default Roles

func (Role) GTE

func (r Role) GTE(other Role) bool

GTE checks if this access level is greater than or equal to 'other' (i.e. al >= other)

func (Role) IsValid

func (r Role) IsValid() bool

IsValid returns true if this is a valid role

type Run

type Run struct {
	ConfigurationVersionID *string
	ForceCancelAvailableAt *time.Time
	ForceCanceledBy        *string
	ModuleVersion          *string
	ModuleSource           *string
	CreatedBy              string
	PlanID                 string
	ApplyID                string
	WorkspaceID            string
	Status                 RunStatus
	Comment                string
	TerraformVersion       string
	Metadata               ResourceMetadata
	HasChanges             bool
	IsDestroy              bool
	ForceCanceled          bool
	AutoApply              bool
}

Run represents a terraform run Only one of ConfigurationVersionID, ModuleSource/ModuleVersion can be non-nil. The ModuleVersion field is optional: blank if non-registry or want latest version

type RunStatus

type RunStatus string

RunStatus represents the various states for a Run resource

const (
	RunApplied            RunStatus = "applied"
	RunApplyQueued        RunStatus = "apply_queued"
	RunApplying           RunStatus = "applying"
	RunCanceled           RunStatus = "canceled"
	RunErrored            RunStatus = "errored"
	RunPending            RunStatus = "pending"
	RunPlanQueued         RunStatus = "plan_queued"
	RunPlanned            RunStatus = "planned"
	RunPlannedAndFinished RunStatus = "planned_and_finished"
	RunPlanning           RunStatus = "planning"
)

Run Status Types

type SCIMToken

type SCIMToken struct {
	Nonce     string
	CreatedBy string
	Metadata  ResourceMetadata
}

SCIMToken represents a SCIM token.

type ServiceAccount

type ServiceAccount struct {
	Metadata          ResourceMetadata
	ResourcePath      string
	Name              string
	Description       string
	GroupID           string
	CreatedBy         string
	OIDCTrustPolicies []OIDCTrustPolicy
}

ServiceAccount provided M2M authentication

func (*ServiceAccount) GetGroupPath

func (s *ServiceAccount) GetGroupPath() string

GetGroupPath returns the group path

func (*ServiceAccount) Validate

func (s *ServiceAccount) Validate() error

Validate returns an error if the model is not valid

type StateVersion

type StateVersion struct {
	WorkspaceID string
	RunID       *string
	CreatedBy   string
	Metadata    ResourceMetadata
}

StateVersion represents a specific version of the the terraform state associated with a workspace

type StateVersionOutput

type StateVersionOutput struct {
	Name           string
	StateVersionID string
	Metadata       ResourceMetadata
	Value          []byte
	Type           []byte
	Sensitive      bool
}

StateVersionOutput represents a terraform state version output

type Team

type Team struct {
	Name           string
	Description    string
	SCIMExternalID string
	Metadata       ResourceMetadata
}

Team represents a team of (human) users

func (*Team) Validate

func (t *Team) Validate() error

Validate returns an error if the model is not valid

type TeamMember

type TeamMember struct {
	UserID       string
	TeamID       string
	Metadata     ResourceMetadata
	IsMaintainer bool
}

TeamMember represents an association between a (human) user and a namespace

type TerraformModule

type TerraformModule struct {
	CreatedBy     string
	Name          string // the module name
	System        string // the name of the remote system the module is intended to target
	GroupID       string
	RootGroupID   string // the module namespace is the path of the root group
	ResourcePath  string // resource path is <group-path>/<module-name>/<system>
	RepositoryURL string
	Metadata      ResourceMetadata
	Private       bool
}

TerraformModule represents a terraform module

func (*TerraformModule) GetGroupPath

func (t *TerraformModule) GetGroupPath() string

GetGroupPath returns the group path

func (*TerraformModule) GetRegistryNamespace

func (t *TerraformModule) GetRegistryNamespace() string

GetRegistryNamespace returns the module registry namespace for the terraform module

func (*TerraformModule) Validate

func (t *TerraformModule) Validate() error

Validate returns an error if the model is not valid

type TerraformModuleAttestation

type TerraformModuleAttestation struct {
	CreatedBy     string
	Description   string
	ModuleID      string
	SchemaType    string
	PredicateType string
	Data          string
	DataSHASum    []byte
	Metadata      ResourceMetadata
	Digests       []string
}

TerraformModuleAttestation represents a terraform module attestation

func (*TerraformModuleAttestation) Validate

func (t *TerraformModuleAttestation) Validate() error

Validate returns an error if the model is not valid

type TerraformModuleVersion

type TerraformModuleVersion struct {
	CreatedBy              string
	ModuleID               string
	SemanticVersion        string
	Status                 TerraformModuleVersionStatus
	Error                  string
	Diagnostics            string
	UploadStartedTimestamp *time.Time
	Metadata               ResourceMetadata
	SHASum                 []byte
	Submodules             []string
	Examples               []string
	Latest                 bool
}

TerraformModuleVersion represents a terraform module version

func (*TerraformModuleVersion) GetSHASumHex

func (t *TerraformModuleVersion) GetSHASumHex() string

GetSHASumHex returns the SHA checksum as a HEX string

type TerraformModuleVersionStatus

type TerraformModuleVersionStatus string

TerraformModuleVersionStatus is the status of the module version upload

const (
	TerraformModuleVersionStatusPending          TerraformModuleVersionStatus = "pending"
	TerraformModuleVersionStatusUploadInProgress TerraformModuleVersionStatus = "upload_in_progress"
	TerraformModuleVersionStatusErrored          TerraformModuleVersionStatus = "errored"
	TerraformModuleVersionStatusUploaded         TerraformModuleVersionStatus = "uploaded"
)

TerraformModuleVersionStatus constants

type TerraformProvider

type TerraformProvider struct {
	CreatedBy     string
	Name          string
	GroupID       string
	RootGroupID   string
	ResourcePath  string
	RepositoryURL string
	Metadata      ResourceMetadata
	Private       bool
}

TerraformProvider represents a terraform provider

func (*TerraformProvider) GetGroupPath

func (t *TerraformProvider) GetGroupPath() string

GetGroupPath returns the group path

func (*TerraformProvider) GetRegistryNamespace

func (t *TerraformProvider) GetRegistryNamespace() string

GetRegistryNamespace returns the provider registry namespace for the terraform provider

func (*TerraformProvider) Validate

func (t *TerraformProvider) Validate() error

Validate returns an error if the model is not valid

type TerraformProviderPlatform

type TerraformProviderPlatform struct {
	ProviderVersionID string
	OperatingSystem   string
	Architecture      string
	SHASum            string
	Filename          string
	CreatedBy         string
	Metadata          ResourceMetadata
	BinaryUploaded    bool
}

TerraformProviderPlatform represents a supported platform for a terraform provider version

type TerraformProviderVersion

type TerraformProviderVersion struct {
	GPGASCIIArmor            *string
	GPGKeyID                 *uint64
	CreatedBy                string
	ProviderID               string
	SemanticVersion          string
	Metadata                 ResourceMetadata
	Protocols                []string
	SHASumsUploaded          bool
	SHASumsSignatureUploaded bool
	ReadmeUploaded           bool
	Latest                   bool
}

TerraformProviderVersion represents a version of a terraform provider

func (*TerraformProviderVersion) GetHexGPGKeyID

func (t *TerraformProviderVersion) GetHexGPGKeyID() *string

GetHexGPGKeyID returns the GPG key id in hex format

type User

type User struct {
	Username       string
	Email          string
	SCIMExternalID string
	Metadata       ResourceMetadata
	Admin          bool
	Active         bool
}

User represents a human user account

type VCSEvent

type VCSEvent struct {
	ErrorMessage        *string // An error message indicating the reason event failed.
	CommitID            *string // Commit ID associated with this event.
	SourceReferenceName *string // Name of branch or tag that triggered this event.
	WorkspaceID         string
	RepositoryURL       string
	Type                VCSEventType
	Status              VCSEventStatus
	Metadata            ResourceMetadata
}

VCSEvent represents a vcs event that result in configuration changes via Tharsis.

type VCSEventStatus

type VCSEventStatus string

VCSEventStatus defines an enum that represents the status of a VCS event.

const (
	VCSEventPending  VCSEventStatus = "pending"
	VCSEventFinished VCSEventStatus = "finished"
	VCSEventErrored  VCSEventStatus = "errored"
)

VCSEventStatus constants.

type VCSEventType

type VCSEventType string

VCSEventType defines an enum that represents the type of VCS event.

const (
	BranchEventType       VCSEventType = "branch"
	TagEventType          VCSEventType = "tag"
	MergeRequestEventType VCSEventType = "merge_request"
	ManualEventType       VCSEventType = "manual"
)

VCSEventType constants.

func (VCSEventType) Equals

func (have VCSEventType) Equals(want VCSEventType) bool

Equals is a convenience func that returns whether two events are equal.

type VCSProvider

type VCSProvider struct {
	OAuthAccessTokenExpiresAt *time.Time
	CreatedBy                 string
	Hostname                  string
	Name                      string
	Description               string
	ResourcePath              string
	Type                      VCSProviderType
	GroupID                   string
	OAuthClientSecret         string
	OAuthClientID             string
	OAuthState                *string
	OAuthAccessToken          *string
	OAuthRefreshToken         *string
	Metadata                  ResourceMetadata
	AutoCreateWebhooks        bool
}

VCSProvider represents a version control system provider.

func (*VCSProvider) GetGroupPath

func (vp *VCSProvider) GetGroupPath() string

GetGroupPath returns the group path

func (*VCSProvider) Validate

func (vp *VCSProvider) Validate() error

Validate returns an error if the model is not valid

type VCSProviderType

type VCSProviderType string

VCSProviderType defines the type of version control system (VCS) provider.

const (
	GitLabProviderType VCSProviderType = "gitlab"
	GitHubProviderType VCSProviderType = "github"
)

VCSProviderType and OAuthTokenType enums.

type Variable

type Variable struct {
	Value         *string
	Category      VariableCategory
	NamespacePath string
	Key           string
	Metadata      ResourceMetadata
	Hcl           bool
}

Variable resource

type VariableCategory

type VariableCategory string

VariableCategory specifies if the variable is a terraform or environment variable

const (
	TerraformVariableCategory   VariableCategory = "terraform"
	EnvironmentVariableCategory VariableCategory = "environment"
)

Variable category Status Types

type Workspace

type Workspace struct {
	MaxJobDuration        *int32
	Name                  string
	FullPath              string
	GroupID               string
	Description           string
	CurrentJobID          string
	CurrentStateVersionID string
	CreatedBy             string
	TerraformVersion      string
	Metadata              ResourceMetadata
	DirtyState            bool
	Locked                bool
	PreventDestroyPlan    bool
}

Workspace represents a terraform workspace

func (*Workspace) GetGroupPath

func (w *Workspace) GetGroupPath() string

GetGroupPath returns the group path

func (*Workspace) Validate

func (w *Workspace) Validate() error

Validate returns an error if the model is not valid

type WorkspaceVCSProviderLink struct {
	CreatedBy           string
	WorkspaceID         string
	ProviderID          string
	TokenNonce          string
	RepositoryPath      string
	WebhookID           string   // Webhook ID if Tharsis configured it.
	ModuleDirectory     *string  // Path to Terraform module, otherwise repo root.
	Branch              string   // A branch name to filter on.
	TagRegex            *string  // A tag regex to use as a filter.
	GlobPatterns        []string // Glob patterns to use for monitoring changes.
	Metadata            ResourceMetadata
	AutoSpeculativePlan bool // Whether to create speculative plans automatically for PRs.
	WebhookDisabled     bool
}

WorkspaceVCSProviderLink represents a link for a version control system provider to a workspace.

func (*WorkspaceVCSProviderLink) Validate

func (wpl *WorkspaceVCSProviderLink) Validate() error

Validate verifies a VCS Provider link struct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL