Documentation ¶
Overview ¶
Package tfeapi provides common functionality useful for implementation of the Hashicorp TFE/TFC API, which uses the json:api encoding
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
func Error(w http.ResponseWriter, err error)
Error writes an HTTP response with a JSON-API encoded error.
func IsTerraformCLI ¶
Types ¶
type IncludeFunc ¶
IncludeFunc retrieves the resource for inclusion
type IncludeName ¶
type IncludeName string
IncludeName is the name used in the query parameter to request a resource be included, i.e. /?include=<IncludeName>
const ( IncludeOrganization IncludeName = "organization" IncludeWorkspace IncludeName = "workspace" IncludeCurrentRun IncludeName = "current_run" IncludeConfig IncludeName = "configuration_version" IncludeIngress IncludeName = "ingress_attributes" IncludeUsers IncludeName = "users" IncludeCreatedBy IncludeName = "created_by" IncludeOutputs IncludeName = "outputs" )
type Responder ¶
type Responder struct {
// contains filtered or unexported fields
}
Responder handles responding to API requests.
func NewResponder ¶
func NewResponder() *Responder
func (Responder) Register ¶
func (i Responder) Register(name IncludeName, f IncludeFunc)
Register registers an IncludeFunc to be called whenever IncludeName is specified in an API query.
func (*Responder) Respond ¶
func (res *Responder) Respond(w http.ResponseWriter, r *http.Request, payload any, status int, opts ...jsonapi.MarshalOption)
func (*Responder) RespondWithPage ¶
func (res *Responder) RespondWithPage(w http.ResponseWriter, r *http.Request, items any, pagination *resource.Pagination)
Click to show internal directories.
Click to hide internal directories.