Documentation
¶
Index ¶
- Constants
- func Block(h http.Handler) http.Handler
- type API
- type HandleFunc
- type RemoteObject
- type Response
- type TerminalSettings
- func (t *TerminalSettings) Clone() *TerminalSettings
- func (t *TerminalSettings) Dial() (*websocket.Conn, *http.Response, error)
- func (t *TerminalSettings) Dialer() *websocket.Dialer
- func (t *TerminalSettings) IsEqual(other *TerminalSettings) bool
- func (t *TerminalSettings) URL() (*url.URL, error)
- func (t *TerminalSettings) Validate() error
Constants ¶
View Source
const ( // Custom content type for API responses, to catch routing / programming mistakes ResponseContentType = "application/vnd.gitlab-workhorse+json" // This header carries the JWT token for gitlab-rails RequestHeader = "Gitlab-Workhorse-Api-Request" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
func NewAPI ¶
func NewAPI(myURL *url.URL, version string, roundTripper *badgateway.RoundTripper) *API
func (*API) PreAuthorize ¶ added in v1.2.0
func (api *API) PreAuthorize(suffix string, r *http.Request) (httpResponse *http.Response, authResponse *Response, outErr error)
Perform a pre-authorization check against the API for the given HTTP request
If `outErr` is set, the other fields will be nil and it should be treated as a 500 error.
If httpResponse is present, the caller is responsible for closing its body ¶
authResponse will only be present if the authorization check was successful
func (*API) PreAuthorizeHandler ¶
func (api *API) PreAuthorizeHandler(next HandleFunc, suffix string) http.Handler
type HandleFunc ¶
type HandleFunc func(http.ResponseWriter, *http.Request, *Response)
type RemoteObject ¶
type RemoteObject struct {
// GetURL is an S3 GetObject URL
GetURL string
// DeleteURL is a presigned S3 RemoveObject URL
DeleteURL string
// StoreURL is the temporary presigned S3 PutObject URL to which upload the first found file
StoreURL string
// ID is a unique identifier of object storage upload
ID string
// Timeout is a number that represents timeout in seconds for sending data to StoreURL
Timeout int
}
type Response ¶
type Response struct {
// GL_ID is an environment variable used by gitlab-shell hooks during 'git
// push' and 'git pull'
GL_ID string
// GL_USERNAME holds gitlab username of the user who is taking the action causing hooks to be invoked
GL_USERNAME string
// GL_REPOSITORY is an environment variable used by gitlab-shell hooks during
// 'git push' and 'git pull'
GL_REPOSITORY string
// RepoPath is the full path on disk to the Git repository the request is
// about
RepoPath string
// StoreLFSPath is provided by the GitLab Rails application to mark where the tmp file should be placed.
// This field is deprecated. GitLab will use TempPath instead
StoreLFSPath string
// LFS object id
LfsOid string
// LFS object size
LfsSize int64
// TmpPath is the path where we should store temporary files
// This is set by authorization middleware
TempPath string
// RemoteObject is provided by the GitLab Rails application
// and defines a way to store object on remote storage
RemoteObject RemoteObject
// Archive is the path where the artifacts archive is stored
Archive string `json:"archive"`
// Entry is a filename inside the archive point to file that needs to be extracted
Entry string `json:"entry"`
// Used to communicate terminal session details
Terminal *TerminalSettings
// GitalyServer specifies an address and authentication token for a gitaly server we should connect to.
GitalyServer gitaly.Server
// Repository object for making gRPC requests to Gitaly. This will
// eventually replace the RepoPath field.
Repository pb.Repository
// For git-http, does the requestor have the right to view all refs?
ShowAllRefs bool
}
type TerminalSettings ¶ added in v1.2.0
type TerminalSettings struct {
// The terminal provider may require use of a particular subprotocol. If so,
// it must be specified here, and Workhorse must have a matching codec.
Subprotocols []string
// The websocket URL to connect to.
Url string
// Any headers (e.g., Authorization) to send with the websocket request
Header http.Header
// The CA roots to validate the remote endpoint with, for wss:// URLs. The
// system-provided CA pool will be used if this is blank. PEM-encoded data.
CAPem string
// The value is specified in seconds. It is converted to time.Duration
// later.
MaxSessionTime int
}
func (*TerminalSettings) Clone ¶ added in v1.2.0
func (t *TerminalSettings) Clone() *TerminalSettings
func (*TerminalSettings) Dialer ¶ added in v1.2.0
func (t *TerminalSettings) Dialer() *websocket.Dialer
func (*TerminalSettings) IsEqual ¶ added in v1.2.0
func (t *TerminalSettings) IsEqual(other *TerminalSettings) bool
func (*TerminalSettings) Validate ¶ added in v1.2.0
func (t *TerminalSettings) Validate() error
Click to show internal directories.
Click to hide internal directories.