types

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package types provides structs suitable for marshaling to/from json:api

Index

Constants

View Source
const (
	DefaultPageSize = 20
	MaxPageSize     = 100
)

Variables

View Source
var DefaultOrganizationPermissions = OrganizationPermissions{
	CanCreateWorkspace: true,
	CanUpdate:          true,
	CanDestroy:         true,
}

Functions

This section is empty.

Types

type AgentPool added in v0.2.0

type AgentPool struct {
	ID                 string `jsonapi:"primary,agent-pools"`
	Name               string `jsonapi:"attribute" json:"name"`
	AgentCount         int    `jsonapi:"attribute" json:"agent-count"`
	OrganizationScoped bool   `jsonapi:"attribute" json:"organization-scoped"`

	// Relations
	Organization      *Organization `jsonapi:"relationship" json:"organization"`
	Workspaces        []*Workspace  `jsonapi:"relationship" json:"workspaces"`
	AllowedWorkspaces []*Workspace  `jsonapi:"relationship" json:"allowed-workspaces"`
}

AgentPool represents a Terraform Cloud agent pool.

type AgentPoolCreateOptions added in v0.2.0

type AgentPoolCreateOptions 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,agent-pools"`

	// Required: A name to identify the agent pool.
	Name *string `jsonapi:"attribute" json:"name"`

	// True if the agent pool is organization scoped, false otherwise.
	OrganizationScoped *bool `jsonapi:"attribute" json:"organization-scoped,omitempty"`

	// List of workspaces that are associated with an agent pool.
	AllowedWorkspaces []*Workspace `jsonapi:"relationship" json:"allowed-workspaces,omitempty"`
}

AgentPoolCreateOptions represents the options for creating an agent pool.

type AgentPoolListOptions added in v0.2.0

type AgentPoolListOptions struct {
	ListOptions

	// Optional: A search query string used to filter agent pool. Agent pools are searchable by name
	Query *string `schema:"q,omitempty"`

	// Optional: String (workspace name) used to filter the results.
	AllowedWorkspacesName *string `schema:"filter[allowed_workspaces][name],omitempty"`
}

AgentPoolListOptions represents the options for listing agent pools.

type AgentPoolUpdateOptions added in v0.2.0

type AgentPoolUpdateOptions 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,agent-pools"`

	// A new name to identify the agent pool.
	Name *string `jsonapi:"attribute" json:"name,omitempty"`

	// True if the agent pool is organization scoped, false otherwise.
	OrganizationScoped *bool `jsonapi:"attribute" json:"organization-scoped,omitempty"`

	// A new list of workspaces that are associated with an agent pool.
	AllowedWorkspaces []*Workspace `jsonapi:"relationship" json:"allowed-workspaces,omitempty"`
}

AgentPoolUpdateOptions represents the options for updating an agent pool.

type AgentToken

type AgentToken struct {
	ID          string    `jsonapi:"primary,authentication-tokens"`
	CreatedAt   time.Time `jsonapi:"attribute" json:"created-at"`
	Description string    `jsonapi:"attribute" json:"description"`
	LastUsedAt  time.Time `jsonapi:"attribute" json:"last-used-at"`
	Token       string    `jsonapi:"attribute" json:"token"`
}

AgentToken represents a TFE agent token.

type AgentTokenCreateOptions

type AgentTokenCreateOptions 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,agent-tokens"`

	// Description is a meaningful description of the purpose of the agent
	// token.
	Description string `jsonapi:"attribute" json:"description"`
}

AgentTokenCreateOptions represents the options for creating a new otf agent token.

type Apply

type Apply struct {
	ID               string                 `jsonapi:"primary,applies"`
	LogReadURL       string                 `jsonapi:"attribute" json:"log-read-url"`
	Status           string                 `jsonapi:"attribute" json:"status"`
	StatusTimestamps *PhaseStatusTimestamps `jsonapi:"attribute" json:"status-timestamps"`

	ResourceReport
}

Apply is a terraform apply

type AuthPolicyType

type AuthPolicyType string

AuthPolicyType represents an authentication policy type.

const (
	AuthPolicyPassword  AuthPolicyType = "password"
	AuthPolicyTwoFactor AuthPolicyType = "two_factor_mandatory"
)

List of available authentication policies.

type CVStatusTimestamps

type CVStatusTimestamps 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 ConfigurationVersion

type ConfigurationVersion struct {
	ID               string              `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 *CVStatusTimestamps `jsonapi:"attribute" json:"status-timestamps"`
	UploadURL        string              `jsonapi:"attribute" json:"upload-url"`

	// Relations
	IngressAttributes *IngressAttributes `jsonapi:"relationship" json:"ingress-attributes"`
}

ConfigurationVersion 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 ConfigurationVersionCreateOptions

type ConfigurationVersionCreateOptions 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 ConfigurationVersionList

type ConfigurationVersionList struct {
	*Pagination
	Items []*ConfigurationVersion
}

ConfigurationVersionList represents a list of configuration versions.

type CostEstimate

type CostEstimate struct {
	ID                      string                        `jsonapi:"primary,cost-estimates"`
	DeltaMonthlyCost        string                        `jsonapi:"attribute" json:"delta-monthly-cost"`
	ErrorMessage            string                        `jsonapi:"attribute" json:"error-message"`
	MatchedResourcesCount   int                           `jsonapi:"attribute" json:"matched-resources-count"`
	PriorMonthlyCost        string                        `jsonapi:"attribute" json:"prior-monthly-cost"`
	ProposedMonthlyCost     string                        `jsonapi:"attribute" json:"proposed-monthly-cost"`
	ResourcesCount          int                           `jsonapi:"attribute" json:"resources-count"`
	Status                  CostEstimateStatus            `jsonapi:"attribute" json:"status"`
	StatusTimestamps        *CostEstimateStatusTimestamps `jsonapi:"attribute" json:"status-timestamps"`
	UnmatchedResourcesCount int                           `jsonapi:"attribute" json:"unmatched-resources-count"`
}

CostEstimate represents a Terraform Enterprise costEstimate.

type CostEstimateStatus

type CostEstimateStatus string

CostEstimateStatus represents a costEstimate state.

const (
	CostEstimateCanceled              CostEstimateStatus = "canceled"
	CostEstimateErrored               CostEstimateStatus = "errored"
	CostEstimateFinished              CostEstimateStatus = "finished"
	CostEstimatePending               CostEstimateStatus = "pending"
	CostEstimateQueued                CostEstimateStatus = "queued"
	CostEstimateSkippedDueToTargeting CostEstimateStatus = "skipped_due_to_targeting"
)

List all available costEstimate statuses.

type CostEstimateStatusTimestamps

type CostEstimateStatusTimestamps struct {
	CanceledAt              time.Time `json:"canceled-at"`
	ErroredAt               time.Time `json:"errored-at"`
	FinishedAt              time.Time `json:"finished-at"`
	PendingAt               time.Time `json:"pending-at"`
	QueuedAt                time.Time `json:"queued-at"`
	SkippedDueToTargetingAt time.Time `json:"skipped-due-to-targeting-at"`
}

CostEstimateStatusTimestamps holds the timestamps for individual costEstimate statuses.

type CreateUserOptions

type CreateUserOptions 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,users"`

	Username *string `jsonapi:"attribute" json:"username"`
}

CreateUserOptions represents the options for creating a user.

type DeliveryResponse

type DeliveryResponse struct {
	Body       string              `jsonapi:"attribute" json:"body"`
	Code       string              `jsonapi:"attribute" json:"code"`
	Headers    map[string][]string `jsonapi:"attribute" json:"headers"`
	SentAt     time.Time           `jsonapi:"attribute" json:"sent-at"`
	Successful string              `jsonapi:"attribute" json:"successful"`
	URL        string              `jsonapi:"attribute" json:"url"`
}

DeliveryResponse represents a notification configuration delivery response.

type Entitlements

type Entitlements struct {
	ID                    string `jsonapi:"primary,entitlement-sets"`
	Agents                bool   `jsonapi:"attribute" json:"agents"`
	AuditLogging          bool   `jsonapi:"attribute" json:"audit-logging"`
	CostEstimation        bool   `jsonapi:"attribute" json:"cost-estimation"`
	Operations            bool   `jsonapi:"attribute" json:"operations"`
	PrivateModuleRegistry bool   `jsonapi:"attribute" json:"private-module-registry"`
	SSO                   bool   `jsonapi:"attribute" json:"sso"`
	Sentinel              bool   `jsonapi:"attribute" json:"sentinel"`
	StateStorage          bool   `jsonapi:"attribute" json:"state-storage"`
	Teams                 bool   `jsonapi:"attribute" json:"teams"`
	VCSIntegrations       bool   `jsonapi:"attribute" json:"vcs-integrations"`
}

Entitlements represents the entitlements of an organization. Unlike TFE/TFC, OTF is free and therefore the user is entitled to all currently supported services. Entitlements represents the entitlements of an organization.

type IngressAttributes

type IngressAttributes struct {
	ID                string `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"`
}

type ListOptions

type ListOptions struct {
	// The page number to request. The results vary based on the PageSize.
	PageNumber int `schema:"page[number],omitempty"`
	// The number of elements returned in a single page.
	PageSize int `schema:"page[size],omitempty"`
}

ListOptions is used to specify pagination options when making API requests. Pagination allows breaking up large result sets into chunks, or "pages".

type NotificationConfiguration

type NotificationConfiguration struct {
	ID                string                      `jsonapi:"primary,notification-configurations"`
	CreatedAt         time.Time                   `jsonapi:"attribute" json:"created-at"`
	DeliveryResponses []*DeliveryResponse         `jsonapi:"attribute" json:"delivery-responses"`
	DestinationType   NotificationDestinationType `jsonapi:"attribute" json:"destination-type"`
	Enabled           bool                        `jsonapi:"attribute" json:"enabled"`
	Name              string                      `jsonapi:"attribute" json:"name"`
	Token             string                      `jsonapi:"attribute" json:"token"`
	Triggers          []string                    `jsonapi:"attribute" json:"triggers"`
	UpdatedAt         time.Time                   `jsonapi:"attribute" json:"updated-at"`
	URL               string                      `jsonapi:"attribute" json:"url"`

	// EmailAddresses is only available for TFE users. It is not available in TFC.
	EmailAddresses []string `jsonapi:"attribute" json:"email-addresses"`
	// relationships
	Subscribable *Workspace `jsonapi:"relationship" json:"subscribable"`
	EmailUsers   []*User    `jsonapi:"relationship" json:"users"`
}

NotificationConfiguration represents a Notification Configuration.

type NotificationConfigurationCreateOptions

type NotificationConfigurationCreateOptions 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,notification-configurations"`

	// Required: The destination type of the notification configuration
	DestinationType *NotificationDestinationType `jsonapi:"attribute" json:"destination-type"`

	// Required: Whether the notification configuration should be enabled or not
	Enabled *bool `jsonapi:"attribute" json:"enabled"`

	// Required: The name of the notification configuration
	Name *string `jsonapi:"attribute" json:"name"`

	// Optional: The token of the notification configuration
	Token *string `jsonapi:"attribute" json:"token,omitempty"`

	// Optional: The list of run events that will trigger notifications.
	Triggers []NotificationTriggerType `jsonapi:"attribute" json:"triggers,omitempty"`

	// Optional: The url of the notification configuration
	URL *string `jsonapi:"attribute" json:"url,omitempty"`

	// Optional: The list of email addresses that will receive notification emails.
	// EmailAddresses is only available for TFE users. It is not available in TFC.
	EmailAddresses []string `jsonapi:"attribute" json:"email-addresses,omitempty"`

	// Optional: The list of users belonging to the organization that will receive notification emails.
	EmailUsers []*User `jsonapi:"relationship" json:"users,omitempty"`
}

NotificationConfigurationCreateOptions represents the options for creating a new notification configuration.

type NotificationConfigurationList

type NotificationConfigurationList struct {
	*Pagination
	Items []*NotificationConfiguration
}

NotificationConfigurationList represents a list of Notification Configurations.

type NotificationConfigurationUpdateOptions

type NotificationConfigurationUpdateOptions 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,notification-configurations"`

	// Optional: Whether the notification configuration should be enabled or not
	Enabled *bool `jsonapi:"attribute" json:"enabled,omitempty"`

	// Optional: The name of the notification configuration
	Name *string `jsonapi:"attribute" json:"name,omitempty"`

	// Optional: The token of the notification configuration
	Token *string `jsonapi:"attribute" json:"token,omitempty"`

	// Optional: The list of run events that will trigger notifications.
	Triggers []NotificationTriggerType `jsonapi:"attribute" json:"triggers,omitempty"`

	// Optional: The url of the notification configuration
	URL *string `jsonapi:"attribute" json:"url,omitempty"`

	// Optional: The list of email addresses that will receive notification emails.
	// EmailAddresses is only available for TFE users. It is not available in TFC.
	EmailAddresses []string `jsonapi:"attribute" json:"email-addresses,omitempty"`

	// Optional: The list of users belonging to the organization that will receive notification emails.
	EmailUsers []*User `jsonapi:"relationship" json:"users,omitempty"`
}

NotificationConfigurationUpdateOptions represents the options for updating a existing notification configuration.

type NotificationDestinationType

type NotificationDestinationType string

NotificationDestinationType represents the destination type of the notification configuration.

const (
	NotificationDestinationTypeEmail          NotificationDestinationType = "email"
	NotificationDestinationTypeGeneric        NotificationDestinationType = "generic"
	NotificationDestinationTypeSlack          NotificationDestinationType = "slack"
	NotificationDestinationTypeMicrosoftTeams NotificationDestinationType = "microsoft-teams"
)

List of available notification destination types.

type NotificationTriggerType

type NotificationTriggerType string

NotificationTriggerType represents the different TFE notifications that can be sent as a run's progress transitions between different states

const (
	NotificationTriggerCreated               NotificationTriggerType = "run:created"
	NotificationTriggerPlanning              NotificationTriggerType = "run:planning"
	NotificationTriggerNeedsAttention        NotificationTriggerType = "run:needs_attention"
	NotificationTriggerApplying              NotificationTriggerType = "run:applying"
	NotificationTriggerCompleted             NotificationTriggerType = "run:completed"
	NotificationTriggerErrored               NotificationTriggerType = "run:errored"
	NotificationTriggerAssessmentDrifted     NotificationTriggerType = "assessment:drifted"
	NotificationTriggerAssessmentFailed      NotificationTriggerType = "assessment:failed"
	NotificationTriggerAssessmentCheckFailed NotificationTriggerType = "assessment:check_failure"
)

type OAuthClient

type OAuthClient struct {
	ID                  string              `jsonapi:"primary,oauth-clients"`
	APIURL              string              `jsonapi:"attribute" json:"api-url"`
	CallbackURL         string              `jsonapi:"attribute" json:"callback-url"`
	ConnectPath         string              `jsonapi:"attribute" json:"connect-path"`
	CreatedAt           time.Time           `jsonapi:"attribute" json:"created-at"`
	HTTPURL             string              `jsonapi:"attribute" json:"http-url"`
	Key                 string              `jsonapi:"attribute" json:"key"`
	RSAPublicKey        string              `jsonapi:"attribute" json:"rsa-public-key"`
	Name                *string             `jsonapi:"attribute" json:"name"`
	Secret              string              `jsonapi:"attribute" json:"secret"`
	ServiceProvider     ServiceProviderType `jsonapi:"attribute" json:"service-provider"`
	ServiceProviderName string              `jsonapi:"attribute" json:"service-provider-display-name"`

	// Relations
	Organization *Organization `jsonapi:"relationship" json:"organization"`
	OAuthTokens  []*OAuthToken `jsonapi:"relationship" json:"oauth-tokens"`
}

OAuthClient represents a connection between an organization and a VCS provider.

type OAuthClientCreateOptions

type OAuthClientCreateOptions 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,oauth-clients"`

	// A display name for the OAuth Client.
	Name *string `jsonapi:"attribute" json:"name"`

	// Required: The base URL of your VCS provider's API.
	APIURL *string `jsonapi:"attribute" json:"api-url"`

	// Required: The homepage of your VCS provider.
	HTTPURL *string `jsonapi:"attribute" json:"http-url"`

	// Optional: The OAuth Client key.
	Key *string `jsonapi:"attribute" json:"key,omitempty"`

	// Optional: The token string you were given by your VCS provider.
	OAuthToken *string `jsonapi:"attribute" json:"oauth-token-string,omitempty"`

	// Optional: Private key associated with this vcs provider - only available for ado_server
	PrivateKey *string `jsonapi:"attribute" json:"private-key,omitempty"`

	// Optional: Secret key associated with this vcs provider - only available for ado_server
	Secret *string `jsonapi:"attribute" json:"secret,omitempty"`

	// Optional: RSAPublicKey the text of the SSH public key associated with your BitBucket
	// Server Application Link.
	RSAPublicKey *string `jsonapi:"attribute" json:"rsa-public-key,omitempty"`

	// Required: The VCS provider being connected with.
	ServiceProvider *ServiceProviderType `jsonapi:"attribute" json:"service-provider"`
}

OAuthClientCreateOptions represents the options for creating an OAuth client.

type OAuthToken

type OAuthToken struct {
	ID                  string    `jsonapi:"primary,oauth-tokens"`
	UID                 string    `jsonapi:"attribute" json:"uid"`
	CreatedAt           time.Time `jsonapi:"attribute" json:"created-at"`
	HasSSHKey           bool      `jsonapi:"attribute" json:"has-ssh-key"`
	ServiceProviderUser string    `jsonapi:"attribute" json:"service-provider-user"`

	// Relations
	OAuthClient *OAuthClient `jsonapi:"relationship" json:"oauth-client"`
}

OAuthToken represents a VCS configuration including the associated OAuth token

type Organization

type Organization struct {
	Name                                              string                   `jsonapi:"primary,organizations"`
	AssessmentsEnforced                               bool                     `jsonapi:"attribute" json:"assessments-enforced"`
	CollaboratorAuthPolicy                            AuthPolicyType           `jsonapi:"attribute" json:"collaborator-auth-policy"`
	CostEstimationEnabled                             bool                     `jsonapi:"attribute" json:"cost-estimation-enabled"`
	CreatedAt                                         time.Time                `jsonapi:"attribute" json:"created-at"`
	Email                                             string                   `jsonapi:"attribute" json:"email"`
	ExternalID                                        string                   `jsonapi:"attribute" json:"external-id"`
	OwnersTeamSAMLRoleID                              string                   `jsonapi:"attribute" json:"owners-team-saml-role-id"`
	Permissions                                       *OrganizationPermissions `jsonapi:"attribute" json:"permissions"`
	SAMLEnabled                                       bool                     `jsonapi:"attribute" json:"saml-enabled"`
	SessionRemember                                   *int                     `jsonapi:"attribute" json:"session-remember"`
	SessionTimeout                                    *int                     `jsonapi:"attribute" json:"session-timeout"`
	TrialExpiresAt                                    time.Time                `jsonapi:"attribute" json:"trial-expires-at"`
	TwoFactorConformant                               bool                     `jsonapi:"attribute" json:"two-factor-conformant"`
	SendPassingStatusesForUntriggeredSpeculativePlans bool                     `jsonapi:"attribute" json:"send-passing-statuses-for-untriggered-speculative-plans"`
	RemainingTestableCount                            int                      `jsonapi:"attribute" json:"remaining-testable-count"`

	// Note: This will be false for TFE versions older than v202211, where the setting was introduced.
	// On those TFE versions, safe delete does not exist, so ALL deletes will be force deletes.
	AllowForceDeleteWorkspaces bool `jsonapi:"attribute" json:"allow-force-delete-workspaces"`
}

Organization represents a Terraform Enterprise organization.

type OrganizationAccess

type OrganizationAccess struct {
	ManagePolicies        bool `jsonapi:"attribute" json:"manage-policies"`
	ManagePolicyOverrides bool `jsonapi:"attribute" json:"manage-policy-overrides"`
	ManageWorkspaces      bool `jsonapi:"attribute" json:"manage-workspaces"`
	ManageVCSSettings     bool `jsonapi:"attribute" json:"manage-vcs-settings"`
	ManageProviders       bool `jsonapi:"attribute" json:"manage-providers"`
	ManageModules         bool `jsonapi:"attribute" json:"manage-modules"`
	ManageRunTasks        bool `jsonapi:"attribute" json:"manage-run-tasks"`
	ManageProjects        bool `jsonapi:"attribute" json:"manage-projects"`
	ReadWorkspaces        bool `jsonapi:"attribute" json:"read-workspaces"`
	ReadProjects          bool `jsonapi:"attribute" json:"read-projects"`
	ManageMembership      bool `jsonapi:"attribute" json:"manage-membership"`
}

OrganizationAccess represents the team's permissions on its organization

type OrganizationAccessOptions

type OrganizationAccessOptions struct {
	ManagePolicies        *bool `json:"manage-policies,omitempty"`
	ManagePolicyOverrides *bool `json:"manage-policy-overrides,omitempty"`
	ManageWorkspaces      *bool `json:"manage-workspaces,omitempty"`
	ManageVCSSettings     *bool `json:"manage-vcs-settings,omitempty"`
	ManageProviders       *bool `json:"manage-providers,omitempty"`
	ManageModules         *bool `json:"manage-modules,omitempty"`
	ManageRunTasks        *bool `json:"manage-run-tasks,omitempty"`
	ManageProjects        *bool `json:"manage-projects,omitempty"`
	ReadWorkspaces        *bool `json:"read-workspaces,omitempty"`
	ReadProjects          *bool `json:"read-projects,omitempty"`
	ManageMembership      *bool `json:"manage-membership,omitempty"`
}

OrganizationAccessOptions represents the organization access options of a team.

type OrganizationCreateOptions

type OrganizationCreateOptions 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,organizations"`

	// Required: Name of the organization.
	Name *string `jsonapi:"attribute" json:"name"`

	// Optional: AssessmentsEnforced toggles whether health assessment enablement is enforced across all assessable workspaces (those with a minimum terraform versio of 0.15.4 and not running in local execution mode) or if the decision to enabled health assessments is delegated to the workspace setting AssessmentsEnabled.
	AssessmentsEnforced *bool `jsonapi:"attribute" json:"assessments-enforced,omitempty"`

	// Required: Admin email address.
	Email *string `jsonapi:"attribute" json:"email"`

	// Optional: Session expiration (minutes).
	SessionRemember *int `jsonapi:"attribute" json:"session-remember,omitempty"`

	// Optional: Session timeout after inactivity (minutes).
	SessionTimeout *int `jsonapi:"attribute" json:"session-timeout,omitempty"`

	// Optional: Authentication policy.
	CollaboratorAuthPolicy *AuthPolicyType `jsonapi:"attribute" json:"collaborator-auth-policy,omitempty"`

	// Optional: Enable Cost Estimation
	CostEstimationEnabled *bool `jsonapi:"attribute" json:"cost-estimation-enabled,omitempty"`

	// Optional: The name of the "owners" team
	OwnersTeamSAMLRoleID *string `jsonapi:"attribute" json:"owners-team-saml-role-id,omitempty"`

	// Optional: SendPassingStatusesForUntriggeredSpeculativePlans toggles behavior of untriggered speculative plans to send status updates to version control systems like GitHub.
	SendPassingStatusesForUntriggeredSpeculativePlans *bool `jsonapi:"attribute" json:"send-passing-statuses-for-untriggered-speculative-plans,omitempty"`

	// Optional: AllowForceDeleteWorkspaces toggles behavior of allowing workspace admins to delete workspaces with resources under management.
	AllowForceDeleteWorkspaces *bool `jsonapi:"attribute" json:"allow-force-delete-workspaces,omitempty"`
}

OrganizationCreateOptions represents the options for creating an organization.

type OrganizationMembership

type OrganizationMembership struct {
	ID     string                       `jsonapi:"primary,organization-memberships"`
	Status OrganizationMembershipStatus `jsonapi:"attribute" json:"status"`
	Email  string                       `jsonapi:"attribute" json:"email"`

	// Relations
	Organization *Organization `jsonapi:"relationship" json:"organization"`
	User         *User         `jsonapi:"relationship" json:"user"`
	Teams        []*Team       `jsonapi:"relationship" json:"teams"`
}

OrganizationMembership represents a Terraform Enterprise organization membership.

type OrganizationMembershipCreateOptions

type OrganizationMembershipCreateOptions 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,organization-memberships"`

	// Required: User's email address.
	Email *string `jsonapi:"attribute" json:"email"`
}

OrganizationMembershipCreateOptions represents the options for creating an organization membership.

type OrganizationMembershipStatus

type OrganizationMembershipStatus string

OrganizationMembershipStatus represents an organization membership status.

const (
	OrganizationMembershipActive  OrganizationMembershipStatus = "active"
	OrganizationMembershipInvited OrganizationMembershipStatus = "invited"
)

type OrganizationPermissions

type OrganizationPermissions struct {
	CanCreateTeam               bool `json:"can-create-team"`
	CanCreateWorkspace          bool `json:"can-create-workspace"`
	CanCreateWorkspaceMigration bool `json:"can-create-workspace-migration"`
	CanDestroy                  bool `json:"can-destroy"`
	CanTraverse                 bool `json:"can-traverse"`
	CanUpdate                   bool `json:"can-update"`
	CanUpdateAPIToken           bool `json:"can-update-api-token"`
	CanUpdateOAuth              bool `json:"can-update-oauth"`
	CanUpdateSentinel           bool `json:"can-update-sentinel"`
}

OrganizationPermissions represents the organization permissions.

type OrganizationTag

type OrganizationTag struct {
	ID string `jsonapi:"primary,tags"`

	// Optional:
	Name string `jsonapi:"attribute" json:"name,omitempty"`

	// Optional: Number of workspaces that have this tag
	InstanceCount int `jsonapi:"attribute" json:"instance-count,omitempty"`

	// The org this tag belongs to
	Organization *Organization `jsonapi:"relationship" json:"organization"`
}

OrganizationTag represents a Terraform Enterprise Organization tag

type OrganizationToken

type OrganizationToken struct {
	ID        string     `jsonapi:"primary,authentication-tokens"`
	CreatedAt time.Time  `jsonapi:"attribute" json:"created-at"`
	Token     string     `jsonapi:"attribute" json:"token"`
	ExpiredAt *time.Time `jsonapi:"attribute" json:"expired-at"`
}

OrganizationToken represents a Terraform Enterprise organization token.

type OrganizationTokenCreateOptions

type OrganizationTokenCreateOptions struct {
	// Optional: The token's expiration date.
	// This feature is available in TFE release v202305-1 and later
	ExpiredAt *time.Time `jsonapi:"attribute" json:"expired-at,omitempty"`
}

OrganizationTokenCreateOptions contains the options for creating an organization token.

type OrganizationUpdateOptions

type OrganizationUpdateOptions 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,organizations"`

	// New name for the organization.
	Name *string `jsonapi:"attribute" json:"name,omitempty"`

	// Optional: AssessmentsEnforced toggles whether health assessment enablement is enforced across all assessable workspaces (those with a minimum terraform versio of 0.15.4 and not running in local execution mode) or if the decision to enabled health assessments is delegated to the workspace setting AssessmentsEnabled.
	AssessmentsEnforced *bool `jsonapi:"attribute" json:"assessments-enforced,omitempty"`

	// New admin email address.
	Email *string `jsonapi:"attribute" json:"email,omitempty"`

	// Session expiration (minutes).
	SessionRemember *int `jsonapi:"attribute" json:"session-remember,omitempty"`

	// Session timeout after inactivity (minutes).
	SessionTimeout *int `jsonapi:"attribute" json:"session-timeout,omitempty"`

	// Authentication policy.
	CollaboratorAuthPolicy *AuthPolicyType `jsonapi:"attribute" json:"collaborator-auth-policy,omitempty"`

	// Enable Cost Estimation
	CostEstimationEnabled *bool `jsonapi:"attribute" json:"cost-estimation-enabled,omitempty"`

	// The name of the "owners" team
	OwnersTeamSAMLRoleID *string `jsonapi:"attribute" json:"owners-team-saml-role-id,omitempty"`

	// SendPassingStatusesForUntriggeredSpeculativePlans toggles behavior of untriggered speculative plans to send status updates to version control systems like GitHub.
	SendPassingStatusesForUntriggeredSpeculativePlans *bool `jsonapi:"attribute" json:"send-passing-statuses-for-untriggered-speculative-plans,omitempty"`

	// Optional: AllowForceDeleteWorkspaces toggles behavior of allowing workspace admins to delete workspaces with resources under management.
	AllowForceDeleteWorkspaces *bool `jsonapi:"attribute" json:"allow-force-delete-workspaces,omitempty"`
}

OrganizationUpdateOptions represents the options for updating an organization.

type Pagination

type Pagination struct {
	CurrentPage  int  `json:"current-page"`
	PreviousPage *int `json:"prev-page"`
	NextPage     *int `json:"next-page"`
	TotalPages   int  `json:"total-pages"`
	TotalCount   int  `json:"total-count"`
}

Pagination is used to return the pagination details of an API request.

type PhaseStatusTimestamps

type PhaseStatusTimestamps struct {
	CanceledAt    *time.Time `json:"canceled-at,omitempty"`
	ErroredAt     *time.Time `json:"errored-at,omitempty"`
	FinishedAt    *time.Time `json:"finished-at,omitempty"`
	PendingAt     *time.Time `json:"pending-at,omitempty"`
	QueuedAt      *time.Time `json:"queued-at,omitempty"`
	StartedAt     *time.Time `json:"started-at,omitempty"`
	UnreachableAt *time.Time `json:"unreachable-at,omitempty"`
}

PhaseStatusTimestamps holds the timestamps for individual statuses for a phase.

type Plan

type Plan struct {
	ID               string                 `jsonapi:"primary,plans"`
	HasChanges       bool                   `jsonapi:"attribute" json:"has-changes"`
	LogReadURL       string                 `jsonapi:"attribute" json:"log-read-url"`
	Status           string                 `jsonapi:"attribute" json:"status"`
	StatusTimestamps *PhaseStatusTimestamps `jsonapi:"attribute" json:"status-timestamps"`

	ResourceReport
}

Plan represents a Terraform Enterprise plan.

type ResourceReport

type ResourceReport struct {
	Additions    *int `json:"resource-additions"`
	Changes      *int `json:"resource-changes"`
	Destructions *int `json:"resource-destructions"`
}

type RollbackStateVersionOptions

type RollbackStateVersionOptions 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,state-versions"`
	// Specifies state version to rollback to. Only its ID is specified.
	RollbackStateVersion *StateVersion `jsonapi:"relationship" json:"state-version"`
}

RollbackStateVersionOptions are options for rolling back a state version

type Run

type Run struct {
	ID                     string               `jsonapi:"primary,runs"`
	Actions                *RunActions          `jsonapi:"attribute" json:"actions"`
	AllowEmptyApply        bool                 `jsonapi:"attribute" json:"allow-empty-apply"`
	AutoApply              bool                 `jsonapi:"attribute" json:"auto-apply"`
	CreatedAt              time.Time            `jsonapi:"attribute" json:"created-at"`
	ForceCancelAvailableAt *time.Time           `jsonapi:"attribute" json:"force-cancel-available-at"`
	ExecutionMode          string               `jsonapi:"attribute" json:"execution-mode"`
	HasChanges             bool                 `jsonapi:"attribute" json:"has-changes"`
	IsDestroy              bool                 `jsonapi:"attribute" json:"is-destroy"`
	Message                string               `jsonapi:"attribute" json:"message"`
	Permissions            *RunPermissions      `jsonapi:"attribute" json:"permissions"`
	PlanOnly               bool                 `jsonapi:"attribute" json:"plan-only"`
	PositionInQueue        int                  `jsonapi:"attribute" json:"position-in-queue"`
	Refresh                bool                 `jsonapi:"attribute" json:"refresh"`
	RefreshOnly            bool                 `jsonapi:"attribute" json:"refresh-only"`
	ReplaceAddrs           []string             `jsonapi:"attribute" json:"replace-addrs,omitempty"`
	Source                 string               `jsonapi:"attribute" json:"source"`
	Status                 string               `jsonapi:"attribute" json:"status"`
	StatusTimestamps       *RunStatusTimestamps `jsonapi:"attribute" json:"status-timestamps"`
	TargetAddrs            []string             `jsonapi:"attribute" json:"target-addrs,omitempty"`
	TerraformVersion       string               `jsonapi:"attribute" json:"terraform-version"`
	Variables              []RunVariable        `jsonapi:"attribute" json:"variables"`

	// Relations
	Apply                *Apply                `jsonapi:"relationship" json:"apply"`
	ConfigurationVersion *ConfigurationVersion `jsonapi:"relationship" json:"configuration-version"`
	CostEstimate         *CostEstimate         `jsonapi:"relationship" json:"cost-estimate"`
	CreatedBy            *User                 `jsonapi:"relationship" json:"created-by"`
	Plan                 *Plan                 `jsonapi:"relationship" json:"plan"`
	Workspace            *Workspace            `jsonapi:"relationship" json:"workspace"`
}

Run is a terraform run.

type RunActions

type RunActions struct {
	IsCancelable      bool `json:"is-cancelable"`
	IsConfirmable     bool `json:"is-confirmable"`
	IsDiscardable     bool `json:"is-discardable"`
	IsForceCancelable bool `json:"is-force-cancelable"`
}

RunActions represents the run actions.

type RunCreateOptions

type RunCreateOptions 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,runs"`

	// AllowEmptyApply specifies whether Terraform can apply the run even when the plan contains no changes.
	// Often used to upgrade state after upgrading a workspace to a new terraform version.
	AllowEmptyApply *bool `jsonapi:"attribute" json:"allow-empty-apply,omitempty"`

	// TerraformVersion specifies the Terraform version to use in this run.
	// Only valid for plan-only runs; must be a valid Terraform version available to the organization.
	TerraformVersion *string `jsonapi:"attribute" json:"terraform-version,omitempty"`

	// PlanOnly specifies if this is a speculative, plan-only run that Terraform cannot apply.
	PlanOnly *bool `jsonapi:"attribute" json:"plan-only,omitempty"`

	// Specifies if this plan is a destroy plan, which will destroy all
	// provisioned resources.
	IsDestroy *bool `jsonapi:"attribute" json:"is-destroy,omitempty"`

	// Refresh determines if the run should
	// update the state prior to checking for differences
	Refresh *bool `jsonapi:"attribute" json:"refresh,omitempty"`

	// RefreshOnly determines whether the run should ignore config changes
	// and refresh the state only
	RefreshOnly *bool `jsonapi:"attribute" json:"refresh-only,omitempty"`

	// Specifies the message to be associated with this run.
	Message *string `jsonapi:"attribute" json:"message,omitempty"`

	// Specifies the configuration version to use for this run. If the
	// configuration version object is omitted, the run will be created using the
	// workspace's latest configuration version.
	ConfigurationVersion *ConfigurationVersion `jsonapi:"relationship" json:"configuration-version"`

	// Specifies the workspace where the run will be executed.
	Workspace *Workspace `jsonapi:"relationship" json:"workspace"`

	// If non-empty, requests that Terraform should create a plan including
	// actions only for the given objects (specified using resource address
	// syntax) and the objects they depend on.
	//
	// This capability is provided for exceptional circumstances only, such as
	// recovering from mistakes or working around existing Terraform
	// limitations. Terraform will generally mention the -target command line
	// option in its error messages describing situations where setting this
	// argument may be appropriate. This argument should not be used as part
	// of routine workflow and Terraform will emit warnings reminding about
	// this whenever this property is set.
	TargetAddrs []string `jsonapi:"attribute" json:"target-addrs,omitempty"`

	// If non-empty, requests that Terraform create a plan that replaces
	// (destroys and then re-creates) the objects specified by the given
	// resource addresses.
	ReplaceAddrs []string `jsonapi:"attribute" json:"replace-addrs,omitempty"`

	// AutoApply determines if the run should be applied automatically without
	// user confirmation. It defaults to the Workspace.AutoApply setting.
	AutoApply *bool `jsonapi:"attribute" json:"auto-apply,omitempty"`

	// Variables allows you to specify terraform input variables for
	// a particular run, prioritized over variables defined on the workspace.
	Variables []*RunVariable `jsonapi:"attribute" json:"variables,omitempty"`
}

RunCreateOptions represents the options for creating a new run.

type RunEvent

type RunEvent struct {
	ID          string    `jsonapi:"primary,run-events"`
	Action      string    `jsonapi:"attr,action"`
	CreatedAt   time.Time `jsonapi:"attr,created-at,iso8601"`
	Description string    `jsonapi:"attr,description"`

	// Relations - Note that `target` is not supported yet
	Actor *User `jsonapi:"relation,actor"`
}

RunEvent represents a Terraform Enterprise run event.

type RunEventList

type RunEventList struct {
	// Pagination is not supported by the API
	*Pagination
	Items []*RunEvent
}

RunEventList represents a list of run events.

type RunList

type RunList struct {
	*Pagination
	Items []*Run
}

RunList represents a list of runs.

type RunListOptions

type RunListOptions struct {
	ListOptions

	Organization *string `schema:"organization_name,omitempty"`

	WorkspaceID *string `schema:"workspace_id,omitempty"`

	// Optional: Searches runs that matches the supplied VCS username.
	User *string `schema:"search[user],omitempty"`

	// Optional: Searches runs that matches the supplied commit sha.
	Commit *string `schema:"search[commit],omitempty"`

	// Optional: Searches runs that matches the supplied VCS username, commit sha, run_id, and run message.
	// The presence of search[commit] or search[user] takes priority over this parameter and will be omitted.
	Search string `schema:"search[basic],omitempty"`

	// Optional: Comma-separated list of acceptable run statuses.
	// Options are listed at https://developer.hashicorp.com/terraform/cloud-docs/api-docs/run#run-states,
	// or as constants with the RunStatus string type.
	Status string `schema:"filter[status],omitempty"`

	// Optional: Comma-separated list of acceptable run sources.
	// Options are listed at https://developer.hashicorp.com/terraform/cloud-docs/api-docs/run#run-sources,
	// or as constants with the RunSource string type.
	Source string `schema:"filter[source],omitempty"`

	// Optional: Comma-separated list of acceptable run operation types.
	// Options are listed at https://developer.hashicorp.com/terraform/cloud-docs/api-docs/run#run-operations,
	// or as constants with the RunOperation string type.
	Operation string `schema:"filter[operation],omitempty"`

	// Optional: A list of relations to include. See available resources:
	// https://developer.hashicorp.com/terraform/cloud-docs/api-docs/run#available-related-resources
	Include []string `schema:"include,omitempty"`
}

RunListOptions represents the options for listing runs.

type RunOperation

type RunOperation string

RunOperation represents an operation type of run.

const (
	RunOperationPlanApply   RunOperation = "plan_and_apply"
	RunOperationPlanOnly    RunOperation = "plan_only"
	RunOperationRefreshOnly RunOperation = "refresh_only"
	RunOperationDestroy     RunOperation = "destroy"
	RunOperationEmptyApply  RunOperation = "empty_apply"
	// **Note: This operation type is still in BETA and subject to change.**
	RunOperationSavePlan RunOperation = "save_plan"
)

List all available run operations.

type RunPermissions

type RunPermissions struct {
	CanApply        bool `json:"can-apply"`
	CanCancel       bool `json:"can-cancel"`
	CanDiscard      bool `json:"can-discard"`
	CanForceCancel  bool `json:"can-force-cancel"`
	CanForceExecute bool `json:"can-force-execute"`
}

RunPermissions represents the run permissions.

type RunStatusTimestamps

type RunStatusTimestamps struct {
	AppliedAt            *time.Time `json:"applied-at,omitempty"`
	ApplyQueuedAt        *time.Time `json:"apply-queued-at,omitempty"`
	ApplyingAt           *time.Time `json:"applying-at,omitempty"`
	CanceledAt           *time.Time `json:"canceled-at,omitempty"`
	ConfirmedAt          *time.Time `json:"confirmed-at,omitempty"`
	CostEstimatedAt      *time.Time `json:"cost-estimated-at,omitempty"`
	CostEstimatingAt     *time.Time `json:"cost-estimating-at,omitempty"`
	DiscardedAt          *time.Time `json:"discarded-at,omitempty"`
	ErroredAt            *time.Time `json:"errored-at,omitempty"`
	ForceCanceledAt      *time.Time `json:"force-canceled-at,omitempty"`
	PlanQueueableAt      *time.Time `json:"plan-queueable-at,omitempty"`
	PlanQueuedAt         *time.Time `json:"plan-queued-at,omitempty"`
	PlannedAndFinishedAt *time.Time `json:"planned-and-finished-at,omitempty"`
	PlannedAt            *time.Time `json:"planned-at,omitempty"`
	PlanningAt           *time.Time `json:"planning-at,omitempty"`
	PolicyCheckedAt      *time.Time `json:"policy-checked-at,omitempty"`
	PolicySoftFailedAt   *time.Time `json:"policy-soft-failed-at,omitempty"`
}

RunStatusTimestamps holds the timestamps for individual run statuses.

type RunVariable

type RunVariable struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

RunVariable represents a variable that can be applied to a run. All values must be expressed as an HCL literal in the same syntax you would use when writing terraform code. See https://developer.hashicorp.com/terraform/language/expressions/types#types for more details.

type ServiceProviderType

type ServiceProviderType string

ServiceProviderType represents a VCS type.

const (
	ServiceProviderAzureDevOpsServer   ServiceProviderType = "ado_server"
	ServiceProviderAzureDevOpsServices ServiceProviderType = "ado_services"
	ServiceProviderBitbucket           ServiceProviderType = "bitbucket_hosted"
	// Bitbucket Server v5.4.0 and above
	ServiceProviderBitbucketServer ServiceProviderType = "bitbucket_server"
	// Bitbucket Server v5.3.0 and below
	ServiceProviderBitbucketServerLegacy ServiceProviderType = "bitbucket_server_legacy"
	ServiceProviderGithub                ServiceProviderType = "github"
	ServiceProviderGithubEE              ServiceProviderType = "github_enterprise"
	ServiceProviderGitlab                ServiceProviderType = "gitlab_hosted"
	ServiceProviderGitlabCE              ServiceProviderType = "gitlab_community_edition"
	ServiceProviderGitlabEE              ServiceProviderType = "gitlab_enterprise_edition"
)

List of available VCS types.

type StateVersion

type StateVersion struct {
	ID                 string             `jsonapi:"primary,state-versions"`
	CreatedAt          time.Time          `jsonapi:"attribute" json:"created-at"`
	DownloadURL        string             `jsonapi:"attribute" json:"hosted-state-download-url"`
	UploadURL          string             `jsonapi:"attribute" json:"hosted-state-upload-url"`
	JSONUploadURL      string             `jsonapi:"attribute" json:"hosted-json-state-upload-url"`
	Status             StateVersionStatus `jsonapi:"attribute" json:"status"`
	Serial             int64              `jsonapi:"attribute" json:"serial"`
	VCSCommitSHA       string             `jsonapi:"attribute" json:"vcs-commit-sha"`
	ResourcesProcessed bool               `jsonapi:"attribute" json:"resources-processed"`
	StateVersion       int                `jsonapi:"attribute" json:"state-version"`
	TerraformVersion   string             `jsonapi:"attribute" json:"terraform-version"`

	// Relations
	Outputs []*StateVersionOutput `jsonapi:"relationship" json:"outputs"`
}

StateVersion is a state version suitable for marshaling into JSONAPI

type StateVersionCreateVersionOptions

type StateVersionCreateVersionOptions 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,state-versions"`
	// The lineage of the state.
	Lineage *string `jsonapi:"attribute" json:"lineage,omitempty"`
	// The MD5 hash of the state version.
	MD5 *string `jsonapi:"attribute" json:"md5"`
	// The serial of the state.
	Serial *int64 `jsonapi:"attribute" json:"serial"`
	// The base64 encoded state.
	State *string `jsonapi:"attribute" json:"state"`
	// Force can be set to skip certain validations. Wrong use of this flag can
	// cause data loss, so USE WITH CAUTION!
	Force *bool `jsonapi:"attribute" json:"force"`
}

StateVersionCreateVersionOptions are options for creating a state version via JSONAPI

type StateVersionList

type StateVersionList struct {
	*Pagination
	Items []*StateVersion
}

StateVersionList is a list of state versions suitable for marshaling into JSONAPI

type StateVersionOutput

type StateVersionOutput struct {
	ID        string `jsonapi:"primary,state-version-outputs"`
	Name      string `jsonapi:"attribute" json:"name"`
	Sensitive bool   `jsonapi:"attribute" json:"sensitive"`
	Type      string `jsonapi:"attribute" json:"type"`
	Value     any    `jsonapi:"attribute" json:"value"`
}

type StateVersionStatus added in v0.1.15

type StateVersionStatus string

StateVersionStatus are available state version status values

const (
	StateVersionPending   StateVersionStatus = "pending"
	StateVersionFinalized StateVersionStatus = "finalized"
	StateVersionDiscarded StateVersionStatus = "discarded"
)

Available state version statuses.

type Tag

type Tag struct {
	ID   string `jsonapi:"primary,tags"`
	Name string `jsonapi:"attr,name,omitempty"`
}

Tag is owned by an organization and applied to workspaces. Used for grouping and search.

type Team

type Team struct {
	ID                 string              `jsonapi:"primary,teams"`
	Name               string              `jsonapi:"attribute" json:"name"`
	OrganizationAccess *OrganizationAccess `jsonapi:"attribute" json:"organization-access"`
	Visibility         string              `jsonapi:"attribute" json:"visibility"`
	Permissions        *TeamPermissions    `jsonapi:"attribute" json:"permissions"`
	UserCount          int                 `jsonapi:"attribute" json:"users-count"`
	SSOTeamID          *string             `jsonapi:"attribute" json:"sso-team-id"`

	// Relations
	Users []*User `jsonapi:"relationship" json:"users"`
}

Team represents an otf team.

type TeamCreateOptions

type TeamCreateOptions 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,teams"`

	// Name of the team.
	Name *string `jsonapi:"attribute" json:"name"`

	// Optional: Unique Identifier to control team membership via SAML
	SSOTeamID *string `jsonapi:"attribute" json:"sso-team-id,omitempty"`

	// The team's organization access
	OrganizationAccess *OrganizationAccessOptions `jsonapi:"attribute" json:"organization-access,omitempty"`

	// The team's visibility ("secret", "organization")
	Visibility *string `jsonapi:"attribute" json:"visibility,omitempty"`
}

TeamCreateOptions represents the options for creating a team.

type TeamPermissions

type TeamPermissions struct {
	CanDestroy          bool `jsonapi:"attribute" json:"can-destroy"`
	CanUpdateMembership bool `jsonapi:"attribute" json:"can-update-membership"`
}

TeamPermissions represents the current user's permissions on the team.

type TeamToken added in v0.1.15

type TeamToken struct {
	ID          string     `jsonapi:"primary,authentication-tokens"`
	CreatedAt   time.Time  `jsonapi:"attribute" json:"created-at"`
	Description string     `jsonapi:"attribute" json:"description"`
	LastUsedAt  time.Time  `jsonapi:"attribute" json:"last-used-at"`
	Token       string     `jsonapi:"attribute" json:"token"`
	ExpiredAt   *time.Time `jsonapi:"attribute" json:"expired-at"`
}

TeamToken represents a Terraform Enterprise team token.

type TeamTokenCreateOptions added in v0.1.15

type TeamTokenCreateOptions struct {
	// Optional: The token's expiration date.
	// This feature is available in TFE release v202305-1 and later
	ExpiredAt *time.Time `jsonapi:"attribute" json:"expired-at,omitempty"`
}

TeamTokenCreateOptions contains the options for creating a team token.

type TeamUpdateOptions

type TeamUpdateOptions 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,teams"`

	// Optional: New name for the team
	Name *string `jsonapi:"attribute" json:"name,omitempty"`

	// Optional: Unique Identifier to control team membership via SAML
	SSOTeamID *string `jsonapi:"attribute" json:"sso-team-id,omitempty"`

	// Optional: The team's organization access
	OrganizationAccess *OrganizationAccessOptions `jsonapi:"attribute" json:"organization-access,omitempty"`

	// Optional: The team's visibility ("secret", "organization")
	Visibility *string `jsonapi:"attribute" json:"visibility,omitempty"`
}

TeamUpdateOptions represents the options for updating a team.

type TwoFactor

type TwoFactor struct {
	Enabled  bool `jsonapi:"attribute" json:"enabled"`
	Verified bool `jsonapi:"attribute" json:"verified"`
}

TwoFactor represents the organization permissions.

type User

type User struct {
	ID               string     `jsonapi:"primary,users"`
	AvatarURL        string     `jsonapi:"attribute" json:"avatar-url"`
	Email            string     `jsonapi:"attribute" json:"email"`
	IsServiceAccount bool       `jsonapi:"attribute" json:"is-service-account"`
	TwoFactor        *TwoFactor `jsonapi:"attribute" json:"two-factor"`
	UnconfirmedEmail string     `jsonapi:"attribute" json:"unconfirmed-email"`
	Username         string     `jsonapi:"attribute" json:"username"`
	V2Only           bool       `jsonapi:"attribute" json:"v2-only"`
}

User represents an OTF user.

type VCSRepo

type VCSRepo struct {
	Branch            string `json:"branch"`
	DisplayIdentifier string `json:"display-identifier"`
	Identifier        string `json:"identifier"`
	IngressSubmodules bool   `json:"ingress-submodules"`
	OAuthTokenID      string `json:"oauth-token-id"`
	RepositoryHTTPURL string `json:"repository-http-url"`
	TagsRegex         string `json:"tags-regex"`
	ServiceProvider   string `json:"service-provider"`
}

VCSRepo contains the configuration of a VCS integration.

type VCSRepoOptions

type VCSRepoOptions struct {
	Branch            *string `json:"branch,omitempty"`
	Identifier        *string `json:"identifier,omitempty"`
	IngressSubmodules *bool   `json:"ingress-submodules,omitempty"`
	OAuthTokenID      *string `json:"oauth-token-id,omitempty"`
	TagsRegex         *string `json:"tags-regex,omitempty"`
}

VCSRepoOptions is used by workspaces, policy sets, and registry modules VCSRepoOptions represents the configuration options of a VCS integration.

type VCSRepoOptionsJSON

type VCSRepoOptionsJSON struct {
	VCSRepoOptions

	Valid bool `json:"-"`
	Set   bool `json:"-"`
}

VCSRepoOptionsJSON wraps VCSRepoOptions and implements json.Unmarshaler in order to differentiate between VCSRepoOptions having been explicitly to null, and omitted.

NOTE: Credit to https://www.calhoun.io/how-to-determine-if-a-json-key-has-been-set-to-null-or-not-provided/

func (*VCSRepoOptionsJSON) UnmarshalJSON

func (o *VCSRepoOptionsJSON) UnmarshalJSON(data []byte) error

UnmarshalJSON differentiates between VCSRepoOptions having been explicitly set to null by the client, or the client has left it out.

type Variable

type Variable struct {
	ID          string `jsonapi:"primary,vars"`
	Key         string `jsonapi:"attribute" json:"key"`
	Value       string `jsonapi:"attribute" json:"value"`
	Description string `jsonapi:"attribute" json:"description"`
	Category    string `jsonapi:"attribute" json:"category"`
	HCL         bool   `jsonapi:"attribute" json:"hcl"`
	Sensitive   bool   `jsonapi:"attribute" json:"sensitive"`
	VersionID   string `jsonapi:"attribute" json:"version-id"`
}

Variable is a workspace variable.

type VariableCreateOptions

type VariableCreateOptions 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,vars"`

	// The name of the variable.
	Key *string `jsonapi:"attribute" json:"key"`

	// The value of the variable.
	Value *string `jsonapi:"attribute" json:"value,omitempty"`

	// The description of the variable.
	Description *string `jsonapi:"attribute" json:"description,omitempty"`

	// Whether this is a Terraform or environment variable.
	Category *string `jsonapi:"attribute" json:"category"`

	// Whether to evaluate the value of the variable as a string of HCL code.
	HCL *bool `jsonapi:"attribute" json:"hcl,omitempty"`

	// Whether the value is sensitive.
	Sensitive *bool `jsonapi:"attribute" json:"sensitive,omitempty"`
}

VariableCreateOptions represents the options for creating a new variable.

type VariableList

type VariableList struct {
	*Pagination
	Items []*Variable
}

VariableList is a list of workspace variables

type VariableSet

type VariableSet struct {
	ID          string `jsonapi:"primary,varsets"`
	Name        string `jsonapi:"attribute" json:"name"`
	Description string `jsonapi:"attribute" json:"description"`
	Global      bool   `jsonapi:"attribute" json:"global"`

	// Relations
	Organization *Organization          `jsonapi:"relationship" json:"organization"`
	Workspaces   []*Workspace           `jsonapi:"relationship" json:"workspaces,omitempty"`
	Variables    []*VariableSetVariable `jsonapi:"relationship" json:"vars,omitempty"`
}

VariableSet represents a Terraform Enterprise variable set.

type VariableSetCreateOptions

type VariableSetCreateOptions 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,varsets"`

	// The name of the variable set.
	// Affects variable precedence when there are conflicts between Variable Sets
	// https://developer.hashicorp.com/terraform/cloud-docs/api-docs/variable-sets#apply-variable-set-to-workspaces
	Name string `jsonapi:"attribute" json:"name"`

	// A description to provide context for the variable set.
	Description string `jsonapi:"attribute" json:"description,omitempty"`

	// If true the variable set is considered in all runs in the organization.
	Global bool `jsonapi:"attribute" json:"global,omitempty"`
}

VariableSetCreateOptions represents the options for creating a new variable set within in a organization.

type VariableSetUpdateOptions

type VariableSetUpdateOptions 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,varsets"`

	// The name of the variable set.
	// Affects variable precedence when there are conflicts between Variable Sets
	// https://developer.hashicorp.com/terraform/cloud-docs/api-docs/variable-sets#apply-variable-set-to-workspaces
	Name *string `jsonapi:"attribute" json:"name,omitempty"`

	// A description to provide context for the variable set.
	Description *string `jsonapi:"attribute" json:"description,omitempty"`

	// If true the variable set is considered in all runs in the organization.
	Global *bool `jsonapi:"attribute" json:"global,omitempty"`
}

VariableSetUpdateOptions represents the options for updating a variable set.

type VariableSetVariable

type VariableSetVariable struct {
	*Variable

	// Relations
	VariableSet *VariableSet `jsonapi:"relationship" json:"varset"`
}

type VariableSetVariableCreateOptions

type VariableSetVariableCreateOptions 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,vars"`

	// The name of the variable.
	Key *string `jsonapi:"attribute" json:"key"`

	// The value of the variable.
	Value *string `jsonapi:"attribute" json:"value,omitempty"`

	// The description of the variable.
	Description *string `jsonapi:"attribute" json:"description,omitempty"`

	// Whether this is a Terraform or environment variable.
	Category *string `jsonapi:"attribute" json:"category"`

	// Whether to evaluate the value of the variable as a string of HCL code.
	HCL *bool `jsonapi:"attribute" json:"hcl,omitempty"`

	// Whether the value is sensitive.
	Sensitive *bool `jsonapi:"attribute" json:"sensitive,omitempty"`
}

VariableSetVariableCreatOptions represents the options for creating a new variable within a variable set

type VariableSetVariableUpdateOptions

type VariableSetVariableUpdateOptions 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,vars"`

	// The name of the variable.
	Key *string `jsonapi:"attribute" json:"key,omitempty"`

	// The value of the variable.
	Value *string `jsonapi:"attribute" json:"value,omitempty"`

	// The description of the variable.
	Description *string `jsonapi:"attribute" json:"description,omitempty"`

	// Whether to evaluate the value of the variable as a string of HCL code.
	HCL *bool `jsonapi:"attribute" json:"hcl,omitempty"`

	// Whether the value is sensitive.
	Sensitive *bool `jsonapi:"attribute" json:"sensitive,omitempty"`
}

VariableSetVariableUpdateOptions represents the options for updating a variable.

type VariableUpdateOptions

type VariableUpdateOptions 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,vars"`

	// The name of the variable.
	Key *string `jsonapi:"attribute" json:"key,omitempty"`

	// The value of the variable.
	Value *string `jsonapi:"attribute" json:"value,omitempty"`

	// The description of the variable.
	Description *string `jsonapi:"attribute" json:"description,omitempty"`

	// Whether this is a Terraform or environment variable.
	Category *string `jsonapi:"attribute" json:"category"`

	// Whether to evaluate the value of the variable as a string of HCL code.
	HCL *bool `jsonapi:"attribute" json:"hcl,omitempty"`

	// Whether the value is sensitive.
	Sensitive *bool `jsonapi:"attribute" json:"sensitive,omitempty"`
}

VariableUpdateOptions represents the options for updating a variable.

type Workspace

type Workspace struct {
	ID                         string                `jsonapi:"primary,workspaces"`
	Actions                    *WorkspaceActions     `jsonapi:"attribute" json:"actions"`
	AgentPoolID                string                `jsonapi:"attribute" json:"agent-pool-id"`
	AllowDestroyPlan           bool                  `jsonapi:"attribute" json:"allow-destroy-plan"`
	AutoApply                  bool                  `jsonapi:"attribute" json:"auto-apply"`
	CanQueueDestroyPlan        bool                  `jsonapi:"attribute" json:"can-queue-destroy-plan"`
	CreatedAt                  time.Time             `jsonapi:"attribute" json:"created-at"`
	Description                string                `jsonapi:"attribute" json:"description"`
	Environment                string                `jsonapi:"attribute" json:"environment"`
	ExecutionMode              string                `jsonapi:"attribute" json:"execution-mode"`
	FileTriggersEnabled        bool                  `jsonapi:"attribute" json:"file-triggers-enabled"`
	GlobalRemoteState          bool                  `jsonapi:"attribute" json:"global-remote-state"`
	Locked                     bool                  `jsonapi:"attribute" json:"locked"`
	MigrationEnvironment       string                `jsonapi:"attribute" json:"migration-environment"`
	Name                       string                `jsonapi:"attribute" json:"name"`
	Operations                 bool                  `jsonapi:"attribute" json:"operations"`
	Permissions                *WorkspacePermissions `jsonapi:"attribute" json:"permissions"`
	QueueAllRuns               bool                  `jsonapi:"attribute" json:"queue-all-runs"`
	SpeculativeEnabled         bool                  `jsonapi:"attribute" json:"speculative-enabled"`
	SourceName                 string                `jsonapi:"attribute" json:"source-name"`
	SourceURL                  string                `jsonapi:"attribute" json:"source-url"`
	StructuredRunOutputEnabled bool                  `jsonapi:"attribute" json:"structured-run-output-enabled"`
	TerraformVersion           string                `jsonapi:"attribute" json:"terraform-version"`
	TriggerPrefixes            []string              `jsonapi:"attribute" json:"trigger-prefixes"`
	TriggerPatterns            []string              `jsonapi:"attribute" json:"trigger-patterns"`
	VCSRepo                    *VCSRepo              `jsonapi:"attribute" json:"vcs-repo"`
	WorkingDirectory           string                `jsonapi:"attribute" json:"working-directory"`
	UpdatedAt                  time.Time             `jsonapi:"attribute" json:"updated-at"`
	ResourceCount              int                   `jsonapi:"attribute" json:"resource-count"`
	ApplyDurationAverage       time.Duration         `jsonapi:"attribute" json:"apply-duration-average"`
	PlanDurationAverage        time.Duration         `jsonapi:"attribute" json:"plan-duration-average"`
	PolicyCheckFailures        int                   `jsonapi:"attribute" json:"policy-check-failures"`
	RunFailures                int                   `jsonapi:"attribute" json:"run-failures"`
	RunsCount                  int                   `jsonapi:"attribute" json:"workspace-kpis-runs-count"`
	TagNames                   []string              `jsonapi:"attribute" json:"tag-names"`

	// Relations
	CurrentRun   *Run               `jsonapi:"relationship" json:"current-run"`
	Organization *Organization      `jsonapi:"relationship" json:"organization"`
	Outputs      []*WorkspaceOutput `jsonapi:"relationship" json:"outputs"`
}

Workspace represents a Terraform Enterprise workspace.

type WorkspaceActions

type WorkspaceActions struct {
	IsDestroyable bool `json:"is-destroyable"`
}

WorkspaceActions represents the workspace actions.

type WorkspaceCreateOptions

type WorkspaceCreateOptions 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,workspaces"`

	// Required when execution-mode is set to agent. The ID of the agent pool
	// belonging to the workspace's organization. This value must not be
	// specified if execution-mode is set to remote or local or if operations is
	// set to true.
	AgentPoolID *string `jsonapi:"attribute" json:"agent-pool-id,omitempty"`

	// Whether destroy plans can be queued on the workspace.
	AllowDestroyPlan *bool `jsonapi:"attribute" json:"allow-destroy-plan,omitempty"`

	// Whether to automatically apply changes when a Terraform plan is successful.
	AutoApply *bool `jsonapi:"attribute" json:"auto-apply,omitempty"`

	// A description for the workspace.
	Description *string `jsonapi:"attribute" json:"description,omitempty"`

	// Which execution mode to use. Valid values are remote, local, and agent.
	// When set to local, the workspace will be used for state storage only.
	// This value must not be specified if operations is specified.
	// 'agent' execution mode is not available in Terraform Enterprise.
	ExecutionMode *string `jsonapi:"attribute" json:"execution-mode,omitempty"`

	// Whether to filter runs based on the changed files in a VCS push. If
	// enabled, the working directory and trigger prefixes describe a set of
	// paths which must contain changes for a VCS push to trigger a run. If
	// disabled, any push will trigger a run.
	FileTriggersEnabled *bool `jsonapi:"attribute" json:"file-triggers-enabled,omitempty"`

	GlobalRemoteState *bool `jsonapi:"attribute" json:"global-remote-state,omitempty"`

	// The legacy TFE environment to use as the source of the migration, in the
	// form organization/environment. Omit this unless you are migrating a legacy
	// environment.
	MigrationEnvironment *string `jsonapi:"attribute" json:"migration-environment,omitempty"`

	// The name of the workspace, which can only include letters, numbers, -,
	// and _. This will be used as an identifier and must be unique in the
	// organization.
	Name *string `jsonapi:"attribute" json:"name"`

	// DEPRECATED. Whether the workspace will use remote or local execution mode.
	// Use ExecutionMode instead.
	Operations *bool `jsonapi:"attribute" json:"operations,omitempty"`

	// Organization the workspace belongs to. Required.
	Organization *string `schema:"organization_name"`

	// Whether to queue all runs. Unless this is set to true, runs triggered by
	// a webhook will not be queued until at least one run is manually queued.
	QueueAllRuns *bool `jsonapi:"attribute" json:"queue-all-runs,omitempty"`

	// Whether this workspace allows speculative plans. Setting this to false
	// prevents Terraform Cloud or the Terraform Enterprise instance from
	// running plans on pull requests, which can improve security if the VCS
	// repository is public or includes untrusted contributors.
	SpeculativeEnabled *bool `jsonapi:"attribute" json:"speculative-enabled,omitempty"`

	// BETA. A friendly name for the application or client creating this
	// workspace. If set, this will be displayed on the workspace as
	// "Created via <SOURCE NAME>".
	SourceName *string `jsonapi:"attribute" json:"source-name,omitempty"`

	// BETA. A URL for the application or client creating this workspace. This
	// can be the URL of a related resource in another app, or a link to
	// documentation or other info about the client.
	SourceURL *string `jsonapi:"attribute" json:"source-url,omitempty"`

	// BETA. Enable the experimental advanced run user interface.
	// This only applies to runs using Terraform version 0.15.2 or newer,
	// and runs executed using older versions will see the classic experience
	// regardless of this setting.
	StructuredRunOutputEnabled *bool `jsonapi:"attribute" json:"structured-run-output-enabled,omitempty"`

	// The version of Terraform to use for this workspace. Upon creating a
	// workspace, the latest version is selected unless otherwise specified.
	TerraformVersion *string `jsonapi:"attribute" json:"terraform-version,omitempty" schema:"terraform_version"`

	// List of repository-root-relative paths which list all locations to be
	// tracked for changes. See FileTriggersEnabled above for more details.
	TriggerPrefixes []string `jsonapi:"attribute" json:"trigger-prefixes,omitempty"`

	// Optional: List of patterns used to match against changed files in order
	// to decide whether to trigger a run or not.
	TriggerPatterns []string `jsonapi:"attribute" json:"trigger-patterns,omitempty"`

	// Settings for the workspace's VCS repository. If omitted, the workspace is
	// created without a VCS repo. If included, you must specify at least the
	// oauth-token-id and identifier keys below.
	VCSRepo *VCSRepoOptions `jsonapi:"attribute" json:"vcs-repo,omitempty"`

	// A relative path that Terraform will execute within. This defaults to the
	// root of your repository and is typically set to a subdirectory matching the
	// environment when multiple environments exist within the same repository.
	WorkingDirectory *string `jsonapi:"attribute" json:"working-directory,omitempty"`

	// A list of tags to attach to the workspace. If the tag does not already
	// exist, it is created and added to the workspace.
	Tags []*Tag `jsonapi:"relationship" json:"tags,omitempty"`
}

WorkspaceCreateOptions represents the options for creating a new workspace.

type WorkspaceList

type WorkspaceList struct {
	*Pagination
	Items []*Workspace
}

WorkspaceList represents a list of workspaces.

type WorkspaceListOptions

type WorkspaceListOptions struct {
	ListOptions

	// Optional: A search string (partial workspace name) used to filter the results.
	Search string `schema:"search[name],omitempty"`

	// Optional: A search string (comma-separated tag names) used to filter the results.
	Tags string `schema:"search[tags],omitempty"`

	// Optional: A search string (comma-separated tag names to exclude) used to filter the results.
	ExcludeTags string `schema:"search[exclude-tags],omitempty"`

	// Optional: A search on substring matching to filter the results.
	WildcardName string `schema:"search[wildcard-name],omitempty"`

	// Optional: A filter string to list all the workspaces linked to a given project id in the organization.
	ProjectID string `schema:"filter[project][id],omitempty"`
}

WorkspaceListOptions represents the options for listing workspaces.

type WorkspaceOutput added in v0.1.12

type WorkspaceOutput struct {
	ID        string `jsonapi:"primary,workspace-outputs"`
	Name      string `jsonapi:"attribute" json:"name"`
	Sensitive bool   `jsonapi:"attribute" json:"sensitive"`
	Type      string `jsonapi:"attribute" json:"output-type"`
	Value     any    `jsonapi:"attribute" json:"value"`
}

type WorkspacePermissions

type WorkspacePermissions struct {
	CanDestroy        bool `json:"can-destroy"`
	CanForceUnlock    bool `json:"can-force-unlock"`
	CanLock           bool `json:"can-lock"`
	CanQueueApply     bool `json:"can-queue-apply"`
	CanQueueDestroy   bool `json:"can-queue-destroy"`
	CanQueueRun       bool `json:"can-queue-run"`
	CanReadSettings   bool `json:"can-read-settings"`
	CanUnlock         bool `json:"can-unlock"`
	CanUpdate         bool `json:"can-update"`
	CanUpdateVariable bool `json:"can-update-variable"`
}

WorkspacePermissions represents the workspace permissions.

type WorkspaceUpdateOptions

type WorkspaceUpdateOptions 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,workspaces"`

	// Required when execution-mode is set to agent. The ID of the agent pool
	// belonging to the workspace's organization. This value must not be
	// specified if execution-mode is set to remote or local or if operations is
	// set to true.
	AgentPoolID *string `jsonapi:"attribute" json:"agent-pool-id,omitempty"`

	// Whether destroy plans can be queued on the workspace.
	AllowDestroyPlan *bool `jsonapi:"attribute" json:"allow-destroy-plan,omitempty"`

	// Whether to automatically apply changes when a Terraform plan is successful.
	AutoApply *bool `jsonapi:"attribute" json:"auto-apply,omitempty"`

	// A new name for the workspace, which can only include letters, numbers, -,
	// and _. This will be used as an identifier and must be unique in the
	// organization. Warning: Changing a workspace's name changes its URL in the
	// API and UI.
	Name *string `jsonapi:"attribute" json:"name,omitempty"`

	// A description for the workspace.
	Description *string `jsonapi:"attribute" json:"description,omitempty"`

	// Which execution mode to use. Valid values are remote, local, and agent.
	// When set to local, the workspace will be used for state storage only.
	// This value must not be specified if operations is specified.
	// 'agent' execution mode is not available in Terraform Enterprise.
	ExecutionMode *string `jsonapi:"attribute" json:"execution-mode,omitempty" schema:"execution_mode"`

	// Whether to filter runs based on the changed files in a VCS push. If
	// enabled, the working directory and trigger prefixes describe a set of
	// paths which must contain changes for a VCS push to trigger a run. If
	// disabled, any push will trigger a run.
	FileTriggersEnabled *bool `jsonapi:"attribute" json:"file-triggers-enabled,omitempty"`

	GlobalRemoteState *bool `jsonapi:"attribute" json:"global-remote-state,omitempty"`

	// DEPRECATED. Whether the workspace will use remote or local execution mode.
	// Use ExecutionMode instead.
	Operations *bool `jsonapi:"attribute" json:"operations,omitempty"`

	// Whether to queue all runs. Unless this is set to true, runs triggered by
	// a webhook will not be queued until at least one run is manually queued.
	QueueAllRuns *bool `jsonapi:"attribute" json:"queue-all-runs,omitempty"`

	// Whether this workspace allows speculative plans. Setting this to false
	// prevents Terraform Cloud or the Terraform Enterprise instance from
	// running plans on pull requests, which can improve security if the VCS
	// repository is public or includes untrusted contributors.
	SpeculativeEnabled *bool `jsonapi:"attribute" json:"speculative-enabled,omitempty"`

	// BETA. Enable the experimental advanced run user interface.
	// This only applies to runs using Terraform version 0.15.2 or newer,
	// and runs executed using older versions will see the classic experience
	// regardless of this setting.
	StructuredRunOutputEnabled *bool `jsonapi:"attribute" json:"structured-run-output-enabled,omitempty"`

	// The version of Terraform to use for this workspace.
	TerraformVersion *string `jsonapi:"attribute" json:"terraform-version,omitempty" schema:"terraform_version"`

	// List of repository-root-relative paths which list all locations to be
	// tracked for changes. See FileTriggersEnabled above for more details.
	TriggerPrefixes []string `jsonapi:"attribute" json:"trigger-prefixes,omitempty"`

	// Optional: List of patterns used to match against changed files in order
	// to decide whether to trigger a run or not.
	TriggerPatterns []string `jsonapi:"attribute" json:"trigger-patterns,omitempty"`

	// To delete a workspace's existing VCS repo, specify null instead of an
	// object. To modify a workspace's existing VCS repo, include whichever of
	// the keys below you wish to modify. To add a new VCS repo to a workspace
	// that didn't previously have one, include at least the oauth-token-id and
	// identifier keys.
	VCSRepo VCSRepoOptionsJSON `jsonapi:"attribute" json:"vcs-repo,omitempty"`

	// A relative path that Terraform will execute within. This defaults to the
	// root of your repository and is typically set to a subdirectory matching
	// the environment when multiple environments exist within the same
	// repository.
	WorkingDirectory *string `jsonapi:"attribute" json:"working-directory,omitempty"`
}

WorkspaceUpdateOptions represents the options for updating a workspace.

func (*WorkspaceUpdateOptions) Validate

func (opts *WorkspaceUpdateOptions) Validate() error

type WorkspaceVariable

type WorkspaceVariable struct {
	*Variable

	// Relations
	Workspace *Workspace `jsonapi:"relationship" json:"configurable"`
}

WorkspaceVariable is a workspace variable.

Jump to

Keyboard shortcuts

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