Documentation ¶
Index ¶
- Variables
- func ParsePipelineMessage(message string) (string, string)
- type CiLintResult
- type Client
- func (g *Client) Do(r *Request) (*Response, error)
- func (g *Client) LintCiYaml(ctx context.Context, projectSlug string, ciYaml []byte) (*CiLintResult, error)
- func (g *Client) NewRequest(method string, path string, payload []byte) (*Request, error)
- func (g *Client) NewRequestWithContext(ctx context.Context, method string, path string, payload []byte) (*Request, error)
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidAuthentication = errors.New("invalid authentication")
ErrInvalidAuthentication indicates the authentication is invalid
var ErrNotFound = errors.New("not found")
ErrNotFound indicates the resource or route does not exist
Functions ¶
func ParsePipelineMessage ¶ added in v0.0.2
ParsePipelineMessage from gitlab api for a message and return the job and the message
Types ¶
type CiLintResult ¶
type CiLintResult struct { // Valid indicates if the YAML file is syntactically correct Valid bool `json:"valid"` // MergedYaml contains the final YAML with all includes and anchors resolved MergedYaml string `json:"mergedYaml"` // Errors encountered with the pipeline Errors []string `json:"errors"` // Warnings encountered with the pipeline Warnings []string `json:"warnings"` }
CiLintResult represents the response from the Gitlab API when a YAML file has been validated
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client to access the gitlab api
func NewClientWithMultiTokenSources ¶
NewClientWithMultiTokenSources creates a new client instance for the gitlab api, taking multiple sources for the token The order is as following 1. token specified via parameter is non-empty 2. netrc contains a host entry with a password 3. environment variable GITLAB_TOKEN is set
func (*Client) LintCiYaml ¶
func (g *Client) LintCiYaml(ctx context.Context, projectSlug string, ciYaml []byte) (*CiLintResult, error)
LintCiYaml against the api for a project
func (*Client) NewRequest ¶
NewRequest creates a new request prefixing it with the base url and adding the GitLab access token
type Request ¶
Request wraps a regular http.Request to make it more explicit for the gitlab api client
type Response ¶
Response as returned by gitlab api client methods
func (*Response) CheckStatus ¶
CheckStatus for the response for common errors and return, according errors, if the HTTP status code does not indicate a general error nil is returned.
func (*Response) UnmarshalJson ¶
UnmarshalJson from the response