Documentation
¶
Overview ¶
Package html provides the otf web app, serving up HTML formatted pages and associated assets (CSS, JS, etc).
Index ¶
- Constants
- Variables
- func AddRoutes(logger logr.Logger, config *Config, srvConfig *otfhttp.ServerConfig, ...) error
- func NewGithubEnterpriseClient(hostname string, httpClient *http.Client) (*github.Client, error)
- func NewTestGithubServer(t *testing.T, user *otf.User) *httptest.Server
- type Application
- type ApplicationOption
- type Authenticator
- type Cloud
- type CloudConfig
- type Config
- type DirectoryClient
- type DirectoryClientOptions
- type GithubCloud
- func (g GithubCloud) CloudName() string
- func (g GithubCloud) Endpoint() (oauth2.Endpoint, error)
- func (g GithubCloud) Hostname() string
- func (g *GithubCloud) NewDirectoryClient(ctx context.Context, opts DirectoryClientOptions) (DirectoryClient, error)
- func (g GithubCloud) Scopes() []string
- func (g GithubCloud) SkipTLSVerification() bool
- type GithubConfig
- type GitlabConfig
- type ListOptions
- type OAuthCredentials
- type UserList
Constants ¶
const ( FlashSuccess flashType = "success" FlashError flashType = "error" )
const DefaultGithubHostname = "github.com"
const DefaultGitlabHostname = "gitlab.com"
const DefaultPathPrefix = "/"
Variables ¶
var ( ErrOAuthCredentialsUnspecified = errors.New("no oauth credentials have been specified") ErrOAuthCredentialsIncomplete = errors.New("must specify both client ID and client secret") )
Functions ¶
func AddRoutes ¶
func AddRoutes(logger logr.Logger, config *Config, srvConfig *otfhttp.ServerConfig, services otf.Application, router *otfhttp.Router) error
AddRoutes adds routes for the html web app.
Types ¶
type Application ¶
type Application struct { // otf service accessors otf.Application // logger for logging messages logr.Logger // server-side-events server *sse.Server // contains filtered or unexported fields }
Application is the otf web app.
type ApplicationOption ¶
type ApplicationOption func(*Application)
func WithSiteToken ¶
func WithSiteToken(token string) ApplicationOption
type Authenticator ¶
type Authenticator struct { Cloud otf.Application }
Authenticator logs people onto the system, synchronising their user account and various organization and team memberships from an external directory.
func NewAuthenticatorsFromConfig ¶
func NewAuthenticatorsFromConfig(app otf.Application, configs ...CloudConfig) ([]*Authenticator, error)
NewAuthenticatorsFromConfig constructs authenticators from the given cloud configurations. If config is unspecified then its corresponding cloud authenticator is skipped.
func (*Authenticator) RequestPath ¶
func (a *Authenticator) RequestPath() string
type Cloud ¶
type Cloud interface { NewDirectoryClient(context.Context, DirectoryClientOptions) (DirectoryClient, error) CloudConfig }
type CloudConfig ¶
type Config ¶
type Config struct { DevMode bool // contains filtered or unexported fields }
Config is the web app configuration.
func NewConfigFromFlags ¶
NewConfigFromFlags binds flags to the config. The flagset must be parsed in order for the config to be populated.
type DirectoryClient ¶
type DirectoryClientOptions ¶
type GithubCloud ¶
type GithubCloud struct {
*GithubConfig
}
func (*GithubCloud) NewDirectoryClient ¶
func (g *GithubCloud) NewDirectoryClient(ctx context.Context, opts DirectoryClientOptions) (DirectoryClient, error)
func (GithubCloud) SkipTLSVerification ¶
func (g GithubCloud) SkipTLSVerification() bool
type GithubConfig ¶
type GithubConfig struct {
// contains filtered or unexported fields
}
func NewGithubConfigFromFlags ¶
func NewGithubConfigFromFlags(flags *pflag.FlagSet) *GithubConfig
func (*GithubConfig) NewCloud ¶
func (cfg *GithubConfig) NewCloud() (Cloud, error)
func (GithubConfig) SkipTLSVerification ¶
func (g GithubConfig) SkipTLSVerification() bool
type GitlabConfig ¶
type GitlabConfig struct {
// contains filtered or unexported fields
}
func NewGitlabConfigFromFlags ¶
func NewGitlabConfigFromFlags(flags *pflag.FlagSet) *GitlabConfig
func (*GitlabConfig) NewCloud ¶
func (cfg *GitlabConfig) NewCloud() (Cloud, error)
func (GitlabConfig) SkipTLSVerification ¶
func (g GitlabConfig) SkipTLSVerification() bool
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 HTTP requests. Pagination allows breaking up large result sets into chunks, or "pages".
type OAuthCredentials ¶
type OAuthCredentials struct {
// contains filtered or unexported fields
}
func (*OAuthCredentials) AddFlags ¶
func (a *OAuthCredentials) AddFlags(flags *pflag.FlagSet)
func (*OAuthCredentials) ClientID ¶
func (a *OAuthCredentials) ClientID() string
func (*OAuthCredentials) ClientSecret ¶
func (a *OAuthCredentials) ClientSecret() string
func (*OAuthCredentials) Valid ¶
func (a *OAuthCredentials) Valid() error
Source Files
¶
- agent_token.go
- app.go
- app_test_helper.go
- auth.go
- authenticator.go
- cache_buster.go
- cloud.go
- cloud_config.go
- context.go
- cookies.go
- error.go
- flash.go
- github.go
- gitlab.go
- html.go
- middleware.go
- oauth_credentials.go
- organization.go
- path_helpers.go
- renderer.go
- run.go
- run_list.go
- session.go
- static.go
- team.go
- test_helpers.go
- token.go
- user.go
- view_engine.go
- workspace.go
- workspace_list.go
- workspace_permission.go