controllers

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MPL-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package controllers package

Index

Constants

View Source
const (
	UserSchemaURI           SCIMSchemaURI = "urn:ietf:params:scim:schemas:core:2.0:User"
	UserEnterpriseSchemaURI SCIMSchemaURI = "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
	GroupSchemaURI          SCIMSchemaURI = "urn:ietf:params:scim:schemas:core:2.0:Group"
	ListSchemaURI           SCIMSchemaURI = "urn:ietf:params:scim:api:messages:2.0:ListResponse"
	UpdateSchemaURI         SCIMSchemaURI = "urn:ietf:params:scim:api:messages:2.0:PatchOp"
	ErrorSchemaURI          SCIMSchemaURI = "urn:ietf:params:scim:api:messages:2.0:Error"

	UserResourceType  SCIMResourceType = "User"
	GroupResourceType SCIMResourceType = "Group"
)

SCIMSchemaURI constants are used to indicate the schema type. SCIMResourceType constants are used to indicate the resource type being returned.

Variables

This section is empty.

Functions

This section is empty.

Types

type AvailableInstallationPackagesResponse added in v0.12.0

type AvailableInstallationPackagesResponse struct {
	Archives map[string]any `json:"archives"`
}

AvailableInstallationPackagesResponse represents the response for GetAvailableInstallationPackages.

type AvailableProviderVersionsResponse added in v0.12.0

type AvailableProviderVersionsResponse struct {
	Versions map[string]struct{} `json:"versions"`
}

AvailableProviderVersionsResponse represents the response for GetAvailableProviderVersions.

type Controller

type Controller interface {
	// RegisterRoutes adds controller handlers to the router
	RegisterRoutes(router chi.Router)
}

Controller encapsulates the logic for registering handler functions

func NewHealthController

func NewHealthController(respWriter response.Writer) Controller

NewHealthController creates an instance of HealthController

func NewJobController

func NewJobController(
	logger logger.Logger,
	respWriter response.Writer,
	jwtAuthMiddleware middleware.Handler,
	jwsProvider jws.Provider,
	jobService job.Service,
) Controller

NewJobController creates an instance of jobController

func NewModuleRegistryController

func NewModuleRegistryController(
	logger logger.Logger,
	respWriter response.Writer,
	jwtAuthMiddleware middleware.Handler,
	moduleRegistryService moduleregistry.Service,
	moduleRegistryMaxUploadSize int,
) Controller

NewModuleRegistryController creates an instance of moduleRegistryController

func NewOIDCController

func NewOIDCController(respWriter response.Writer, jwsProvider jws.Provider, tharsisAPIURL string) Controller

NewOIDCController creates an instance of oidcController

func NewProviderMirrorController added in v0.12.0

func NewProviderMirrorController(
	logger logger.Logger,
	respWriter response.Writer,
	jwtAuthMiddleware middleware.Handler,
	providerMirrorService providermirror.Service,
) Controller

NewProviderMirrorController creates an instance of providerMirrorController.

func NewProviderRegistryController

func NewProviderRegistryController(
	logger logger.Logger,
	respWriter response.Writer,
	jwtAuthMiddleware middleware.Handler,
	providerRegistryService providerregistry.Service,
) Controller

NewProviderRegistryController creates an instance of providerRegistryController

func NewRunController

func NewRunController(
	logger logger.Logger,
	respWriter response.Writer,
	jwtAuthMiddleware middleware.Handler,
	runService run.Service,
) Controller

NewRunController creates an instance of runController

func NewSCIMController

func NewSCIMController(
	logger logger.Logger,
	respWriter response.Writer,
	jwtAuthMiddleware middleware.Handler,
	userService user.Service,
	teamService team.Service,
	scimService scim.Service,
) Controller

NewSCIMController creates an instance of scimController

func NewServiceAccountController

func NewServiceAccountController(
	logger logger.Logger,
	respWriter response.Writer,
	saService serviceaccount.Service,
) Controller

NewServiceAccountController handles service account REST requests

func NewVCSController

func NewVCSController(
	logger logger.Logger,
	respWriter response.Writer,
	authenticator *auth.Authenticator,
	vcsService vcs.Service,
) Controller

NewVCSController creates an instance of vcsController.

type CreateSCIMGroupRequest

type CreateSCIMGroupRequest struct {
	DisplayName string          `json:"displayName"`
	ExternalID  string          `json:"externalId"`
	Schemas     []SCIMSchemaURI `json:"schemas"`
}

CreateSCIMGroupRequest represents a SCIM create group (Team) request.

type CreateSCIMUserRequest

type CreateSCIMUserRequest struct {
	ExternalID string          `json:"externalId"`
	Emails     []SCIMEmail     `json:"emails"`
	Schemas    []SCIMSchemaURI `json:"schemas"`
	Active     bool            `json:"active"`
}

CreateSCIMUserRequest represents a SCIM create user request.

type GPGPublicKey

type GPGPublicKey struct {
	KeyID          string `json:"key_id"`
	ASCIIArmor     string `json:"ascii_armor"`
	TrustSignature string `json:"trust_signature"`
	Source         string `json:"source"`
	SourceURL      string `json:"source_url"`
}

GPGPublicKey represents a GPG public key used to sign a provider version

type RegistryModuleVersion

type RegistryModuleVersion struct {
	Version string `json:"version"`
}

RegistryModuleVersion represents a module version

type RegistryModuleVersionList

type RegistryModuleVersionList struct {
	Versions []RegistryModuleVersion `json:"versions"`
}

RegistryModuleVersionList contains a list of module versions

type RegistryModuleVersionsResponse

type RegistryModuleVersionsResponse struct {
	Modules []RegistryModuleVersionList `json:"modules"`
}

RegistryModuleVersionsResponse is the response for the modules versions endpoint

type RegistryProviderDownloadResponse

type RegistryProviderDownloadResponse struct {
	SHASumsSignatureURL string      `json:"shasums_signature_url"`
	OperatingSystem     string      `json:"os"`
	Arch                string      `json:"arch"`
	Filename            string      `json:"filename"`
	DownloadURL         string      `json:"download_url"`
	SHASumsURL          string      `json:"shasums_url"`
	SHASum              string      `json:"shasum"`
	Protocols           []string    `json:"protocols"`
	SigningKeys         SigningKeys `json:"signing_keys"`
}

RegistryProviderDownloadResponse is the response that adheres to the Terraform Provider Registry Protocol

type RegistryProviderPlatform

type RegistryProviderPlatform struct {
	OperatingSystem string `json:"os"`
	Arch            string `json:"arch"`
}

RegistryProviderPlatform represents a platform for a provider version

type RegistryProviderVersion

type RegistryProviderVersion struct {
	Version   string                     `json:"version"`
	Protocols []string                   `json:"protocols"`
	Platforms []RegistryProviderPlatform `json:"platforms"`
}

RegistryProviderVersion represents a provider version

type RegistryProviderVersionList

type RegistryProviderVersionList struct {
	Versions []RegistryProviderVersion `json:"versions"`
}

RegistryProviderVersionList contains a list of provider versions

type SCIMEmail

type SCIMEmail struct {
	Type    string `json:"type"`
	Value   string `json:"value"`
	Primary bool   `json:"primary"`
}

SCIMEmail represents a SCIM user email.

type SCIMGroup

type SCIMGroup struct {
	Metadata    SCIMMetadata    `json:"meta"`
	ID          string          `json:"id"`
	ExternalID  string          `json:"externalId"`
	DisplayName string          `json:"displayName"`
	SchemaURIs  []SCIMSchemaURI `json:"schemas"`
}

SCIMGroup represents a SCIM group resource.

func TharsisTeamToSCIMGroup

func TharsisTeamToSCIMGroup(team *models.Team) *SCIMGroup

TharsisTeamToSCIMGroup converts from Tharsis team to a SCIMGroup.

type SCIMListResponse

type SCIMListResponse struct {
	SchemaURIs   []SCIMSchemaURI `json:"schemas"`
	Resources    []interface{}   `json:"Resources"`
	TotalResults int             `json:"totalResults"`
	StartIndex   int             `json:"startIndex"`
	ItemsPerPage int             `json:"itemsPerPage"`
}

SCIMListResponse is a SCIM list response.

type SCIMMetadata

type SCIMMetadata struct {
	CreatedAt    *time.Time       `json:"created,omitempty"`
	LastModified *time.Time       `json:"lastModified,omitempty"`
	ResourceType SCIMResourceType `json:"resourceType"`
}

SCIMMetadata is the metadata for SCIM resources.

type SCIMOperation

type SCIMOperation struct {
	Value interface{} `json:"value"`
	OP    string      `json:"op"`
	Path  string      `json:"path"`
}

SCIMOperation represents a SCIM PATCH request operation.

type SCIMResourceType

type SCIMResourceType string

SCIMResourceType represents a SCIM resource type.

type SCIMSchemaURI

type SCIMSchemaURI string

SCIMSchemaURI defines the SchemaURI used by SCIM resources. See: https://www.rfc-editor.org/rfc/rfc7644#section-8.2.

type SCIMUpdateRequest

type SCIMUpdateRequest struct {
	Schemas    []SCIMSchemaURI `json:"schemas"`
	Operations []SCIMOperation `json:"operations"`
}

SCIMUpdateRequest represents a SCIM update request.

type SCIMUser

type SCIMUser struct {
	SchemaURIs []SCIMSchemaURI `json:"schemas"`
	ID         string          `json:"id"`
	ExternalID string          `json:"externalId"`
	Metadata   SCIMMetadata    `json:"meta"`
	Username   string          `json:"userName"`
	Emails     []SCIMEmail     `json:"emails"`
	Active     bool            `json:"active"`
}

SCIMUser represents a SCIM user resource.

func TharsisUserToSCIMUser

func TharsisUserToSCIMUser(user *models.User) *SCIMUser

TharsisUserToSCIMUser converts a Tharsis user to a SCIM user.

type ScimErrorResponse

type ScimErrorResponse struct {
	Detail     string          `json:"detail"`
	Status     string          `json:"status"`
	SchemaURIs []SCIMSchemaURI `json:"schemas"`
}

ScimErrorResponse is the SCIM specific error response.

type ServiceAccountLoginOptions

type ServiceAccountLoginOptions struct {
	// ServiceAccount needs to be set to the full path of the service account
	ServiceAccountPath *string `jsonapi:"attr,service-account-path,omitempty"`
	// Token is set to the token being used to login with
	Token *string `jsonapi:"attr,token,omitempty"`
	// Type is a public field utilized by JSON:API to
	// set the resource type via the field tag.
	Type string `jsonapi:"primary,service-account-token"`
}

ServiceAccountLoginOptions is used to login to a service account

type ServiceAccountLoginResponse

type ServiceAccountLoginResponse struct {
	ID    string `jsonapi:"primary,service-account-token"`
	Token string `jsonapi:"attr,token"`
}

ServiceAccountLoginResponse is returned after logging in to a service account

type SigningKeys

type SigningKeys struct {
	GPGPublicKeys []GPGPublicKey `json:"gpg_public_keys"`
}

SigningKeys contains a list of GPG public keys

Directories

Path Synopsis
Package tfe package
Package tfe package

Jump to

Keyboard shortcuts

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